/** return a node-tree */ function &getTree(&$xmap, &$parent, &$params) { $result = null; if ($parent->type === 'component') { $task = preg_replace("/.*view=([^&]+).*/", '$1', $parent->link); $id = preg_replace("/.*[&\\?]id=([0-9]+).*/", '$1', $parent->link); $type = "content_{$task}"; } else { $type = $parent->type; $id = $parent->componentid; } /*** * Parameters Initialitation **/ //----- Set expand_categories param $expand_categories = xmap_com_content::getParam($params, 'expand_categories', 1); $expand_categories = $expand_categories == 1 || $expand_categories == 2 && $xmap->view == 'xml' || $expand_categories == 3 && $xmap->view == 'html' || $xmap->view == 'navigator'; $params['expand_categories'] = $expand_categories; //----- Set expand_sections param $expand_sections = xmap_com_content::getParam($params, 'expand_sections', 1); $expand_sections = $expand_sections == 1 || $expand_sections == 2 && $xmap->view == 'xml' || $expand_sections == 3 && $xmap->view == 'html' || $xmap->view == 'navigator'; $params['expand_sections'] = $expand_sections; //----- Set show_unauth param $show_unauth = xmap_com_content::getParam($params, 'show_unauth', 1); $show_unauth = $show_unauth == 1 || $show_unauth == 2 && $xmap->view == 'xml' || $show_unauth == 3 && $xmap->view == 'html'; $params['show_unauth'] = $show_unauth; //----- Set cat_priority and cat_changefreq params $priority = xmap_com_content::getParam($params, 'cat_priority', $parent->priority); $changefreq = xmap_com_content::getParam($params, 'cat_changefreq', $parent->changefreq); if ($priority == '-1') { $priority = $parent->priority; } if ($changefreq == '-1') { $changefreq = $parent->changefreq; } $params['cat_priority'] = $priority; $params['cat_changefreq'] = $changefreq; //----- Set art_priority and art_changefreq params $priority = xmap_com_content::getParam($params, 'art_priority', $parent->priority); $changefreq = xmap_com_content::getParam($params, 'art_changefreq', $parent->changefreq); if ($priority == '-1') { $priority = $parent->priority; } if ($changefreq == '-1') { $changefreq = $parent->changefreq; } $params['art_priority'] = $priority; $params['art_changefreq'] = $changefreq; $params['max_art'] = intval(xmap_com_content::getParam($params, 'max_art', 0)); $params['max_art_age'] = intval(xmap_com_content::getParam($params, 'max_art_age', 0)); switch ($type) { case 'content_blog_category': if ($params['expand_categories']) { $menuparams = xmap_com_content::paramsToArray($parent->params); if ($id == 0) { // Multi category $id = xmap_com_content::getParam($menuparams, 'categoryid', $id); } $result = xmap_com_content::getContentCategory($xmap, $parent, $id, $params, $menuparams); } break; case 'content_category': if ($params['expand_categories']) { $menuparams = xmap_com_content::paramsToArray($parent->params); $result = xmap_com_content::getContentCategory($xmap, $parent, $id, $params, $menuparams); } break; case 'content_section': if ($params['expand_sections']) { $menuparams = xmap_com_content::paramsToArray($parent->params); $result = xmap_com_content::getContentSection($xmap, $parent, $id, $params, $menuparams); } break; case 'content_blog_section': if ($params['expand_sections']) { $menuparams = xmap_com_content::paramsToArray($parent->params); $result = xmap_com_content::getContentBlogSection($xmap, $parent, $id, $param, $menuparams); } break; case 'content_typed': $database =& JFactory::getDBO(); $database->setQuery("SELECT modified, created FROM #__content WHERE id=" . $id); $database->loadObject($item); if ($item->modified == '0000-00-00 00:00:00') { $item->modified = $item->created; } $parent->modified = xmap_com_content::toTimestamp($item->modified); break; } return $result; }
/** return a node-tree */ function getTree(&$xmap, &$parent, &$params) { $result = null; $link_query = parse_url($parent->link); parse_str(html_entity_decode($link_query['query']), $link_vars); $view = JArrayHelper::getValue($link_vars, 'view', ''); $layout = JArrayHelper::getValue($link_vars, 'layout', ''); $id = intval(JArrayHelper::getValue($link_vars, 'id', 0)); $menu =& JSite::getMenu(); $menuparams = $menu->getParams($parent->id); /*** * Parameters Initialitation **/ //----- Set expand_categories param $expand_categories = JArrayHelper::getValue($params, 'expand_categories', 1); $expand_categories = $expand_categories == 1 || $expand_categories == 2 && $xmap->view == 'xml' || $expand_categories == 3 && $xmap->view == 'html' || $xmap->view == 'navigator'; $params['expand_categories'] = $expand_categories; //----- Set expand_sections param $expand_sections = JArrayHelper::getValue($params, 'expand_sections', 1); $expand_sections = $expand_sections == 1 || $expand_sections == 2 && $xmap->view == 'xml' || $expand_sections == 3 && $xmap->view == 'html' || $xmap->view == 'navigator'; $params['expand_sections'] = $expand_sections; //----- Set show_unauth param $show_unauth = JArrayHelper::getValue($params, 'show_unauth', 1); $show_unauth = $show_unauth == 1 || $show_unauth == 2 && $xmap->view == 'xml' || $show_unauth == 3 && $xmap->view == 'html'; $params['show_unauth'] = $show_unauth; //----- Set cat_priority and cat_changefreq params $priority = JArrayHelper::getValue($params, 'cat_priority', $parent->priority); $changefreq = JArrayHelper::getValue($params, 'cat_changefreq', $parent->changefreq); if ($priority == '-1') { $priority = $parent->priority; } if ($changefreq == '-1') { $changefreq = $parent->changefreq; } $params['cat_priority'] = $priority; $params['cat_changefreq'] = $changefreq; //----- Set art_priority and art_changefreq params $priority = JArrayHelper::getValue($params, 'art_priority', $parent->priority); $changefreq = JArrayHelper::getValue($params, 'art_changefreq', $parent->changefreq); if ($priority == '-1') { $priority = $parent->priority; } if ($changefreq == '-1') { $changefreq = $parent->changefreq; } $params['art_priority'] = $priority; $params['art_changefreq'] = $changefreq; $params['keywords'] = JArrayHelper::getValue($params, 'keywords', 'metakey'); $params['max_art'] = intval(JArrayHelper::getValue($params, 'max_art', 0)); $params['max_art_age'] = intval(JArrayHelper::getValue($params, 'max_art_age', 0)); $params['articles_order'] = JArrayHelper::getValue($params, 'articles_order', 'menu'); if ($xmap->isNews) { // $params['max_art_age'] = 2; $params['show_unauth'] = 0; } switch ($view) { case 'category': if ($params['expand_categories']) { xmap_com_content::getContentCategory($xmap, $parent, $id, $params, $menuparams); } break; case 'section': if ($params['expand_sections']) { if ($layout == 'blog') { xmap_com_content::getContentBlogSection($xmap, $parent, $id, $params, $menuparams); } else { xmap_com_content::getContentSection($xmap, $parent, $id, $params, $menuparams); } } break; case 'archive': xmap_com_content::getArchivedArticles($xmap, $parent, $params, $menuparams); break; } return true; }