当前位置: 首页>>代码示例>>PHP>>正文


PHP SEFTools::fixVariable方法代码示例

本文整理汇总了PHP中SEFTools::fixVariable方法的典型用法代码示例。如果您正苦于以下问题:PHP SEFTools::fixVariable方法的具体用法?PHP SEFTools::fixVariable怎么用?PHP SEFTools::fixVariable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SEFTools的用法示例。


在下文中一共展示了SEFTools::fixVariable方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: beforeCreate

 function beforeCreate(&$uri)
 {
     // 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');
     }
     $view = $uri->getVar('view');
     $id = (int) $uri->getVar('id');
     $catid = (int) $uri->getVar('catid');
     switch ($view) {
         case 'category':
         case 'categories':
             // Remove view and catid if they point to empty category/categories
             if (!$id) {
                 $uri->delVar('view');
                 $uri->delVar('id');
             }
         case 'contact':
             if ($id && $catid) {
                 $uri->delVar('catid');
             }
     }
     return;
 }
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:27,代码来源:com_contact.php

示例2: beforeCreate

 function beforeCreate(&$uri)
 {
     // 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');
     }
     return;
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:11,代码来源:com_weblinks.php

示例3: beforeCreate

 function beforeCreate(&$uri)
 {
     // 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 ($uri->getVar('view') == 'categories' && !(int) $uri->getVar('id')) {
         $uri->delVar('id');
     }
     if (is_null($uri->getVar('view'))) {
         $uri->setVar('view', 'categories');
     }
     return;
 }
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:17,代码来源:com_newsfeeds.php

示例4: beforeCreate

 function beforeCreate(&$uri)
 {
     // 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');
     }
     // Remove view and catid if they point to empty category
     if (!is_null($uri->getVar('view')) && $uri->getVar('view') == 'category') {
         if (is_null($uri->getVar('catid')) || $uri->getVar('catid') == 0) {
             $uri->delVar('view');
             $uri->delVar('catid');
         }
     }
     return;
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:18,代码来源:com_contact.php

示例5: beforeCreate

 public function beforeCreate(&$uri)
 {
     // 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');
     }
     // Remove empty variables
     if ($uri->getVar('limitstart') == '') {
         $uri->delVar('limitstart');
     }
     if ($uri->getVar('showall') == '') {
         $uri->delVar('showall');
     }
     // Try to guess the correct Itemid if set to
     if ($this->params->get('guessId', '0') != '0') {
         if (!is_null($uri->getVar('Itemid')) && !is_null($uri->getVar('id'))) {
             $itemid = SefExtContentRouteHelper::getItemid($uri->getVar('id'));
             if (!is_null($itemid)) {
                 $uri->setVar('Itemid', $itemid);
             }
         }
     }
     // 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');
     }
     // TODO: We should remove this, as it generates 1 unnecessary SQL query for each article link,
     // instead the catid should just be always removed from article URL (but when updating JoomSEF,
     // we'll need to update URLs already in database to reflect such change = remove catid from them!)
     // 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 = $uri->getVar('id');
         $query = "SELECT `catid` FROM `#__content` WHERE `id` = '{$id}'";
         $this->_db->setQuery($query);
         $catid = $this->_db->loadResult();
         if (is_null($catid)) {
             JoomSefLogger::Log("Article with ID {$id} could not be found.", $this, 'com_content');
         }
         if (!empty($catid)) {
             $uri->setVar('catid', $catid);
         }
     }
     // remove empty id in categories list
     if ($uri->getVar('view') == 'categories' && !(int) $uri->getVar('id')) {
         $uri->delVar('id');
     }
     return;
 }
开发者ID:01J,项目名称:bealtine,代码行数:53,代码来源:com_content.php

示例6: beforeCreate

 public function beforeCreate(&$uri)
 {
     // Fix IDs
     SEFTools::fixVariable($uri, 'id');
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:5,代码来源:com_tags.php

示例7: beforeCreate

 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;
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:62,代码来源:com_content.php


注:本文中的SEFTools::fixVariable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。