/**
  * @param XmapDisplayerInterface $xmap
  * @param stdClass $parent
  * @param array $params
  */
 public static function getTree($xmap, stdClass $parent, array &$params)
 {
     $uri = new JUri($parent->link);
     if (!self::$enabled || !in_array($uri->getVar('view'), self::$views)) {
         return;
     }
     $params['include_entries'] = JArrayHelper::getValue($params, 'include_entries', 1);
     $params['include_entries'] = $params['include_entries'] == 1 || $params['include_entries'] == 2 && $xmap->view == 'xml' || $params['include_entries'] == 3 && $xmap->view == 'html';
     $params['include_expired_entries'] = JArrayHelper::getValue($params, 'include_expired_entries', 0);
     $params['include_expired_entries'] = $params['include_expired_entries'] == 1 || $params['include_expired_entries'] == 2 && $xmap->view == 'xml' || $params['include_expired_entries'] == 3 && $xmap->view == 'html';
     $params['category_priority'] = JArrayHelper::getValue($params, 'category_priority', $parent->priority);
     $params['category_changefreq'] = JArrayHelper::getValue($params, 'category_changefreq', $parent->changefreq);
     if ($params['category_priority'] == -1) {
         $params['category_priority'] = $parent->priority;
     }
     if ($params['category_changefreq'] == -1) {
         $params['category_changefreq'] = $parent->changefreq;
     }
     $params['entry_priority'] = JArrayHelper::getValue($params, 'entry_priority', $parent->priority);
     $params['entry_changefreq'] = JArrayHelper::getValue($params, 'entry_changefreq', $parent->changefreq);
     if ($params['entry_priority'] == -1) {
         $params['entry_priority'] = $parent->priority;
     }
     if ($params['entry_changefreq'] == -1) {
         $params['entry_changefreq'] = $parent->changefreq;
     }
     switch ($uri->getVar('view')) {
         case 'front':
             self::getCategoryTree($xmap, $parent, $params, 0);
             break;
         case 'list':
             self::getEntries($xmap, $parent, $params, $uri->getVar('catid'));
             break;
     }
 }
 /**
  * @param XmapDisplayerInterface $xmap
  * @param stdClass $parent
  * @param array $params
  *
  * @throws Exception
  */
 public static function getTree($xmap, stdClass $parent, array &$params)
 {
     $uri = new JUri($parent->link);
     if (!self::$enabled || !in_array($uri->getVar('view'), self::$views)) {
         return;
     }
     $params['groups'] = implode(',', JFactory::getUser()->getAuthorisedViewLevels());
     $params['language_filter'] = JFactory::getApplication()->getLanguageFilter();
     $params['enable_imagemap'] = JArrayHelper::getValue($params, 'enable_imagemap', 0);
     $params['image_type'] = JArrayHelper::getValue($params, 'image_type', 'original');
     $params['include_images'] = JArrayHelper::getValue($params, 'include_images', 1);
     $params['include_images'] = $params['include_images'] == 1 || $params['include_images'] == 2 && $xmap->view == 'xml' || $params['include_images'] == 3 && $xmap->view == 'html';
     $params['show_unauth'] = JArrayHelper::getValue($params, 'show_unauth', 0);
     $params['show_unauth'] = $params['show_unauth'] == 1 || $params['show_unauth'] == 2 && $xmap->view == 'xml' || $params['show_unauth'] == 3 && $xmap->view == 'html';
     $params['category_priority'] = JArrayHelper::getValue($params, 'category_priority', $parent->priority);
     $params['category_changefreq'] = JArrayHelper::getValue($params, 'category_changefreq', $parent->changefreq);
     if ($params['category_priority'] == -1) {
         $params['category_priority'] = $parent->priority;
     }
     if ($params['category_changefreq'] == -1) {
         $params['category_changefreq'] = $parent->changefreq;
     }
     $params['image_priority'] = JArrayHelper::getValue($params, 'image_priority', $parent->priority);
     $params['image_changefreq'] = JArrayHelper::getValue($params, 'image_changefreq', $parent->changefreq);
     if ($params['image_priority'] == -1) {
         $params['image_priority'] = $parent->priority;
     }
     if ($params['image_changefreq'] == -1) {
         $params['image_changefreq'] = $parent->changefreq;
     }
     self::getCategoryTree($xmap, $parent, $params, $uri->getVar('id', 0));
 }
 /**
  * @param XmapDisplayerInterface $xmap
  * @param stdClass $parent
  * @param array $params
  */
 public static function getTree($xmap, stdClass $parent, array &$params)
 {
     $uri = new JUri($parent->link);
     if (!self::$enabled || !in_array($uri->getVar('view'), self::$views)) {
         return;
     }
     $params['groups'] = implode(',', JFactory::getUser()->getAuthorisedViewLevels());
     $params['include_events'] = JArrayHelper::getValue($params, 'include_events', 1);
     $params['include_events'] = $params['include_events'] == 1 || $params['include_events'] == 2 && $xmap->view == 'xml' || $params['include_events'] == 3 && $xmap->view == 'html';
     $params['show_unauth'] = JArrayHelper::getValue($params, 'show_unauth', 0);
     $params['show_unauth'] = $params['show_unauth'] == 1 || $params['show_unauth'] == 2 && $xmap->view == 'xml' || $params['show_unauth'] == 3 && $xmap->view == 'html';
     $params['category_priority'] = JArrayHelper::getValue($params, 'category_priority', $parent->priority);
     $params['category_changefreq'] = JArrayHelper::getValue($params, 'category_changefreq', $parent->changefreq);
     if ($params['category_priority'] == -1) {
         $params['category_priority'] = $parent->priority;
     }
     if ($params['category_changefreq'] == -1) {
         $params['category_changefreq'] = $parent->changefreq;
     }
     $params['event_priority'] = JArrayHelper::getValue($params, 'event_priority', $parent->priority);
     $params['event_changefreq'] = JArrayHelper::getValue($params, 'event_changefreq', $parent->changefreq);
     if ($params['event_priority'] == -1) {
         $params['event_priority'] = $parent->priority;
     }
     if ($params['event_changefreq'] == -1) {
         $params['event_changefreq'] = $parent->changefreq;
     }
     self::getEvents($xmap, $parent, $params, $uri->getVar('catid'));
 }
 /**
  * @param XmapDisplayerInterface $xmap
  * @param stdClass $parent
  * @param array $params
  */
 public static function getTree($xmap, stdClass $parent, array &$params)
 {
     $uri = new JUri($parent->link);
     if ($xmap->isNews || !self::$enabled || !in_array($uri->getVar('view'), self::$views)) {
         return;
     }
     $params['include_topics'] = JArrayHelper::getValue($params, 'include_topics', 1);
     $params['include_topics'] = $params['include_topics'] == 1 || $params['include_topics'] == 2 && $xmap->view == 'xml' || $params['include_topics'] == 3 && $xmap->view == 'html';
     $params['include_pagination'] = JArrayHelper::getValue($params, 'include_pagination', 0);
     $params['include_pagination'] = $params['include_pagination'] == 1 || $params['include_pagination'] == 2 && $xmap->view == 'xml' || $params['include_pagination'] == 3 && $xmap->view == 'html';
     $params['cat_priority'] = JArrayHelper::getValue($params, 'cat_priority', $parent->priority);
     $params['cat_priority'] = $params['cat_priority'] == -1 ? $parent->priority : $params['cat_priority'];
     $params['cat_changefreq'] = JArrayHelper::getValue($params, 'cat_changefreq', $parent->changefreq);
     $params['cat_changefreq'] = $params['cat_changefreq'] == -1 ? $parent->changefreq : $params['cat_changefreq'];
     $params['topic_priority'] = JArrayHelper::getValue($params, 'topic_priority', $parent->changefreq);
     $params['topic_priority'] = $params['topic_priority'] == -1 ? $parent->priority : $params['topic_priority'];
     $params['topic_changefreq'] = JArrayHelper::getValue($params, 'topic_changefreq', $parent->changefreq);
     $params['topic_changefreq'] = $params['topic_changefreq'] == -1 ? $parent->changefreq : $params['topic_changefreq'];
     if ($params['include_topics']) {
         if ((int) ($limit = JArrayHelper::getValue($params, 'max_topics', 0))) {
             $params['limit'] = $limit;
         } else {
             $params['limit'] = 0;
         }
         if ((int) ($days = JArrayHelper::getValue($params, 'max_age', 0))) {
             $params['days'] = JFactory::getDate()->toUnix() - intval($days) * 86400;
         } else {
             $params['days'] = '';
         }
     }
     self::getCategoryTree($xmap, $parent, $params, $uri->getVar('catid', 0));
 }
 /**
  * Test the delVar method.
  *
  * @return  void
  *
  * @since   11.1
  * @covers  JUri::delVar
  */
 public function testDelVar()
 {
     $this->object->parse('http://*****:*****@www.example.com:80/path/file.html?var=value#fragment');
     $this->assertThat($this->object->getVar('var'), $this->equalTo('value'));
     $this->object->delVar('var');
     $this->assertThat($this->object->getVar('var'), $this->equalTo(''));
 }
 /**
  * @param XmapDisplayerInterface $xmap
  * @param stdClass $parent
  * @param array $params
  */
 public static function getTree($xmap, stdClass $parent, array &$params)
 {
     $uri = new JUri($parent->link);
     if (!self::$enabled || !in_array($uri->getVar('view'), self::$views)) {
         return;
     }
     $params['groups'] = implode(',', JFactory::getUser()->getAuthorisedViewLevels());
     $params['language_filter'] = $uri->getVar('tag_list_language_filter');
     $params['include_tags'] = JArrayHelper::getValue($params, 'include_tags', 1);
     $params['include_tags'] = $params['include_tags'] == 1 || $params['include_tags'] == 2 && $xmap->view == 'xml' || $params['include_tags'] == 3 && $xmap->view == 'html';
     $params['show_unauth'] = JArrayHelper::getValue($params, 'show_unauth', 0);
     $params['show_unauth'] = $params['show_unauth'] == 1 || $params['show_unauth'] == 2 && $xmap->view == 'xml' || $params['show_unauth'] == 3 && $xmap->view == 'html';
     $params['tag_priority'] = JArrayHelper::getValue($params, 'tag_priority', $parent->priority);
     $params['tag_changefreq'] = JArrayHelper::getValue($params, 'tag_changefreq', $parent->changefreq);
     if ($params['tag_priority'] == -1) {
         $params['tag_priority'] = $parent->priority;
     }
     if ($params['tag_changefreq'] == -1) {
         $params['tag_changefreq'] = $parent->changefreq;
     }
     switch ($uri->getVar('view')) {
         case 'tags':
             self::getTagsTree($xmap, $parent, $params, $uri->getVar('parent_id', 0));
             break;
         case 'tag':
             self::getTagTree($xmap, $parent, $params, (array) $uri->getVar('id'), (array) $uri->getVar('types'));
             break;
     }
 }
