*/ /** * patTemplate modfifier: Dictionary * * Use dictionary record * * @version 0.1.0 * @package Wombat * @subpackage patTemplate */ class patTemplate_Modifier_Dictionary extends patTemplate_Modifier { /** * dictionary * @var WBDictionary */ private $dict; /** * modify the value * * @access public * @param string value * @return string modified value */ public function modify($value, $params = array()) { if (empty($value)) { return ''; } // start dictionary $this->dict = WBClass::create('WBDictionary_' . ucfirst($params['dict'])); try { $this->dict->load($value); } catch (Exception $e) { return ''; } return $this->dict->getWord(); } }