diff options
author | Andreas Gohr <andi@splitbrain.org> | 2018-04-27 20:55:43 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2018-04-27 20:55:43 +0200 |
commit | 3dc2d50c5fda9c4bf708ff4c26e266ba239af62c (patch) | |
tree | 8bbbe59ba1721b4cfc2352833a3ac4385fba078c /lib/plugins | |
parent | aba86f383f2a5af0340d1bc69cf4f6853b03bf77 (diff) | |
download | dokuwiki-3dc2d50c5fda9c4bf708ff4c26e266ba239af62c.tar.gz dokuwiki-3dc2d50c5fda9c4bf708ff4c26e266ba239af62c.zip |
visibility declarations in plugins
Diffstat (limited to 'lib/plugins')
-rw-r--r-- | lib/plugins/acl/admin.php | 65 | ||||
-rw-r--r-- | lib/plugins/authldap/auth.php | 5 | ||||
-rw-r--r-- | lib/plugins/config/settings/config.class.php | 123 | ||||
-rw-r--r-- | lib/plugins/config/settings/extra.class.php | 28 | ||||
-rw-r--r-- | lib/plugins/extension/helper/list.php | 42 | ||||
-rw-r--r-- | lib/plugins/info/syntax.php | 20 | ||||
-rw-r--r-- | lib/plugins/popularity/action.php | 16 | ||||
-rw-r--r-- | lib/plugins/popularity/admin.php | 22 | ||||
-rw-r--r-- | lib/plugins/popularity/helper.php | 64 | ||||
-rw-r--r-- | lib/plugins/revert/admin.php | 22 | ||||
-rw-r--r-- | lib/plugins/testing/action.php | 5 |
11 files changed, 199 insertions, 213 deletions
diff --git a/lib/plugins/acl/admin.php b/lib/plugins/acl/admin.php index 39bd37efb..a7c637a67 100644 --- a/lib/plugins/acl/admin.php +++ b/lib/plugins/acl/admin.php @@ -13,8 +13,8 @@ * need to inherit from this class */ class admin_plugin_acl extends DokuWiki_Admin_Plugin { - var $acl = null; - var $ns = null; + public $acl = null; + protected $ns = null; /** * The currently selected item, associative array with id and type. * Populated from (in this order): @@ -23,22 +23,22 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { * $ns * $ID */ - var $current_item = null; - var $who = ''; - var $usersgroups = array(); - var $specials = array(); + protected $current_item = null; + protected $who = ''; + protected $usersgroups = array(); + protected $specials = array(); /** * return prompt for admin menu */ - function getMenuText($language) { + public function getMenuText($language) { return $this->getLang('admin_acl'); } /** * return sort order for position in admin menu */ - function getMenuSort() { + public function getMenuSort() { return 1; } @@ -49,7 +49,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { * * @author Andreas Gohr <andi@splitbrain.org> */ - function handle() { + public function handle() { global $AUTH_ACL; global $ID; global $auth; @@ -169,7 +169,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { * @author Frank Schubert <frank@schokilade.de> * @author Andreas Gohr <andi@splitbrain.org> */ - function html() { + public function html() { echo '<div id="acl_manager">'.NL; echo '<h1>'.$this->getLang('admin_acl').'</h1>'.NL; echo '<div class="level1">'.NL; @@ -202,7 +202,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { * * @author Andreas Gohr <andi@splitbrain.org> */ - function _get_opts($addopts=null){ + protected function _get_opts($addopts=null){ $opts = array( 'do'=>'admin', 'page'=>'acl', @@ -219,7 +219,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { * * @author Andreas Gohr <andi@splitbrain.org> */ - function _html_explorer(){ + protected function _html_explorer(){ global $conf; global $ID; global $lang; @@ -249,9 +249,10 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { * get a combined list of media and page files * * @param string $folder an already converted filesystem folder of the current namespace - * @param string $limit limit the search to this folder + * @param string $limit limit the search to this folder + * @return array */ - function _get_tree($folder,$limit=''){ + protected function _get_tree($folder,$limit=''){ global $conf; // read tree structure from pages and media @@ -279,7 +280,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { * * Sorts the combined trees of media and page files */ - function _tree_sort($a,$b){ + public function _tree_sort($a,$b){ // handle the trivial cases first if ($a['id'] == '') return -1; if ($b['id'] == '') return 1; @@ -313,6 +314,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { // before that other part. if (empty($a_ids)) return ($a['type'] == 'd') ? -1 : 1; if (empty($b_ids)) return ($b['type'] == 'd') ? 1 : -1; + return 0; //shouldn't happen } /** @@ -321,7 +323,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { * * @author Andreas Gohr <andi@splitbrain.org> */ - function _html_detail(){ + protected function _html_detail(){ global $ID; echo '<form action="'.wl().'" method="post" accept-charset="utf-8"><div class="no">'.NL; @@ -348,7 +350,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { /** * Print info and editor */ - function _html_info(){ + protected function _html_info(){ global $ID; if($this->who){ @@ -376,7 +378,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { * * @author Andreas Gohr <andi@splitbrain.org> */ - function _html_acleditor($current){ + protected function _html_acleditor($current){ global $lang; echo '<fieldset>'; @@ -403,7 +405,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { * * @author Andreas Gohr <andi@splitbrain.org> */ - function _html_explain($current){ + protected function _html_explain($current){ global $ID; global $auth; @@ -486,7 +488,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { * * @author Andreas Gohr <andi@splitbrain.org> */ - function _html_list_acl($item){ + protected function _html_list_acl($item){ $ret = ''; // what to display if(!empty($item['label'])){ @@ -528,8 +530,13 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { return $ret; } - - function _html_li_acl($item){ + /** + * List Item formatter + * + * @param array $item + * @return string + */ + public function _html_li_acl($item){ return '<li class="level' . $item['level'] . ' ' . ($item['open'] ? 'open' : 'closed') . '">'; } @@ -540,7 +547,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { * * @author Andreas Gohr <andi@splitbrain.org> */ - function _init_acl_config(){ + public function _init_acl_config(){ global $AUTH_ACL; global $conf; $acl_config=array(); @@ -587,7 +594,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { * * @author Andreas Gohr <andi@splitbrain.org> */ - function _html_table(){ + protected function _html_table(){ global $lang; global $ID; @@ -657,7 +664,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { * * @author Andreas Gohr <andi@splitbrain.org> */ - function _get_exact_perm(){ + protected function _get_exact_perm(){ global $ID; if($this->ns){ if($this->ns == '*'){ @@ -681,7 +688,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { * * @author Frank Schubert <frank@schokilade.de> */ - function _acl_add($acl_scope, $acl_user, $acl_level){ + public function _acl_add($acl_scope, $acl_user, $acl_level){ global $config_cascade; $acl_user = auth_nameencode($acl_user,true); @@ -700,7 +707,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { * * @author Frank Schubert <frank@schokilade.de> */ - function _acl_del($acl_scope, $acl_user){ + public function _acl_del($acl_scope, $acl_user){ global $config_cascade; $acl_user = auth_nameencode($acl_user,true); @@ -715,7 +722,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { * @author Frank Schubert <frank@schokilade.de> * @author Andreas Gohr <andi@splitbrain.org> */ - function _html_checkboxes($setperm,$ispage,$name){ + protected function _html_checkboxes($setperm,$ispage,$name){ global $lang; static $label = 0; //number labels @@ -754,7 +761,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { * * @author Andreas Gohr <andi@splitbrain.org> */ - function _html_select(){ + protected function _html_select(){ $inlist = false; $usel = ''; $gsel = ''; diff --git a/lib/plugins/authldap/auth.php b/lib/plugins/authldap/auth.php index 3a8dcee64..0f19553a8 100644 --- a/lib/plugins/authldap/auth.php +++ b/lib/plugins/authldap/auth.php @@ -309,8 +309,7 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin { * @param array $changes array of field/value pairs to be changed (password will be clear text) * @return bool true on success, false on error */ - - function modifyUser($user,$changes){ + public function modifyUser($user,$changes){ // open the connection to the ldap if(!$this->_openLDAP()){ @@ -384,7 +383,7 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin { * @param array $filter array of field/pattern pairs, null for no filter * @return array of userinfo (refer getUserData for internal userinfo details) */ - function retrieveUsers($start = 0, $limit = 0, $filter = array()) { + public function retrieveUsers($start = 0, $limit = 0, $filter = array()) { if(!$this->_openLDAP()) return false; if(is_null($this->users)) { diff --git a/lib/plugins/config/settings/config.class.php b/lib/plugins/config/settings/config.class.php index 2be631828..0d39eb2c5 100644 --- a/lib/plugins/config/settings/config.class.php +++ b/lib/plugins/config/settings/config.class.php @@ -15,22 +15,22 @@ if (!class_exists('configuration')) { */ class configuration { - var $_name = 'conf'; // name of the config variable found in the files (overridden by $config['varname']) - var $_format = 'php'; // format of the config file, supported formats - php (overridden by $config['format']) - var $_heading = ''; // heading string written at top of config file - don't include comment indicators - var $_loaded = false; // set to true after configuration files are loaded - var $_metadata = array();// holds metadata describing the settings + protected $_name = 'conf'; // name of the config variable found in the files (overridden by $config['varname']) + protected $_format = 'php'; // format of the config file, supported formats - php (overridden by $config['format']) + protected $_heading = ''; // heading string written at top of config file - don't include comment indicators + protected $_loaded = false; // set to true after configuration files are loaded + protected $_metadata = array();// holds metadata describing the settings /** @var setting[] */ - var $setting = array(); // array of setting objects - var $locked = false; // configuration is considered locked if it can't be updated - var $show_disabled_plugins = false; + public $setting = array(); // array of setting objects + public $locked = false; // configuration is considered locked if it can't be updated + public $show_disabled_plugins = false; // configuration filenames - var $_default_files = array(); - var $_local_files = array(); // updated configuration is written to the first file - var $_protected_files = array(); + protected $_default_files = array(); + protected $_local_files = array(); // updated configuration is written to the first file + protected $_protected_files = array(); - var $_plugin_list = null; + protected $_plugin_list = null; /** * constructor @@ -45,6 +45,7 @@ if (!class_exists('configuration')) { return; } $meta = array(); + /** @var array $config gets loaded via include here */ include($datafile); if (isset($config['varname'])) $this->_name = $config['varname']; @@ -196,7 +197,7 @@ if (!class_exists('configuration')) { * @param string $file file path * @return array config settings */ - function _read_config($file) { + protected function _read_config($file) { if (!$file) return array(); @@ -353,7 +354,7 @@ if (!class_exists('configuration')) { * @return array plugin names * @triggers PLUGIN_CONFIG_PLUGINLIST event */ - function get_plugin_list() { + protected function get_plugin_list() { if (is_null($this->_plugin_list)) { $list = plugin_list('',$this->show_disabled_plugins); @@ -374,7 +375,7 @@ if (!class_exists('configuration')) { * @param string $tpl name of active template * @return array metadata of settings */ - function get_plugintpl_metadata($tpl){ + protected function get_plugintpl_metadata($tpl){ $file = '/conf/metadata.php'; $class = '/conf/settings.class.php'; $metadata = array(); @@ -418,7 +419,7 @@ if (!class_exists('configuration')) { * @param string $tpl name of active template * @return array default settings */ - function get_plugintpl_default($tpl){ + protected function get_plugintpl_default($tpl){ $file = '/conf/default.php'; $default = array(); @@ -452,17 +453,17 @@ if (!class_exists('setting')) { */ class setting { - var $_key = ''; - var $_default = null; - var $_local = null; - var $_protected = null; + protected $_key = ''; + protected $_default = null; + protected $_local = null; + protected $_protected = null; - var $_pattern = ''; - var $_error = false; // only used by those classes which error check - var $_input = null; // only used by those classes which error check - var $_caution = null; // used by any setting to provide an alert along with the setting - // valid alerts, 'warning', 'danger', 'security' - // images matching the alerts are in the plugin's images directory + protected $_pattern = ''; + protected $_error = false; // only used by those classes which error check + protected $_input = null; // only used by those classes which error check + protected $_caution = null; // used by any setting to provide an alert along with the setting + // valid alerts, 'warning', 'danger', 'security' + // images matching the alerts are in the plugin's images directory static protected $_validCautions = array('warning','danger','security'); @@ -693,7 +694,7 @@ if (!class_exists('setting_array')) { * @param string $input * @return bool true if changed, false otherwise (incl. on error) */ - function update($input) { + public function update($input) { if (is_null($input)) return false; if ($this->is_protected()) return false; @@ -732,7 +733,7 @@ if (!class_exists('setting_array')) { * @param string $fmt save format * @return string */ - function out($var, $fmt='php') { + public function out($var, $fmt='php') { if ($this->is_protected()) return ''; if (is_null($this->_local) || ($this->_default == $this->_local)) return ''; @@ -754,7 +755,7 @@ if (!class_exists('setting_array')) { * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting * @return string[] with content array(string $label_html, string $input_html) */ - function html(admin_plugin_config $plugin, $echo=false) { + public function html(admin_plugin_config $plugin, $echo=false) { $disable = ''; if ($this->is_protected()) { @@ -791,7 +792,7 @@ if (!class_exists('setting_string')) { * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting * @return string[] with content array(string $label_html, string $input_html) */ - function html(admin_plugin_config $plugin, $echo=false) { + public function html(admin_plugin_config $plugin, $echo=false) { $disable = ''; if ($this->is_protected()) { @@ -822,7 +823,7 @@ if (!class_exists('setting_password')) { */ class setting_password extends setting_string { - var $_code = 'plain'; // mechanism to be used to obscure passwords + protected $_code = 'plain'; // mechanism to be used to obscure passwords /** * update changed setting with user provided value $input @@ -832,7 +833,7 @@ if (!class_exists('setting_password')) { * @param mixed $input the new value * @return boolean true if changed, false otherwise (also on error) */ - function update($input) { + public function update($input) { if ($this->is_protected()) return false; if (!$input) return false; @@ -853,7 +854,7 @@ if (!class_exists('setting_password')) { * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting * @return string[] with content array(string $label_html, string $input_html) */ - function html(admin_plugin_config $plugin, $echo=false) { + public function html(admin_plugin_config $plugin, $echo=false) { $disable = $this->is_protected() ? 'disabled="disabled"' : ''; @@ -872,8 +873,8 @@ if (!class_exists('setting_email')) { * Class setting_email */ class setting_email extends setting_string { - var $_multiple = false; - var $_placeholders = false; + protected $_multiple = false; + protected $_placeholders = false; /** * update setting with user provided value $input @@ -882,7 +883,7 @@ if (!class_exists('setting_email')) { * @param mixed $input * @return boolean true if changed, false otherwise (incl. on error) */ - function update($input) { + public function update($input) { if (is_null($input)) return false; if ($this->is_protected()) return false; @@ -938,9 +939,9 @@ if (!class_exists('setting_numeric')) { // This allows for many PHP syntax errors... // var $_pattern = '/^[-+\/*0-9 ]*$/'; // much more restrictive, but should eliminate syntax errors. - var $_pattern = '/^[-+]? *[0-9]+ *(?:[-+*] *[0-9]+ *)*$/'; - var $_min = null; - var $_max = null; + protected $_pattern = '/^[-+]? *[0-9]+ *(?:[-+*] *[0-9]+ *)*$/'; + protected $_min = null; + protected $_max = null; /** * update changed setting with user provided value $input @@ -950,7 +951,7 @@ if (!class_exists('setting_numeric')) { * @param mixed $input the new value * @return boolean true if changed, false otherwise (also on error) */ - function update($input) { + public function update($input) { $local = $this->_local; $valid = parent::update($input); if ($valid && !(is_null($this->_min) && is_null($this->_max))) { @@ -973,7 +974,7 @@ if (!class_exists('setting_numeric')) { * @param string $fmt save format * @return string */ - function out($var, $fmt='php') { + public function out($var, $fmt='php') { if ($this->is_protected()) return ''; if (is_null($this->_local) || ($this->_default == $this->_local)) return ''; @@ -996,7 +997,7 @@ if (!class_exists('setting_numericopt')) { */ class setting_numericopt extends setting_numeric { // just allow an empty config - var $_pattern = '/^(|[-]?[0-9]+(?:[-+*][0-9]+)*)$/'; + protected $_pattern = '/^(|[-]?[0-9]+(?:[-+*][0-9]+)*)$/'; /** @@ -1006,7 +1007,7 @@ if (!class_exists('setting_numericopt')) { * * @return bool */ - function update($input) { + public function update($input) { if ($input === '') { return true; } @@ -1028,7 +1029,7 @@ if (!class_exists('setting_onoff')) { * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting * @return string[] with content array(string $label_html, string $input_html) */ - function html(admin_plugin_config $plugin, $echo = false) { + public function html(admin_plugin_config $plugin, $echo = false) { $disable = ''; if ($this->is_protected()) { @@ -1055,7 +1056,7 @@ if (!class_exists('setting_onoff')) { * @param mixed $input the new value * @return boolean true if changed, false otherwise (also on error) */ - function update($input) { + public function update($input) { if ($this->is_protected()) return false; $input = ($input) ? 1 : 0; @@ -1073,8 +1074,8 @@ if (!class_exists('setting_multichoice')) { * Class setting_multichoice */ class setting_multichoice extends setting_string { - var $_choices = array(); - var $lang; //some custom language strings are stored in setting + protected $_choices = array(); + public $lang; //some custom language strings are stored in setting /** * Build html for label and input of setting @@ -1083,7 +1084,7 @@ if (!class_exists('setting_multichoice')) { * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting * @return string[] with content array(string $label_html, string $input_html) */ - function html(admin_plugin_config $plugin, $echo = false) { + public function html(admin_plugin_config $plugin, $echo = false) { $disable = ''; $nochoice = ''; @@ -1136,7 +1137,7 @@ if (!class_exists('setting_multichoice')) { * @param mixed $input the new value * @return boolean true if changed, false otherwise (also on error) */ - function update($input) { + public function update($input) { if (is_null($input)) return false; if ($this->is_protected()) return false; @@ -1158,7 +1159,7 @@ if (!class_exists('setting_dirchoice')) { */ class setting_dirchoice extends setting_multichoice { - var $_dir = ''; + protected $_dir = ''; /** * Receives current values for the setting $key @@ -1167,7 +1168,7 @@ if (!class_exists('setting_dirchoice')) { * @param mixed $local local setting value * @param mixed $protected protected setting value */ - function initialize($default,$local,$protected) { + public function initialize($default,$local,$protected) { // populate $this->_choices with a list of directories $list = array(); @@ -1246,9 +1247,9 @@ if (!class_exists('setting_multicheckbox')) { */ class setting_multicheckbox extends setting_string { - var $_choices = array(); - var $_combine = array(); - var $_other = 'always'; + protected $_choices = array(); + protected $_combine = array(); + protected $_other = 'always'; /** * update changed setting with user provided value $input @@ -1258,7 +1259,7 @@ if (!class_exists('setting_multicheckbox')) { * @param mixed $input the new value * @return boolean true if changed, false otherwise (also on error) */ - function update($input) { + public function update($input) { if ($this->is_protected()) return false; // split any combined values + convert from array to comma separated string @@ -1285,7 +1286,7 @@ if (!class_exists('setting_multicheckbox')) { * @param bool $echo true: show input value, when error occurred, otherwise the stored setting * @return string[] with content array(string $label_html, string $input_html) */ - function html(admin_plugin_config $plugin, $echo=false) { + public function html(admin_plugin_config $plugin, $echo=false) { $disable = ''; @@ -1360,7 +1361,7 @@ if (!class_exists('setting_multicheckbox')) { * @param string $str * @return array */ - function _str2array($str) { + protected function _str2array($str) { $array = explode(',',$str); if (!empty($this->_combine)) { @@ -1386,7 +1387,7 @@ if (!class_exists('setting_multicheckbox')) { * @param array $input * @return string */ - function _array2str($input) { + protected function _array2str($input) { // handle other $other = trim($input['other']); @@ -1418,8 +1419,8 @@ if (!class_exists('setting_regex')){ */ class setting_regex extends setting_string { - var $_delimiter = '/'; // regex delimiter to be used in testing input - var $_pregflags = 'ui'; // regex pattern modifiers to be used in testing input + protected $_delimiter = '/'; // regex delimiter to be used in testing input + protected $_pregflags = 'ui'; // regex pattern modifiers to be used in testing input /** * update changed setting with user provided value $input @@ -1429,7 +1430,7 @@ if (!class_exists('setting_regex')){ * @param mixed $input the new value * @return boolean true if changed, false otherwise (incl. on error) */ - function update($input) { + public function update($input) { // let parent do basic checks, value, not changed, etc. $local = $this->_local; diff --git a/lib/plugins/config/settings/extra.class.php b/lib/plugins/config/settings/extra.class.php index 41af42247..5f963fb81 100644 --- a/lib/plugins/config/settings/extra.class.php +++ b/lib/plugins/config/settings/extra.class.php @@ -15,7 +15,7 @@ if (!class_exists('setting_sepchar')) { * @param string $key * @param array|null $param array with metadata of setting */ - function __construct($key,$param=null) { + public function __construct($key,$param=null) { $str = '_-.'; for ($i=0;$i<strlen($str);$i++) $this->_choices[] = $str{$i}; @@ -39,7 +39,7 @@ if (!class_exists('setting_savedir')) { * @param mixed $input the new value * @return boolean true if changed, false otherwise (also on error) */ - function update($input) { + public function update($input) { if ($this->is_protected()) return false; $value = is_null($this->_local) ? $this->_default : $this->_local; @@ -70,7 +70,7 @@ if (!class_exists('setting_authtype')) { * @param mixed $local local setting value * @param mixed $protected protected setting value */ - function initialize($default,$local,$protected) { + public function initialize($default,$local,$protected) { /** @var $plugin_controller Doku_Plugin_Controller */ global $plugin_controller; @@ -90,7 +90,7 @@ if (!class_exists('setting_authtype')) { * @param mixed $input the new value * @return boolean true if changed, false otherwise (also on error) */ - function update($input) { + public function update($input) { /** @var $plugin_controller Doku_Plugin_Controller */ global $plugin_controller; @@ -143,7 +143,7 @@ if (!class_exists('setting_im_convert')) { * @param mixed $input the new value * @return boolean true if changed, false otherwise (also on error) */ - function update($input) { + public function update($input) { if ($this->is_protected()) return false; $input = trim($input); @@ -176,7 +176,7 @@ if (!class_exists('setting_disableactions')) { * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting * @return array with content array(string $label_html, string $input_html) */ - function html(admin_plugin_config $plugin, $echo=false) { + public function html(admin_plugin_config $plugin, $echo=false) { global $lang; // make some language adjustments (there must be a better way) @@ -197,7 +197,7 @@ if (!class_exists('setting_compression')) { */ class setting_compression extends setting_multichoice { - var $_choices = array('0'); // 0 = no compression, always supported + protected $_choices = array('0'); // 0 = no compression, always supported /** * Receives current values for the setting $key @@ -206,7 +206,7 @@ if (!class_exists('setting_compression')) { * @param mixed $local local setting value * @param mixed $protected protected setting value */ - function initialize($default,$local,$protected) { + public function initialize($default,$local,$protected) { // populate _choices with the compression methods supported by this php installation if (function_exists('gzopen')) $this->_choices[] = 'gz'; @@ -223,7 +223,7 @@ if (!class_exists('setting_license')) { */ class setting_license extends setting_multichoice { - var $_choices = array(''); // none choosen + protected $_choices = array(''); // none choosen /** * Receives current values for the setting $key @@ -232,7 +232,7 @@ if (!class_exists('setting_license')) { * @param mixed $local local setting value * @param mixed $protected protected setting value */ - function initialize($default,$local,$protected) { + public function initialize($default,$local,$protected) { global $license; foreach($license as $key => $data){ @@ -251,8 +251,8 @@ if (!class_exists('setting_renderer')) { * Class setting_renderer */ class setting_renderer extends setting_multichoice { - var $_prompts = array(); - var $_format = null; + protected $_prompts = array(); + protected $_format = null; /** * Receives current values for the setting $key @@ -261,7 +261,7 @@ if (!class_exists('setting_renderer')) { * @param mixed $local local setting value * @param mixed $protected protected setting value */ - function initialize($default,$local,$protected) { + public function initialize($default,$local,$protected) { $format = $this->_format; foreach (plugin_list('renderer') as $plugin) { @@ -284,7 +284,7 @@ if (!class_exists('setting_renderer')) { * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting * @return array with content array(string $label_html, string $input_html) */ - function html(admin_plugin_config $plugin, $echo=false) { + public function html(admin_plugin_config $plugin, $echo=false) { // make some language adjustments (there must be a better way) // transfer some plugin names to the config plugin diff --git a/lib/plugins/extension/helper/list.php b/lib/plugins/extension/helper/list.php index 22852a59d..03740abe0 100644 --- a/lib/plugins/extension/helper/list.php +++ b/lib/plugins/extension/helper/list.php @@ -23,7 +23,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { $this->gui = plugin_load('helper', 'extension_gui'); } - function start_form() { + public function start_form() { $this->form .= '<form id="extension__list" accept-charset="utf-8" method="post" action="">'; $hidden = array( 'do'=>'admin', @@ -38,7 +38,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * @param helper_plugin_extension_extension $extension The extension that shall be added * @param bool $showinfo Show the info area */ - function add_row(helper_plugin_extension_extension $extension, $showinfo = false) { + public function add_row(helper_plugin_extension_extension $extension, $showinfo = false) { $this->start_row($extension); $this->populate_column('legend', $this->make_legend($extension, $showinfo)); $this->populate_column('actions', $this->make_actions($extension)); @@ -52,7 +52,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * @param string $header The content of the header * @param int $level The level of the header */ - function add_header($id, $header, $level = 2) { + public function add_header($id, $header, $level = 2) { $this->form .='<h'.$level.' id="'.$id.'">'.hsc($header).'</h'.$level.'>'.DOKU_LF; } @@ -61,7 +61,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * * @param string $data The content */ - function add_p($data) { + public function add_p($data) { $this->form .= '<p>'.hsc($data).'</p>'.DOKU_LF; } @@ -69,7 +69,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * Add hidden fields to the form with the given data * @param array $array */ - function add_hidden(array $array) { + public function add_hidden(array $array) { $this->form .= '<div class="no">'; foreach ($array as $key => $value) { $this->form .= '<input type="hidden" name="'.hsc($key).'" value="'.hsc($value).'" />'; @@ -80,7 +80,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { /** * Add closing tags */ - function end_form() { + public function end_form() { $this->form .= '</ul>'; $this->form .= '</form>'.DOKU_LF; } @@ -88,7 +88,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { /** * Show message when no results are found */ - function nothing_found() { + public function nothing_found() { global $lang; $this->form .= '<li class="notfound">'.$lang['nothingfound'].'</li>'; } @@ -96,7 +96,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { /** * Print the form */ - function render() { + public function render() { echo $this->form; } @@ -132,7 +132,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * @param helper_plugin_extension_extension $extension The extension * @return string The HTML code */ - function make_homepagelink(helper_plugin_extension_extension $extension) { + public function make_homepagelink(helper_plugin_extension_extension $extension) { $text = $this->getLang('homepage_link'); $url = hsc($extension->getURL()); return '<a href="'.$url.'" title="'.$url.'" class ="urlextern">'.$text.'</a> '; @@ -144,7 +144,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * @param helper_plugin_extension_extension $extension The extension object * @return string The class name */ - function make_class(helper_plugin_extension_extension $extension) { + public function make_class(helper_plugin_extension_extension $extension) { $class = ($extension->isTemplate()) ? 'template' : 'plugin'; if($extension->isInstalled()) { $class.=' installed'; @@ -163,7 +163,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * @param helper_plugin_extension_extension $extension The extension object * @return string The HTML code of the link */ - function make_author(helper_plugin_extension_extension $extension) { + public function make_author(helper_plugin_extension_extension $extension) { global $ID; if($extension->getAuthor()) { @@ -188,7 +188,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * @param helper_plugin_extension_extension $extension The extension object * @return string The HTML code */ - function make_screenshot(helper_plugin_extension_extension $extension) { + public function make_screenshot(helper_plugin_extension_extension $extension) { $screen = $extension->getScreenshotURL(); $thumb = $extension->getThumbnailURL(); @@ -219,7 +219,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * @param bool $showinfo Show the info section * @return string The HTML code */ - function make_legend(helper_plugin_extension_extension $extension, $showinfo = false) { + public function make_legend(helper_plugin_extension_extension $extension, $showinfo = false) { $return = '<div>'; $return .= '<h2>'; $return .= sprintf( @@ -273,7 +273,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * @param helper_plugin_extension_extension $extension The extension instance * @return string The HTML code */ - function make_linkbar(helper_plugin_extension_extension $extension) { + public function make_linkbar(helper_plugin_extension_extension $extension) { $return = '<div class="linkbar">'; $return .= $this->make_homepagelink($extension); if ($extension->getBugtrackerURL()) { @@ -305,7 +305,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * @param helper_plugin_extension_extension $extension The extension * @return string The HTML code */ - function make_noticearea(helper_plugin_extension_extension $extension) { + public function make_noticearea(helper_plugin_extension_extension $extension) { $return = ''; $missing_dependencies = $extension->getMissingDependencies(); if(!empty($missing_dependencies)) { @@ -360,7 +360,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * @param string $url * @return string HTML link */ - function shortlink($url){ + public function shortlink($url){ $link = parse_url($url); $base = $link['host']; @@ -379,7 +379,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * @param helper_plugin_extension_extension $extension The extension * @return string The HTML code */ - function make_info(helper_plugin_extension_extension $extension) { + public function make_info(helper_plugin_extension_extension $extension) { $default = $this->getLang('unknown'); $return = '<dl class="details">'; @@ -471,7 +471,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * @param array $ext The extensions * @return string The HTML code */ - function make_linklist($ext) { + public function make_linklist($ext) { $return = ''; foreach ($ext as $link) { $return .= '<bdi><a href="'. @@ -486,7 +486,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * @param helper_plugin_extension_extension $extension The extension * @return string The HTML code */ - function make_actions(helper_plugin_extension_extension $extension) { + public function make_actions(helper_plugin_extension_extension $extension) { global $conf; $return = ''; $errors = ''; @@ -554,7 +554,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * @param helper_plugin_extension_extension $extension The extension * @return string The HTML code */ - function make_action($action, $extension) { + public function make_action($action, $extension) { $title = ''; switch ($action) { @@ -577,7 +577,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { * @param helper_plugin_extension_extension $extension The extension * @return string The description of all relevant statusses */ - function make_status(helper_plugin_extension_extension $extension) { + public function make_status(helper_plugin_extension_extension $extension) { $status = array(); diff --git a/lib/plugins/info/syntax.php b/lib/plugins/info/syntax.php index f6360ead4..a782016ca 100644 --- a/lib/plugins/info/syntax.php +++ b/lib/plugins/info/syntax.php @@ -11,21 +11,21 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { /** * What kind of syntax are we? */ - function getType(){ + public function getType(){ return 'substition'; } /** * What about paragraphs? */ - function getPType(){ + public function getPType(){ return 'block'; } /** * Where to sort in? */ - function getSort(){ + public function getSort(){ return 155; } @@ -33,7 +33,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { /** * Connect pattern to lexer */ - function connectTo($mode) { + public function connectTo($mode) { $this->Lexer->addSpecialPattern('~~INFO:\w+~~',$mode,'plugin_info'); } @@ -46,7 +46,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { * @param Doku_Handler $handler The Doku_Handler object * @return array Return an array with all data you want to use in render */ - function handle($match, $state, $pos, Doku_Handler $handler){ + public function handle($match, $state, $pos, Doku_Handler $handler){ $match = substr($match,7,-2); //strip ~~INFO: from start and ~~ from end return array(strtolower($match)); } @@ -59,7 +59,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { * @param array $data data created by handler() * @return boolean rendered correctly? */ - function render($format, Doku_Renderer $renderer, $data) { + public function render($format, Doku_Renderer $renderer, $data) { if($format == 'xhtml'){ /** @var Doku_Renderer_xhtml $renderer */ //handle various info stuff @@ -110,7 +110,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { * @param string $type * @param Doku_Renderer_xhtml $renderer */ - function _plugins_xhtml($type, Doku_Renderer_xhtml $renderer){ + protected function _plugins_xhtml($type, Doku_Renderer_xhtml $renderer){ global $lang; $renderer->doc .= '<ul>'; @@ -150,7 +150,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { * * @param Doku_Renderer_xhtml $renderer */ - function _helpermethods_xhtml(Doku_Renderer_xhtml $renderer){ + protected function _helpermethods_xhtml(Doku_Renderer_xhtml $renderer){ $plugins = plugin_list('helper'); foreach($plugins as $p){ if (!$po = plugin_load('helper',$p)) continue; @@ -200,7 +200,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { * * @return string */ - function _syntaxtypes_xhtml(){ + protected function _syntaxtypes_xhtml(){ global $PARSER_MODES; $doc = ''; @@ -224,7 +224,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin { * * @return string */ - function _syntaxmodes_xhtml(){ + protected function _syntaxmodes_xhtml(){ $modes = p_get_parsermodes(); $compactmodes = array(); diff --git a/lib/plugins/popularity/action.php b/lib/plugins/popularity/action.php index d5ec0f5c5..24f3c750f 100644 --- a/lib/plugins/popularity/action.php +++ b/lib/plugins/popularity/action.php @@ -13,20 +13,26 @@ class action_plugin_popularity extends Dokuwiki_Action_Plugin { /** * @var helper_plugin_popularity */ - var $helper; + protected $helper; - function __construct(){ + public function __construct(){ $this->helper = $this->loadHelper('popularity', false); } /** * Register its handlers with the dokuwiki's event controller */ - function register(Doku_Event_Handler $controller) { + public function register(Doku_Event_Handler $controller) { $controller->register_hook('INDEXER_TASKS_RUN', 'AFTER', $this, '_autosubmit', array()); } - function _autosubmit(Doku_Event &$event, $param){ + /** + * Event handler + * + * @param Doku_Event $event + * @param $param + */ + public function _autosubmit(Doku_Event &$event, $param){ //Do we have to send the data now if ( !$this->helper->isAutosubmitEnabled() || $this->_isTooEarlyToSubmit() ){ return; @@ -53,7 +59,7 @@ class action_plugin_popularity extends Dokuwiki_Action_Plugin { * Check if it's time to send autosubmit data * (we should have check if autosubmit is enabled first) */ - function _isTooEarlyToSubmit(){ + protected function _isTooEarlyToSubmit(){ $lastSubmit = $this->helper->lastSentTime(); return $lastSubmit + 24*60*60*30 > time(); } diff --git a/lib/plugins/popularity/admin.php b/lib/plugins/popularity/admin.php index c474238cc..763347167 100644 --- a/lib/plugins/popularity/admin.php +++ b/lib/plugins/popularity/admin.php @@ -10,31 +10,33 @@ class admin_plugin_popularity extends DokuWiki_Admin_Plugin { /** * @var helper_plugin_popularity */ - var $helper; - var $sentStatus = null; + protected $helper; + protected $sentStatus = null; - function __construct(){ + public function __construct(){ $this->helper = $this->loadHelper('popularity', false); } /** * return prompt for admin menu + * @param $language + * @return string */ - function getMenuText($language) { + public function getMenuText($language) { return $this->getLang('name'); } /** * return sort order for position in admin menu */ - function getMenuSort() { + public function getMenuSort() { return 2000; } /** * Accessible for managers */ - function forAdminOnly() { + public function forAdminOnly() { return false; } @@ -42,7 +44,7 @@ class admin_plugin_popularity extends DokuWiki_Admin_Plugin { /** * handle user request */ - function handle() { + public function handle() { global $INPUT; //Send the data @@ -61,7 +63,7 @@ class admin_plugin_popularity extends DokuWiki_Admin_Plugin { * Enable or disable autosubmit * @param bool $enable If TRUE, it will enable autosubmit. Else, it will disable it. */ - function _enableAutosubmit( $enable ){ + protected function _enableAutosubmit( $enable ){ if ( $enable ){ io_saveFile( $this->helper->autosubmitFile, ' '); } else { @@ -72,7 +74,7 @@ class admin_plugin_popularity extends DokuWiki_Admin_Plugin { /** * Output HTML form */ - function html() { + public function html() { global $INPUT; if ( ! $INPUT->has('data') ){ @@ -115,7 +117,7 @@ class admin_plugin_popularity extends DokuWiki_Admin_Plugin { * @param string $data The popularity data, if it has already been computed. NULL otherwise. * @return string The form, as an html string */ - function buildForm($submissionMode, $data = null){ + protected function buildForm($submissionMode, $data = null){ $url = ($submissionMode === 'browser' ? $this->helper->submitUrl : script()); if ( is_null($data) ){ $data = $this->helper->gatherAsString(); diff --git a/lib/plugins/popularity/helper.php b/lib/plugins/popularity/helper.php index b81ab7005..2545d18bc 100644 --- a/lib/plugins/popularity/helper.php +++ b/lib/plugins/popularity/helper.php @@ -9,28 +9,28 @@ class helper_plugin_popularity extends Dokuwiki_Plugin { /** * The url where the data should be sent */ - var $submitUrl = 'http://update.dokuwiki.org/popularity.php'; + public $submitUrl = 'http://update.dokuwiki.org/popularity.php'; /** * Name of the file which determine if the the autosubmit is enabled, * and when it was submited for the last time */ - var $autosubmitFile; + public $autosubmitFile; /** * File where the last error which happened when we tried to autosubmit, will be log */ - var $autosubmitErrorFile; + public $autosubmitErrorFile; /** * Name of the file which determine when the popularity data was manually * submitted for the last time * (If this file doesn't exist, the data has never been sent) */ - var $popularityLastSubmitFile; + public $popularityLastSubmitFile; - function __construct(){ + public function __construct(){ global $conf; $this->autosubmitFile = $conf['cachedir'].'/autosubmit.txt'; $this->autosubmitErrorFile = $conf['cachedir'].'/autosubmitError.txt'; @@ -38,46 +38,11 @@ class helper_plugin_popularity extends Dokuwiki_Plugin { } /** - * Return methods of this helper - * - * @return array with methods description - */ - function getMethods(){ - $result = array(); - $result[] = array( - 'name' => 'isAutoSubmitEnabled', - 'desc' => 'Check if autosubmit is enabled', - 'params' => array(), - 'return' => array('result' => 'bool') - ); - $result[] = array( - 'name' => 'sendData', - 'desc' => 'Send the popularity data', - 'params' => array('data' => 'string'), - 'return' => array() - ); - $result[] = array( - 'name' => 'gatherAsString', - 'desc' => 'Gather the popularity data', - 'params' => array(), - 'return' => array('data' => 'string') - ); - $result[] = array( - 'name' => 'lastSentTime', - 'desc' => 'Compute the last time popularity data was sent', - 'params' => array(), - 'return' => array('data' => 'int') - ); - return $result; - - } - - /** * Check if autosubmit is enabled * * @return boolean TRUE if we should send data once a month, FALSE otherwise */ - function isAutoSubmitEnabled(){ + public function isAutoSubmitEnabled(){ return file_exists($this->autosubmitFile); } @@ -87,7 +52,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin { * @param string $data The popularity data * @return string An empty string if everything worked fine, a string describing the error otherwise */ - function sendData($data){ + public function sendData($data){ $error = ''; $httpClient = new DokuHTTPClient(); $status = $httpClient->sendRequest($this->submitUrl, array('data' => $data), 'POST'); @@ -102,7 +67,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin { * * @return int */ - function lastSentTime(){ + public function lastSentTime(){ $manualSubmission = @filemtime($this->popularityLastSubmitFile); $autoSubmission = @filemtime($this->autosubmitFile); @@ -114,7 +79,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin { * * @return string The popularity data as a string */ - function gatherAsString(){ + public function gatherAsString(){ $data = $this->_gather(); $string = ''; foreach($data as $key => $val){ @@ -132,7 +97,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin { * * @return array The popularity data as an array */ - function _gather(){ + protected function _gather(){ global $conf; /** @var $auth DokuWiki_Auth_Plugin */ global $auth; @@ -259,6 +224,11 @@ class helper_plugin_popularity extends Dokuwiki_Plugin { return $data; } + /** + * Triggers event to let plugins add their own data + * + * @param $data + */ protected function _add_plugin_usage_data(&$data){ $pluginsData = array(); trigger_event('PLUGIN_POPULARITY_DATA_SETUP', $pluginsData); @@ -284,7 +254,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin { * @param array $opts option array as given to search() * @return bool */ - function _search_count(&$data,$base,$file,$type,$lvl,$opts){ + protected function _search_count(&$data,$base,$file,$type,$lvl,$opts){ // traverse if($type == 'd'){ if($data['dir_nest'] < $lvl) $data['dir_nest'] = $lvl; @@ -315,7 +285,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin { * @param string $v * @return int|string */ - function _to_byte($v){ + protected function _to_byte($v){ $l = substr($v, -1); $ret = substr($v, 0, -1); switch(strtoupper($l)){ diff --git a/lib/plugins/revert/admin.php b/lib/plugins/revert/admin.php index c20dda7c2..8bdccda24 100644 --- a/lib/plugins/revert/admin.php +++ b/lib/plugins/revert/admin.php @@ -4,43 +4,43 @@ * need to inherit from this class */ class admin_plugin_revert extends DokuWiki_Admin_Plugin { - var $cmd; + protected $cmd; // some vars which might need tuning later - var $max_lines = 800; // lines to read from changelog - var $max_revs = 20; // numer of old revisions to check + protected $max_lines = 800; // lines to read from changelog + protected $max_revs = 20; // numer of old revisions to check /** * Constructor */ - function __construct(){ + public function __construct(){ $this->setupLocale(); } /** * access for managers */ - function forAdminOnly(){ + public function forAdminOnly(){ return false; } /** * return sort order for position in admin menu */ - function getMenuSort() { + public function getMenuSort() { return 40; } /** * handle user request */ - function handle() { + public function handle() { } /** * output appropriate html */ - function html() { + public function html() { global $INPUT; echo $this->locale_xhtml('intro'); @@ -57,7 +57,7 @@ class admin_plugin_revert extends DokuWiki_Admin_Plugin { /** * Display the form for searching spam pages */ - function _searchform(){ + protected function _searchform(){ global $lang, $INPUT; echo '<form action="" method="post"><div class="no">'; echo '<label>'.$this->getLang('filter').': </label>'; @@ -70,7 +70,7 @@ class admin_plugin_revert extends DokuWiki_Admin_Plugin { /** * Start the reversion process */ - function _revert($revert,$filter){ + protected function _revert($revert,$filter){ echo '<hr /><br />'; echo '<p>'.$this->getLang('revstart').'</p>'; @@ -107,7 +107,7 @@ class admin_plugin_revert extends DokuWiki_Admin_Plugin { /** * List recent edits matching the given filter */ - function _list($filter){ + protected function _list($filter){ global $conf; global $lang; echo '<hr /><br />'; diff --git a/lib/plugins/testing/action.php b/lib/plugins/testing/action.php index a242ab0b7..d34ef1858 100644 --- a/lib/plugins/testing/action.php +++ b/lib/plugins/testing/action.php @@ -8,11 +8,12 @@ */ class action_plugin_testing extends DokuWiki_Action_Plugin { - function register(Doku_Event_Handler $controller) { + /** @inheritdoc */ + public function register(Doku_Event_Handler $controller) { $controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, 'dokuwikiStarted'); } - function dokuwikiStarted() { + public function dokuwikiStarted() { $param = array(); trigger_event('TESTING_PLUGIN_INSTALLED', $param); msg('The testing plugin is enabled and should be disabled.',-1); |