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


PHP CommonController::makeModParamsUsable方法代码示例

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


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

示例1: _discoverIDs

 /**
  * Category auto-detect
  */
 function _discoverIDs(&$controller)
 {
     // Initialize variables
     $id = Sanitize::getInt($controller->params, 'id');
     $cat_id = Sanitize::getInt($controller->params, 'catid');
     $option = Sanitize::getString($controller->params, 'option');
     $view = Sanitize::getString($controller->params, 'view');
     $task = Sanitize::getString($controller->params, 'task');
     switch ($option) {
         case 'com_jreviews':
             # Get url params for current controller/action
             $url = Sanitize::getString($controller->passedArgs, 'url');
             $route['url']['url'] = $url;
             $route = S2Router::parse($route, true, 'jreviews');
             isset($route['data']['action']) and $route['data']['action'] == 'search' and $route = $route['url'];
             $dir_id = Sanitize::getString($route, 'dir');
             $section_id = Sanitize::getString($route, 'section');
             $cat_id = Sanitize::getString($route, 'cat');
             $criteria_id = Sanitize::getString($route, 'criteria');
             if ($cat_id != '') {
                 if ($cat_id[0] == 's') {
                     $section_id = CommonController::makeModParamsUsable(str_replace('s', '', $cat_id));
                     $cat_id = '';
                     break;
                 }
                 $cat_id = CommonController::makeModParamsUsable($cat_id);
             } elseif ($section_id != '') {
                 $section_id = CommonController::makeModParamsUsable($section_id);
             } elseif ($criteria_id != '') {
                 $criteria_id = CommonController::makeModParamsUsable($criteria_id);
             } elseif ($dir_id != '') {
                 $dir_id = CommonController::makeModParamsUsable($dir_id);
             } else {
                 //Discover the params from the menu_id
                 $menu_id = Sanitize::getString($controller->params, 'Itemid');
                 $params = $controller->Menu->getMenuParams($menu_id);
                 $dir_id = cleanIntegerCommaList(Sanitize::getString($params, 'dirid'));
                 $cat_id = cleanIntegerCommaList(Sanitize::getString($params, 'catid'));
                 $section_id = cleanIntegerCommaList(Sanitize::getString($params, 'sectionid'));
             }
             break;
         case 'com_content':
             if ('article' == $view || 'view' == $task) {
                 // If cat id was not available in url then we need to query it, otherwise it was already read above
                 if (!$cat_id) {
                     $query = "\r\n                                SELECT \r\n                                    catid \r\n                                FROM \r\n                                    #__content\r\n                                WHERE \r\n                                    id = " . $id;
                     $this->_db->setQuery($query);
                     $cat_id = $this->_db->loadResult();
                 }
             } elseif ($view == "section") {
                 $section_id = $id;
             } elseif ($view == "category") {
                 $cat_id = $id;
             }
             break;
         default:
             $cat_id = null;
             // Catid not detected because the page is neither content nor jreviews
             break;
     }
     $ids = array();
     isset($dir_id) and !empty($dir_id) and $ids['dir_id'] = $dir_id;
     isset($section_id) and !empty($section_id) and $ids['section_id'] = $section_id;
     isset($cat_id) and !empty($cat_id) and $ids['cat_id'] = $cat_id;
     isset($criteria_id) and !empty($criteria_id) and $ids['criteria_id'] = $criteria_id;
     return $ids;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:70,代码来源:common_controller.php


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