* @license PHP License * @package wb * @subpackage Markup */ WBClass::load('WBMarkup_Dereferencer'); /** * Markup dereferer * * Find list of references stored in XML node * * @version 0.2.0 * @package wb * @subpackage Markup */ class WBMarkup_Dereferencer_Wb_Url extends WBMarkup_Dereferencer { /** * @var WBDictionary_URL */ static private $dict; private function initDict() { if (!empty(self::$dict)) { return; } self::$dict = WBClass::create('WBDictionary_URL'); } /** * get references * * Scan for refering ids and return list of them. * * @param array $node to be modified document node * @return array */ public function getReferences($node) { $urlid = $node['attributes']['urlid']; $refs = array('wb' => array()); $refs['wb']['url'] = array($urlid); // seek for URLs to VFSFiles $this->initDict(); self::$dict->load($urlid); $info = self::$dict->get(); // add VFSFile if ('self' != $info['protocol'] || 0 != strncmp('[[SERVICE_FILE]]', $info['path'], 16)) { return $refs; } // strip [[SERVICE_FILE]]XY $t = substr($info['path'], 18); // strip rest of path $t = explode('/', $t); $t = $t[0]; $refs['wb']['vfsfile'] = array($t); return $refs; } }