Minahito
minah****@users*****
2005年 11月 29日 (火) 16:14:32 JST
Index: xoops2jp/html/kernel/XCube_TextModifier.class.php diff -u /dev/null xoops2jp/html/kernel/XCube_TextModifier.class.php:1.1.2.1 --- /dev/null Tue Nov 29 16:14:32 2005 +++ xoops2jp/html/kernel/XCube_TextModifier.class.php Tue Nov 29 16:14:32 2005 @@ -0,0 +1,65 @@ +<?php + +class XCube_TextModifier +{ + function getName() + { + } + + function convertString(&$string) + { + } + + function convertText(&$text) + { + } +} + +/** + * Collect TextModifiers. When a logic wants to call a convert function, this + * class does substitution. + */ +class XCube_TextModifierManager +{ + var $mDefaultKey=null; + var $mModifiers=array(); + + function addModifier(&$modifier) + { + $this->mModifiers[$modifier->getName()]=&$modifier; + if($this->mDefaultKey==null) { + $this->mDefaultKey=$modifier->getName(); + } + } + + function hasModifier($modifierName) + { + return array_key_exists($modifierName,$this->mModifiers); + } + + function countModifier() + { + return count($this->mModifiers); + } + + function &searchModifier($modifierName=null,$fallback=true) + { + $dmy=false; + if($modifierName!=null) { + if($this->hasModifier($modifierName)) { + return $this->mModifiers[$modifierName]; + } + elseif($fallback) { + return $this->mModifiers[$this->mDefaultKey]; + } + else { + return $dmy; + } + } + else { + return $this->mModifiers[$this->mDefaultKey]; + } + } +} + +?> \ No newline at end of file