示例#7
0
 /**
  * @param XmapDisplayerInterface $xmap
  * @param stdClass $parent
  * @param array $params
  *
  * @return bool
  */
 public static function getTree($xmap, stdClass $parent, array &$params)
 {
     $uri = new JUri($parent->link);
     if (!self::$enabled || !in_array($uri->getVar('layout'), self::$layouts)) {
         return false;
     }
     $params['groups'] = implode(',', JFactory::getUser()->getAuthorisedViewLevels());
     $params['language_filter'] = JFactory::getApplication()->getLanguageFilter();
     $params['include_items'] = JArrayHelper::getValue($params, 'include_items', 1);
     $params['include_items'] = $params['include_items'] == 1 || $params['include_items'] == 2 && $xmap->view == 'xml' || $params['include_items'] == 3 && $xmap->view == 'html';
     $params['show_unauth'] = JArrayHelper::getValue($params, 'show_unauth', 0);
     $params['show_unauth'] = $params['show_unauth'] == 1 || $params['show_unauth'] == 2 && $xmap->view == 'xml' || $params['show_unauth'] == 3 && $xmap->view == 'html';
     $params['category_priority'] = JArrayHelper::getValue($params, 'category_priority', $parent->priority);
     $params['category_priority'] = $params['category_priority'] == -1 ? $parent->priority : $params['category_priority'];
     $params['category_changefreq'] = JArrayHelper::getValue($params, 'category_changefreq', $parent->changefreq);
     $params['category_changefreq'] = $params['category_changefreq'] == -1 ? $parent->changefreq : $params['category_changefreq'];
     $params['item_priority'] = JArrayHelper::getValue($params, 'item_priority', $parent->priority);
     $params['item_priority'] = $params['item_priority'] == -1 ? $parent->priority : $params['item_priority'];
     $params['item_changefreq'] = JArrayHelper::getValue($params, 'item_changefreq', $parent->changefreq);
     $params['item_changefreq'] = $params['item_changefreq'] == -1 ? $parent->changefreq : $params['item_changefreq'];
     switch ($uri->getVar('layout')) {
         case 'category':
             $categories = JFactory::getApplication()->getMenu()->getItem($parent->id)->params->get('categories');
             if (count($categories) == 1) {
                 return self::getItems($xmap, $parent, $params, 'category', $categories[0]);
             } elseif (count($categories) > 1) {
                 return self::getCategoryTree($xmap, $parent, $params, 0, $categories);
             } else {
                 return self::getCategoryTree($xmap, $parent, $params, 0);
             }
             break;
         case 'tag':
             return self::getItems($xmap, $parent, $params, 'tag', $uri->getVar('tag'));
             break;
         case 'user':
             return self::getItems($xmap, $parent, $params, 'user', $uri->getVar('id'));
             break;
     }
 }
 /**
  * @param XmapDisplayerInterface $xmap
  * @param stdClass $parent
  * @param array $params
  *
  * @throws Exception
  */
 public static function getTree($xmap, stdClass $parent, array &$params)
 {
     $uri = new JUri($parent->link);
     if (!self::$enabled || !in_array($uri->getVar('view'), self::$views)) {
         return;
     }
     $params['groups'] = implode(',', JFactory::getUser()->getAuthorisedViewLevels());
     $params['language_filter'] = JFactory::getApplication()->getLanguageFilter();
     $params['itemid_workaround'] = JArrayHelper::getValue($params, 'itemid_workaround', 0);
     $params['include_downloads'] = JArrayHelper::getValue($params, 'include_downloads', 1);
     $params['include_downloads'] = $params['include_downloads'] == 1 || $params['include_downloads'] == 2 && $xmap->view == 'xml' || $params['include_downloads'] == 3 && $xmap->view == 'html';
     $params['show_unauth'] = JArrayHelper::getValue($params, 'show_unauth', 0);
     $params['show_unauth'] = $params['show_unauth'] == 1 || $params['show_unauth'] == 2 && $xmap->view == 'xml' || $params['show_unauth'] == 3 && $xmap->view == 'html';
     $params['category_priority'] = JArrayHelper::getValue($params, 'category_priority', $parent->priority);
     $params['category_changefreq'] = JArrayHelper::getValue($params, 'category_changefreq', $parent->changefreq);
     if ($params['category_priority'] == -1) {
         $params['category_priority'] = $parent->priority;
     }
     if ($params['category_changefreq'] == -1) {
         $params['category_changefreq'] = $parent->changefreq;
     }
     $params['download_priority'] = JArrayHelper::getValue($params, 'download_priority', $parent->priority);
     $params['download_changefreq'] = JArrayHelper::getValue($params, 'download_changefreq', $parent->changefreq);
     if ($params['download_priority'] == -1) {
         $params['download_priority'] = $parent->priority;
     }
     if ($params['download_changefreq'] == -1) {
         $params['download_changefreq'] = $parent->changefreq;
     }
     switch ($uri->getVar('view')) {
         case 'categories':
             self::getCategoryTree($xmap, $parent, $params, 0);
             break;
         case 'category':
             self::getDownloads($xmap, $parent, $params, $uri->getVar('id'));
             break;
     }
 }
 /**
  * @param XmapDisplayerInterface $xmap
  * @param stdClass $parent
  * @param array $params
  *
  * @throws Exception
  */
 public static function getTree($xmap, stdClass $parent, array &$params)
 {
     $uri = new JUri($parent->link);
     if (!self::$enabled || !in_array($uri->getVar('view'), self::$views)) {
         return;
     }
     $params['groups'] = implode(',', JFactory::getUser()->getAuthorisedViewLevels());
     $params['include_newsletter'] = JArrayHelper::getValue($params, 'include_newsletter', 1);
     $params['include_newsletter'] = $params['include_newsletter'] == 1 || $params['include_newsletter'] == 2 && $xmap->view == 'xml' || $params['include_newsletter'] == 3 && $xmap->view == 'html';
     $params['show_unauth'] = JArrayHelper::getValue($params, 'show_unauth', 0);
     $params['show_unauth'] = $params['show_unauth'] == 1 || $params['show_unauth'] == 2 && $xmap->view == 'xml' || $params['show_unauth'] == 3 && $xmap->view == 'html';
     $params['list_priority'] = JArrayHelper::getValue($params, 'list_priority', $parent->priority);
     $params['list_changefreq'] = JArrayHelper::getValue($params, 'list_changefreq', $parent->changefreq);
     if ($params['list_priority'] == -1) {
         $params['list_priority'] = $parent->priority;
     }
     if ($params['list_changefreq'] == -1) {
         $params['list_changefreq'] = $parent->changefreq;
     }
     $params['newsletter_priority'] = JArrayHelper::getValue($params, 'newsletter_priority', $parent->priority);
     $params['newsletter_changefreq'] = JArrayHelper::getValue($params, 'newsletter_changefreq', $parent->changefreq);
     if ($params['newsletter_priority'] == -1) {
         $params['newsletter_priority'] = $parent->priority;
     }
     if ($params['newsletter_changefreq'] == -1) {
         $params['newsletter_changefreq'] = $parent->changefreq;
     }
     switch ($uri->getVar('view')) {
         case 'lists':
             self::getListsTree($xmap, $parent, $params);
             break;
         case 'archive':
             $item = JFactory::getApplication()->getMenu()->getItem($parent->id);
             self::getNewsletter($xmap, $parent, $params, $item->params->get('listid'));
             break;
     }
 }
