* @license PHP License * @package WB * @subpackage Event_Handler */ WBClass::load('WBEvent_Handler' , 'WBEvent_Handler_Dictionary'); /** * Event_Handler_DictionaryLoad * * Load dictionary data into event * * @version 0.1.1 * @package WB * @subpackage Event_Handler */ class WBEvent_Handler_Dictionary_Load extends WBEvent_Handler_Dictionary { /** * Handler config * * Parameters: * - dictionary * - key * * @var array */ protected $config = array( 'dictionary' => 'URL', 'key' => 'urlid', 'target' => 'url' ); /** * Process event * * Populate dictionary record * * @see isRecoverable() * @param WBEvent $e * @return bool true to continue, false to stop processing * @throws Exception in case of error */ public function process(WBEvent $e) { $this->dict = WBClass::create('WBDictionary_' . $this->config['dictionary']); if (!$this->dict) { return false; } $this->dict->load($e->get($this->config['key'])); $id = $this->dict->getId(); if (empty($id)) { return false; } $e->set($this->config['target'], $this->dict->getWord()); return true; } }