aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/inc/Extension/PluginTrait.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/Extension/PluginTrait.php')
-rw-r--r--inc/Extension/PluginTrait.php28
1 files changed, 14 insertions, 14 deletions
diff --git a/inc/Extension/PluginTrait.php b/inc/Extension/PluginTrait.php
index 7f399df1a..96c25aeb7 100644
--- a/inc/Extension/PluginTrait.php
+++ b/inc/Extension/PluginTrait.php
@@ -7,11 +7,10 @@ namespace dokuwiki\Extension;
*/
trait PluginTrait
{
-
protected $localised = false; // set to true by setupLocale() after loading language dependent strings
- protected $lang = array(); // array to hold language dependent strings, best accessed via ->getLang()
+ protected $lang = []; // array to hold language dependent strings, best accessed via ->getLang()
protected $configloaded = false; // set to true by loadConfig() after loading plugin configuration variables
- protected $conf = array(); // array to hold plugin settings, best accessed via ->getConf()
+ protected $conf = []; // array to hold plugin settings, best accessed via ->getConf()
/**
* @see PluginInterface::getInfo()
@@ -25,12 +24,13 @@ trait PluginTrait
msg(
'getInfo() not implemented in ' . get_class($this) . ' and ' . $info . ' not found.<br />' .
'Verify you\'re running the latest version of the plugin. If the problem persists, send a ' .
- 'bug report to the author of the ' . $parts[2] . ' plugin.', -1
+ 'bug report to the author of the ' . $parts[2] . ' plugin.',
+ -1
);
- return array(
+ return [
'date' => '0000-00-00',
- 'name' => $parts[2] . ' plugin',
- );
+ 'name' => $parts[2] . ' plugin'
+ ];
}
/**
@@ -58,7 +58,7 @@ trait PluginTrait
*/
public function getPluginType()
{
- list($t) = explode('_', get_class($this), 2);
+ [$t] = explode('_', get_class($this), 2);
return $t;
}
@@ -67,7 +67,7 @@ trait PluginTrait
*/
public function getPluginName()
{
- list(/* $t */, /* $p */, $n) = sexplode('_', get_class($this), 4, '');
+ [/* t */, /* p */, $n] = sexplode('_', get_class($this), 4, '');
return $n;
}
@@ -76,7 +76,7 @@ trait PluginTrait
*/
public function getPluginComponent()
{
- list(/* $t */, /* $p */, /* $n */, $c) = sexplode('_', get_class($this), 4, '');
+ [/* t */, /* p */, /* n */, $c] = sexplode('_', get_class($this), 4, '');
return $c;
}
@@ -90,7 +90,7 @@ trait PluginTrait
{
if (!$this->localised) $this->setupLocale();
- return (isset($this->lang[$id]) ? $this->lang[$id] : '');
+ return ($this->lang[$id] ?? '');
}
/**
@@ -129,7 +129,7 @@ trait PluginTrait
global $conf, $config_cascade; // definitely don't invoke "global $lang"
$path = DOKU_PLUGIN . $this->getPluginName() . '/lang/';
- $lang = array();
+ $lang = [];
// don't include once, in case several plugin components require the same language file
@include($path . 'en/lang.php');
@@ -201,7 +201,7 @@ trait PluginTrait
{
$path = DOKU_PLUGIN . $this->getPluginName() . '/conf/';
- $conf = array();
+ $conf = [];
if (file_exists($path . 'default.php')) {
include($path . 'default.php');
@@ -221,7 +221,7 @@ trait PluginTrait
if (!$email) return $name;
$email = obfuscate($email);
if (!$name) $name = $email;
- $class = "class='" . ($class ? $class : 'mail') . "'";
+ $class = "class='" . ($class ?: 'mail') . "'";
return "<a href='mailto:$email' $class title='$email' $more>$name</a>";
}