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


PHP XenForo_Helper_String::stripCensoredText方法代码示例

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


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

示例1: actionSearch

 /**
  * Performs a search.
  *
  * @return XenForo_ControllerResponse_Abstract
  */
 public function actionSearch()
 {
     // note: intentionally not post-only
     if (!XenForo_Visitor::getInstance()->canSearch()) {
         throw $this->getNoPermissionResponseException();
     }
     $input = $this->_input->filter(array('keywords' => XenForo_Input::STRING, 'title_only' => XenForo_Input::UINT, 'date' => XenForo_Input::DATE_TIME, 'users' => XenForo_Input::STRING, 'nodes' => array(XenForo_Input::UINT, 'array' => true), 'child_nodes' => XenForo_Input::UINT, 'user_content' => XenForo_Input::STRING, 'order' => XenForo_Input::STRING, 'group_discussion' => XenForo_Input::UINT));
     $input['type'] = $this->_handleInputType($input);
     if (!$input['order']) {
         $input['order'] = 'date';
     }
     $origKeywords = $input['keywords'];
     $input['keywords'] = XenForo_Helper_String::stripCensoredText($input['keywords']);
     // don't allow searching of censored stuff
     $visitorUserId = XenForo_Visitor::getUserId();
     $searchModel = $this->_getSearchModel();
     $constraints = $searchModel->getGeneralConstraintsFromInput($input, $errors);
     if ($errors) {
         return $this->responseError($errors);
     }
     if (!$input['type'] && $input['keywords'] === '' && count($constraints) == 1 && !empty($constraints['user']) && count($constraints['user']) == 1) {
         // we're searching for messages by a single user
         $this->_request->setParam('user_id', reset($constraints['user']));
         return $this->responseReroute(__CLASS__, 'member');
     }
     if ($input['keywords'] === '' && empty($constraints['user'])) {
         // must have keyword or user constraint
         return $this->responseError(new XenForo_Phrase('please_specify_search_query_or_name_of_member'));
     }
     $typeHandler = null;
     if ($input['type']) {
         if (is_array($input['type'])) {
             $typeInfo = $input['type'];
             list($input['type'], $contentInfo) = each($input['type']);
             list($contentType, $contentId) = each($contentInfo);
         }
         $typeHandler = $searchModel->getSearchDataHandler($input['type']);
         if ($typeHandler) {
             $constraints = array_merge($constraints, $typeHandler->getTypeConstraintsFromInput($this->_input));
         } else {
             $input['type'] = '';
         }
     }
     if ($searchModel->allowUserUseCachedSearch()) {
         $search = $searchModel->getExistingSearch($input['type'], $input['keywords'], $constraints, $input['order'], $input['group_discussion'], $visitorUserId);
     } else {
         $search = false;
     }
     if (!$search) {
         $searcher = new XenForo_Search_Searcher($searchModel);
         if ($typeHandler) {
             $results = $searcher->searchType($typeHandler, $input['keywords'], $constraints, $input['order'], $input['group_discussion']);
             $userResults = array();
         } else {
             $results = $searcher->searchGeneral($input['keywords'], $constraints, $input['order']);
             if ($this->_getUserModel()->canViewMemberList()) {
                 $userResults = $this->_getUserSearch($input['keywords']);
             } else {
                 $userResults = array();
             }
         }
         if (!$results && !$userResults) {
             return $this->getNoSearchResultsResponse($searcher);
         }
         $warnings = $searcher->getErrors() + $searcher->getWarnings();
         $search = $searchModel->insertSearch($results, $input['type'], $origKeywords, $constraints, $input['order'], $input['group_discussion'], $userResults, $warnings, $visitorUserId);
     }
     return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildPublicLink('search', $search), '');
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:74,代码来源:Search.php


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