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


PHP CharsetConverter::entities_to_utf8方法代码示例

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


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

示例1: charsetEntity2utf8

 /**
  * Convert character set and HTML entities in the value of input content array keys
  *
  * @param array Standard content array
  * @param string Charset of the input content (converted to utf-8)
  * @return void
  */
 public function charsetEntity2utf8(&$contentArr, $charset)
 {
     // Convert charset if necessary
     foreach ($contentArr as $key => $value) {
         if ((string) $contentArr[$key] !== '') {
             if ($charset !== 'utf-8') {
                 $contentArr[$key] = $this->csObj->utf8_encode($contentArr[$key], $charset);
             }
             // decode all numeric / html-entities in the string to real characters:
             $contentArr[$key] = $this->csObj->entities_to_utf8($contentArr[$key], TRUE);
         }
     }
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:20,代码来源:Indexer.php

示例2: getSearchWords

 /**
  * Splits the search word input into an array where each word is represented by an array with key "sword" holding the search word and key "oper" holding the SQL operator (eg. AND, OR)
  *
  * Only words with 2 or more characters are accepted
  * Max 200 chars total
  * Space is used to split words, "" can be used search for a whole string
  * AND, OR and NOT are prefix words, overruling the default operator
  * +/|/- equals AND, OR and NOT as operators.
  * All search words are converted to lowercase.
  *
  * $defOp is the default operator. 1=OR, 0=AND
  *
  * @param bool $defOp If TRUE, the default operator will be OR, not AND
  * @return array Returns array with search words if any found
  */
 public function getSearchWords($defOp)
 {
     // Shorten search-word string to max 200 bytes (does NOT take multibyte charsets into account - but never mind, shortening the string here is only a run-away feature!)
     $inSW = substr($this->piVars['sword'], 0, 200);
     // Convert to UTF-8 + conv. entities (was also converted during indexing!)
     $inSW = $this->charsetConverter->conv($inSW, $this->frontendController->metaCharset, 'utf-8');
     $inSW = $this->charsetConverter->entities_to_utf8($inSW);
     $sWordArray = false;
     if ($hookObj = $this->hookRequest('getSearchWords')) {
         $sWordArray = $hookObj->getSearchWords_splitSWords($inSW, $defOp);
     } else {
         if ($this->piVars['type'] == 20) {
             // type = Sentence
             $sWordArray = array(array('sword' => trim($inSW), 'oper' => 'AND'));
         } else {
             $searchWords = \TYPO3\CMS\IndexedSearch\Utility\IndexedSearchUtility::getExplodedSearchString($inSW, $defOp == 1 ? 'OR' : 'AND', $this->operator_translate_table);
             if (is_array($searchWords)) {
                 $sWordArray = $this->procSearchWordsByLexer($searchWords);
             }
         }
     }
     return $sWordArray;
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:38,代码来源:SearchFormController.php

示例3: getSearchWords

 /**
  * Splits the search word input into an array where each word is represented by an array with key "sword"
  * holding the search word and key "oper" holding the SQL operator (eg. AND, OR)
  *
  * Only words with 2 or more characters are accepted
  * Max 200 chars total
  * Space is used to split words, "" can be used search for a whole string
  * AND, OR and NOT are prefix words, overruling the default operator
  * +/|/- equals AND, OR and NOT as operators.
  * All search words are converted to lowercase.
  *
  * $defOp is the default operator. 1=OR, 0=AND
  *
  * @param bool $defaultOperator If TRUE, the default operator will be OR, not AND
  * @return array Search words if any found
  */
 protected function getSearchWords($defaultOperator)
 {
     // Shorten search-word string to max 200 bytes (does NOT take multibyte charsets into account - but never mind,
     // shortening the string here is only a run-away feature!)
     $searchWords = substr($this->sword, 0, 200);
     // Convert to UTF-8 + conv. entities (was also converted during indexing!)
     $searchWords = $this->charsetConverter->conv($searchWords, $GLOBALS['TSFE']->metaCharset, 'utf-8');
     $searchWords = $this->charsetConverter->entities_to_utf8($searchWords);
     $sWordArray = false;
     if ($hookObj = $this->hookRequest('getSearchWords')) {
         $sWordArray = $hookObj->getSearchWords_splitSWords($searchWords, $defaultOperator);
     } else {
         // sentence
         if ($this->searchData['searchType'] == 20) {
             $sWordArray = array(array('sword' => trim($searchWords), 'oper' => 'AND'));
         } else {
             // case-sensitive. Defines the words, which will be
             // operators between words
             $operatorTranslateTable = array(array('+', 'AND'), array('|', 'OR'), array('-', 'AND NOT'), array($this->charsetConverter->conv_case('utf-8', LocalizationUtility::translate('localizedOperandAnd', 'IndexedSearch'), 'toLower'), 'AND'), array($this->charsetConverter->conv_case('utf-8', LocalizationUtility::translate('localizedOperandOr', 'IndexedSearch'), 'toLower'), 'OR'), array($this->charsetConverter->conv_case('utf-8', LocalizationUtility::translate('localizedOperandNot', 'IndexedSearch'), 'toLower'), 'AND NOT'));
             $swordArray = \TYPO3\CMS\IndexedSearch\Utility\IndexedSearchUtility::getExplodedSearchString($searchWords, $defaultOperator == 1 ? 'OR' : 'AND', $operatorTranslateTable);
             if (is_array($swordArray)) {
                 $sWordArray = $this->procSearchWordsByLexer($swordArray);
             }
         }
     }
     return $sWordArray;
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:43,代码来源:SearchController.php


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