summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Eckelmann <deckelmann@gmail.com>2012-11-29 16:06:43 +0100
committerDominik Eckelmann <deckelmann@gmail.com>2012-11-29 16:06:43 +0100
commit38479cbba628ee76a92ff5f3c974cfa8e6ce9e61 (patch)
tree710a0bca9a6f0704903f295bf6237807685d53fa
parent818f6d5179dd55f43e04269bc03e0afd5459c27e (diff)
downloadrpg-38479cbba628ee76a92ff5f3c974cfa8e6ce9e61.tar.gz
rpg-38479cbba628ee76a92ff5f3c974cfa8e6ce9e61.tar.bz2
some coding style improvements
- removed some dead/unused code - fixed phpdoc - added typing on methods
-rw-r--r--lib/plugins/acl/admin.php7
-rw-r--r--lib/plugins/config/settings/config.class.php7
-rw-r--r--lib/plugins/info/syntax.php20
-rw-r--r--lib/plugins/plugin/admin.php22
-rw-r--r--lib/plugins/plugin/classes/ap_download.class.php4
-rw-r--r--lib/plugins/plugin/classes/ap_manage.class.php6
-rw-r--r--lib/plugins/plugin/classes/ap_update.class.php2
-rw-r--r--lib/plugins/popularity/action.php6
-rw-r--r--lib/plugins/popularity/admin.php8
-rw-r--r--lib/plugins/popularity/helper.php10
-rw-r--r--lib/plugins/revert/admin.php2
-rw-r--r--lib/plugins/syntax.php14
-rw-r--r--lib/plugins/usermanager/admin.php5
13 files changed, 37 insertions, 76 deletions
diff --git a/lib/plugins/acl/admin.php b/lib/plugins/acl/admin.php
index 1197892f2..0d9cd742a 100644
--- a/lib/plugins/acl/admin.php
+++ b/lib/plugins/acl/admin.php
@@ -173,8 +173,6 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
* @author Andreas Gohr <andi@splitbrain.org>
*/
function html() {
- global $ID;
-
echo '<div id="acl_manager">'.NL;
echo '<h1>'.$this->getLang('admin_acl').'</h1>'.NL;
echo '<div class="level1">'.NL;
@@ -208,7 +206,6 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
* @author Andreas Gohr <andi@splitbrain.org>
*/
function _get_opts($addopts=null){
- global $ID;
$opts = array(
'do'=>'admin',
'page'=>'acl',
@@ -230,7 +227,6 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
global $ID;
global $lang;
- $dir = $conf['datadir'];
$ns = $this->ns;
if(empty($ns)){
$ns = dirname(str_replace(':','/',$ID));
@@ -326,7 +322,6 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
* @author Andreas Gohr <andi@splitbrain.org>
*/
function _html_detail(){
- global $conf;
global $ID;
echo '<form action="'.wl().'" method="post" accept-charset="utf-8"><div class="no">'.NL;
@@ -493,7 +488,6 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
* @author Andreas Gohr <andi@splitbrain.org>
*/
function _html_list_acl($item){
- global $ID;
$ret = '';
// what to display
if($item['label']){
@@ -764,7 +758,6 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
* @author Andreas Gohr <andi@splitbrain.org>
*/
function _html_select(){
- global $conf;
$inlist = false;
if($this->who &&
diff --git a/lib/plugins/config/settings/config.class.php b/lib/plugins/config/settings/config.class.php
index 8c48018d7..a30a0605b 100644
--- a/lib/plugins/config/settings/config.class.php
+++ b/lib/plugins/config/settings/config.class.php
@@ -369,7 +369,7 @@ if (!class_exists('setting')) {
* update setting with user provided value $input
* if value fails error check, save it
*
- * @return true if changed, false otherwise (incl. on error)
+ * @return boolean true if changed, false otherwise (incl. on error)
*/
function update($input) {
if (is_null($input)) return false;
@@ -426,7 +426,6 @@ if (!class_exists('setting')) {
if ($fmt=='php') {
// translation string needs to be improved FIXME
- $tr = array("\n"=>'\n', "\r"=>'\r', "\t"=>'\t', "\\" => '\\\\', "'" => '\\\'');
$tr = array("\\" => '\\\\', "'" => '\\\'');
$out = '$'.$var."['".$this->_out_key()."'] = '".strtr($this->_local, $tr)."';\n";
@@ -538,7 +537,7 @@ if (!class_exists('setting_email')) {
* update setting with user provided value $input
* if value fails error check, save it
*
- * @return true if changed, false otherwise (incl. on error)
+ * @return boolean true if changed, false otherwise (incl. on error)
*/
function update($input) {
if (is_null($input)) return false;
@@ -574,7 +573,7 @@ if (!class_exists('setting_richemail')) {
* update setting with user provided value $input
* if value fails error check, save it
*
- * @return true if changed, false otherwise (incl. on error)
+ * @return boolean true if changed, false otherwise (incl. on error)
*/
function update($input) {
if (is_null($input)) return false;
diff --git a/lib/plugins/info/syntax.php b/lib/plugins/info/syntax.php
index 9aedbf0aa..d813aa23a 100644
--- a/lib/plugins/info/syntax.php
+++ b/lib/plugins/info/syntax.php
@@ -16,20 +16,6 @@ if(!defined('DOKU_INC')) die();
class syntax_plugin_info extends DokuWiki_Syntax_Plugin {
/**
- * return some info
- */
- function getInfo(){
- return array(
- 'author' => 'Andreas Gohr',
- 'email' => 'andi@splitbrain.org',
- 'date' => '2008-09-12',
- 'name' => 'Info Plugin',
- 'desc' => 'Displays information about various DokuWiki internals',
- 'url' => 'http://dokuwiki.org/plugin:info',
- );
- }
-
- /**
* What kind of syntax are we?
*/
function getType(){
@@ -114,7 +100,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin {
*
* uses some of the original renderer methods
*/
- function _plugins_xhtml($type, &$renderer){
+ function _plugins_xhtml($type, Doku_Renderer &$renderer){
global $lang;
$renderer->doc .= '<ul>';
@@ -152,7 +138,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin {
*
* uses some of the original renderer methods
*/
- function _helpermethods_xhtml(&$renderer){
+ function _helpermethods_xhtml(Doku_Renderer &$renderer){
global $lang;
$plugins = plugin_list('helper');
@@ -237,7 +223,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin {
/**
* Adds a TOC item
*/
- function _addToTOC($text, $level, &$renderer){
+ function _addToTOC($text, $level, Doku_Renderer_xhtml &$renderer){
global $conf;
if (($level >= $conf['toptoclevel']) && ($level <= $conf['maxtoclevel'])){
diff --git a/lib/plugins/plugin/admin.php b/lib/plugins/plugin/admin.php
index b2108f185..8b1ee3c7d 100644
--- a/lib/plugins/plugin/admin.php
+++ b/lib/plugins/plugin/admin.php
@@ -33,6 +33,10 @@ class admin_plugin_plugin extends DokuWiki_Admin_Plugin {
var $disabled = 0;
var $plugin = '';
var $cmd = '';
+
+ /**
+ * @var ap_manage
+ */
var $handler = NULL;
var $functions = array('delete','update',/*'settings',*/'info'); // require a plugin name
@@ -43,28 +47,10 @@ class admin_plugin_plugin extends DokuWiki_Admin_Plugin {
var $error = '';
function admin_plugin_plugin() {
- global $conf;
$this->disabled = plugin_isdisabled('plugin');
}
/**
- * return some info
- */
- function getInfo(){
- $disabled = ($this->disabled) ? '(disabled)' : '';
-
- return array(
- 'author' => 'Christopher Smith',
- 'email' => 'chris@jalakai.co.uk',
- 'date' => '2009-11-11',
- 'name' => 'Plugin Manager',
- 'desc' => "Manage Plugins, including automated plugin installer $disabled",
- 'url' => 'http://www.dokuwiki.org/plugin:plugin',
- );
- }
-
-
- /**
* return sort order for position in admin menu
*/
function getMenuSort() {
diff --git a/lib/plugins/plugin/classes/ap_download.class.php b/lib/plugins/plugin/classes/ap_download.class.php
index 0eb567c80..3cc455867 100644
--- a/lib/plugins/plugin/classes/ap_download.class.php
+++ b/lib/plugins/plugin/classes/ap_download.class.php
@@ -7,7 +7,6 @@ class ap_download extends ap_manage {
* Initiate the plugin download
*/
function process() {
- global $lang;
global $INPUT;
$plugin_url = $INPUT->str('url');
@@ -45,7 +44,6 @@ class ap_download extends ap_manage {
* Process the downloaded file
*/
function download($url, $overwrite=false) {
- global $lang;
// check the url
$matches = array();
if (!preg_match("/[^\/]*$/", $url, $matches) || !$matches[0]) {
@@ -241,7 +239,7 @@ class ap_download extends ap_manage {
* if neither bz, gz or zip are recognized, tar is assumed.
*
* @author Andreas Gohr <andi@splitbrain.org>
- * @returns false if the file can't be read, otherwise an "extension"
+ * @returns boolean|string false if the file can't be read, otherwise an "extension"
*/
function guess_archive($file){
$fh = fopen($file,'rb');
diff --git a/lib/plugins/plugin/classes/ap_manage.class.php b/lib/plugins/plugin/classes/ap_manage.class.php
index 28579cbe9..3ec740dae 100644
--- a/lib/plugins/plugin/classes/ap_manage.class.php
+++ b/lib/plugins/plugin/classes/ap_manage.class.php
@@ -69,7 +69,6 @@ class ap_manage {
}
function html_pluginlist() {
- global $ID;
global $plugin_protected;
foreach ($this->manager->plugin_list as $plugin) {
@@ -195,11 +194,8 @@ class ap_manage {
closedir($dh);
return @rmdir($path);
- } else {
- return @unlink($path);
}
-
- return false;
+ return @unlink($path);
}
diff --git a/lib/plugins/plugin/classes/ap_update.class.php b/lib/plugins/plugin/classes/ap_update.class.php
index c43429a1b..5d7f6cb08 100644
--- a/lib/plugins/plugin/classes/ap_update.class.php
+++ b/lib/plugins/plugin/classes/ap_update.class.php
@@ -5,8 +5,6 @@ class ap_update extends ap_download {
var $overwrite = true;
function process() {
- global $lang;
-
$plugin_url = $this->plugin_readlog($this->plugin, 'url');
$this->download($plugin_url, $this->overwrite);
return '';
diff --git a/lib/plugins/popularity/action.php b/lib/plugins/popularity/action.php
index 1c7a2f65d..f0cbb771b 100644
--- a/lib/plugins/popularity/action.php
+++ b/lib/plugins/popularity/action.php
@@ -9,6 +9,10 @@ require_once(DOKU_PLUGIN.'action.php');
require_once(DOKU_PLUGIN.'popularity/admin.php');
class action_plugin_popularity extends Dokuwiki_Action_Plugin {
+
+ /**
+ * @var helper_plugin_popularity
+ */
var $helper;
function action_plugin_popularity(){
@@ -22,7 +26,7 @@ class action_plugin_popularity extends Dokuwiki_Action_Plugin {
$controller->register_hook('INDEXER_TASKS_RUN', 'AFTER', $this, '_autosubmit', array());
}
- function _autosubmit(&$event, $param){
+ function _autosubmit(Doku_Event &$event, $param){
//Do we have to send the data now
if ( !$this->helper->isAutosubmitEnabled() || $this->_isTooEarlyToSubmit() ){
return;
diff --git a/lib/plugins/popularity/admin.php b/lib/plugins/popularity/admin.php
index 474a09ef9..deb8048f4 100644
--- a/lib/plugins/popularity/admin.php
+++ b/lib/plugins/popularity/admin.php
@@ -14,6 +14,10 @@ if(!defined('DOKU_INC')) die();
*/
class admin_plugin_popularity extends DokuWiki_Admin_Plugin {
var $version;
+
+ /**
+ * @var helper_plugin_popularity
+ */
var $helper;
var $sentStatus = null;
@@ -118,9 +122,9 @@ class admin_plugin_popularity extends DokuWiki_Admin_Plugin {
/**
* Build the form which presents the data to be sent
- * @param string $submit How is the data supposed to be sent? (may be: 'browser' or 'server')
+ * @param string $submissionMode How is the data supposed to be sent? (may be: 'browser' or 'server')
* @param string $data The popularity data, if it has already been computed. NULL otherwise.
- * @return The form, as an html string
+ * @return string The form, as an html string
*/
function buildForm($submissionMode, $data = null){
$url = ($submissionMode === 'browser' ? $this->helper->submitUrl : script());
diff --git a/lib/plugins/popularity/helper.php b/lib/plugins/popularity/helper.php
index 34521021d..5bbeddba0 100644
--- a/lib/plugins/popularity/helper.php
+++ b/lib/plugins/popularity/helper.php
@@ -29,6 +29,8 @@ class helper_plugin_popularity extends Dokuwiki_Plugin {
*/
var $popularityLastSubmitFile;
+ var $version;
+
function helper_plugin_popularity(){
global $conf;
@@ -69,7 +71,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin {
/**
* Check if autosubmit is enabled
- * @return TRUE if we should send data once a month, FALSE otherwise
+ * @return boolean TRUE if we should send data once a month, FALSE otherwise
*/
function isAutoSubmitEnabled(){
return @file_exists($this->autosubmitFile);
@@ -78,7 +80,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin {
/**
* Send the data, to the submit url
* @param string $data The popularity data
- * @return An empty string if everything worked fine, a string describing the error otherwise
+ * @return string An empty string if everything worked fine, a string describing the error otherwise
*/
function sendData($data){
$error = '';
@@ -102,7 +104,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin {
/**
* Gather all information
- * @return The popularity data as a string
+ * @return string The popularity data as a string
*/
function gatherAsString(){
$data = $this->_gather();
@@ -119,7 +121,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin {
/**
* Gather all information
- * @return The popularity data as an array
+ * @return array The popularity data as an array
*/
function _gather(){
global $conf;
diff --git a/lib/plugins/revert/admin.php b/lib/plugins/revert/admin.php
index 958cf5acf..fcdaa230d 100644
--- a/lib/plugins/revert/admin.php
+++ b/lib/plugins/revert/admin.php
@@ -73,8 +73,6 @@ class admin_plugin_revert extends DokuWiki_Admin_Plugin {
* Start the reversion process
*/
function _revert($revert,$filter){
- global $conf;
-
echo '<hr /><br />';
echo '<p>'.$this->getLang('revstart').'</p>';
diff --git a/lib/plugins/syntax.php b/lib/plugins/syntax.php
index 8b94493e4..552cc747a 100644
--- a/lib/plugins/syntax.php
+++ b/lib/plugins/syntax.php
@@ -84,13 +84,13 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode {
*
* Usually you should only need the $match param.
*
- * @param $match string The text matched by the patterns
- * @param $state int The lexer state for the match
- * @param $pos int The character position of the matched text
- * @param $handler Doku_Handler Reference to the Doku_Handler object
- * @return array Return an array with all data you want to use in render
+ * @param string $match The text matched by the patterns
+ * @param int $state The lexer state for the match
+ * @param int $pos The character position of the matched text
+ * @param Doku_Handler $handler Reference to the Doku_Handler object
+ * @return array Return an array with all data you want to use in render
*/
- function handle($match, $state, $pos, &$handler){
+ function handle($match, $state, $pos, Doku_Handler &$handler){
trigger_error('handle() not implemented in '.get_class($this), E_USER_WARNING);
}
@@ -117,7 +117,7 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode {
* @param $data array data created by handler()
* @return boolean rendered correctly?
*/
- function render($format, &$renderer, $data) {
+ function render($format, Doku_Renderer &$renderer, $data) {
trigger_error('render() not implemented in '.get_class($this), E_USER_WARNING);
}
diff --git a/lib/plugins/usermanager/admin.php b/lib/plugins/usermanager/admin.php
index 30b65debb..cf8963e64 100644
--- a/lib/plugins/usermanager/admin.php
+++ b/lib/plugins/usermanager/admin.php
@@ -73,8 +73,6 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
* handle user request
*/
function handle() {
- global $ID;
-
if (is_null($this->_auth)) return false;
// extract the command and any specific parameters
@@ -308,7 +306,6 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
function _htmlInputField($id, $name, $label, $value, $cando, $indent=0) {
$class = $cando ? '' : ' class="disabled"';
- $disabled = $cando ? '' : ' disabled="disabled"';
echo str_pad('',$indent);
if($name == 'userpass'){
@@ -549,7 +546,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
/**
* retrieve & clean user data from the form
*
- * @return array(user, password, full name, email, array(groups))
+ * @return array (user, password, full name, email, array(groups))
*/
function _retrieveUser($clean=true) {
global $auth;