Exemplo n.º 1
0
 function getContactName($id)
 {
     $database =& JFactory::getDBO();
     $sefConfig =& SEFConfig::getConfig();
     $field = 'name';
     if (SEFTools::UseAlias($this->params, 'contact_alias')) {
         $field = 'alias';
     }
     $jfTranslate = $sefConfig->translateNames ? ', `id`' : '';
     $id = intval($id);
     $database->setQuery("SELECT `{$field}` AS `name`, `catid` {$jfTranslate} FROM `#__contact_details` WHERE `id` = '{$id}'");
     $contact = $database->loadObject();
     if (is_null($contact)) {
         JoomSefLogger::Log("Contact with ID {$id} could not be found.", $this, 'com_contact');
         return array();
     }
     if ($contact) {
         $name = ($this->params->get('contactid', '0') != '0' ? $id . '-' : '') . $contact->name;
         if ($this->params->get('category', '1') != '1') {
             return array($name);
         } else {
             return array($this->getCategoryTitle($contact->catid), $name);
         }
     }
 }
Exemplo n.º 2
0
 public function create(&$uri)
 {
     $title = array();
     $vars = $uri->getQuery(true);
     $this->_createNonSefVars($uri);
     // Set menu title
     $title[] = JoomSEF::_getMenuTitle($uri->getVar('option'), $uri->getVar('task'), $uri->getVar('Itemid'));
     if (isset($vars['view'])) {
         switch ($vars['view']) {
             case 'tag':
                 if (isset($vars['id'])) {
                     $tag = $this->getTag($vars['id']);
                     if (is_null($tag)) {
                         JoomSefLogger::Log('Tag with ID ' . $vars['id'] . ' not set.', $this, 'com_tags');
                         return $uri;
                     }
                     $title[] = $tag;
                 }
                 break;
             default:
                 $title[] = $vars['view'];
                 break;
         }
     }
     $newUri = $uri;
     if (count($title) > 0) {
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, $uri->getVar('lang'), $this->nonSefVars, null, null, null, true);
     }
     return $newUri;
 }
Exemplo n.º 3
0
 function create(&$uri)
 {
     $sefConfig =& SEFConfig::getConfig();
     $database =& JFactory::getDBO();
     $vars = $uri->getQuery(true);
     extract($vars);
     $title = array();
     $title[] = JoomSEF::_getMenuTitleLang($option, $this->lang);
     switch (@$view) {
         case 'categories':
             break;
         case 'category':
             $catInfo = $this->getCategoryInfo($id);
             if ($catInfo === false) {
                 JoomSefLogger::Log("Category with ID {$id} could not be found.", $this, 'com_newsfeeds');
             }
             if (is_array($catInfo->path)) {
                 $title = array_merge($title, $catInfo->path);
             }
             break;
         case 'newsfeed':
             $title = array_merge($title, $this->getFeedTitle($id));
             break;
     }
     if (isset($format)) {
         if ($format == 'feed' && isset($type)) {
             $title[] = $type;
         } else {
             $title[] = $format;
         }
     }
     $newUri = $uri;
     if (count($title) > 0) {
         // Generate meta tags
         $this->metatags = $this->getMetaTags();
         $priority = $this->getPriority($uri);
         $sitemap = $this->getSitemapParams($uri);
         if (isset($this->lang)) {
             $lang = $this->lang;
         }
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, null, null, $this->metatags, $priority, false, null, $sitemap);
     }
     return $newUri;
 }
Exemplo n.º 4
0
 function GetBannerName($id)
 {
     $database =& JFactory::getDBO();
     $sefConfig =& SEFConfig::getConfig();
     $field = 'name';
     if (SEFTools::UseAlias($this->params, 'banner_alias')) {
         $field = 'alias';
     }
     $id = intval($id);
     $query = "SELECT id, `{$field}` AS `name`, `language` FROM `#__banners` WHERE `id` = '{$id}'";
     $database->setQuery($query);
     $row = $database->loadObject('stdClass', $this->config->translateItems);
     if (is_null($row)) {
         JoomSefLogger::Log("Banner with ID {$id} could not be found.", $this, 'com_banners');
         return '';
     }
     $this->lang = $row->language;
     $name = isset($row->name) ? $row->name : '';
     if ($this->params->get('banner_id', '0')) {
         $name = $id . '-' . $name;
     }
     return $name;
 }
