コード例 #1
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     if ($this->getLayout() !== 'modal') {
         OSMapHelper::addSubmenu('sitemaps');
     }
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $version = new JVersion();
     $message = $this->get('ExtensionsMessage');
     if ($message) {
         JFactory::getApplication()->enqueueMessage($message);
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // We don't need toolbar in the modal window.
     if ($this->getLayout() !== 'modal') {
         if (version_compare($version->getShortVersion(), '3.0.0', '<')) {
             $tpl = 'legacy';
         }
         $this->addToolbar();
     }
     // Load the extension
     $extension = Factory::getExtension('OSMap', 'component');
     $extension->loadLibrary();
     $displayLegacyStats = (bool) $extension->params->get('display_legacy_stats', 0);
     $this->assignRef("extension", $extension);
     $this->assignRef("displayLegacyStats", $displayLegacyStats);
     parent::display($tpl);
 }
コード例 #2
0
ファイル: sitemap.php プロジェクト: lepca/OSMap
 function getExtensions()
 {
     return OSMapHelper::getExtensions();
 }
コード例 #3
0
ファイル: view.html.php プロジェクト: lepca/OSMap
 public function navigatorLinks($tpl = null)
 {
     require_once JPATH_COMPONENT_SITE . '/helpers/osmap.php';
     $link = urldecode(JRequest::getVar('link', ''));
     $name = JRequest::getCmd('e_name', '');
     $Itemid = JRequest::getInt('Itemid');
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     $menuItems = OSMapHelper::getMenuItems($item->selections);
     $extensions = OSMapHelper::getExtensions();
     $this->loadTemplate('class');
     $nav = new OSMapNavigatorDisplayer($state->params, $item);
     $nav->setExtensions($extensions);
     $this->list = array();
     // Show the menu list
     if (!$link && !$Itemid) {
         foreach ($menuItems as $menutype => &$menu) {
             $menu = new stdclass();
             #$menu->id = 0;
             #$menu->menutype = $menutype;
             $node = new stdClass();
             $node->uid = "menu-" . $menutype;
             $node->menutype = $menutype;
             $node->ordering = $item->selections->{$menutype}->ordering;
             $node->priority = $item->selections->{$menutype}->priority;
             $node->changefreq = $item->selections->{$menutype}->changefreq;
             $node->browserNav = 3;
             $node->type = 'separator';
             if (!($node->name = $nav->getMenuTitle($menutype, @$menu->module))) {
                 $node->name = $menutype;
             }
             $node->link = '-menu-' . $menutype;
             $node->expandible = true;
             $node->selectable = false;
             //$node->name = $this->getMenuTitle($menutype,@$menu->module);    // get the mod_mainmenu title from modules table
             $this->list[] = $node;
         }
     } else {
         $parent = new stdClass();
         if ($Itemid) {
             // Expand a menu Item
             $items =& JSite::getMenu();
             $node =& $items->getItem($Itemid);
             if (isset($menuItems[$node->menutype])) {
                 $parent->name = $node->title;
                 $parent->id = $node->id;
                 $parent->uid = 'itemid' . $node->id;
                 $parent->link = $link;
                 $parent->type = $node->type;
                 $parent->browserNav = $node->browserNav;
                 $parent->priority = $item->selections->{$node->menutype}->priority;
                 $parent->changefreq = $item->selections->{$node->menutype}->changefreq;
                 $parent->menutype = $node->menutype;
                 $parent->selectable = false;
                 $parent->expandible = true;
             }
         } else {
             $parent->id = 1;
             $parent->link = $link;
         }
         $this->list = $nav->expandLink($parent);
     }
     parent::display('links');
     exit;
 }
コード例 #4
0
ファイル: osmap.php プロジェクト: alesconti/FF_2015
 /**
  * Call the function prepareMenuItem of the extension for the item (if any)
  *
  * @param    object        Menu item object
  *
  * @return    void
  */
 public static function prepareMenuItem($item)
 {
     $extensions = OSMapHelper::getExtensions();
     if (!empty($extensions[$item->option])) {
         $className = 'xmap_' . $item->option;
         $obj = new $className();
         if (method_exists($obj, 'prepareMenuItem')) {
             $obj->prepareMenuItem($item, $extensions[$item->option]->params);
         }
     }
 }
