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


PHP cmsFramework::mosCmsSef方法代码示例

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


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

示例1: _process

 function _process()
 {
     $urlSeparator = "_";
     $simple_search = Sanitize::getInt($this->data, 'simple_search');
     $keywords = Sanitize::getVar($this->data, 'keywords');
     $criteria = isset($this->data['Search']) ? Sanitize::getInt($this->data['Search'], 'criteria_id') : null;
     $dir = str_replace(array(',', ' '), array($urlSeparator, ''), Sanitize::getString($this->data, 'dir'));
     $cat = str_replace(array(',', ' '), array($urlSeparator, ''), Sanitize::getString($this->data, 'cat'));
     $section = str_replace(array(',', ' '), array($urlSeparator, ''), Sanitize::getString($this->data, 'section'));
     /*J15*/
     $order = Sanitize::getVar($this->data, 'order');
     $query_type = Sanitize::getVar($this->data, 'search_query_type');
     $scope = Sanitize::getVar($this->data, 'contentoptions');
     $author = Sanitize::getString($this->data, 'author');
     $categories = Sanitize::getVar($this->data, 'categories');
     $menu_id = Sanitize::getInt($this->data, 'menu_id');
     $tmpl_suffix = Sanitize::getString($this->data, 'tmpl_suffix');
     $illegal_chars = array('#', '/', '?', ':', urldecode('%E3%80%80'));
     // Last one is japanese double space
     $sort = '';
     # Load Routes helper
     App::import('Helper', 'routes', 'jreviews');
     $Routes = new RoutesHelper();
     // Replace ampersands with temp string to be replaced back as urlencoded ampersand further below
     $keywords = str_replace(array_keys($this->KeywordReplacementMask), array_values($this->KeywordReplacementMask), $keywords);
     # Get the Itemid
     $menu_id_param = $menu_id > 0 ? $menu_id : '';
     $url_params = '';
     # SIMPLE SEARCH
     if ($simple_search) {
         # Build the query string
         if (trim($keywords) != '') {
             $url_params .= (cmsFramework::mosCmsSef() ? '' : '/') . 'keywords' . _PARAM_CHAR . str_replace(' ', '+', urlencode(str_replace($illegal_chars, ' ', $keywords)));
         }
         !empty($dir) and $url_params .= "/dir" . _PARAM_CHAR . $dir;
         !empty($section) and $url_params .= "/cat" . _PARAM_CHAR . 's' . $section;
         /*J15*/
         !empty($cat) and $url_params .= "/cat" . _PARAM_CHAR . $cat;
         !empty($tmpl_suffix) and $url_params .= '/tmpl_suffix' . _PARAM_CHAR . $tmpl_suffix;
         !empty($order) and $sort = '/order' . _PARAM_CHAR . $order;
         # Checks if need to keep the Itemid on the result page
         if ($this->Config->search_itemid && $menu_id) {
             $url = $Routes->search_results($menu_id_param, '');
         } else {
             $url = $Routes->search_results(null, '');
         }
         $url = cmsFramework::route($url . $url_params . $sort);
         $url = str_replace(array_keys($this->KeywordReplacementUrl), array_values($this->KeywordReplacementUrl), $url);
         cmsFramework::redirect($url);
         exit;
     }
     # ADVANCED SEARCH
     $url_params = array();
     $criteria_param = $criteria ? (cmsFramework::mosCmsSef() ? '' : '/') . 'criteria:' . $criteria : '';
     // Search query type
     !empty($query_type) and $url_params[] = "query" . _PARAM_CHAR . $query_type;
     !empty($dir) != '' and $url_params[] = "dir" . _PARAM_CHAR . $dir;
     // Listing and reviews
     if ($keywords) {
         if ($scope) {
             $url_params[] = "scope" . _PARAM_CHAR . urlencode(implode($urlSeparator, $scope));
         }
         $url_params[] = "keywords" . _PARAM_CHAR . urlencode(str_replace($illegal_chars, ' ', $keywords));
     }
     // Author
     !empty($author) and $url_params[] = "author" . _PARAM_CHAR . urlencode($author);
     // Categories
     if (is_array($categories)) {
         // Remove empty values from array
         foreach ($categories as $index => $value) {
             if (empty($value)) {
                 unset($categories[$index]);
             }
         }
         if (!empty($categories)) {
             $cat = urlencode(implode($urlSeparator, $categories));
             !empty($cat) and $url_params[] = "cat" . _PARAM_CHAR . $cat;
         }
     } elseif ($categories != '') {
         // Single select category list
         !empty($categories) and $url_params[] = "cat" . _PARAM_CHAR . $categories;
     }
     // First pass to process numeric values, need to merge operator and operand into one parameter
     if (isset($this->data['Field'])) {
         foreach ($this->data['Field']['Listing'] as $key => $value) {
             if (substr($key, -9, 9) == '_operator') {
                 $operand = substr($key, 0, -9);
                 if (is_array($this->data['Field']['Listing'][$operand]) && is_numeric($this->data['Field']['Listing'][$operand][0]) || is_numeric($this->data['Field']['Listing'][$operand])) {
                     $this->data['Field']['Listing'][$operand] = $value . $urlSeparator . trim(implode('_', $this->data['Field']['Listing'][$operand]));
                 } elseif (is_array($this->data['Field']['Listing'][$operand]) && trim($this->data['Field']['Listing'][$operand][0]) != '' || !is_array($this->data['Field']['Listing'][$operand]) && trim($this->data['Field']['Listing'][$operand]) != '') {
                     // Assume it's a date field
                     $this->data['Field']['Listing'][$operand] = $value . $urlSeparator . "date_" . implode('_', $this->data['Field']['Listing'][$operand]);
                 } else {
                     $this->data['Field']['Listing'][$operand] = '';
                 }
                 // Remove trailing separator char
                 $this->data['Field']['Listing'][$operand] = rtrim($this->data['Field']['Listing'][$operand], $urlSeparator);
             }
         }
         // Second pass to process everything
//.........这里部分代码省略.........
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:search_controller.php

示例2: display_items_per_page

 /**
  * Generates the dropdown list for number of items per page
  * @return html select list
  */
 function display_items_per_page()
 {
     $args = func_get_args();
     if (func_num_args() == 2) {
         $this->update_id = array_shift($args);
         $items_per_page = array_shift($args);
     } else {
         $items_per_page = array(5, 10, 15, 20, 25, 30, 35, 40, 45, 50);
     }
     $Form = ClassRegistry::getClass('FormHelper');
     $segments = '';
     $url_param = array();
     $passedArgs = $this->passedArgs;
     if ($this->ajaxRequest) {
         foreach ($items_per_page as $limit) {
             $selectList[] = array('value' => $limit, 'text' => $limit);
         }
         $selected = $this->limit;
         //Sanitize::getInt($this->data,'limit');
         $onchange = ($this->ajax_scroll ? "jQuery('#" . $this->scroll_id . "').scrollTo(500,100);" : '') . "        \r\n                var \$form = jQuery(this).parents('form');\r\n                \$form.find('input[name="data[page]"]').val(1);\r\n                \$form.find('input[name="data[limit]"]').val(this.value);\r\n                \$form.find('input[name="data[action]"]').val('{$this->action}');\r\n                jQuery.post(s2AjaxUri,\$form.serialize(),function(s2Out){jQuery('#{$this->update_id}').html(s2Out);},'html');\r\n            ";
         return __t("Results per page", true) . ': ' . $Form->select('order_limit', $selectList, $selected, array('onchange' => $onchange));
     } else {
         foreach ($items_per_page as $limit) {
             if (defined('MVC_FRAMEWORK_ADMIN')) {
                 $url = $this->base_url . 'page' . _PARAM_CHAR . '1/limit' . _PARAM_CHAR . $limit;
             } else {
                 $url = cmsFramework::route($this->base_url . '/page' . _PARAM_CHAR . '1/limit' . _PARAM_CHAR . $limit . (cmsFramework::mosCmsSef() ? '' : '/'));
             }
             $selectList[] = array('value' => $url, 'text' => $limit);
         }
         if (defined('MVC_FRAMEWORK_ADMIN')) {
             $selected = $this->base_url . 'page' . _PARAM_CHAR . '1/limit' . _PARAM_CHAR . $this->limit;
         } else {
             $selected = cmsFramework::route($this->base_url . '/page' . _PARAM_CHAR . '1/limit' . _PARAM_CHAR . $this->limit . (cmsFramework::mosCmsSef() ? '' : '/'));
         }
         return __t("Results per page", true) . ': ' . $Form->select('order_limit', $selectList, $selected, array('onchange' => "window.location=this.value"));
     }
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:42,代码来源:paginator.php


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