/** include() all plugin files */ function loadPlugins() { $pathname = JPATH_COMPONENT_ADMINISTRATOR . DS . 'plugins' . DS; $plugins = JoomapPlugins::listPlugins(); foreach ($plugins as $plugin) { include_once $pathname . $plugin; } }
<?php defined('_JEXEC') or die('Direct Access to this location is not allowed.'); // Register with the Plugin Manager $tmp = new Joomap_content(); JoomapPlugins::addPlugin($tmp); /** * A Plugin to show standard Joomla content in the Joomap Sitemap. * * @package Plugins * @author Daniel Grothe * @version $Id: content.plugin.php 12 2008-08-17 20:51:27Z koders.de $ */ class Joomap_content { /** * Keeps the reference of the calling Joomap instance. * @var Joomap */ var $joomap; /** * Keeps the reference of the currenty processed Menu-Item. * * @var stdClass */ var $menuEntry; /** * Checks wether this Plugin is able to handle the passed Menu-Item. * * @param Joomap $joomap * @param Object $menuItem
/** Get a Menu's tree * Get the complete list of menu entries where the menu is in $menutype. * If the component, that is linked to the menuentry, has a registered handler, * this function will call the handler routine and add the complete tree. * A tree with subtrees for each menuentry is returned. */ function &getMenuTree(&$menutype) { global $database; if (strlen($menutype) == 0) { $result = null; return $result; } $menuExluded = explode(',', $this->config->exclmenus); // by mic: fill array with excluded menu IDs // echo '<br />[DEBUG excluded menus] ' . $this->config->exclmenus . '<br />'; /* * noauth is true: - Will show links to registered content, even if the client is not logged in. - The user will need to login to see the item in full. * noauth is false: - Will show only links to content for which the logged in client has access. */ $sql = "SELECT m.id, m.name, m.parent, m.link, m.type, m.browserNav, m.menutype, m.ordering, m.params, m.componentid, c.name AS component" . "\n FROM #__menu AS m" . "\n LEFT JOIN #__components AS c ON m.type='components' AND c.id=m.componentid" . "\n WHERE m.published='1' AND m.menutype = '" . $menutype . "'" . ($this->noauth ? '' : "\n AND m.access <= '" . $this->gid . "'") . "\n ORDER BY m.menutype,m.parent,m.ordering"; // Load all menuentries $database->setQuery($sql); $items = $database->loadObjectList(); if (count($items) <= 0) { //ignore empty menus $result = null; return $result; } $root = array(); foreach ($items as $i => $item) { // Add each menu entry to the root tree. if (in_array($item->id, $menuExluded)) { // ignore exluded menu-items continue; } $node = new stdclass(); $node->tree = JoomapPlugins::getTree($this, $item); // Determine the menu entry's type and call it's handler $node->id = $item->id; $node->name = $item->name; // displayed name of node $node->parent = $item->parent; // id of parent node $node->browserNav = $item->browserNav; // how to open link $node->ordering = isset($item->ordering) ? $item->ordering : $i; // display-order of the menuentry $node->link = isset($item->link) ? htmlspecialchars($item->link) : ''; // convert link to valid xml $node->type = $item->type; // menuentry-type if (isset($item->modified)) { // getTree() might have added a modified date $node->modified = $item->modified; } $root[$node->id] = $node; //add this node to the root tree } foreach ($root as $node) { //move children into the tree of their parent if ($node->parent > 0 && isset($root[$node->parent])) { $root[$node->parent]->tree[] =& $root[$node->id]; } } foreach ($root as $node) { //remove all children from the toptree if ($node->parent > 0) { unset($root[$node->id]); } } usort($root, array('Joomap', 'sort_ordering')); //sort the top tree according to ordering return $root; }