コード例 #5
0
ファイル: osmap.php プロジェクト: lepca/OSMap
 /**
  * Call the function prepareMenuItem of the extension for the item (if any)
  *
  * @param    object        Menu item object
  *
  * @return    void
  */
 public static function prepareMenuItem($item)
 {
     $extensions = OSMapHelper::getExtensions();
     $result = true;
     if (!empty($extensions[$item->option])) {
         $plugin = $extensions[$item->option];
         // Check if the method is static or not
         $result = Alledia\Framework\Helper::callMethod($plugin->className, 'prepareMenuItem', array($item, &$plugin->params));
     }
     if ($result === null) {
         $result = true;
     }
     return $result;
 }
コード例 #6
0
ファイル: navigator_class.php プロジェクト: alesconti/FF_2015
 function &expandLink(&$parent)
 {
     $items =& JSite::getMenu();
     $extensions =& $this->_extensions;
     $rows = null;
     if (strpos($parent->link, '-menu-') === 0) {
         $menutype = str_replace('-menu-', '', $parent->link);
         // Get Menu Items
         $rows = $items->getItems('menutype', $menutype);
     } elseif ($parent->id) {
         $rows = $items->getItems('parent_id', $parent->id);
     }
     if ($rows) {
         foreach ($rows as $item) {
             if ($item->parent_id == $parent->id) {
                 $node = new stdclass();
                 $node->name = $item->title;
                 $node->id = $item->id;
                 $node->uid = 'itemid' . $item->id;
                 $node->link = $item->link;
                 $node->expandible = true;
                 $node->selectable = true;
                 // Prepare the node link
                 OSMapHelper::prepareMenuItem($node);
                 if ($item->home) {
                     $node->link = JURI::root();
                 } elseif (substr($item->link, 0, 9) == 'index.php' && $item->type != 'url') {
                     if ($item->type == 'menulink') {
                         // For Joomla 1.5 SEF compatibility
                         $params = new JParameter($item->params);
                         $node->link = 'index.php?Itemid=' . $params->get('menu_item');
                     } elseif (strpos($item->link, 'Itemid=') === FALSE) {
                         $node->link = 'index.php?Itemid=' . $node->id;
                     }
                 } elseif ($item->type == 'separator') {
                     $node->selectable = false;
                 }
                 $this->printNode($node);
                 // Add to the internal list
             }
         }
     }
     if ($parent->id) {
         $option = null;
         if (preg_match('#^/?index.php.*option=(com_[^&]+)#', $parent->link, $matches)) {
             $option = $matches[1];
         }
         $Itemid = JRequest::getInt('Itemid');
         if (!$option && $Itemid) {
             $item = $items->getItem($Itemid);
             $link_query = parse_url($item->link);
             parse_str(html_entity_decode($link_query['query']), $link_vars);
             $option = JArrayHelper::getValue($link_vars, 'option', '');
             if ($option) {
                 $parent->link = $item->link;
             }
         }
         if ($option) {
             if (!empty($extensions[$option])) {
                 $parent->uid = $option;
                 $className = 'xmap_' . $option;
                 $result = call_user_func_array(array($className, 'getTree'), array(&$this, &$parent, $extensions[$option]->params));
             }
         }
     }
     return $this->_list;
 }