Exemplo n.º 5
0
 function GetBannerName($id)
 {
     $database =& JFactory::getDBO();
     $sefConfig =& SEFConfig::getConfig();
     $field = 'name';
     if (SEFTools::UseAlias($this->params, 'banner_alias')) {
         $field = 'alias';
     }
     $jfTranslate = $sefConfig->translateNames ? ', `bid`' : '';
     $id = intval($id);
     $query = "SELECT `{$field}` AS `name` {$jfTranslate} FROM `#__banner` WHERE `bid` = '{$id}'";
     $database->setQuery($query);
     $row = $database->loadObject();
     $name = '';
     if (is_null($row)) {
         JoomSefLogger::Log("Banner with ID {$id} could not be found.", $this, 'com_banners');
     } else {
         $name = isset($row->name) ? $row->name : '';
         if ($this->params->get('banner_id', '0')) {
             $name = $id . '-' . $name;
         }
     }
     return $name;
 }
Exemplo n.º 6
0
 function create(&$uri)
 {
     $sefConfig =& SEFConfig::getConfig();
     $vars = $uri->getQuery(true);
     extract($vars);
     $title[] = JoomSEF::_getMenuTitleLang($option, $this->lang, @$Itemid);
     switch (@$view) {
         case 'categories':
             break;
         case 'category':
             $catInfo = $this->getCategoryInfo($id);
             if ($catInfo === false) {
                 JoomSefLogger::Log("Category with ID {$id} could not be found.", $this, 'com_weblinks');
             }
             if (is_array($catInfo->path)) {
                 $title = array_merge($title, $catInfo->path);
             }
             break;
         case 'form':
             if (isset($w_id)) {
                 $title = array_merge($title, $this->getWeblinkTitle(@$w_id));
             }
             break;
         case 'weblink':
             if (!empty($id)) {
                 $title = array_merge($title, $this->getWeblinkTitle($id));
             } else {
                 if ($this->params->get('always_en', '0') == '1') {
                     $title[] = 'Submit';
                 } else {
                     $title[] = JText::_('COM_SEF_SUBMIT');
                 }
             }
             break;
     }
     switch (@$task) {
         case 'weblink.go':
             if (!empty($id)) {
                 $title = array_merge($title, $this->getWeblinkTitle($id));
             } else {
                 if ($this->params->get('always_en', '0') == '1') {
                     $title[] = 'Submit';
                 } else {
                     $title[] = JText::_('COM_SEF_SUBMIT');
                 }
             }
             break;
         case 'new':
             $title[] = 'new' . $sefConfig->suffix;
             break;
         case 'weblink.edit':
             $title = array_merge($title, $this->getWeblinkTitle(@$w_id));
             if ($this->params->get('always_en', '0') == '1') {
                 $title[] = 'Edit';
             } else {
                 $title[] = JText::_('COM_SEF_EDIT');
             }
             if (@$return) {
                 $nonSefVars['return'] = $return;
             }
             break;
     }
     if (@$format) {
         if ($format == 'feed' && @$type) {
             $title[] = ucfirst($type);
         } else {
             $title[] = ucfirst($format);
         }
     }
     $newUri = $uri;
     if (count($title)) {
         // Generate meta tags
         $this->metatags = $this->getMetaTags();
         $priority = $this->getPriority($uri);
         $sitemap = $this->getSitemapParams($uri);
         if (isset($this->lang)) {
             $lang = $this->lang;
         }
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, @$nonSefVars, null, $this->metatags, $priority, false, null, $sitemap);
     }
     return $newUri;
 }
