diff options
author | chris <chris@jalakai.co.uk> | 2006-01-25 01:15:46 +0100 |
---|---|---|
committer | chris <chris@jalakai.co.uk> | 2006-01-25 01:15:46 +0100 |
commit | 1044933224145c95bacf2d3534eaed7d9381fdf4 (patch) | |
tree | 4a4d3d5b93c382fbd9d4168fffc6880f05e1e4aa /lib/plugins/config/settings/extra.class.php | |
parent | 0440ff150cefe9088c8aa126e646f901c69a7793 (diff) | |
download | rpg-1044933224145c95bacf2d3534eaed7d9381fdf4.tar.gz rpg-1044933224145c95bacf2d3534eaed7d9381fdf4.tar.bz2 |
config plugin
darcs-hash:20060125001546-9b6ab-02a6255db9adc4dc22f4970b01a3b148d2b1810c.gz
Diffstat (limited to 'lib/plugins/config/settings/extra.class.php')
-rw-r--r-- | lib/plugins/config/settings/extra.class.php | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/lib/plugins/config/settings/extra.class.php b/lib/plugins/config/settings/extra.class.php new file mode 100644 index 000000000..0c5d9866e --- /dev/null +++ b/lib/plugins/config/settings/extra.class.php @@ -0,0 +1,90 @@ +<?php +/** + * additional setting classes specific to these settings + * + * @author Chris Smith <chris@jalakai.co.uk> + */ + +if (!class_exists('setting_sepchar')) { + class setting_sepchar extends setting_multichoice { + + function setting_sepchar($key,$param=NULL) { + $str = '_-.0123456789abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + for ($i=0;$i<strlen($str);$i++) $this->_choices[] = $str{$i}; + + // call foundation class constructor + $this->setting($key,$param); + } + } +} + +if (!class_exists('setting_savedir')) { + class setting_savedir extends setting { + + function update($input) { + if ($this->is_protected()) return false; + + $value = is_null($this->_local) ? $this->_default : $this->_local; + if ($value == $input) return false; + + if (!init_path($input)) { + $this->_error = true; + $this->_input = $input; + return false; + } + + $this->_local = $input; + return true; + } + } +} + +if (!class_exists('setting_authtype')) { + class setting_authtype extends setting { + var $_pattern = '#^[a-zA-Z0-9_]*$#'; + + function update($input) { + if ($this->is_protected()) return false; + + $input = trim($input); + + $value = is_null($this->_local) ? $this->_default : $this->_local; + if ($value == $input) return false; + + if (preg_match($this->_pattern, $input)) { + if (@file_exists(DOKU_INC.'inc/auth/'.$input.'.class.php') || + @file_exists(DOKU_INC.'inc/auth/'.$input.'.php')) { + $this->_local = $input; + return true; + } + } + + $this->_error = true; + $this->_input = $input; + return false; + } + } +} + +if (!class_exists('setting_im_convert')) { + class setting_im_convert extends setting { + + function update($input) { + if ($this->is_protected()) return false; + + $input = trim($input); + + $value = is_null($this->_local) ? $this->_default : $this->_local; + if ($value == $input) return false; + + if ($input && !@file_exists($input)) { + $this->_error = true; + $this->_input = $input; + return false; + } + + $this->_local = $input; + return true; + } + } +} |