コード例 #7
0
ファイル: com_content.php プロジェクト: lepca/OSMap
 /**
  * Get all content items within a content category.
  * Returns an array of all contained content items.
  *
  * @since 2.0
  */
 public static function includeCategoryContent($osmap, $parent, $catid, &$params, $Itemid)
 {
     $db = JFactory::getDBO();
     // We do not do ordering for XML sitemap.
     if ($osmap->view != 'xml') {
         $orderby = self::buildContentOrderBy($parent->params, $parent->id, $Itemid);
         //$orderby = !empty($menuparams['orderby']) ? $menuparams['orderby'] : (!empty($menuparams['orderby_sec']) ? $menuparams['orderby_sec'] : 'rdate' );
         //$orderby = self::orderby_sec($orderby);
     }
     if ($params['include_archived']) {
         $where = array('(a.state = 1 or a.state = 2)');
     } else {
         $where = array('a.state = 1');
     }
     if ($catid == 'featured') {
         $where[] = 'a.featured=1';
     } elseif ($catid == 'archived') {
         $where = array('a.state=2');
     } elseif (is_numeric($catid)) {
         $where[] = 'a.catid=' . (int) $catid;
     }
     if ($params['max_art_age'] || $osmap->isNews) {
         $days = $osmap->isNews && ($params['max_art_age'] > 3 || !$params['max_art_age']) ? 3 : $params['max_art_age'];
         $where[] = "( a.created >= '" . date('Y-m-d H:i:s', time() - $days * 86400) . "' ) ";
     }
     if ($params['language_filter']) {
         $where[] = 'a.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')';
     }
     if (!$params['show_unauth']) {
         $where[] = 'a.access IN (' . $params['groups'] . ') ';
     }
     $query = 'SELECT a.id, a.title, a.alias, a.catid, ' . 'a.created created, a.modified modified, attribs as params, metadata' . ',a.language' . ($params['add_images'] || $params['add_pagebreaks'] ? ',a.introtext, a.fulltext ' : ' ') . 'FROM #__content AS a ' . 'LEFT JOIN #__content_frontpage AS fp ON a.id = fp.content_id ' . 'WHERE ' . implode(' AND ', $where) . ' AND ' . '      (a.publish_up = ' . $params['nullDate'] . ' OR a.publish_up <= ' . $params['nowDate'] . ') AND ' . '      (a.publish_down = ' . $params['nullDate'] . ' OR a.publish_down >= ' . $params['nowDate'] . ') ' . ($osmap->view != 'xml' ? "\n ORDER BY {$orderby}  " : '') . ($params['max_art'] ? "\n LIMIT {$params['max_art']}" : '');
     $db->setQuery($query);
     $items = $db->loadObjectList();
     if (count($items) > 0) {
         $osmap->changeLevel(1);
         foreach ($items as $item) {
             if (OSMAP_LICENSE === 'pro') {
                 $content = new Alledia\OSMap\Pro\Joomla\Item($item);
                 if (!$content->isVisibleForRobots()) {
                     continue;
                 }
             }
             $node = new stdclass();
             $node->id = $parent->id;
             $node->uid = $parent->uid . 'a' . $item->id;
             $node->browserNav = $parent->browserNav;
             $node->priority = $params['art_priority'];
             $node->changefreq = $params['art_changefreq'];
             $node->name = $item->title;
             $node->modified = $item->modified;
             $node->expandible = false;
             $node->secure = $parent->secure;
             // TODO: Should we include category name or metakey here?
             // $node->keywords = $item->metakey;
             $node->newsItem = 1;
             $node->language = $item->language;
             // For the google news we should use te publication date instead
             // the last modification date. See
             if ($osmap->isNews || !$node->modified) {
                 $node->modified = $item->created;
             }
             $node->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id;
             //$node->catslug = $item->category_route ? ($catid . ':' . $item->category_route) : $catid;
             $node->catslug = $item->catid;
             $node->link = ContentHelperRoute::getArticleRoute($node->slug, $node->catslug);
             // Add images to the article
             $text = @$item->introtext . @$item->fulltext;
             if ($params['add_images']) {
                 if (OSMAP_LICENSE === 'pro') {
                     $node->images = Alledia\OSMap\Pro\Joomla\Helper::getImages($text, JArrayHelper::getValue($params, 'max_images', 1000));
                 } else {
                     $node->images = OSMapHelper::getImages($text, JArrayHelper::getValue($params, 'max_images', 1000));
                 }
             }
             if ($params['add_pagebreaks']) {
                 $subnodes = OSMapHelper::getPagebreaks($text, $node->link);
                 $node->expandible = count($subnodes) > 0;
                 // This article has children
             }
             if ($osmap->printNode($node) && $node->expandible) {
                 self::printNodes($osmap, $parent, $params, $subnodes);
             }
         }
         $osmap->changeLevel(-1);
     }
     return true;
 }