示例#10
0
 public function getTree($osmap, $parent, &$params)
 {
     $uri = new JUri($parent->link);
     if (!static::isEnabled() || !in_array($uri->getVar('view'), static::$views)) {
         return;
     }
     $params['groups'] = implode(',', JFactory::getUser()->getAuthorisedViewLevels());
     $params['language_filter'] = JFactory::getApplication()->getLanguageFilter();
     $params['include_links'] = JArrayHelper::getValue($params, 'include_links', 1);
     $params['include_links'] = $params['include_links'] == 1 || $params['include_links'] == 2 && $osmap->view == 'xml' || $params['include_links'] == 3 && $osmap->view == 'html';
     $params['show_unauth'] = JArrayHelper::getValue($params, 'show_unauth', 0);
     $params['show_unauth'] = $params['show_unauth'] == 1 || $params['show_unauth'] == 2 && $osmap->view == 'xml' || $params['show_unauth'] == 3 && $osmap->view == 'html';
     $params['category_priority'] = JArrayHelper::getValue($params, 'category_priority', $parent->priority);
     $params['category_changefreq'] = JArrayHelper::getValue($params, 'category_changefreq', $parent->changefreq);
     if ($params['category_priority'] == -1) {
         $params['category_priority'] = $parent->priority;
     }
     if ($params['category_changefreq'] == -1) {
         $params['category_changefreq'] = $parent->changefreq;
     }
     $params['link_priority'] = JArrayHelper::getValue($params, 'link_priority', $parent->priority);
     $params['link_changefreq'] = JArrayHelper::getValue($params, 'link_changefreq', $parent->changefreq);
     if ($params['link_priority'] == -1) {
         $params['link_priority'] = $parent->priority;
     }
     if ($params['link_changefreq'] == -1) {
         $params['link_changefreq'] = $parent->changefreq;
     }
     switch ($uri->getVar('view')) {
         case 'categories':
             static::getCategoryTree($osmap, $parent, $params, $uri->getVar('id'));
             break;
         case 'category':
             static::getlinks($osmap, $parent, $params, $uri->getVar('id'));
             break;
     }
 }
 /**
  * @param XmapDisplayerInterface $xmap
  * @param stdClass $parent
  * @param array $params
  */
 public static function getTree($xmap, stdClass $parent, array &$params)
 {
     $uri = new JUri($parent->link);
     if (!self::$enabled || !in_array($uri->getVar('view'), self::$views)) {
         return;
     }
     $params['level_priority'] = JArrayHelper::getValue($params, 'level_priority', $parent->priority);
     $params['level_changefreq'] = JArrayHelper::getValue($params, 'level_changefreq', $parent->changefreq);
     if ($params['level_priority'] == -1) {
         $params['level_priority'] = $parent->priority;
     }
     if ($params['level_changefreq'] == -1) {
         $params['level_changefreq'] = $parent->changefreq;
     }
     self::getLevels($xmap, $parent, $params);
 }