Exemplo n.º 7
0
 public function create(&$uri)
 {
     $this->metadesc = null;
     $this->cat_desc = null;
     $this->item_desc = null;
     $sefConfig =& SEFConfig::getConfig();
     $title = array();
     $vars = $uri->getQuery(true);
     extract($vars);
     $this->_createNonSefVars($uri);
     // Set title.
     $title[] = JoomSEF::_getMenuTitleLang(@$option, $this->lang, @$Itemid);
     switch (@$view) {
         case 'form':
             // 13.2.2012, dajo: Don't SEF
             return $uri;
             //$this->nonSefVars = array();
             //$this->nonSefVars["return"]=@$return;
             //if(isset($a_id)) {
             //    $title=array_merge($title,$this->_getArticle($a_id));
             //}
             //$title[] = JText::_('COM_SEF_FORM');
             //break;
         //$this->nonSefVars = array();
         //$this->nonSefVars["return"]=@$return;
         //if(isset($a_id)) {
         //    $title=array_merge($title,$this->_getArticle($a_id));
         //}
         //$title[] = JText::_('COM_SEF_FORM');
         //break;
         case 'featured':
             if (isset($format) && $format == "feed") {
                 @($title[] = $type);
             }
             $title = array_merge($title, $this->_processPagination($uri));
             break;
         case 'categories':
             break;
         case 'category':
             if (isset($id)) {
                 $catInfo = $this->getCategoryInfo($id);
                 if ($catInfo === false) {
                     JoomSefLogger::Log("Category with ID {$id} could not be found.", $this, 'com_content');
                     return $uri;
                 }
                 if (is_array($catInfo->path) && count($catInfo->path) > 0) {
                     $title = array_merge($title, $catInfo->path);
                 }
             }
             if ($this->params->get('add_layout') == 2 || $this->params->get('add_layout') == 1 && $this->params->get('def_layout') != @$layout) {
                 @($title[] = $layout);
             }
             if (isset($format) && $format == "feed") {
                 @($title[] = $type);
             }
             $title = array_merge($title, $this->_processPagination($uri));
             break;
         case 'article':
             $articleInfo = $this->_getArticle($id);
             if (!$articleInfo) {
                 return $uri;
             }
             $title = array_merge($title, $articleInfo);
             $title = array_merge($title, $this->_processPagination($uri));
             break;
         case 'archive':
             if (!empty($year)) {
                 $title[] = $year;
             }
             if (!empty($month)) {
                 $title[] = $month;
             }
             $title = array_merge($title, $this->_processPagination($uri));
             break;
         default:
             switch (@$task) {
                 case 'article.add':
                     if (isset($catid)) {
                         $catInfo = $this->getCategoryInfo($catid);
                         if ($catInfo === false) {
                             JoomSefLogger::Log("Category with ID {$catid} could not be found.", $this, 'com_content');
                             return $uri;
                         }
                         if (is_array($catInfo->path) && count($catInfo->path) > 0) {
                             $title = array_merge($title, $catInfo->path);
                         }
                     }
                     if ($this->params->get('always_en', '0') == '1') {
                         $title[] = 'New';
                     } else {
                         $title[] = JText::_('COM_SEF_NEW');
                     }
                     break;
                 case 'article.edit':
                     if (isset($a_id)) {
                         $title = array_merge($title, $this->_getArticle($a_id));
                     }
                     if ($this->params->get('always_en', '0') == '1') {
                         $title[] = 'Edit';
                     } else {
                         $title[] = JText::_('COM_SEF_EDIT');
                     }
                     break;
                 default:
                     // Don't SEF
                     return $uri;
             }
             break;
     }
     // Handle printing
     if (isset($print) && intval($print) == 1) {
         if ($this->params->get('always_en', '0') == '1') {
             $title[] = 'Print';
         } else {
             $title[] = JText::_('JGLOBAL_PRINT');
         }
     }
     $newUri = $uri;
     if (count($title) > 0) {
         // Generate meta tags
         $this->metatags = $this->getMetaTags();
         if ($this->params->get('meta_titlepage', '0') == '1' && !empty($this->pageNumberText)) {
             // Add page number to page title
             if (!empty($this->metatags["metatitle"])) {
                 $this->metatags["metatitle"] .= ' - ' . $this->pageNumberText;
             } else {
                 $this->metatags["metatitle"] = (!empty($this->pageTitle) ? $this->pageTitle . ' - ' : '') . $this->pageNumberText;
             }
         }
         $priority = $this->getPriority($uri);
         $sitemap = $this->getSitemapParams($uri);
         if (isset($this->lang)) {
             $lang = $this->lang;
         }
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, $this->nonSefVars, null, $this->metatags, $priority, true, null, $sitemap);
     }
     return $newUri;
 }
Exemplo n.º 8
0
 function beforeCreate(&$uri)
 {
     $db =& JFactory::getDBO();
     $params = SEFTools::GetExtParams('com_content');
     // Compatibility mode
     $comp = $params->get('compatibility', '0');
     // Change task=view to view=article for old urls
     if (!is_null($uri->getVar('task')) && $uri->getVar('task') == 'view') {
         if ($comp == '0') {
             $uri->delVar('task');
         }
         $uri->setVar('view', 'article');
     }
     // Add the task=view in compatibility mode
     if ($comp != '0') {
         if (is_null($uri->getVar('task')) && !is_null($uri->getVar('view')) && $uri->getVar('view') == 'article') {
             $uri->setVar('task', 'view');
         }
     }
     // remove the limitstart and limit variables if they point to the first page
     if (!is_null($uri->getVar('limitstart')) && $uri->getVar('limitstart') == '0') {
         $uri->delVar('limitstart');
         $uri->delVar('limit');
     }
     // Try to guess the correct Itemid if set to
     if ($params->get('guessId', '0') != '0') {
         if (!is_null($uri->getVar('Itemid')) && !is_null($uri->getVar('id'))) {
             $mainframe =& JFactory::getApplication();
             $i = $mainframe->getItemid($uri->getVar('id'));
             $uri->setVar('Itemid', $i);
         }
     }
     // Remove the part after ':' from variables
     if (!is_null($uri->getVar('id'))) {
         SEFTools::fixVariable($uri, 'id');
     }
     if (!is_null($uri->getVar('catid'))) {
         SEFTools::fixVariable($uri, 'catid');
     }
     // If catid not given, try to find it
     $catid = $uri->getVar('catid');
     if (!is_null($uri->getVar('view')) && $uri->getVar('view') == 'article' && !is_null($uri->getVar('id')) && empty($catid)) {
         $id = intval($uri->getVar('id'));
         $query = "SELECT `catid` FROM `#__content` WHERE `id` = '{$id}'";
         $db->setQuery($query);
         $catid = $db->loadResult();
         if (is_null($catid)) {
             JoomSefLogger::Log("Article with ID {$id} could not be found.", $this, 'com_content');
         } else {
             $uri->setVar('catid', $catid);
         }
     }
     // add the view variable if it's not set
     if (is_null($uri->getVar('view'))) {
         if (is_null($uri->getVar('id'))) {
             $uri->setVar('view', 'frontpage');
         } else {
             $uri->setVar('view', 'article');
         }
     }
     return;
 }
