-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: mprins <[email protected]>
- Loading branch information
1 parent
1f4c5e3
commit 0a137de
Showing
3 changed files
with
25 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,54 @@ | ||
<?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 DokuWiki_Action_Plugin { | ||
|
||
public function register(Doku_Event_Handler $controller) { | ||
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'addVerifyHeaders', array()); | ||
class action_plugin_webmaster extends ActionPlugin | ||
{ | ||
public function register(EventHandler $controller) | ||
{ | ||
$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'addVerifyHeaders', []); | ||
} | ||
|
||
public function addVerifyHeaders(Doku_Event $event, $param) { | ||
if(empty($event->data) || empty($event->data['meta'])) { | ||
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 = array('name' => 'google-site-verification', 'content' => $g); | ||
if (!empty($g)) { | ||
$g = ['name' => 'google-site-verification', 'content' => $g]; | ||
$event->data['meta'][] = $g; | ||
} | ||
|
||
/* bing */ | ||
$b = $this->getConf('webmaster_bing'); | ||
if(!empty($b)) { | ||
$b = array('name' => 'msvalidate.01', 'content' => $b); | ||
if (!empty($b)) { | ||
$b = ['name' => 'msvalidate.01', 'content' => $b]; | ||
$event->data['meta'][] = $b; | ||
} | ||
|
||
/* Yandex */ | ||
$y = $this->getConf('webmaster_yandexkey'); | ||
if(!empty($y)) { | ||
$y = array('name' => 'yandex-verification', 'content' => $y); | ||
if (!empty($y)) { | ||
$y = ['name' => 'yandex-verification', 'content' => $y]; | ||
$event->data['meta'][] = $y; | ||
} | ||
|
||
/* Pinterest */ | ||
$y = $this->getConf('webmaster_pinterestkey'); | ||
if(!empty($y)) { | ||
$y = array('name' => 'p:domain_verify', 'content' => $y); | ||
if (!empty($y)) { | ||
$y = ['name' => 'p:domain_verify', 'content' => $y]; | ||
$event->data['meta'][] = $y; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
<?php | ||
|
||
/** | ||
* Options for the webmaster tools plugin. | ||
* | ||
* @author Mark C. Prins <[email protected]> | ||
* @author Marius Rieder <[email protected]> | ||
*/ | ||
|
||
$conf['webmaster_google'] = ''; | ||
$conf['webmaster_bing'] = ''; | ||
$conf['webmaster_yandexkey'] = ''; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
<?php | ||
|
||
/** | ||
* Metadata for configuration of webmaster tools plugin. | ||
* | ||
* @author Mark C. Prins <[email protected]> | ||
* @author Marius Rieder <[email protected]> | ||
*/ | ||
|
||
$meta['webmaster_google'] = array('string'); | ||
$meta['webmaster_bing'] = array('string'); | ||
$meta['webmaster_yandexkey'] = array('string'); | ||
|