aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lib/plugins')
-rw-r--r--lib/plugins/acl/admin.php232
-rw-r--r--lib/plugins/authad/action.php4
-rw-r--r--lib/plugins/authad/auth.php30
-rw-r--r--lib/plugins/authad/conf/metadata.php2
-rw-r--r--lib/plugins/authldap/conf/metadata.php2
-rw-r--r--lib/plugins/authplain/auth.php8
-rw-r--r--lib/plugins/extension/action.php4
-rw-r--r--lib/plugins/extension/admin.php16
-rw-r--r--lib/plugins/extension/helper/extension.php64
-rw-r--r--lib/plugins/extension/helper/gui.php42
-rw-r--r--lib/plugins/extension/helper/list.php176
-rw-r--r--lib/plugins/extension/helper/repository.php14
-rw-r--r--lib/plugins/popularity/action.php2
-rw-r--r--lib/plugins/popularity/admin.php28
-rw-r--r--lib/plugins/popularity/helper.php32
-rw-r--r--lib/plugins/revert/admin.php42
-rw-r--r--lib/plugins/safefnrecode/action.php16
-rw-r--r--lib/plugins/styling/action.php2
-rw-r--r--lib/plugins/styling/admin.php41
19 files changed, 383 insertions, 374 deletions
diff --git a/lib/plugins/acl/admin.php b/lib/plugins/acl/admin.php
index 285805f27..3a2857f62 100644
--- a/lib/plugins/acl/admin.php
+++ b/lib/plugins/acl/admin.php
@@ -1,4 +1,5 @@
<?php
+
use dokuwiki\Extension\AdminPlugin;
use dokuwiki\Utf8\Sort;
@@ -86,7 +87,7 @@ class admin_plugin_acl extends AdminPlugin
// user or group choosen?
$who = trim($INPUT->str('acl_w'));
if ($INPUT->str('acl_t') == '__g__' && $who) {
- $this->who = '@'.ltrim($auth->cleanGroup($who), '@');
+ $this->who = '@' . ltrim($auth->cleanGroup($who), '@');
} elseif ($INPUT->str('acl_t') == '__u__' && $who) {
$this->who = ltrim($who, '@');
if ($this->who != '%USER%' && $this->who != '%GROUP%') { #keep wildcard as is
@@ -94,8 +95,8 @@ class admin_plugin_acl extends AdminPlugin
}
} elseif (
$INPUT->str('acl_t') &&
- $INPUT->str('acl_t') != '__u__' &&
- $INPUT->str('acl_t') != '__g__'
+ $INPUT->str('acl_t') != '__u__' &&
+ $INPUT->str('acl_t') != '__g__'
) {
$this->who = $INPUT->str('acl_t');
} elseif ($who) {
@@ -111,7 +112,7 @@ class admin_plugin_acl extends AdminPlugin
if ($this->ns == '*') {
$scope = '*';
} else {
- $scope = $this->ns.':*';
+ $scope = $this->ns . ':*';
}
} else {
$scope = $ID;
@@ -146,9 +147,9 @@ class admin_plugin_acl extends AdminPlugin
// re-add all rules
foreach ($acl as $where => $opt) {
foreach ($opt as $who => $perm) {
- if ($who[0]=='@') {
+ if ($who[0] == '@') {
if ($who != '@ALL') {
- $who = '@'.ltrim($auth->cleanGroup($who), '@');
+ $who = '@' . ltrim($auth->cleanGroup($who), '@');
}
} elseif ($who != '%USER%' && $who != '%GROUP%') { #keep wildcard as is
$who = $auth->cleanUser($who);
@@ -180,31 +181,31 @@ class admin_plugin_acl extends AdminPlugin
*/
public function html()
{
- echo '<div id="acl_manager">'.NL;
- echo '<h1>'.$this->getLang('admin_acl').'</h1>'.NL;
- echo '<div class="level1">'.NL;
+ echo '<div id="acl_manager">';
+ echo '<h1>' . $this->getLang('admin_acl') . '</h1>';
+ echo '<div class="level1">';
- echo '<div id="acl__tree">'.NL;
+ echo '<div id="acl__tree">';
$this->makeExplorer();
- echo '</div>'.NL;
+ echo '</div>';
- echo '<div id="acl__detail">'.NL;
+ echo '<div id="acl__detail">';
$this->printDetail();
- echo '</div>'.NL;
- echo '</div>'.NL;
+ echo '</div>';
+ echo '</div>';
echo '<div class="clearer"></div>';
- echo '<h2>'.$this->getLang('current').'</h2>'.NL;
- echo '<div class="level2">'.NL;
+ echo '<h2>' . $this->getLang('current') . '</h2>';
+ echo '<div class="level2">';
$this->printAclTable();
- echo '</div>'.NL;
+ echo '</div>';
- echo '<div class="footnotes"><div class="fn">'.NL;
- echo '<sup><a id="fn__1" class="fn_bot" href="#fnt__1">1)</a></sup>'.NL;
- echo '<div class="content">'.$this->getLang('p_include').'</div>';
+ echo '<div class="footnotes"><div class="fn">';
+ echo '<sup><a id="fn__1" class="fn_bot" href="#fnt__1">1)</a></sup>';
+ echo '<div class="content">' . $this->getLang('p_include') . '</div>';
echo '</div></div>';
- echo '</div>'.NL;
+ echo '</div>';
}
/**
@@ -214,7 +215,7 @@ class admin_plugin_acl extends AdminPlugin
*/
protected function getLinkOptions($addopts = null)
{
- $opts = ['do'=>'admin', 'page'=>'acl'];
+ $opts = ['do' => 'admin', 'page' => 'acl'];
if ($this->ns) $opts['ns'] = $this->ns;
if ($this->who) $opts['acl_w'] = $this->who;
@@ -233,14 +234,14 @@ class admin_plugin_acl extends AdminPlugin
global $ID;
global $lang;
- $ns = $this->ns;
+ $ns = $this->ns;
if (empty($ns)) {
$ns = dirname(str_replace(':', '/', $ID));
- if ($ns == '.') $ns ='';
+ if ($ns == '.') $ns = '';
} elseif ($ns == '*') {
- $ns ='';
+ $ns = '';
}
- $ns = utf8_encodeFN(str_replace(':', '/', $ns));
+ $ns = utf8_encodeFN(str_replace(':', '/', $ns));
$data = $this->makeTree($ns);
@@ -249,8 +250,8 @@ class admin_plugin_acl extends AdminPlugin
'level' => 0,
'id' => '*',
'type' => 'd',
- 'open' =>'true',
- 'label' => '['.$lang['mediaroot'].']'
+ 'open' => 'true',
+ 'label' => '[' . $lang['mediaroot'] . ']'
]);
echo html_buildlist(
@@ -285,8 +286,8 @@ class admin_plugin_acl extends AdminPlugin
// combine by sorting and removing duplicates
usort($data, [$this, 'treeSort']);
$count = count($data);
- if ($count>0) for ($i=1; $i<$count; $i++) {
- if ($data[$i-1]['id'] == $data[$i]['id'] && $data[$i-1]['type'] == $data[$i]['type']) {
+ if ($count > 0) for ($i = 1; $i < $count; $i++) {
+ if ($data[$i - 1]['id'] == $data[$i]['id'] && $data[$i - 1]['type'] == $data[$i]['type']) {
unset($data[$i]);
$i++; // duplicate found, next $i can't be a duplicate, so skip forward one
}
@@ -347,25 +348,28 @@ class admin_plugin_acl extends AdminPlugin
{
global $ID;
- echo '<form action="'.wl().'" method="post" accept-charset="utf-8"><div class="no">'.NL;
+ echo '<form action="' . wl() . '" method="post" accept-charset="utf-8"><div class="no">';
echo '<div id="acl__user">';
- echo $this->getLang('acl_perms').' ';
- $inl = $this->makeSelect();
- echo '<input type="text" name="acl_w" class="edit" value="'.(($inl)?'':hsc(ltrim($this->who, '@'))).'" />'.NL;
- echo '<button type="submit">'.$this->getLang('btn_select').'</button>'.NL;
- echo '</div>'.NL;
+ echo $this->getLang('acl_perms') . ' ';
+ $inl = $this->makeSelect();
+ echo sprintf(
+ '<input type="text" name="acl_w" class="edit" value="%s" />',
+ ($inl) ? '' : hsc(ltrim($this->who, '@'))
+ );
+ echo '<button type="submit">' . $this->getLang('btn_select') . '</button>';
+ echo '</div>';
echo '<div id="acl__info">';
$this->printInfo();
echo '</div>';
- echo '<input type="hidden" name="ns" value="'.hsc($this->ns).'" />'.NL;
- echo '<input type="hidden" name="id" value="'.hsc($ID).'" />'.NL;
- echo '<input type="hidden" name="do" value="admin" />'.NL;
- echo '<input type="hidden" name="page" value="acl" />'.NL;
- echo '<input type="hidden" name="sectok" value="'.getSecurityToken().'" />'.NL;
- echo '</div></form>'.NL;
+ echo '<input type="hidden" name="ns" value="' . hsc($this->ns) . '" />';
+ echo '<input type="hidden" name="id" value="' . hsc($ID) . '" />';
+ echo '<input type="hidden" name="do" value="admin" />';
+ echo '<input type="hidden" name="page" value="acl" />';
+ echo '<input type="hidden" name="sectok" value="' . getSecurityToken() . '" />';
+ echo '</div></form>';
}
/**
@@ -408,18 +412,18 @@ class admin_plugin_acl extends AdminPlugin
echo '<fieldset>';
if (is_null($current)) {
- echo '<legend>'.$this->getLang('acl_new').'</legend>';
+ echo '<legend>' . $this->getLang('acl_new') . '</legend>';
} else {
- echo '<legend>'.$this->getLang('acl_mod').'</legend>';
+ echo '<legend>' . $this->getLang('acl_mod') . '</legend>';
}
echo $this->makeCheckboxes($current, empty($this->ns), 'acl');
if (is_null($current)) {
- echo '<button type="submit" name="cmd[save]">'.$lang['btn_save'].'</button>'.NL;
+ echo '<button type="submit" name="cmd[save]">' . $lang['btn_save'] . '</button>';
} else {
- echo '<button type="submit" name="cmd[save]">'.$lang['btn_update'].'</button>'.NL;
- echo '<button type="submit" name="cmd[del]">'.$lang['btn_delete'].'</button>'.NL;
+ echo '<button type="submit" name="cmd[save]">' . $lang['btn_update'] . '</button>';
+ echo '<button type="submit" name="cmd[del]">' . $lang['btn_delete'] . '</button>';
}
echo '</fieldset>';
@@ -436,14 +440,14 @@ class admin_plugin_acl extends AdminPlugin
global $auth;
$who = $this->who;
- $ns = $this->ns;
+ $ns = $this->ns;
// prepare where to check
if ($ns) {
if ($ns == '*') {
- $check='*';
+ $check = '*';
} else {
- $check=$ns.':*';
+ $check = $ns . ':*';
}
} else {
$check = $ID;
@@ -451,7 +455,7 @@ class admin_plugin_acl extends AdminPlugin
// prepare who to check
if ($who[0] == '@') {
- $user = '';
+ $user = '';
$groups = [ltrim($who, '@')];
} else {
$user = $who;
@@ -498,9 +502,9 @@ class admin_plugin_acl extends AdminPlugin
// add note if admin
if ($perm == AUTH_ADMIN) {
- echo '<p>'.$this->getLang('p_isadmin').'</p>';
+ echo '<p>' . $this->getLang('p_isadmin') . '</p>';
} elseif (is_null($current)) {
- echo '<p>'.$this->getLang('p_inherited').'</p>';
+ echo '<p>' . $this->getLang('p_inherited') . '</p>';
}
}
@@ -519,36 +523,36 @@ class admin_plugin_acl extends AdminPlugin
if (!empty($item['label'])) {
$base = $item['label'];
} else {
- $base = ':'.$item['id'];
- $base = substr($base, strrpos($base, ':')+1);
+ $base = ':' . $item['id'];
+ $base = substr($base, strrpos($base, ':') + 1);
}
// highlight?
- if (($item['type']== $this->current_item['type'] && $item['id'] == $this->current_item['id'])) {
+ if (($item['type'] == $this->current_item['type'] && $item['id'] == $this->current_item['id'])) {
$cl = ' cur';
} else {
$cl = '';
}
// namespace or page?
- if ($item['type']=='d') {
+ if ($item['type'] == 'd') {
if ($item['open']) {
- $img = DOKU_BASE.'lib/images/minus.gif';
- $alt = '−';
+ $img = DOKU_BASE . 'lib/images/minus.gif';
+ $alt = '−';
} else {
- $img = DOKU_BASE.'lib/images/plus.gif';
- $alt = '+';
+ $img = DOKU_BASE . 'lib/images/plus.gif';
+ $alt = '+';
}
- $ret .= '<img src="'.$img.'" alt="'.$alt.'" />';
- $ret .= '<a href="'.
- wl('', $this->getLinkOptions(['ns'=> $item['id'], 'sectok'=>getSecurityToken()])).
- '" class="idx_dir'.$cl.'">';
+ $ret .= '<img src="' . $img . '" alt="' . $alt . '" />';
+ $ret .= '<a href="' .
+ wl('', $this->getLinkOptions(['ns' => $item['id'], 'sectok' => getSecurityToken()])) .
+ '" class="idx_dir' . $cl . '">';
$ret .= $base;
$ret .= '</a>';
} else {
- $ret .= '<a href="'.
- wl('', $this->getLinkOptions(['id'=> $item['id'], 'ns'=>'', 'sectok'=>getSecurityToken()])).
- '" class="wikilink1'.$cl.'">';
+ $ret .= '<a href="' .
+ wl('', $this->getLinkOptions(['id' => $item['id'], 'ns' => '', 'sectok' => getSecurityToken()])) .
+ '" class="wikilink1' . $cl . '">';
$ret .= noNS($item['id']);
$ret .= '</a>';
}
@@ -564,7 +568,7 @@ class admin_plugin_acl extends AdminPlugin
public function makeListItem($item)
{
return '<li class="level' . $item['level'] . ' ' .
- ($item['open'] ? 'open' : 'closed') . '">';
+ ($item['open'] ? 'open' : 'closed') . '">';
}
@@ -577,12 +581,12 @@ class admin_plugin_acl extends AdminPlugin
{
global $AUTH_ACL;
global $conf;
- $acl_config=[];
+ $acl_config = [];
$usersgroups = [];
// get special users and groups
$this->specials[] = '@ALL';
- $this->specials[] = '@'.$conf['defaultgroup'];
+ $this->specials[] = '@' . $conf['defaultgroup'];
if ($conf['manager'] != '!!not set!!') {
$this->specials = array_merge(
$this->specials,
@@ -633,51 +637,51 @@ class admin_plugin_acl extends AdminPlugin
global $lang;
global $ID;
- echo '<form action="'.wl().'" method="post" accept-charset="utf-8"><div class="no">'.NL;
+ echo '<form action="' . wl() . '" method="post" accept-charset="utf-8"><div class="no">';
if ($this->ns) {
- echo '<input type="hidden" name="ns" value="'.hsc($this->ns).'" />'.NL;
+ echo '<input type="hidden" name="ns" value="' . hsc($this->ns) . '" />';
} else {
- echo '<input type="hidden" name="id" value="'.hsc($ID).'" />'.NL;
+ echo '<input type="hidden" name="id" value="' . hsc($ID) . '" />';
}
- echo '<input type="hidden" name="acl_w" value="'.hsc($this->who).'" />'.NL;
- echo '<input type="hidden" name="do" value="admin" />'.NL;
- echo '<input type="hidden" name="page" value="acl" />'.NL;
- echo '<input type="hidden" name="sectok" value="'.getSecurityToken().'" />'.NL;
+ echo '<input type="hidden" name="acl_w" value="' . hsc($this->who) . '" />';
+ echo '<input type="hidden" name="do" value="admin" />';
+ echo '<input type="hidden" name="page" value="acl" />';
+ echo '<input type="hidden" name="sectok" value="' . getSecurityToken() . '" />';
echo '<div class="table">';
echo '<table class="inline">';
echo '<tr>';
- echo '<th>'.$this->getLang('where').'</th>';
- echo '<th>'.$this->getLang('who').'</th>';
- echo '<th>'.$this->getLang('perm').'<sup><a id="fnt__1" class="fn_top" href="#fn__1">1)</a></sup></th>';
- echo '<th>'.$lang['btn_delete'].'</th>';
+ echo '<th>' . $this->getLang('where') . '</th>';
+ echo '<th>' . $this->getLang('who') . '</th>';
+ echo '<th>' . $this->getLang('perm') . '<sup><a id="fnt__1" class="fn_top" href="#fn__1">1)</a></sup></th>';
+ echo '<th>' . $lang['btn_delete'] . '</th>';
echo '</tr>';
foreach ($this->acl as $where => $set) {
foreach ($set as $who => $perm) {
echo '<tr>';
echo '<td>';
if (substr($where, -1) == '*') {
- echo '<span class="aclns">'.hsc($where).'</span>';
+ echo '<span class="aclns">' . hsc($where) . '</span>';
$ispage = false;
} else {
- echo '<span class="aclpage">'.hsc($where).'</span>';
+ echo '<span class="aclpage">' . hsc($where) . '</span>';
$ispage = true;
}
echo '</td>';
echo '<td>';
if ($who[0] == '@') {
- echo '<span class="aclgroup">'.hsc($who).'</span>';
+ echo '<span class="aclgroup">' . hsc($who) . '</span>';
} else {
- echo '<span class="acluser">'.hsc($who).'</span>';
+ echo '<span class="acluser">' . hsc($who) . '</span>';
}
echo '</td>';
echo '<td>';
- echo $this->makeCheckboxes($perm, $ispage, 'acl['.$where.']['.$who.']');
+ echo $this->makeCheckboxes($perm, $ispage, 'acl[' . $where . '][' . $who . ']');
echo '</td>';
echo '<td class="check">';
- echo '<input type="checkbox" name="del['.hsc($where).'][]" value="'.hsc($who).'" />';
+ echo '<input type="checkbox" name="del[' . hsc($where) . '][]" value="' . hsc($who) . '" />';
echo '</td>';
echo '</tr>';
}
@@ -685,12 +689,12 @@ class admin_plugin_acl extends AdminPlugin
echo '<tr>';
echo '<th class="action" colspan="4">';
- echo '<button type="submit" name="cmd[update]">'.$lang['btn_update'].'</button>';
+ echo '<button type="submit" name="cmd[update]">' . $lang['btn_update'] . '</button>';
echo '</th>';
echo '</tr>';
echo '</table>';
echo '</div>';
- echo '</div></form>'.NL;
+ echo '</div></form>';
}
/**
@@ -706,7 +710,7 @@ class admin_plugin_acl extends AdminPlugin
if ($this->ns == '*') {
$check = '*';
} else {
- $check = $this->ns.':*';
+ $check = $this->ns . ':*';
}
} else {
$check = $ID;
@@ -752,7 +756,7 @@ class admin_plugin_acl extends AdminPlugin
global $config_cascade;
$acl_user = auth_nameencode($acl_user, true);
- $acl_pattern = '^'.preg_quote($acl_scope, '/').'[ \t]+'.$acl_user.'[ \t]+[0-8].*$';
+ $acl_pattern = '^' . preg_quote($acl_scope, '/') . '[ \t]+' . $acl_user . '[ \t]+[0-8].*$';
return io_deleteFromFile($config_cascade['acl']['default'], "/$acl_pattern/", true);
}
@@ -777,13 +781,13 @@ class admin_plugin_acl extends AdminPlugin
//general checkbox attributes
$atts = [
- 'type' => 'radio',
- 'id' => 'pbox'.$label,
- 'name' => $name,
+ 'type' => 'radio',
+ 'id' => 'pbox' . $label,
+ 'name' => $name,
'value' => $perm
];
//dynamic attributes
- if (!is_null($setperm) && $setperm == $perm) $atts['checked'] = 'checked';
+ if (!is_null($setperm) && $setperm == $perm) $atts['checked'] = 'checked';
if ($ispage && $perm > AUTH_EDIT) {
$atts['disabled'] = 'disabled';
$class = ' class="disabled"';
@@ -792,10 +796,10 @@ class admin_plugin_acl extends AdminPlugin
}
//build code
- $ret .= '<label for="pbox'.$label.'"'.$class.'>';
- $ret .= '<input '.buildAttributes($atts).' />&#160;';
- $ret .= $this->getLang('acl_perm'.$perm);
- $ret .= '</label>'.NL;
+ $ret .= '<label for="pbox' . $label . '"' . $class . '>';
+ $ret .= '<input ' . buildAttributes($atts) . ' />&#160;';
+ $ret .= $this->getLang('acl_perm' . $perm);
+ $ret .= '</label>';
}
return $ret;
}
@@ -825,46 +829,46 @@ class admin_plugin_acl extends AdminPlugin
$inlist = true;
}
- echo '<select name="acl_t" class="edit">'.NL;
- echo ' <option value="__g__" class="aclgroup"'.$gsel.'>'.$this->getLang('acl_group').'</option>'.NL;
- echo ' <option value="__u__" class="acluser"'.$usel.'>'.$this->getLang('acl_user').'</option>'.NL;
+ echo '<select name="acl_t" class="edit">';
+ echo ' <option value="__g__" class="aclgroup"' . $gsel . '>' . $this->getLang('acl_group') . '</option>';
+ echo ' <option value="__u__" class="acluser"' . $usel . '>' . $this->getLang('acl_user') . '</option>';
if (!empty($this->specials)) {
- echo ' <optgroup label="&#160;">'.NL;
+ echo ' <optgroup label="&#160;">';
foreach ($this->specials as $ug) {
if ($ug == $this->who) {
- $sel = ' selected="selected"';
+ $sel = ' selected="selected"';
$inlist = true;
} else {
$sel = '';
}
if ($ug[0] == '@') {
- echo ' <option value="'.hsc($ug).'" class="aclgroup"'.$sel.'>'.hsc($ug).'</option>'.NL;
+ echo ' <option value="' . hsc($ug) . '" class="aclgroup"' . $sel . '>' . hsc($ug) . '</option>';
} else {
- echo ' <option value="'.hsc($ug).'" class="acluser"'.$sel.'>'.hsc($ug).'</option>'.NL;
+ echo ' <option value="' . hsc($ug) . '" class="acluser"' . $sel . '>' . hsc($ug) . '</option>';
}
}
- echo ' </optgroup>'.NL;
+ echo ' </optgroup>';
}
if (!empty($this->usersgroups)) {
- echo ' <optgroup label="&#160;">'.NL;
+ echo ' <optgroup label="&#160;">';
foreach ($this->usersgroups as $ug) {
if ($ug == $this->who) {
- $sel = ' selected="selected"';
+ $sel = ' selected="selected"';
$inlist = true;
} else {
$sel = '';
}
if ($ug[0] == '@') {
- echo ' <option value="'.hsc($ug).'" class="aclgroup"'.$sel.'>'.hsc($ug).'</option>'.NL;
+ echo ' <option value="' . hsc($ug) . '" class="aclgroup"' . $sel . '>' . hsc($ug) . '</option>';
} else {
- echo ' <option value="'.hsc($ug).'" class="acluser"'.$sel.'>'.hsc($ug).'</option>'.NL;
+ echo ' <option value="' . hsc($ug) . '" class="acluser"' . $sel . '>' . hsc($ug) . '</option>';
}
}
- echo ' </optgroup>'.NL;
+ echo ' </optgroup>';
}
- echo '</select>'.NL;
+ echo '</select>';
return $inlist;
}
}
diff --git a/lib/plugins/authad/action.php b/lib/plugins/authad/action.php
index 3be34013b..cd5c9e01a 100644
--- a/lib/plugins/authad/action.php
+++ b/lib/plugins/authad/action.php
@@ -42,7 +42,7 @@ class action_plugin_authad extends ActionPlugin
$usr = $auth->cleanUser($event->data['user']);
$dom = $auth->getUserDomain($usr);
if (!$dom) {
- $usr = "$usr@".$INPUT->str('dom');
+ $usr = "$usr@" . $INPUT->str('dom');
}
$INPUT->post->set('u', $usr);
$event->data['user'] = $usr;
@@ -85,7 +85,7 @@ class action_plugin_authad extends ActionPlugin
}
// add locate domain selector just after the username input box
- $element = $form->addDropdown('dom', $domains, $this->getLang('domain'), $pos +1);
+ $element = $form->addDropdown('dom', $domains, $this->getLang('domain'), $pos + 1);
$element->addClass('block');
}
}
diff --git a/lib/plugins/authad/auth.php b/lib/plugins/authad/auth.php
index 78fba3104..40a2bbb20 100644
--- a/lib/plugins/authad/auth.php
+++ b/lib/plugins/authad/auth.php
@@ -79,8 +79,8 @@ class auth_plugin_authad extends AuthPlugin
global $INPUT;
parent::__construct();
- require_once(DOKU_PLUGIN.'authad/adLDAP/adLDAP.php');
- require_once(DOKU_PLUGIN.'authad/adLDAP/classes/adLDAPUtils.php');
+ require_once(DOKU_PLUGIN . 'authad/adLDAP/adLDAP.php');
+ require_once(DOKU_PLUGIN . 'authad/adLDAP/classes/adLDAPUtils.php');
// we load the config early to modify it a bit here
$this->loadConfig();
@@ -268,7 +268,7 @@ class auth_plugin_authad extends AuthPlugin
$expiry = $adldap->user()->passwordExpiry($user);
if (is_array($expiry)) {
$info['expiresat'] = $expiry['expiryts'];
- $info['expiresin'] = round(($info['expiresat'] - time())/(24*60*60));
+ $info['expiresin'] = round(($info['expiresat'] - time()) / (24 * 60 * 60));
// if this is the current user, warn him (once per request only)
if (
@@ -278,8 +278,8 @@ class auth_plugin_authad extends AuthPlugin
) {
$msg = sprintf($this->getLang('authpwdexpire'), $info['expiresin']);
if ($this->canDo('modPass')) {
- $url = wl($ID, ['do'=> 'profile']);
- $msg .= ' <a href="'.$url.'">'.$lang['btn_profile'].'</a>';
+ $url = wl($ID, ['do' => 'profile']);
+ $msg .= ' <a href="' . $url . '">' . $lang['btn_profile'] . '</a>';
}
msg($msg);
$this->msgshown = true;
@@ -412,15 +412,15 @@ class auth_plugin_authad extends AuthPlugin
$usermanager = plugin_load("admin", "usermanager", false);
$usermanager->setLastdisabled(true);
if (!isset($this->grpsusers[$this->filterToString($filter)])) {
- $this->fillGroupUserArray($filter, $usermanager->getStart() + 3*$usermanager->getPagesize());
+ $this->fillGroupUserArray($filter, $usermanager->getStart() + 3 * $usermanager->getPagesize());
} elseif (
count($this->grpsusers[$this->filterToString($filter)]) <
- $usermanager->getStart() + 3*$usermanager->getPagesize()
+ $usermanager->getStart() + 3 * $usermanager->getPagesize()
) {
$this->fillGroupUserArray(
$filter,
$usermanager->getStart() +
- 3*$usermanager->getPagesize() -
+ 3 * $usermanager->getPagesize() -
count($this->grpsusers[$this->filterToString($filter)])
);
}
@@ -481,7 +481,7 @@ class auth_plugin_authad extends AuthPlugin
$actualstart = 0;
}
- $i=0;
+ $i = 0;
$count = 0;
$this->constructPattern($filter);
foreach ($this->users as $user => &$info) {
@@ -546,7 +546,7 @@ class auth_plugin_authad extends AuthPlugin
$usermanager->setLastdisabled(true);
if (
!isset($this->grpsusers[$this->filterToString($filter)]) ||
- count($this->grpsusers[$this->filterToString($filter)]) < ($start+$limit)
+ count($this->grpsusers[$this->filterToString($filter)]) < ($start + $limit)
) {
if (!isset($this->grpsusers[$this->filterToString($filter)])) {
$this->grpsusers[$this->filterToString($filter)] = [];
@@ -554,7 +554,7 @@ class auth_plugin_authad extends AuthPlugin
$this->fillGroupUserArray(
$filter,
- $start+$limit - count($this->grpsusers[$this->filterToString($filter)]) +1
+ $start + $limit - count($this->grpsusers[$this->filterToString($filter)]) + 1
);
}
if (!$this->grpsusers[$this->filterToString($filter)]) return [];
@@ -590,7 +590,7 @@ class auth_plugin_authad extends AuthPlugin
try {
$return = $adldap->user()->password($this->getUserName($user), $changes['pass']);
} catch (adLDAPException $e) {
- if ($this->conf['debug']) msg('AD Auth: '.$e->getMessage(), -1);
+ if ($this->conf['debug']) msg('AD Auth: ' . $e->getMessage(), -1);
$return = false;
}
if (!$return) msg($this->getLang('passchangefail'), -1);
@@ -612,7 +612,7 @@ class auth_plugin_authad extends AuthPlugin
try {
$return &= $adldap->user()->modify($this->getUserName($user), $adchanges);
} catch (adLDAPException $e) {
- if ($this->conf['debug']) msg('AD Auth: '.$e->getMessage(), -1);
+ if ($this->conf['debug']) msg('AD Auth: ' . $e->getMessage(), -1);
$return = false;
}
if (!$return) msg($this->getLang('userchangefail'), -1);
@@ -646,7 +646,7 @@ class auth_plugin_authad extends AuthPlugin
return $this->adldap[$domain];
} catch (Exception $e) {
if ($this->conf['debug']) {
- msg('AD Auth: '.$e->getMessage(), -1);
+ msg('AD Auth: ' . $e->getMessage(), -1);
}
$this->success = false;
$this->adldap[$domain] = null;
@@ -797,7 +797,7 @@ class auth_plugin_authad extends AuthPlugin
{
$this->pattern = [];
foreach ($filter as $item => $pattern) {
- $this->pattern[$item] = '/'.str_replace('/', '\/', $pattern).'/i'; // allow regex characters
+ $this->pattern[$item] = '/' . str_replace('/', '\/', $pattern) . '/i'; // allow regex characters
}
}
}
diff --git a/lib/plugins/authad/conf/metadata.php b/lib/plugins/authad/conf/metadata.php
index 96d8937ae..aa5d92e5c 100644
--- a/lib/plugins/authad/conf/metadata.php
+++ b/lib/plugins/authad/conf/metadata.php
@@ -11,7 +11,7 @@ $meta['real_primarygroup'] = array('onoff','_caution' => 'danger');
$meta['use_ssl'] = array('onoff','_caution' => 'danger');
$meta['use_tls'] = array('onoff','_caution' => 'danger');
$meta['debug'] = array('onoff','_caution' => 'security');
-$meta['expirywarn'] = array('numeric', '_min'=>0,'_caution' => 'danger');
+$meta['expirywarn'] = array('numeric', '_min' => 0,'_caution' => 'danger');
$meta['additional'] = array('string','_caution' => 'danger');
$meta['update_name'] = array('onoff','_caution' => 'danger');
$meta['update_mail'] = array('onoff','_caution' => 'danger');
diff --git a/lib/plugins/authldap/conf/metadata.php b/lib/plugins/authldap/conf/metadata.php
index 3a58590a8..e631659a0 100644
--- a/lib/plugins/authldap/conf/metadata.php
+++ b/lib/plugins/authldap/conf/metadata.php
@@ -10,7 +10,7 @@ $meta['starttls'] = array('onoff','_caution' => 'danger');
$meta['referrals'] = array('multichoice','_choices' => array(-1,0,1),'_caution' => 'danger');
$meta['deref'] = array('multichoice','_choices' => array(0,1,2,3),'_caution' => 'danger');
$meta['binddn'] = array('string','_caution' => 'danger');
-$meta['bindpw'] = array('password','_caution' => 'danger','_code'=>'base64');
+$meta['bindpw'] = array('password','_caution' => 'danger','_code' => 'base64');
$meta['attributes'] = array('array');
//$meta['mapping']['name'] unsupported in config manager
//$meta['mapping']['grps'] unsupported in config manager
diff --git a/lib/plugins/authplain/auth.php b/lib/plugins/authplain/auth.php
index edc1d6ea8..370e6cfa0 100644
--- a/lib/plugins/authplain/auth.php
+++ b/lib/plugins/authplain/auth.php
@@ -112,7 +112,7 @@ class auth_plugin_authplain extends AuthPlugin
$userline = [$user, $pass, $name, $mail, $groups];
$userline = str_replace('\\', '\\\\', $userline); // escape \ as \\
$userline = str_replace(':', '\\:', $userline); // escape : as \:
- $userline = implode(':', $userline)."\n";
+ $userline = implode(':', $userline) . "\n";
return $userline;
}
@@ -214,7 +214,7 @@ class auth_plugin_authplain extends AuthPlugin
$userinfo['grps']
);
- if (!io_replaceInFile($config_cascade['plainauth.users']['default'], '/^'.$user.':/', $userline, true)) {
+ if (!io_replaceInFile($config_cascade['plainauth.users']['default'], '/^' . $user . ':/', $userline, true)) {
msg('There was an error modifying your user data. You may need to register again.', -1);
// FIXME, io functions should be fail-safe so existing data isn't lost
$ACT = 'register';
@@ -253,7 +253,7 @@ class auth_plugin_authplain extends AuthPlugin
if ($deleted === []) return 0;
- $pattern = '/^('.implode('|', $deleted).'):/';
+ $pattern = '/^(' . implode('|', $deleted) . '):/';
if (!io_deleteFromFile($config_cascade['plainauth.users']['default'], $pattern, true)) {
msg($this->getLang('writefail'), -1);
return 0;
@@ -481,7 +481,7 @@ class auth_plugin_authplain extends AuthPlugin
{
$this->pattern = [];
foreach ($filter as $item => $pattern) {
- $this->pattern[$item] = '/'.str_replace('/', '\/', $pattern).'/i'; // allow regex characters
+ $this->pattern[$item] = '/' . str_replace('/', '\/', $pattern) . '/i'; // allow regex characters
}
}
}
diff --git a/lib/plugins/extension/action.php b/lib/plugins/extension/action.php
index a2ddbd1bb..f833702e8 100644
--- a/lib/plugins/extension/action.php
+++ b/lib/plugins/extension/action.php
@@ -70,9 +70,9 @@ class action_plugin_extension extends ActionPlugin
$reverse = ($act == 'disable') ? 'enable' : 'disable';
$return = [
- 'state' => $act.'d', // isn't English wonderful? :-)
+ 'state' => $act . 'd', // isn't English wonderful? :-)
'reverse' => $reverse,
- 'label' => $extension->getLang('btn_'.$reverse),
+ 'label' => $extension->getLang('btn_' . $reverse),
];
header('Content-Type: application/json');
diff --git a/lib/plugins/extension/admin.php b/lib/plugins/extension/admin.php
index b3c823ae6..5f1267ce3 100644
--- a/lib/plugins/extension/admin.php
+++ b/lib/plugins/extension/admin.php
@@ -54,8 +54,8 @@ class admin_plugin_extension extends AdminPlugin
if (!$repository->hasAccess(!$INPUT->bool('purge'))) {
$url = $this->gui->tabURL('', ['purge' => 1], '&');
- msg($this->getLang('repo_error').
- ' [<a href="'.$url.'">'.$this->getLang('repo_retry').'</a>]', -1);
+ msg($this->getLang('repo_error') .
+ ' [<a href="' . $url . '">' . $this->getLang('repo_retry') . '</a>]', -1);
}
if (!in_array('ssl', stream_get_transports())) {
@@ -78,7 +78,7 @@ class admin_plugin_extension extends AdminPlugin
$installed = $extension->installOrUpdate();
foreach ($installed as $info) {
msg(sprintf(
- $this->getLang('msg_'.$info['type'].'_'.$info['action'].'_success'),
+ $this->getLang('msg_' . $info['type'] . '_' . $info['action'] . '_success'),
$info['base']
), 1);
}
@@ -133,7 +133,7 @@ class admin_plugin_extension extends AdminPlugin
);
foreach ($installed as $info) {
msg(sprintf(
- $this->getLang('msg_'.$info['type'].'_'.$info['action'].'_success'),
+ $this->getLang('msg_' . $info['type'] . '_' . $info['action'] . '_success'),
$info['base']
), 1);
}
@@ -142,7 +142,7 @@ class admin_plugin_extension extends AdminPlugin
$installed = $extension->installFromUpload('installfile', $INPUT->post->bool('overwrite'));
foreach ($installed as $info) {
msg(sprintf(
- $this->getLang('msg_'.$info['type'].'_'.$info['action'].'_success'),
+ $this->getLang('msg_' . $info['type'] . '_' . $info['action'] . '_success'),
$info['base']
), 1);
}
@@ -159,8 +159,8 @@ class admin_plugin_extension extends AdminPlugin
*/
public function html()
{
- echo '<h1>'.$this->getLang('menu').'</h1>'.DOKU_LF;
- echo '<div id="extension__manager">'.DOKU_LF;
+ echo '<h1>' . $this->getLang('menu') . '</h1>' . DOKU_LF;
+ echo '<div id="extension__manager">' . DOKU_LF;
$this->gui->tabNavigation();
@@ -179,7 +179,7 @@ class admin_plugin_extension extends AdminPlugin
$this->gui->tabPlugins();
}
- echo '</div>'.DOKU_LF;
+ echo '</div>' . DOKU_LF;
}
}
diff --git a/lib/plugins/extension/helper/extension.php b/lib/plugins/extension/helper/extension.php
index ca3698024..bca80ec34 100644
--- a/lib/plugins/extension/helper/extension.php
+++ b/lib/plugins/extension/helper/extension.php
@@ -39,7 +39,7 @@ class helper_plugin_extension_extension extends Plugin
*/
public function __construct()
{
- $this->tpllib = dirname(tpl_incdir()).'/';
+ $this->tpllib = dirname(tpl_incdir()) . '/';
}
/**
@@ -118,7 +118,7 @@ class helper_plugin_extension_extension extends Plugin
public function isGitControlled()
{
if (!$this->isInstalled()) return false;
- return file_exists($this->getInstallDir().'/.git');
+ return file_exists($this->getInstallDir() . '/.git');
}
/**
@@ -324,8 +324,8 @@ class helper_plugin_extension_extension extends Plugin
public function getURL()
{
if (!empty($this->localInfo['url'])) return $this->localInfo['url'];
- return 'https://www.dokuwiki.org/'.
- ($this->isTemplate() ? 'template' : 'plugin').':'.$this->getBase();
+ return 'https://www.dokuwiki.org/' .
+ ($this->isTemplate() ? 'template' : 'plugin') . ':' . $this->getBase();
}
/**
@@ -589,9 +589,9 @@ class helper_plugin_extension_extension extends Plugin
public function getInstallDir()
{
if ($this->isTemplate()) {
- return $this->tpllib.$this->base;
+ return $this->tpllib . $this->base;
} else {
- return DOKU_PLUGIN.$this->base;
+ return DOKU_PLUGIN . $this->base;
}
}
@@ -604,7 +604,7 @@ class helper_plugin_extension_extension extends Plugin
{
if (!$this->isInstalled()) return 'none';
if (!empty($this->managerData)) return 'automatic';
- if (is_dir($this->getInstallDir().'/.git')) return 'git';
+ if (is_dir($this->getInstallDir() . '/.git')) return 'git';
return 'manual';
}
@@ -640,7 +640,7 @@ class helper_plugin_extension_extension extends Plugin
public function installFromUpload($field, $overwrite = true)
{
if ($_FILES[$field]['error']) {
- throw new Exception($this->getLang('msg_upload_failed').' ('.$_FILES[$field]['error'].')');
+ throw new Exception($this->getLang('msg_upload_failed') . ' (' . $_FILES[$field]['error'] . ')');
}
$tmp = $this->mkTmpDir();
@@ -773,28 +773,28 @@ class helper_plugin_extension_extension extends Plugin
protected function readLocalData()
{
if ($this->isTemplate()) {
- $infopath = $this->getInstallDir().'/template.info.txt';
+ $infopath = $this->getInstallDir() . '/template.info.txt';
} else {
- $infopath = $this->getInstallDir().'/plugin.info.txt';
+ $infopath = $this->getInstallDir() . '/plugin.info.txt';
}
if (is_readable($infopath)) {
$this->localInfo = confToHash($infopath);
} elseif (!$this->isTemplate() && $this->isEnabled()) {
- $path = $this->getInstallDir().'/';
+ $path = $this->getInstallDir() . '/';
$plugin = null;
foreach (PluginController::PLUGIN_TYPES as $type) {
- if (file_exists($path.$type.'.php')) {
+ if (file_exists($path . $type . '.php')) {
$plugin = plugin_load($type, $this->base);
if ($plugin instanceof PluginInterface) break;
}
- if ($dh = @opendir($path.$type.'/')) {
+ if ($dh = @opendir($path . $type . '/')) {
while (false !== ($cp = readdir($dh))) {
if ($cp == '.' || $cp == '..' || strtolower(substr($cp, -4)) != '.php') continue;
- $plugin = plugin_load($type, $this->base.'_'.substr($cp, 0, -4));
+ $plugin = plugin_load($type, $this->base . '_' . substr($cp, 0, -4));
if ($plugin instanceof PluginInterface) break;
}
if ($plugin instanceof PluginInterface) break;
@@ -845,7 +845,7 @@ class helper_plugin_extension_extension extends Plugin
*/
protected function readManagerData()
{
- $managerpath = $this->getInstallDir().'/manager.dat';
+ $managerpath = $this->getInstallDir() . '/manager.dat';
if (is_readable($managerpath)) {
$file = @file($managerpath);
if (!empty($file)) {
@@ -866,10 +866,10 @@ class helper_plugin_extension_extension extends Plugin
*/
protected function writeManagerData()
{
- $managerpath = $this->getInstallDir().'/manager.dat';
+ $managerpath = $this->getInstallDir() . '/manager.dat';
$data = '';
foreach ($this->managerData as $k => $v) {
- $data .= $k.'='.$v.DOKU_LF;
+ $data .= $k . '=' . $v . DOKU_LF;
}
io_saveFile($managerpath, $data);
}
@@ -971,15 +971,15 @@ class helper_plugin_extension_extension extends Plugin
}
// download
- if (!$file = $this->downloadToFile($url, $tmp.'/', $file)) {
+ if (!$file = $this->downloadToFile($url, $tmp . '/', $file)) {
io_rmdir($tmp, true);
throw new Exception(sprintf(
$this->getLang('error_download'),
- '<bdi>'.hsc($url).'</bdi>'
+ '<bdi>' . hsc($url) . '</bdi>'
));
}
- return $tmp.'/'.$file;
+ return $tmp . '/' . $file;
}
/**
@@ -999,18 +999,18 @@ class helper_plugin_extension_extension extends Plugin
}
// add default base folder if specified to handle case where zip doesn't contain this
- if ($base && !@mkdir($tmp.'/'.$base)) {
+ if ($base && !@mkdir($tmp . '/' . $base)) {
throw new Exception($this->getLang('error_dircreate'));
}
// decompress
- $this->decompress($file, "$tmp/".$base);
+ $this->decompress($file, "$tmp/" . $base);
// search $tmp/$base for the folder(s) that has been created
// move the folder(s) to lib/..
- $result = ['old'=>[], 'new'=>[]];
+ $result = ['old' => [], 'new' => []];
$default = ($this->isTemplate() ? 'template' : 'plugin');
- if (!$this->findFolders($result, $tmp.'/'.$base, $default)) {
+ if (!$this->findFolders($result, $tmp . '/' . $base, $default)) {
throw new Exception($this->getLang('error_findfolder'));
}
@@ -1046,7 +1046,7 @@ class helper_plugin_extension_extension extends Plugin
}
// check to make sure we aren't overwriting anything
- $target = $target_base_dir.$item['base'];
+ $target = $target_base_dir . $item['base'];
if (!$overwrite && file_exists($target)) {
// this info message is not being exposed via exception,
// so that it's not interrupting the installation
@@ -1061,7 +1061,7 @@ class helper_plugin_extension_extension extends Plugin
// return info
$id = $item['base'];
if ($item['type'] == 'template') {
- $id = 'template:'.$id;
+ $id = 'template:' . $id;
}
$installed_extensions[$id] = [
'base' => $item['base'],
@@ -1070,8 +1070,8 @@ class helper_plugin_extension_extension extends Plugin
];
} else {
throw new Exception(sprintf(
- $this->getLang('error_copy').DOKU_LF,
- '<bdi>'.$item['base'].'</bdi>'
+ $this->getLang('error_copy') . DOKU_LF,
+ '<bdi>' . $item['base'] . '</bdi>'
));
}
}
@@ -1191,7 +1191,7 @@ class helper_plugin_extension_extension extends Plugin
$tar->open($file);
$tar->extract($target);
} catch (ArchiveIOException $e) {
- throw new Exception($this->getLang('error_decompress').' '.$e->getMessage(), $e->getCode(), $e);
+ throw new Exception($this->getLang('error_decompress') . ' ' . $e->getMessage(), $e->getCode(), $e);
}
return true;
@@ -1201,7 +1201,7 @@ class helper_plugin_extension_extension extends Plugin
$zip->open($file);
$zip->extract($target);
} catch (ArchiveIOException $e) {
- throw new Exception($this->getLang('error_decompress').' '.$e->getMessage(), $e->getCode(), $e);
+ throw new Exception($this->getLang('error_decompress') . ' ' . $e->getMessage(), $e->getCode(), $e);
}
return true;
@@ -1209,7 +1209,7 @@ class helper_plugin_extension_extension extends Plugin
// the only case when we don't get one of the recognized archive types is
// when the archive file can't be read
- throw new Exception($this->getLang('error_decompress').' Couldn\'t read archive file');
+ throw new Exception($this->getLang('error_decompress') . ' Couldn\'t read archive file');
}
/**
@@ -1286,7 +1286,7 @@ class helper_plugin_extension_extension extends Plugin
} else {
$extensiondir = DOKU_PLUGIN;
}
- $extensiondir = $extensiondir . $extension['base'] .'/';
+ $extensiondir = $extensiondir . $extension['base'] . '/';
$definitionfile = $extensiondir . 'deleted.files';
if (!file_exists($definitionfile)) continue;
diff --git a/lib/plugins/extension/helper/gui.php b/lib/plugins/extension/helper/gui.php
index 2a0e4f034..88b6831bc 100644
--- a/lib/plugins/extension/helper/gui.php
+++ b/lib/plugins/extension/helper/gui.php
@@ -5,6 +5,7 @@
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andreas Gohr <andi@splitbrain.org>
*/
+
use dokuwiki\Extension\Plugin;
use dokuwiki\Form\Form;
@@ -45,8 +46,8 @@ class helper_plugin_extension_gui extends Plugin
$list = $this->loadHelper('extension_list');
$form = new Form([
- 'action' => $this->tabURL('', [], '&'),
- 'id' => 'extension__list',
+ 'action' => $this->tabURL('', [], '&'),
+ 'id' => 'extension__list',
]);
$list->startForm();
foreach ($pluginlist as $name) {
@@ -68,7 +69,7 @@ class helper_plugin_extension_gui extends Plugin
echo '</div>';
// FIXME do we have a real way?
- $tpllist = glob(DOKU_INC.'lib/tpl/*', GLOB_ONLYDIR);
+ $tpllist = glob(DOKU_INC . 'lib/tpl/*', GLOB_ONLYDIR);
$tpllist = array_map('basename', $tpllist);
sort($tpllist);
@@ -78,8 +79,8 @@ class helper_plugin_extension_gui extends Plugin
$list = $this->loadHelper('extension_list');
$form = new Form([
- 'action' => $this->tabURL('', [], '&'),
- 'id' => 'extension__list',
+ 'action' => $this->tabURL('', [], '&'),
+ 'id' => 'extension__list',
]);
$list->startForm();
foreach ($tpllist as $name) {
@@ -102,8 +103,8 @@ class helper_plugin_extension_gui extends Plugin
echo '</div>';
$form = new Form([
- 'action' => $this->tabURL('', [], '&'),
- 'class' => 'search',
+ 'action' => $this->tabURL('', [], '&'),
+ 'class' => 'search',
]);
$form->addTagOpen('div')->addClass('no');
$form->addTextInput('q', $this->getLang('search_for'))
@@ -118,7 +119,7 @@ class helper_plugin_extension_gui extends Plugin
/* @var helper_plugin_extension_repository $repository FIXME should we use some gloabl instance? */
$repository = $this->loadHelper('extension_repository');
- $result = $repository->search($INPUT->str('q'));
+ $result = $repository->search($INPUT->str('q'));
/* @var helper_plugin_extension_extension $extension */
$extension = $this->loadHelper('extension_extension');
@@ -126,8 +127,8 @@ class helper_plugin_extension_gui extends Plugin
$list = $this->loadHelper('extension_list');
$form = new Form([
- 'action' => $this->tabURL('', [], '&'),
- 'id' => 'extension__list',
+ 'action' => $this->tabURL('', [], '&'),
+ 'id' => 'extension__list',
]);
$list->startForm();
if ($result) {
@@ -154,9 +155,9 @@ class helper_plugin_extension_gui extends Plugin
echo '</div>';
$form = new Form([
- 'action' => $this->tabURL('', [], '&'),
- 'enctype' => 'multipart/form-data',
- 'class' => 'install',
+ 'action' => $this->tabURL('', [], '&'),
+ 'enctype' => 'multipart/form-data',
+ 'class' => 'install',
]);
$form->addTagOpen('div')->addClass('no');
$form->addTextInput('installurl', $this->getLang('install_url'))
@@ -191,7 +192,8 @@ class helper_plugin_extension_gui extends Plugin
} else {
$class = '';
}
- echo '<li class="'.$tab.$class.'"><a href="'.$url.'">'.$this->getLang('tab_'.$tab).'</a></li>';
+ echo '<li class="' . $tab . $class . '"><a href="' . $url . '">' .
+ $this->getLang('tab_' . $tab) . '</a></li>';
}
echo '</ul>';
}
@@ -213,10 +215,10 @@ class helper_plugin_extension_gui extends Plugin
/**
* Create an URL inside the extension manager
*
- * @param string $tab tab to load, empty for current tab
- * @param array $params associative array of parameter to set
- * @param string $sep seperator to build the URL
- * @param bool $absolute create absolute URLs?
+ * @param string $tab tab to load, empty for current tab
+ * @param array $params associative array of parameter to set
+ * @param string $sep seperator to build the URL
+ * @param bool $absolute create absolute URLs?
* @return string
*/
public function tabURL($tab = '', $params = [], $sep = '&', $absolute = false)
@@ -226,9 +228,9 @@ class helper_plugin_extension_gui extends Plugin
if (!$tab) $tab = $this->currentTab();
$defaults = [
- 'do' => 'admin',
+ 'do' => 'admin',
'page' => 'extension',
- 'tab' => $tab
+ 'tab' => $tab
];
if ($tab == 'search') $defaults['q'] = $INPUT->str('q');
diff --git a/lib/plugins/extension/helper/list.php b/lib/plugins/extension/helper/list.php
index 2352ae060..346fb13fa 100644
--- a/lib/plugins/extension/helper/list.php
+++ b/lib/plugins/extension/helper/list.php
@@ -57,7 +57,7 @@ class helper_plugin_extension_list extends Plugin
*/
public function addHeader($id, $header, $level = 2)
{
- $this->form .='<h'.$level.' id="'.$id.'">'.hsc($header).'</h'.$level.'>'.DOKU_LF;
+ $this->form .= '<h' . $level . ' id="' . $id . '">' . hsc($header) . '</h' . $level . '>' . DOKU_LF;
}
/**
@@ -67,7 +67,7 @@ class helper_plugin_extension_list extends Plugin
*/
public function addParagraph($data)
{
- $this->form .= '<p>'.hsc($data).'</p>'.DOKU_LF;
+ $this->form .= '<p>' . hsc($data) . '</p>' . DOKU_LF;
}
/**
@@ -79,9 +79,9 @@ class helper_plugin_extension_list extends Plugin
{
$this->form .= '<div class="no">';
foreach ($data as $key => $value) {
- $this->form .= '<input type="hidden" name="'.hsc($key).'" value="'.hsc($value).'" />';
+ $this->form .= '<input type="hidden" name="' . hsc($key) . '" value="' . hsc($value) . '" />';
}
- $this->form .= '</div>'.DOKU_LF;
+ $this->form .= '</div>' . DOKU_LF;
}
/**
@@ -98,7 +98,7 @@ class helper_plugin_extension_list extends Plugin
public function nothingFound()
{
global $lang;
- $this->form .= '<li class="notfound">'.$lang['nothingfound'].'</li>';
+ $this->form .= '<li class="notfound">' . $lang['nothingfound'] . '</li>';
}
/**
@@ -119,8 +119,8 @@ class helper_plugin_extension_list extends Plugin
*/
private function startRow(helper_plugin_extension_extension $extension)
{
- $this->form .= '<li id="extensionplugin__'.hsc($extension->getID()).
- '" class="'.$this->makeClass($extension).'">';
+ $this->form .= '<li id="extensionplugin__' . hsc($extension->getID()) .
+ '" class="' . $this->makeClass($extension) . '">';
}
/**
@@ -130,7 +130,7 @@ class helper_plugin_extension_list extends Plugin
*/
private function populateColumn($class, $html)
{
- $this->form .= '<div class="'.$class.' col">'.$html.'</div>'.DOKU_LF;
+ $this->form .= '<div class="' . $class . ' col">' . $html . '</div>' . DOKU_LF;
}
/**
@@ -138,7 +138,7 @@ class helper_plugin_extension_list extends Plugin
*/
private function endRow()
{
- $this->form .= '</li>'.DOKU_LF;
+ $this->form .= '</li>' . DOKU_LF;
}
/**
@@ -166,8 +166,8 @@ class helper_plugin_extension_list extends Plugin
if ($linktype == 'extern' && $conf['relnofollow']) {
$param['rel'] = implode(' ', [$param['rel'], 'ugc nofollow']);
}
- $html = ' <a '. buildAttributes($param, true).'>'.
- $this->getLang('homepage_link').'</a>';
+ $html = ' <a ' . buildAttributes($param, true) . '>' .
+ $this->getLang('homepage_link') . '</a>';
return $html;
}
@@ -181,12 +181,12 @@ class helper_plugin_extension_list extends Plugin
{
$class = ($extension->isTemplate()) ? 'template' : 'plugin';
if ($extension->isInstalled()) {
- $class.=' installed';
- $class.= ($extension->isEnabled()) ? ' enabled':' disabled';
+ $class .= ' installed';
+ $class .= ($extension->isEnabled()) ? ' enabled' : ' disabled';
if ($extension->updateAvailable()) $class .= ' updatable';
}
- if (!$extension->canModify()) $class.= ' notselect';
- if ($extension->isProtected()) $class.= ' protected';
+ if (!$extension->canModify()) $class .= ' notselect';
+ if ($extension->isProtected()) $class .= ' protected';
//if($this->showinfo) $class.= ' showinfo';
return $class;
}
@@ -202,17 +202,17 @@ class helper_plugin_extension_list extends Plugin
if ($extension->getAuthor()) {
$mailid = $extension->getEmailID();
if ($mailid) {
- $url = $this->gui->tabURL('search', ['q' => 'authorid:'.$mailid]);
- $html = '<a href="'.$url.'" class="author" title="'.$this->getLang('author_hint').'" >'.
- '<img src="//www.gravatar.com/avatar/'.$mailid.
- '?s=20&amp;d=mm" width="20" height="20" alt="" /> '.
- hsc($extension->getAuthor()).'</a>';
+ $url = $this->gui->tabURL('search', ['q' => 'authorid:' . $mailid]);
+ $html = '<a href="' . $url . '" class="author" title="' . $this->getLang('author_hint') . '" >' .
+ '<img src="//www.gravatar.com/avatar/' . $mailid .
+ '?s=20&amp;d=mm" width="20" height="20" alt="" /> ' .
+ hsc($extension->getAuthor()) . '</a>';
} else {
- $html = '<span class="author">'.hsc($extension->getAuthor()).'</span>';
+ $html = '<span class="author">' . hsc($extension->getAuthor()) . '</span>';
}
- $html = '<bdi>'.$html.'</bdi>';
+ $html = '<bdi>' . $html . '</bdi>';
} else {
- $html = '<em class="author">'.$this->getLang('unknown_author').'</em>'.DOKU_LF;
+ $html = '<em class="author">' . $this->getLang('unknown_author') . '</em>' . DOKU_LF;
}
return $html;
}
@@ -234,17 +234,17 @@ class helper_plugin_extension_list extends Plugin
$thumb = str_replace('http://www.dokuwiki.org', '//www.dokuwiki.org', $thumb);
$title = sprintf($this->getLang('screenshot'), hsc($extension->getDisplayName()));
- $img = '<a href="'.hsc($screen).'" target="_blank" class="extension_screenshot">'.
- '<img alt="'.$title.'" width="120" height="70" src="'.hsc($thumb).'" />'.
+ $img = '<a href="' . hsc($screen) . '" target="_blank" class="extension_screenshot">' .
+ '<img alt="' . $title . '" width="120" height="70" src="' . hsc($thumb) . '" />' .
'</a>';
} elseif ($extension->isTemplate()) {
- $img = '<img alt="" width="120" height="70" src="'.DOKU_BASE.
+ $img = '<img alt="" width="120" height="70" src="' . DOKU_BASE .
'lib/plugins/extension/images/template.png" />';
} else {
- $img = '<img alt="" width="120" height="70" src="'.DOKU_BASE.
+ $img = '<img alt="" width="120" height="70" src="' . DOKU_BASE .
'lib/plugins/extension/images/plugin.png" />';
}
- $html = '<div class="screenshot" >'.$img.'<span></span></div>'.DOKU_LF;
+ $html = '<div class="screenshot" >' . $img . '<span></span></div>' . DOKU_LF;
return $html;
}
@@ -261,26 +261,26 @@ class helper_plugin_extension_list extends Plugin
$html .= '<h2>';
$html .= sprintf(
$this->getLang('extensionby'),
- '<bdi>'.hsc($extension->getDisplayName()).'</bdi>',
+ '<bdi>' . hsc($extension->getDisplayName()) . '</bdi>',
$this->makeAuthor($extension)
);
- $html .= '</h2>'.DOKU_LF;
+ $html .= '</h2>' . DOKU_LF;
$html .= $this->makeScreenshot($extension);
$popularity = $extension->getPopularity();
if ($popularity !== false && !$extension->isBundled()) {
- $popularityText = sprintf($this->getLang('popularity'), round($popularity*100, 2));
- $html .= '<div class="popularity" title="'.$popularityText.'">'.
- '<div style="width: '.($popularity * 100).'%;">'.
- '<span class="a11y">'.$popularityText.'</span>'.
- '</div></div>'.DOKU_LF;
+ $popularityText = sprintf($this->getLang('popularity'), round($popularity * 100, 2));
+ $html .= '<div class="popularity" title="' . $popularityText . '">' .
+ '<div style="width: ' . ($popularity * 100) . '%;">' .
+ '<span class="a11y">' . $popularityText . '</span>' .
+ '</div></div>' . DOKU_LF;
}
if ($extension->getDescription()) {
$html .= '<p><bdi>';
- $html .= hsc($extension->getDescription()).' ';
- $html .= '</bdi></p>'.DOKU_LF;
+ $html .= hsc($extension->getDescription()) . ' ';
+ $html .= '</bdi></p>' . DOKU_LF;
}
$html .= $this->makeLinkbar($extension);
@@ -292,15 +292,15 @@ class helper_plugin_extension_list extends Plugin
$url = $this->gui->tabURL('', ['info' => $extension->getID()]);
$class = '';
}
- $html .= ' <a href="'.$url.'#extensionplugin__'.$extension->getID().
- '" class="info '.$class.'" title="'.$this->getLang('btn_info').
- '" data-extid="'.$extension->getID().'">'.$this->getLang('btn_info').'</a>';
+ $html .= ' <a href="' . $url . '#extensionplugin__' . $extension->getID() .
+ '" class="info ' . $class . '" title="' . $this->getLang('btn_info') .
+ '" data-extid="' . $extension->getID() . '">' . $this->getLang('btn_info') . '</a>';
if ($showinfo) {
$html .= $this->makeInfo($extension);
}
$html .= $this->makeNoticeArea($extension);
- $html .= '</div>'.DOKU_LF;
+ $html .= '</div>' . DOKU_LF;
return $html;
}
@@ -333,24 +333,24 @@ class helper_plugin_extension_list extends Plugin
if ($conf['relnofollow']) {
$param['rel'] = implode(' ', [$param['rel'], 'ugc nofollow']);
}
- $html .= ' <a '.buildAttributes($param, true).'>'.
- $this->getLang('bugs_features').'</a>';
+ $html .= ' <a ' . buildAttributes($param, true) . '>' .
+ $this->getLang('bugs_features') . '</a>';
}
if ($extension->getTags()) {
$first = true;
- $html .= ' <span class="tags">'.$this->getLang('tags').' ';
+ $html .= ' <span class="tags">' . $this->getLang('tags') . ' ';
foreach ($extension->getTags() as $tag) {
if (!$first) {
$html .= ', ';
} else {
$first = false;
}
- $url = $this->gui->tabURL('search', ['q' => 'tag:'.$tag]);
- $html .= '<bdi><a href="'.$url.'">'.hsc($tag).'</a></bdi>';
+ $url = $this->gui->tabURL('search', ['q' => 'tag:' . $tag]);
+ $html .= '<bdi><a href="' . $url . '">' . hsc($tag) . '</a></bdi>';
}
$html .= '</span>';
}
- $html .= '</div>'.DOKU_LF;
+ $html .= '</div>' . DOKU_LF;
return $html;
}
@@ -382,18 +382,18 @@ class helper_plugin_extension_list extends Plugin
'</div>';
}
if (($securityissue = $extension->getSecurityIssue()) !== false) {
- $html .= '<div class="msg error">'.
- sprintf($this->getLang('security_issue'), '<bdi>'.hsc($securityissue).'</bdi>').
+ $html .= '<div class="msg error">' .
+ sprintf($this->getLang('security_issue'), '<bdi>' . hsc($securityissue) . '</bdi>') .
'</div>';
}
if (($securitywarning = $extension->getSecurityWarning()) !== false) {
- $html .= '<div class="msg notify">'.
- sprintf($this->getLang('security_warning'), '<bdi>'.hsc($securitywarning).'</bdi>').
+ $html .= '<div class="msg notify">' .
+ sprintf($this->getLang('security_warning'), '<bdi>' . hsc($securitywarning) . '</bdi>') .
'</div>';
}
if ($extension->updateAvailable()) {
- $html .= '<div class="msg notify">'.
- sprintf($this->getLang('update_available'), hsc($extension->getLastUpdate())).
+ $html .= '<div class="msg notify">' .
+ sprintf($this->getLang('update_available'), hsc($extension->getLastUpdate())) .
'</div>';
}
if ($extension->hasDownloadURLChanged()) {
@@ -405,7 +405,7 @@ class helper_plugin_extension_list extends Plugin
) .
'</div>';
}
- return $html.DOKU_LF;
+ return $html . DOKU_LF;
}
/**
@@ -421,13 +421,13 @@ class helper_plugin_extension_list extends Plugin
$link = parse_url($url);
$base = $link['host'];
- if (!empty($link['port'])) $base .= $base.':'.$link['port'];
+ if (!empty($link['port'])) $base .= $base . ':' . $link['port'];
$long = $link['path'];
if (!empty($link['query'])) $long .= $link['query'];
$name = shorten($base, $long, 55);
- $html = '<a href="'.hsc($url).'" class="urlextern">'.hsc($name).'</a>';
+ $html = '<a href="' . hsc($url) . '" class="urlextern">' . hsc($name) . '</a>';
return $html;
}
@@ -442,26 +442,26 @@ class helper_plugin_extension_list extends Plugin
$default = $this->getLang('unknown');
$html = '<dl class="details">';
- $html .= '<dt>'.$this->getLang('status').'</dt>';
- $html .= '<dd>'.$this->makeStatus($extension).'</dd>';
+ $html .= '<dt>' . $this->getLang('status') . '</dt>';
+ $html .= '<dd>' . $this->makeStatus($extension) . '</dd>';
if ($extension->getDonationURL()) {
- $html .= '<dt>'.$this->getLang('donate').'</dt>';
+ $html .= '<dt>' . $this->getLang('donate') . '</dt>';
$html .= '<dd>';
- $html .= '<a href="'.$extension->getDonationURL().'" class="donate">'.
- $this->getLang('donate_action').'</a>';
+ $html .= '<a href="' . $extension->getDonationURL() . '" class="donate">' .
+ $this->getLang('donate_action') . '</a>';
$html .= '</dd>';
}
if (!$extension->isBundled()) {
- $html .= '<dt>'.$this->getLang('downloadurl').'</dt>';
+ $html .= '<dt>' . $this->getLang('downloadurl') . '</dt>';
$html .= '<dd><bdi>';
$html .= ($extension->getDownloadURL()
? $this->shortlink($extension->getDownloadURL())
: $default);
$html .= '</bdi></dd>';
- $html .= '<dt>'.$this->getLang('repository').'</dt>';
+ $html .= '<dt>' . $this->getLang('repository') . '</dt>';
$html .= '<dd><bdi>';
$html .= ($extension->getSourcerepoURL()
? $this->shortlink($extension->getSourcerepoURL())
@@ -471,13 +471,13 @@ class helper_plugin_extension_list extends Plugin
if ($extension->isInstalled()) {
if ($extension->getInstalledVersion()) {
- $html .= '<dt>'.$this->getLang('installed_version').'</dt>';
+ $html .= '<dt>' . $this->getLang('installed_version') . '</dt>';
$html .= '<dd>';
$html .= hsc($extension->getInstalledVersion());
$html .= '</dd>';
}
if (!$extension->isBundled()) {
- $html .= '<dt>'.$this->getLang('install_date').'</dt>';
+ $html .= '<dt>' . $this->getLang('install_date') . '</dt>';
$html .= '<dd>';
$html .= ($extension->getUpdateDate()
? hsc($extension->getUpdateDate())
@@ -486,7 +486,7 @@ class helper_plugin_extension_list extends Plugin
}
}
if (!$extension->isInstalled() || $extension->updateAvailable()) {
- $html .= '<dt>'.$this->getLang('available_version').'</dt>';
+ $html .= '<dt>' . $this->getLang('available_version') . '</dt>';
$html .= '<dd>';
$html .= ($extension->getLastUpdate()
? hsc($extension->getLastUpdate())
@@ -494,7 +494,7 @@ class helper_plugin_extension_list extends Plugin
$html .= '</dd>';
}
- $html .= '<dt>'.$this->getLang('provides').'</dt>';
+ $html .= '<dt>' . $this->getLang('provides') . '</dt>';
$html .= '<dd><bdi>';
$html .= ($extension->getTypes()
? hsc(implode(', ', $extension->getTypes()))
@@ -502,35 +502,35 @@ class helper_plugin_extension_list extends Plugin
$html .= '</bdi></dd>';
if (!$extension->isBundled() && $extension->getCompatibleVersions()) {
- $html .= '<dt>'.$this->getLang('compatible').'</dt>';
+ $html .= '<dt>' . $this->getLang('compatible') . '</dt>';
$html .= '<dd>';
foreach ($extension->getCompatibleVersions() as $date => $version) {
- $html .= '<bdi>'.$version['label'].' ('.$date.')</bdi>, ';
+ $html .= '<bdi>' . $version['label'] . ' (' . $date . ')</bdi>, ';
}
$html = rtrim($html, ', ');
$html .= '</dd>';
}
if ($extension->getDependencies()) {
- $html .= '<dt>'.$this->getLang('depends').'</dt>';
+ $html .= '<dt>' . $this->getLang('depends') . '</dt>';
$html .= '<dd>';
$html .= $this->makeLinkList($extension->getDependencies());
$html .= '</dd>';
}
if ($extension->getSimilarExtensions()) {
- $html .= '<dt>'.$this->getLang('similar').'</dt>';
+ $html .= '<dt>' . $this->getLang('similar') . '</dt>';
$html .= '<dd>';
$html .= $this->makeLinkList($extension->getSimilarExtensions());
$html .= '</dd>';
}
if ($extension->getConflicts()) {
- $html .= '<dt>'.$this->getLang('conflicts').'</dt>';
+ $html .= '<dt>' . $this->getLang('conflicts') . '</dt>';
$html .= '<dd>';
$html .= $this->makeLinkList($extension->getConflicts());
$html .= '</dd>';
}
- $html .= '</dl>'.DOKU_LF;
+ $html .= '</dl>' . DOKU_LF;
return $html;
}
@@ -544,9 +544,9 @@ class helper_plugin_extension_list extends Plugin
{
$html = '';
foreach ($ext as $link) {
- $html .= '<bdi><a href="'.
- $this->gui->tabURL('search', ['q'=>'ext:'.$link]).'">'.
- hsc($link).'</a></bdi>, ';
+ $html .= '<bdi><a href="' .
+ $this->gui->tabURL('search', ['q' => 'ext:' . $link]) . '">' .
+ hsc($link) . '</a></bdi>, ';
}
return rtrim($html, ', ');
}
@@ -576,7 +576,7 @@ class helper_plugin_extension_list extends Plugin
}
}
} else {
- $errors .= '<p class="permerror">'.$this->getLang($canmod).'</p>';
+ $errors .= '<p class="permerror">' . $this->getLang($canmod) . '</p>';
}
if (!$extension->isProtected() && !$extension->isTemplate()) { // no enable/disable for templates
if ($extension->isEnabled()) {
@@ -586,31 +586,31 @@ class helper_plugin_extension_list extends Plugin
}
}
if ($extension->isGitControlled()) {
- $errors .= '<p class="permerror">'.$this->getLang('git').'</p>';
+ $errors .= '<p class="permerror">' . $this->getLang('git') . '</p>';
}
if (
$extension->isEnabled() &&
in_array('Auth', $extension->getTypes()) &&
$conf['authtype'] != $extension->getID()
) {
- $errors .= '<p class="permerror">'.$this->getLang('auth').'</p>';
+ $errors .= '<p class="permerror">' . $this->getLang('auth') . '</p>';
}
} elseif (($canmod = $extension->canModify()) === true) {
if ($extension->getDownloadURL()) {
$html .= $this->makeAction('install', $extension);
}
} else {
- $errors .= '<div class="permerror">'.$this->getLang($canmod).'</div>';
+ $errors .= '<div class="permerror">' . $this->getLang($canmod) . '</div>';
}
if (!$extension->isInstalled() && $extension->getDownloadURL()) {
- $html .= ' <span class="version">'.$this->getLang('available_version').' ';
+ $html .= ' <span class="version">' . $this->getLang('available_version') . ' ';
$html .= ($extension->getLastUpdate()
? hsc($extension->getLastUpdate())
- : $this->getLang('unknown')).'</span>';
+ : $this->getLang('unknown')) . '</span>';
}
- return $html.' '.$errors.DOKU_LF;
+ return $html . ' ' . $errors . DOKU_LF;
}
/**
@@ -625,14 +625,14 @@ class helper_plugin_extension_list extends Plugin
$title = '';
if ($action == 'install' || $action == 'reinstall') {
- $title = 'title="'.hsc($extension->getDownloadURL()).'"';
+ $title = 'title="' . hsc($extension->getDownloadURL()) . '"';
}
- $classes = 'button '.$action;
- $name = 'fn['.$action.']['.hsc($extension->getID()).']';
+ $classes = 'button ' . $action;
+ $name = 'fn[' . $action . '][' . hsc($extension->getID()) . ']';
- $html = '<button class="'.$classes.'" name="'.$name.'" type="submit" '.$title.'>'.
- $this->getLang('btn_'.$action).'</button> ';
+ $html = '<button class="' . $classes . '" name="' . $name . '" type="submit" ' . $title . '>' .
+ $this->getLang('btn_' . $action) . '</button> ';
return $html;
}
diff --git a/lib/plugins/extension/helper/repository.php b/lib/plugins/extension/helper/repository.php
index 5fa0343d8..37a2513e9 100644
--- a/lib/plugins/extension/helper/repository.php
+++ b/lib/plugins/extension/helper/repository.php
@@ -33,7 +33,7 @@ class helper_plugin_extension_repository extends Plugin
$request_data = ['fmt' => 'php'];
$request_needed = false;
foreach ($list as $name) {
- $cache = new Cache('##extension_manager##'.$name, '.repo');
+ $cache = new Cache('##extension_manager##' . $name, '.repo');
if (
!isset($this->loaded_extensions[$name]) &&
@@ -52,7 +52,7 @@ class helper_plugin_extension_repository extends Plugin
if ($data !== false) {
$extensions = unserialize($data);
foreach ($extensions as $extension) {
- $cache = new Cache('##extension_manager##'.$extension['plugin'], '.repo');
+ $cache = new Cache('##extension_manager##' . $extension['plugin'], '.repo');
$cache->storeCache(serialize($extension));
}
} else {
@@ -73,10 +73,10 @@ class helper_plugin_extension_repository extends Plugin
if ($this->has_access === null) {
$cache = new Cache('##extension_manager###hasAccess', '.repo');
- if (!$cache->useCache(['age' => 60*10, 'purge' => !$usecache])) {
+ if (!$cache->useCache(['age' => 60 * 10, 'purge' => !$usecache])) {
$httpclient = new DokuHTTPClient();
$httpclient->timeout = 5;
- $data = $httpclient->get(self::EXTENSION_REPOSITORY_API.'?cmd=ping');
+ $data = $httpclient->get(self::EXTENSION_REPOSITORY_API . '?cmd=ping');
if ($data !== false) {
$this->has_access = true;
$cache->storeCache(1);
@@ -99,7 +99,7 @@ class helper_plugin_extension_repository extends Plugin
*/
public function getData($name)
{
- $cache = new Cache('##extension_manager##'.$name, '.repo');
+ $cache = new Cache('##extension_manager##' . $name, '.repo');
if (
!isset($this->loaded_extensions[$name]) &&
@@ -108,7 +108,7 @@ class helper_plugin_extension_repository extends Plugin
) {
$this->loaded_extensions[$name] = true;
$httpclient = new DokuHTTPClient();
- $data = $httpclient->get(self::EXTENSION_REPOSITORY_API.'?fmt=php&ext[]='.urlencode($name));
+ $data = $httpclient->get(self::EXTENSION_REPOSITORY_API . '?fmt=php&ext[]=' . urlencode($name));
if ($data !== false) {
$result = unserialize($data);
if (count($result)) {
@@ -147,7 +147,7 @@ class helper_plugin_extension_repository extends Plugin
// store cache info for each extension
foreach ($result as $ext) {
$name = $ext['plugin'];
- $cache = new Cache('##extension_manager##'.$name, '.repo');
+ $cache = new Cache('##extension_manager##' . $name, '.repo');
$cache->storeCache(serialize($ext));
$ids[] = $name;
}
diff --git a/lib/plugins/popularity/action.php b/lib/plugins/popularity/action.php
index 2df66299d..f35154ba7 100644
--- a/lib/plugins/popularity/action.php
+++ b/lib/plugins/popularity/action.php
@@ -64,6 +64,6 @@ class action_plugin_popularity extends ActionPlugin
protected function isTooEarlyToSubmit()
{
$lastSubmit = $this->helper->lastSentTime();
- return $lastSubmit + 24*60*60*30 > time();
+ return $lastSubmit + 24 * 60 * 60 * 30 > time();
}
}
diff --git a/lib/plugins/popularity/admin.php b/lib/plugins/popularity/admin.php
index c0e66655a..5a989ce04 100644
--- a/lib/plugins/popularity/admin.php
+++ b/lib/plugins/popularity/admin.php
@@ -129,25 +129,25 @@ class admin_plugin_popularity extends AdminPlugin
$data = $this->helper->gatherAsString();
}
- $form = '<form method="post" action="'. $url .'" accept-charset="utf-8">'
- .'<fieldset style="width: 60%;">'
- .'<textarea class="edit" rows="10" cols="80" readonly="readonly" name="data">'
- .$data
- .'</textarea><br />';
+ $form = '<form method="post" action="' . $url . '" accept-charset="utf-8">'
+ . '<fieldset style="width: 60%;">'
+ . '<textarea class="edit" rows="10" cols="80" readonly="readonly" name="data">'
+ . $data
+ . '</textarea><br />';
//If we submit via the server, we give the opportunity to suscribe to the autosubmission option
if ($submissionMode !== 'browser') {
$form .= '<label for="autosubmit">'
- .'<input type="checkbox" name="autosubmit" id="autosubmit" '
- .($this->helper->isAutosubmitEnabled() ? 'checked' : '' )
- .'/> ' . $this->getLang('autosubmit') .'<br />'
- .'</label>'
- .'<input type="hidden" name="do" value="admin" />'
- .'<input type="hidden" name="page" value="popularity" />';
+ . '<input type="checkbox" name="autosubmit" id="autosubmit" '
+ . ($this->helper->isAutosubmitEnabled() ? 'checked' : '' )
+ . '/> ' . $this->getLang('autosubmit') . '<br />'
+ . '</label>'
+ . '<input type="hidden" name="do" value="admin" />'
+ . '<input type="hidden" name="page" value="popularity" />';
}
- $form .= '<button type="submit">'.$this->getLang('submit').'</button>'
- .'</fieldset>'
- .'</form>';
+ $form .= '<button type="submit">' . $this->getLang('submit') . '</button>'
+ . '</fieldset>'
+ . '</form>';
return $form;
}
}
diff --git a/lib/plugins/popularity/helper.php b/lib/plugins/popularity/helper.php
index 62fc905fc..64831a6b0 100644
--- a/lib/plugins/popularity/helper.php
+++ b/lib/plugins/popularity/helper.php
@@ -39,9 +39,9 @@ class helper_plugin_popularity extends Dokuwiki_Plugin
public function __construct()
{
global $conf;
- $this->autosubmitFile = $conf['cachedir'].'/autosubmit.txt';
- $this->autosubmitErrorFile = $conf['cachedir'].'/autosubmitError.txt';
- $this->popularityLastSubmitFile = $conf['cachedir'].'/lastSubmitTime.txt';
+ $this->autosubmitFile = $conf['cachedir'] . '/autosubmit.txt';
+ $this->autosubmitErrorFile = $conf['cachedir'] . '/autosubmitError.txt';
+ $this->popularityLastSubmitFile = $conf['cachedir'] . '/lastSubmitTime.txt';
}
/**
@@ -95,9 +95,9 @@ class helper_plugin_popularity extends Dokuwiki_Plugin
$string = '';
foreach ($data as $key => $val) {
if (is_array($val)) foreach ($val as $v) {
- $string .= hsc($key)."\t".hsc($v)."\n";
+ $string .= hsc($key) . "\t" . hsc($v) . "\n";
} else {
- $string .= hsc($key)."\t".hsc($val)."\n";
+ $string .= hsc($key) . "\t" . hsc($val) . "\n";
}
}
return $string;
@@ -152,7 +152,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin
// number and size of pages
$list = $this->initEmptySearchList();
- search($list, $conf['datadir'], [$this, 'searchCountCallback'], ['all'=>false], '');
+ search($list, $conf['datadir'], [$this, 'searchCountCallback'], ['all' => false], '');
$data['page_count'] = $list['file_count'];
$data['page_size'] = $list['file_size'];
$data['page_biggest'] = $list['file_max'];
@@ -165,7 +165,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin
// number and size of media
$list = $this->initEmptySearchList();
- search($list, $conf['mediadir'], [$this, 'searchCountCallback'], ['all'=>true]);
+ search($list, $conf['mediadir'], [$this, 'searchCountCallback'], ['all' => true]);
$data['media_count'] = $list['file_count'];
$data['media_size'] = $list['file_size'];
$data['media_biggest'] = $list['file_max'];
@@ -177,7 +177,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin
// number and size of cache
$list = $this->initEmptySearchList();
- search($list, $conf['cachedir'], [$this, 'searchCountCallback'], ['all'=>true]);
+ search($list, $conf['cachedir'], [$this, 'searchCountCallback'], ['all' => true]);
$data['cache_count'] = $list['file_count'];
$data['cache_size'] = $list['file_size'];
$data['cache_biggest'] = $list['file_max'];
@@ -187,7 +187,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin
// number and size of index
$list = $this->initEmptySearchList();
- search($list, $conf['indexdir'], [$this, 'searchCountCallback'], ['all'=>true]);
+ search($list, $conf['indexdir'], [$this, 'searchCountCallback'], ['all' => true]);
$data['index_count'] = $list['file_count'];
$data['index_size'] = $list['file_size'];
$data['index_biggest'] = $list['file_max'];
@@ -197,7 +197,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin
// number and size of meta
$list = $this->initEmptySearchList();
- search($list, $conf['metadir'], [$this, 'searchCountCallback'], ['all'=>true]);
+ search($list, $conf['metadir'], [$this, 'searchCountCallback'], ['all' => true]);
$data['meta_count'] = $list['file_count'];
$data['meta_size'] = $list['file_size'];
$data['meta_biggest'] = $list['file_max'];
@@ -207,7 +207,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin
// number and size of attic
$list = $this->initEmptySearchList();
- search($list, $conf['olddir'], [$this, 'searchCountCallback'], ['all'=>true]);
+ search($list, $conf['olddir'], [$this, 'searchCountCallback'], ['all' => true]);
$data['attic_count'] = $list['file_count'];
$data['attic_size'] = $list['file_size'];
$data['attic_biggest'] = $list['file_max'];
@@ -222,13 +222,13 @@ class helper_plugin_popularity extends Dokuwiki_Plugin
}
// calculate edits per day
- $list = (array) @file($conf['metadir'].'/_dokuwiki.changes');
+ $list = (array) @file($conf['metadir'] . '/_dokuwiki.changes');
$count = count($list);
if ($count > 2) {
$first = (int) substr(array_shift($list), 0, 10);
$last = (int) substr(array_pop($list), 0, 10);
- $dur = ($last - $first)/(60*60*24); // number of days in the changelog
- $data['edits_per_day'] = $count/$dur;
+ $dur = ($last - $first) / (60 * 60 * 24); // number of days in the changelog
+ $data['edits_per_day'] = $count / $dur;
}
unset($list);
@@ -297,8 +297,8 @@ class helper_plugin_popularity extends Dokuwiki_Plugin
//only search txt files if 'all' option not set
if ($opts['all'] || substr($file, -4) == '.txt') {
- $size = filesize($base.'/'.$file);
- $date = filemtime($base.'/'.$file);
+ $size = filesize($base . '/' . $file);
+ $date = filemtime($base . '/' . $file);
$data['file_count']++;
$data['file_size'] += $size;
if (!isset($data['file_min']) || $data['file_min'] > $size) $data['file_min'] = $size;
diff --git a/lib/plugins/revert/admin.php b/lib/plugins/revert/admin.php
index 03777e46f..4b9fe8584 100644
--- a/lib/plugins/revert/admin.php
+++ b/lib/plugins/revert/admin.php
@@ -71,10 +71,10 @@ class admin_plugin_revert extends AdminPlugin
{
global $lang, $INPUT;
echo '<form action="" method="post"><div class="no">';
- echo '<label>'.$this->getLang('filter').': </label>';
- echo '<input type="text" name="filter" class="edit" value="'.hsc($INPUT->str('filter')).'" /> ';
- echo '<button type="submit">'.$lang['btn_search'].'</button> ';
- echo '<span>'.$this->getLang('note1').'</span>';
+ echo '<label>' . $this->getLang('filter') . ': </label>';
+ echo '<input type="text" name="filter" class="edit" value="' . hsc($INPUT->str('filter')) . '" /> ';
+ echo '<button type="submit">' . $lang['btn_search'] . '</button> ';
+ echo '<span>' . $this->getLang('note1') . '</span>';
echo '</div></form><br /><br />';
}
@@ -84,7 +84,7 @@ class admin_plugin_revert extends AdminPlugin
protected function revertEdits($revert, $filter)
{
echo '<hr /><br />';
- echo '<p>'.$this->getLang('revstart').'</p>';
+ echo '<p>' . $this->getLang('revstart') . '</p>';
echo '<ul>';
foreach ($revert as $id) {
@@ -103,17 +103,17 @@ class admin_plugin_revert extends AdminPlugin
if ($data) {
saveWikiText($id, $data, 'old revision restored', false);
- printf('<li><div class="li">'.$this->getLang('reverted').'</div></li>', $id, $REV);
+ printf('<li><div class="li">' . $this->getLang('reverted') . '</div></li>', $id, $REV);
} else {
saveWikiText($id, '', '', false);
- printf('<li><div class="li">'.$this->getLang('removed').'</div></li>', $id);
+ printf('<li><div class="li">' . $this->getLang('removed') . '</div></li>', $id);
}
@set_time_limit(10);
flush();
}
echo '</ul>';
- echo '<p>'.$this->getLang('revstop').'</p>';
+ echo '<p>' . $this->getLang('revstop') . '</p>';
}
/**
@@ -125,7 +125,7 @@ class admin_plugin_revert extends AdminPlugin
global $lang;
echo '<hr /><br />';
echo '<form action="" method="post"><div class="no">';
- echo '<input type="hidden" name="filter" value="'.hsc($filter).'" />';
+ echo '<input type="hidden" name="filter" value="' . hsc($filter) . '" />';
formSecurityToken();
$recents = getRecents(0, $this->max_lines);
@@ -140,15 +140,15 @@ class admin_plugin_revert extends AdminPlugin
$cnt++;
$date = dformat($recent['date']);
- echo ($recent['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) ? '<li class="minor">' : '<li>';
+ echo ($recent['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT) ? '<li class="minor">' : '<li>';
echo '<div class="li">';
- echo '<input type="checkbox" name="revert[]" value="'.hsc($recent['id']).
- '" checked="checked" id="revert__'.$cnt.'" />';
- echo ' <label for="revert__'.$cnt.'">'.$date.'</label> ';
+ echo '<input type="checkbox" name="revert[]" value="' . hsc($recent['id']) .
+ '" checked="checked" id="revert__' . $cnt . '" />';
+ echo ' <label for="revert__' . $cnt . '">' . $date . '</label> ';
- echo '<a href="'.wl($recent['id'], "do=diff").'">';
+ echo '<a href="' . wl($recent['id'], "do=diff") . '">';
$p = [];
- $p['src'] = DOKU_BASE.'lib/images/diff.png';
+ $p['src'] = DOKU_BASE . 'lib/images/diff.png';
$p['width'] = 15;
$p['height'] = 11;
$p['title'] = $lang['diff'];
@@ -157,9 +157,9 @@ class admin_plugin_revert extends AdminPlugin
echo "<img $att />";
echo '</a> ';
- echo '<a href="'.wl($recent['id'], "do=revisions").'">';
+ echo '<a href="' . wl($recent['id'], "do=revisions") . '">';
$p = [];
- $p['src'] = DOKU_BASE.'lib/images/history.png';
+ $p['src'] = DOKU_BASE . 'lib/images/history.png';
$p['width'] = 12;
$p['height'] = 14;
$p['title'] = $lang['btn_revs'];
@@ -168,11 +168,11 @@ class admin_plugin_revert extends AdminPlugin
echo "<img $att />";
echo '</a> ';
- echo html_wikilink(':'.$recent['id'], (useHeading('navigation'))?null:$recent['id']);
- echo ' – '.htmlspecialchars($recent['sum']);
+ echo html_wikilink(':' . $recent['id'], (useHeading('navigation')) ? null : $recent['id']);
+ echo ' – ' . htmlspecialchars($recent['sum']);
echo ' <span class="user">';
- echo $recent['user'].' '.$recent['ip'];
+ echo $recent['user'] . ' ' . $recent['ip'];
echo '</span>';
echo '</div>';
@@ -184,7 +184,7 @@ class admin_plugin_revert extends AdminPlugin
echo '</ul>';
echo '<p>';
- echo '<button type="submit">'.$this->getLang('revert').'</button> ';
+ echo '<button type="submit">' . $this->getLang('revert') . '</button> ';
printf($this->getLang('note2'), hsc($filter));
echo '</p>';
diff --git a/lib/plugins/safefnrecode/action.php b/lib/plugins/safefnrecode/action.php
index 5a12dcb09..e89dd9dc9 100644
--- a/lib/plugins/safefnrecode/action.php
+++ b/lib/plugins/safefnrecode/action.php
@@ -29,24 +29,24 @@ class action_plugin_safefnrecode extends ActionPlugin
global $conf;
if ($conf['fnencode'] != 'safe') return;
- if (!file_exists($conf['datadir'].'_safefn.recoded')) {
+ if (!file_exists($conf['datadir'] . '_safefn.recoded')) {
$this->recode($conf['datadir']);
- touch($conf['datadir'].'_safefn.recoded');
+ touch($conf['datadir'] . '_safefn.recoded');
}
- if (!file_exists($conf['olddir'].'_safefn.recoded')) {
+ if (!file_exists($conf['olddir'] . '_safefn.recoded')) {
$this->recode($conf['olddir']);
- touch($conf['olddir'].'_safefn.recoded');
+ touch($conf['olddir'] . '_safefn.recoded');
}
- if (!file_exists($conf['metadir'].'_safefn.recoded')) {
+ if (!file_exists($conf['metadir'] . '_safefn.recoded')) {
$this->recode($conf['metadir']);
- touch($conf['metadir'].'_safefn.recoded');
+ touch($conf['metadir'] . '_safefn.recoded');
}
- if (!file_exists($conf['mediadir'].'_safefn.recoded')) {
+ if (!file_exists($conf['mediadir'] . '_safefn.recoded')) {
$this->recode($conf['mediadir']);
- touch($conf['mediadir'].'_safefn.recoded');
+ touch($conf['mediadir'] . '_safefn.recoded');
}
}
diff --git a/lib/plugins/styling/action.php b/lib/plugins/styling/action.php
index 66ab1dacc..dca48fc43 100644
--- a/lib/plugins/styling/action.php
+++ b/lib/plugins/styling/action.php
@@ -46,7 +46,7 @@ class action_plugin_styling extends ActionPlugin
$event->data['link'][$i]['rel'] == 'stylesheet' &&
strpos($event->data['link'][$i]['href'], 'lib/exe/css.php') !== false
) {
- $event->data['link'][$i]['href'] .= '&preview=1&tseed='.time();
+ $event->data['link'][$i]['href'] .= '&preview=1&tseed=' . time();
}
}
}
diff --git a/lib/plugins/styling/admin.php b/lib/plugins/styling/admin.php
index 982fe9a7e..22efa84b5 100644
--- a/lib/plugins/styling/admin.php
+++ b/lib/plugins/styling/admin.php
@@ -1,6 +1,8 @@
<?php
+
use dokuwiki\Extension\AdminPlugin;
use dokuwiki\StyleUtils;
+
/**
* DokuWiki Plugin styling (Admin Component)
*
@@ -37,7 +39,7 @@ class admin_plugin_styling extends AdminPlugin
$run = $INPUT->extract('run')->str('run');
if (!$run) return;
if (!checkSecurityToken()) return;
- $run = 'run'.ucfirst($run);
+ $run = 'run' . ucfirst($run);
$this->$run();
}
@@ -49,8 +51,8 @@ class admin_plugin_styling extends AdminPlugin
$class = 'nopopup';
if ($this->ispopup) $class = 'ispopup page';
- echo '<div id="plugin__styling" class="'.$class.'">';
- echo '<h1>'.$this->getLang('menu').'</h1>';
+ echo '<div id="plugin__styling" class="' . $class . '">';
+ echo '<h1>' . $this->getLang('menu') . '</h1>';
$this->form();
echo '</div>';
}
@@ -64,21 +66,21 @@ class admin_plugin_styling extends AdminPlugin
global $ID;
$styleUtil = new StyleUtils($conf['template'], true, true);
- $styleini = $styleUtil->cssStyleini();
+ $styleini = $styleUtil->cssStyleini();
$replacements = $styleini['replacements'];
if ($this->ispopup) {
- $target = DOKU_BASE.'lib/plugins/styling/popup.php';
+ $target = DOKU_BASE . 'lib/plugins/styling/popup.php';
} else {
$target = wl($ID, ['do' => 'admin', 'page' => 'styling']);
}
if (empty($replacements)) {
- echo '<p class="error">'.$this->getLang('error').'</p>';
+ echo '<p class="error">' . $this->getLang('error') . '</p>';
} else {
echo $this->locale_xhtml('intro');
- echo '<form class="styling" method="post" action="'.$target.'">';
+ echo '<form class="styling" method="post" action="' . $target . '">';
formSecurityToken();
echo '<table><tbody>';
@@ -88,27 +90,28 @@ class admin_plugin_styling extends AdminPlugin
if (empty($name)) $name = $key;
echo '<tr>';
- echo '<td><label for="tpl__'.hsc($key).'">'.$name.'</label></td>';
- echo '<td><input type="'.$this->colorType($value).'" name="tpl['.hsc($key).']" id="tpl__'.hsc($key).'"
- value="'.hsc($this->colorValue($value)).'" dir="ltr" required="required"/></td>';
+ echo '<td><label for="tpl__' . hsc($key) . '">' . $name . '</label></td>';
+ echo '<td><input type="' . $this->colorType($value) . '" name="tpl[' . hsc($key) . ']" ' .
+ 'id="tpl__' . hsc($key) . '" value="' . hsc($this->colorValue($value)) . '" ' .
+ 'dir="ltr" required="required"/></td>';
echo '</tr>';
}
echo '</tbody></table>';
echo '<p>';
- echo '<button type="submit" name="run[preview]" class="btn_preview primary">'.
- $this->getLang('btn_preview').'</button> ';
+ echo '<button type="submit" name="run[preview]" class="btn_preview primary">' .
+ $this->getLang('btn_preview') . '</button> ';
#FIXME only if preview.ini exists:
- echo '<button type="submit" name="run[reset]">'.$this->getLang('btn_reset').'</button>';
+ echo '<button type="submit" name="run[reset]">' . $this->getLang('btn_reset') . '</button>';
echo '</p>';
echo '<p>';
- echo '<button type="submit" name="run[save]" class="primary">'.$this->getLang('btn_save').'</button>';
+ echo '<button type="submit" name="run[save]" class="primary">' . $this->getLang('btn_save') . '</button>';
echo '</p>';
echo '<p>';
#FIXME only if local.ini exists:
- echo '<button type="submit" name="run[revert]">'.$this->getLang('btn_revert').'</button>';
+ echo '<button type="submit" name="run[revert]">' . $this->getLang('btn_revert') . '</button>';
echo '</p>';
echo '</form>';
@@ -152,7 +155,7 @@ class admin_plugin_styling extends AdminPlugin
public function runPreview()
{
global $conf;
- $ini = $conf['cachedir'].'/preview.ini';
+ $ini = $conf['cachedir'] . '/preview.ini';
io_saveFile($ini, $this->makeini());
}
@@ -162,7 +165,7 @@ class admin_plugin_styling extends AdminPlugin
protected function runReset()
{
global $conf;
- $ini = $conf['cachedir'].'/preview.ini';
+ $ini = $conf['cachedir'] . '/preview.ini';
io_saveFile($ini, '');
}
@@ -197,7 +200,7 @@ class admin_plugin_styling extends AdminPlugin
$ini .= ";These overwrites have been generated from the Template styling Admin interface\n";
$ini .= ";Any values in this section will be overwritten by that tool again\n";
foreach ($INPUT->arr('tpl') as $key => $val) {
- $ini .= $key.' = "'.addslashes($val).'"'."\n";
+ $ini .= $key . ' = "' . addslashes($val) . '"' . "\n";
}
return $ini;
@@ -211,7 +214,7 @@ class admin_plugin_styling extends AdminPlugin
protected function replaceIni($new)
{
global $conf;
- $ini = DOKU_CONF."tpl/".$conf['template']."/style.ini";
+ $ini = DOKU_CONF . "tpl/" . $conf['template'] . "/style.ini";
if (file_exists($ini)) {
$old = io_readFile($ini);
$old = preg_replace('/\[replacements\]\n.*?(\n\[.*]|$)/s', '\\1', $old);