/** * Constructor. * initializes the linxDisplay. * * @param string $tagContent The tag content. * @return void * @access public */ function __construct($tag) { $conditions = $tag->getElementsByTagName('condition'); $htmltemplates = $tag->getElementsByTagName('htmltemplate'); $modes = $tag->getElementsByTagName('mode'); $subleveltemplates = $tag->getElementsByTagName('subleveltemplate'); $root = $tag->getElementsByTagName('root'); //conditions if ($conditions->length > 0) { foreach ($conditions as $condition) { $this->_conditions[] = CMS_linxCondition::createCondition($condition); } } //htmltemplate if ($htmltemplates->length > 0) { $this->_htmlTemplate = CMS_DOMDocument::DOMElementToString($htmltemplates->item(0), true); } //mode if ($modes->length > 0) { $this->_mode = trim(CMS_DOMDocument::DOMElementToString($modes->item(0), true)); } else { if ($tag->getAttribute('mode')) { $this->_mode = trim($tag->getAttribute('mode')); } } //root if ($root->length > 0) { $attribute = trim(CMS_DOMDocument::DOMElementToString($root->item(0), true)); $this->_root = $attribute === "0" || $attribute === "false" || !$attribute ? false : true; } else { if ($tag->hasAttribute('root')) { $attribute = trim($tag->getAttribute('root')); $this->_root = $attribute === "0" || $attribute === "false" || !$attribute ? false : true; } else { $this->_root = true; } } //subleveltemplate if ($subleveltemplates->length > 0) { $this->_subleveltemplate = CMS_DOMDocument::DOMElementToString($subleveltemplates->item(0), true); } }
/** * Parse a "selection" XML tag searching for start and stop nodespecs * This will fill the _selectionStartPageTags and _selectionStopPageTag attributes * * @param CMS_XMLTag $selectionTag The selection tag to parse * @return boolean true on success, false on failure * @access private */ protected function _parseSelection($selectionTag) { if (is_a($selectionTag, "DOMElement")) { //set error level on selection attribute if ($selectionTag->hasAttribute('noerror') && ($selectionTag->getAttribute('noerror') == 'true' || $selectionTag->getAttribute('noerror') == '1')) { $this->_noerror = true; } //set cross website status on selection attribute if ($selectionTag->hasAttribute('crosswebsite') && $selectionTag->getAttribute('crosswebsite') == 'true' || $selectionTag->getAttribute('crosswebsite') == '1') { $this->_crosswebsite = true; } $starts = $selectionTag->getElementsByTagName('start'); $stops = $selectionTag->getElementsByTagName('stop'); $conditions = $selectionTag->getElementsByTagName('condition'); if ($conditions->length > 0) { $this->_selectionCondition = CMS_linxCondition::createCondition($conditions->item(0)); } //parse the start tag(s) foreach ($starts as $start) { $nodespecs = $start->getElementsByTagName('nodespec'); if ($nodespecs->length > 0) { $nodespec = $nodespecs->item(0); $nodespec = CMS_linxNodespec::createNodespec($nodespec, $this->_crosswebsite); } $pages = $nodespec->getTarget($this->_page, $this->_publicTree); if ($pages) { if (!is_array($pages)) { $pages = array($pages); } foreach ($pages as $pg) { $this->_selectionStartPages[] = $pg; //if nodespec type is relative and relative type is father OR the linx type is sublinks, //store the representation ID in the _fatherWatch array if ($nodespec->getRelativeType() == "brother" || $this->_type == "sublinks" || $this->_type == "recursivelinks") { $this->_fatherWatches[] = $pg->getID(); } } } } if ($stops->length > 0) { $stop = $stops->item(0); $nodespecs = $stop->getElementsByTagName('nodespec'); if ($nodespecs->length > 0) { $nodespec = $nodespecs->item(0); $nodespec = CMS_linxNodespec::createNodespec($nodespec); $pg = $nodespec->getTarget($this->_page, $this->_publicTree); if ($pg) { $this->_selectionStopPage = $pg; } } } } else { $this->raiseError('SelectionTag is not a DOMElement instance'); return false; } return true; }