示例#12
0
 /**
  * smartUrlConvertor
  *
  * @param JUri  $uri
  * @param array $button
  *
  * @return  mixed
  */
 public function smartUrlConvertor($uri, $button)
 {
     // fix task redirect
     if ($uri->getVar('layout') == 'edit') {
         $uri->setVar('task', "{$uri->getVar('view')}.{$uri->getVar('layout')}");
         $uri->delVar('view');
         $uri->delVar('layout');
     }
     return $uri;
 }
示例#13
0
 /**
  * @param array $matches
  * @return string
  */
 private function appendHtml(array $matches)
 {
     $html = $matches[0];
     if (strpos($matches[2], 'task=style.edit')) {
         $uri = new JUri($matches[2]);
         $id = (int) $uri->getVar('id');
         if ($id && in_array($uri->getVar('option'), ['com_templates', 'com_advancedtemplates']) && isset($this->styles[$id])) {
             $html = $matches[1] . $uri . $matches[3] . $matches[4] . $matches[5];
             $html .= ' <span class="label" style="background:#439a86;color:#fff;">Gantry 5</span>';
         }
     }
     return $html;
 }
示例#14
0
文件: menuary.php 项目: gruz/MenuAry
        /**
         * Appends HTML to menu items
         *
         * @param   array   $matches  Don't remember
         * @param   string  $content  Don't remember
         *
         * @return   string  Html with MenuAry badges inserted
         */
        private function _appendHtml(array $matches, $content = 'MenuAry')
        {
            $html = $matches[0];
            if (strpos($matches[2], 'task=item.edit')) {
                $uri = new JUri($matches[2]);
                $id = (int) $uri->getVar('id');
                if ($id && in_array($uri->getVar('option'), array('com_menus')) && in_array($id, $this->menuitems)) {
                    $html = $matches[1] . $uri . $matches[3] . $matches[4] . $matches[5];
                    $html .= '
					<span
						onMouseOver="this.style.color=\'#00F\'"
						onMouseOut="this.style.color=\'#000\'"
						class="hasTip icon-power-cord" style="
						cursor: help;"
						title="' . JText::_('PLG_MENUARY_MENUITEM_TOOLTIP') . '"></span>';
                }
            }
            return $html;
        }
