Skip to content

Commit

Permalink
Moved replacement of security warning shortcut into own helper function.
Browse files Browse the repository at this point in the history
  • Loading branch information
lpaulsen93 committed May 21, 2015
1 parent 4738218 commit 8869615
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
17 changes: 14 additions & 3 deletions helper/repository.php
Expand Up @@ -390,9 +390,7 @@ public function getFilteredPlugins(
$plugins[$i]['compatible'] = $this->cleanCompat($plugins[$i]['compatible']);
$plugins[$i]['types'] = $this->listtypes($plugins[$i]['type']);

if(in_array($plugins[$i]['securitywarning'],$this->securitywarning)){
$plugins[$i]['securitywarning'] = $this->getLang('security_'.$plugins[$i]['securitywarning']);
}
$plugins[$i]['securitywarning'] = $this->replaceSecurityWarningShortcut ($plugins[$i]['securitywarning']);

ksort($plugins[$i]);
}
Expand Down Expand Up @@ -749,5 +747,18 @@ private function _initPluginDB($db) {
bestcompatible varchar(50) default NULL, popularity int default 0);'
);
}

/**
* Return security warning with replaced shortcut, if any.
* If not, return original warning.
*
* @param $warning Original warning content
*/
public function replaceSecurityWarningShortcut($warning) {
if(in_array($warning,$this->securitywarning)){
return $this->getLang('security_'.$warning);
}
return hsc($warning);
}
}

2 changes: 1 addition & 1 deletion plugin.info.txt
@@ -1,7 +1,7 @@
base pluginrepo
author Andreas Gohr/Håkan Sandell
email sandell.hakan@gmail.com
date 2015-05-19
date 2015-05-21
name Repository plugin
desc Helps organizing the plugin repository
url http://www.dokuwiki.org/plugin:pluginrepo
6 changes: 1 addition & 5 deletions syntax/entry.php
Expand Up @@ -272,11 +272,7 @@ function _showWarnings(&$R, $data, $hasUnderscoreIssue) {
$R->doc .= '<div class="notify">'.NL;
$securitylink = $R->internallink('devel:security',$this->getLang('securitylink'),NULL,true);
$R->doc .= '<p><strong>'.sprintf($this->getLang('securitywarning'),$securitylink).'</strong> ';
if(in_array($data['securitywarning'],$this->hlp->securitywarning)){
$R->doc .= $this->getLang('security_'.$data['securitywarning']);
}else{
$R->doc .= hsc($data['securitywarning']);
}
$R->doc .= $this->hlp->replaceSecurityWarningShortcut($data['securitywarning']);
$R->doc .= '</p>'.NL.'</div>'.NL;
}

Expand Down

0 comments on commit 8869615

Please sign in to comment.