Skip to content

Commit

Permalink
🤖 Rector and PHPCS fixes (#17)
Browse files Browse the repository at this point in the history
Co-authored-by: mprins <mprins@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and mprins authored Nov 8, 2023
1 parent 1f4c5e3 commit 0a137de
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 15 deletions.
36 changes: 21 additions & 15 deletions action.php
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 <mprins@users.sf.net>
* @author Marius Rieder <marius.rieder@durchmesser.ch>
*/

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;
}
}
Expand Down
2 changes: 2 additions & 0 deletions conf/default.php
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 <mprins@users.sf.net>
* @author Marius Rieder <marius.rieder@durchmesser.cg>
*/

$conf['webmaster_google'] = '';
$conf['webmaster_bing'] = '';
$conf['webmaster_yandexkey'] = '';
Expand Down
2 changes: 2 additions & 0 deletions conf/metadata.php
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 <mprins@users.sf.net>
* @author Marius Rieder <marius.rieder@durchmesser.ch>
*/

$meta['webmaster_google'] = array('string');
$meta['webmaster_bing'] = array('string');
$meta['webmaster_yandexkey'] = array('string');
Expand Down

0 comments on commit 0a137de

Please sign in to comment.