示例#15
0
	protected static function check($item, JUri $uri)
	{
		$hits = 0;

		foreach ($item->query as $var => $value)
		{
			if ($value != $uri->getVar($var)) {
				return 0;
			}

			$hits++;
		}

		return $hits;
	}
 /**
  * @param plgSystemCommunityBuilder $router
  * @param JUri $uri
  */
 public function buildRule(&$router, &$uri)
 {
     $app = JFactory::getApplication();
     if ($app->isSite() && $this->isRerouteSafe()) {
         if ($uri->getVar('option') == 'com_users') {
             $uri->setVar('option', 'com_comprofiler');
             $view = $uri->getVar('task');
             if (!$view) {
                 $view = $uri->getVar('view');
             }
             switch ($view) {
                 case 'profile':
                     if ($uri->getVar('layout') == 'edit') {
                         $userId = (int) $uri->getVar('user_id');
                         $task = 'userdetails';
                         if ($userId) {
                             $task .= '&user='******'userprofile';
                     }
                     break;
                 case 'registration':
                     $task = 'registers';
                     break;
                 case 'reset':
                 case 'remind':
                     $task = 'lostpassword';
                     break;
                 case 'logout':
                     $task = 'logout';
                     break;
                 case 'login':
                 default:
                     $task = 'login';
                     break;
             }
             $uri->delVar('task');
             $uri->delVar('view');
             $uri->delVar('layout');
             if ($task) {
                 $uri->setVar('view', $task);
             }
             $Itemid = $uri->getVar('Itemid');
             if (!$Itemid) {
                 $Itemid = $this->params->get('itemids', 1) ? $this->getItemid($task) : null;
             }
             $uri->delVar('Itemid');
             if ($Itemid) {
                 $uri->setVar('Itemid', $Itemid);
             }
         }
     }
 }
示例#17
0
 /**
  * @param JRouter $router
  * @param JUri $uri
  */
 function buildRule(&$router, &$uri)
 {
     $MobileJoomla_Device =& MobileJoomla::getDevice();
     if ($MobileJoomla_Device['markup'] != $MobileJoomla_Device['default_markup']) {
         switch ($uri->getVar('format')) {
             case 'feed':
             case 'json':
             case 'xml':
                 return;
         }
         switch ($uri->getVar('type')) {
             case 'rss':
             case 'atom':
                 return;
         }
         if ((is_a($router, 'shRouter') || class_exists('Sh404sefClassRouter')) && $uri->getVar('Itemid') && count($uri->getQuery(true)) == 2) {
             $itemid = $uri->getVar('Itemid');
             $app = JFactory::getApplication();
             $menu = $app->getMenu();
             $item = $menu->getItem($itemid);
             $uri->setQuery($item->query);
             $uri->setVar('Itemid', $itemid);
             $uri->setVar('device', $MobileJoomla_Device['markup']);
         } else {
             $uri->setVar('device', $MobileJoomla_Device['markup']);
         }
     }
 }
示例#18
0
文件: site.php 项目: fur81/zofaxiopeu
 /**
  * Process the build uri query data based on custom defined rules
  *
  * @param   JUri  $uri  The URI
  *
  * @return  void
  */
 protected function _processBuildRules($uri)
 {
     // Make sure any menu vars are used if no others are specified
     if ($this->_mode != JROUTER_MODE_SEF && $uri->getVar('Itemid') && count($uri->getQuery(true)) == 2) {
         $app = JApplication::getInstance('site');
         $menu = $app->getMenu();
         // Get the active menu item
         $itemid = $uri->getVar('Itemid');
         $item = $menu->getItem($itemid);
         if ($item) {
             $uri->setQuery($item->query);
         }
         $uri->setVar('Itemid', $itemid);
     }
     // Process the attached build rules
     parent::_processBuildRules($uri);
     // Get the path data
     $route = $uri->getPath();
     if ($this->_mode == JROUTER_MODE_SEF && $route) {
         if ($limitstart = $uri->getVar('limitstart')) {
             $uri->setVar('start', (int) $limitstart);
             $uri->delVar('limitstart');
         }
     }
     $uri->setPath($route);
 }
示例#19
0
 /**
  * @param array $matches
  * @return string
  */
 private function appendHtml(array $matches, $content = 'Gantry 5')
 {
     $html = $matches[0];
     if (strpos($matches[2], 'task=style.edit') || strpos($matches[2], 'task=module.edit')) {
         $uri = new JUri($matches[2]);
         $id = (int) $uri->getVar('id');
         if ($id && in_array($uri->getVar('option'), array('com_templates', 'com_advancedtemplates', 'com_modules')) && (isset($this->styles[$id]) || isset($this->modules[$id]))) {
             $html = $matches[1] . $uri . $matches[3] . $matches[4] . $matches[5];
             $html .= ' <span class="label" style="background:#439a86;color:#fff;">' . $content . '</span>';
             if ($this->modules[$id]) {
                 unset($this->modules[$id]);
             } else {
                 unset($this->styles[$id]);
             }
         }
     }
     return $html;
 }
示例#20
0
function arsBuildRouteIni(&$query)
{
    $segments = array();
    $view = ArsRouterHelper::getAndPop($query, 'view', 'update');
    $Itemid = ArsRouterHelper::getAndPop($query, 'Itemid', null);
    $local_id = ArsRouterHelper::getAndPop($query, 'id', 'components');
    $task = 'ini';
    $id = '';
    if (!in_array($view, ['Update', 'updates', 'update'])) {
        return $segments;
    }
    // Analyze the current Itemid
    if (!empty($Itemid)) {
        // Get the specified menu
        $menus = JMenu::getInstance('site');
        $menuitem = $menus->getItem($Itemid);
        // Analyze URL
        $uri = new JUri($menuitem->link);
        $option = $uri->getVar('option');
        // Sanity check
        if ($option != 'com_ars') {
            $Itemid = null;
        } else {
            $task = $uri->getVar('task');
            $layout = $uri->getVar('layout');
            $format = $uri->getVar('format', 'ini');
            $id = $uri->getVar('id', null);
            if (empty($task) && !empty($layout)) {
                $task = $layout;
            }
            if (empty($task)) {
                if ($format == 'ini') {
                    $task = 'ini';
                } else {
                    $task = 'all';
                }
            }
            // make sure we can grab the ID specified in menu item options
            if (empty($id)) {
                switch ($task) {
                    case 'category':
                        $params = $menuitem->params instanceof JRegistry ? $menuitem->params : new JRegistry($menuitem->params);
                        $id = $params->get('category', 'components');
                        break;
                    case 'ini':
                    case 'stream':
                        $params = $menuitem->params instanceof JRegistry ? $menuitem->params : new JRegistry($menuitem->params);
                        $id = $params->get('streamid', 0);
                        break;
                }
            }
        }
    }
    // TODO cache this?
    $db = JFactory::getDBO();
    $dbquery = $db->getQuery(true)->select(array($db->qn('type'), $db->qn('alias')))->from($db->qn('#__ars_updatestreams'))->where($db->qn('id') . ' = ' . $db->q($local_id));
    $db->setQuery($dbquery, 0, 1);
    $stream = $db->loadObject();
    if (empty($stream)) {
        die;
    }
    if (empty($Itemid)) {
        // Try to find an Itemid with the same properties
        $otherMenuItem = ArsRouterHelper::findMenu(array('view' => 'updates', 'layout' => 'ini', 'option' => 'com_ars'), array('streamid' => $local_id));
        if (!empty($otherMenuItem)) {
            // Exact match
            $query['Itemid'] = $otherMenuItem->id;
        } else {
            $segments[] = 'updates';
            $segments[] = $stream->type;
            $segments[] = $stream->alias;
        }
    } else {
        // menu item id exists in the query
        if ($task == 'ini' && $id == $local_id) {
            $query['Itemid'] = $Itemid;
        } else {
            $segments[] = 'updates';
            $segments[] = $stream->type;
            $segments[] = $stream->alias;
        }
    }
    return $segments;
}