Exemplo n.º 9
0
 function create(&$uri)
 {
     $this->metadesc = null;
     // Extract variables
     $vars = $uri->getQuery(true);
     extract($vars);
     $this->params = SEFTools::getExtParams('com_contact');
     $title[] = JoomSEF::_getMenuTitleLang(@$option, $this->lang, @$Itemid);
     if (isset($view)) {
         switch ($view) {
             case 'categories':
             case 'featured':
                 break;
             case 'category':
                 $catInfo = $this->getCategoryInfo($id);
                 if ($catInfo === false) {
                     JoomSefLogger::Log("Category with ID {$id} could not be found.", $this, 'com_contact');
                 }
                 if (is_array($catInfo->path)) {
                     $title = array_merge($title, $catInfo->path);
                 }
                 break;
             case 'contact':
                 $title = array_merge($title, $this->getContactName($id));
                 break;
         }
     }
     if (!empty($format)) {
         if ($format == 'feed' && !empty($type)) {
             $title[] = $type;
         } elseif ($format == 'vcf') {
             $title[] = 'vCard';
         }
     }
     $newUri = $uri;
     if (count($title) > 0) {
         // Generate meta tags
         $this->metatags = $this->getMetaTags();
         $priority = $this->getPriority($uri);
         $sitemap = $this->getSitemapParams($uri);
         if (isset($this->lang)) {
             $lang = $this->lang;
         }
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, null, null, $this->metatags, $priority, false, null, $sitemap);
     }
     return $newUri;
 }
Exemplo n.º 10
0
 function create(&$uri)
 {
     $sefConfig =& SEFConfig::getConfig();
     $database =& JFactory::getDBO();
     $this->params =& SEFTools::getExtParams('com_newsfeeds');
     $vars = $uri->getQuery(true);
     extract($vars);
     // JF translate extension.
     $jfTranslate = $sefConfig->translateNames ? ', `id`' : '';
     $title = array();
     $title[] = JoomSEF::_getMenuTitle($option, @$this_task);
     if (@$view == 'category' && isset($id)) {
         $title[] = $this->getCategoryTitle($id, SEFTools::UseAlias($this->params, 'category_alias'));
     }
     if (@$view == "newsfeed") {
         if (!empty($catid)) {
             if ($this->params->get('show_category', '1')) {
                 $title[] = $this->getCategoryTitle($catid, SEFTools::UseAlias($this->params, 'category_alias'));
             }
         }
         if (empty($feedid)) {
             $feedid = $id;
         }
         $field = 'name';
         if (SEFTools::UseAlias($this->params, 'feed_alias')) {
             $field = 'alias';
         }
         $feedid = intval($feedid);
         $database->setQuery("SELECT `{$field}` AS `name` {$jfTranslate} FROM `#__newsfeeds` WHERE `id` = '{$feedid}'");
         $row = $database->loadObject();
         if (is_null($row)) {
             JoomSefLogger::Log("Newsfeed with ID {$feedid} could not be found.", $this, 'com_newsfeeds');
         } elseif (!empty($row->name)) {
             $name = $row->name;
             if ($this->params->get('feedid', '0')) {
                 $name = $feedid . '-' . $name;
             }
             $title[] = $name;
         }
     }
     $newUri = $uri;
     if (count($title) > 0) {
         // Generate meta tags
         $metatags = $this->getMetaTags();
         $priority = $this->getPriority($uri);
         $sitemap = $this->getSitemapParams($uri);
         $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$vars['lang'], null, null, $metatags, $priority, false, null, $sitemap);
     }
     return $newUri;
 }