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


PHP XenForo_Helper_String::wholeWordTrimAroundSearchTerm方法代码示例

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


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

示例1: helperSnippet

 /**
  * Strips BB Code from a string and word-trims it to a given max length around an optional search term
  *
  * @param string $string Input text (bb code)
  * @param integer $maxLength
  * @param array $options Key-value options
  *
  * @return string HTML
  */
 public static function helperSnippet($string, $maxLength = 0, array $options = array())
 {
     $options = array_merge(array('term' => '', 'emClass' => '', 'stripQuote' => false), $options);
     $string = XenForo_Helper_String::bbCodeStrip($string, $options['stripQuote']);
     if ($maxLength) {
         $string = XenForo_Helper_String::wholeWordTrimAroundSearchTerm($string, $maxLength, $options['term']);
     }
     $string = trim($string);
     $string = XenForo_Helper_String::censorString($string);
     if ($options['term'] && $options['emClass']) {
         return XenForo_Helper_String::highlightSearchTerm($string, $options['term'], $options['emClass']);
     } else {
         return htmlspecialchars($string);
     }
 }
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:24,代码来源:Core.php

示例2: helperSnippet

 /**
  * Strips BB Code from a string and word-trims it to a given max length around an optional search term
  *
  * @param string $string Input text (bb code)
  * @param integer $maxLength
  * @param array $options Key-value options
  *
  * @return string HTML
  */
 public static function helperSnippet($string, $maxLength = 0, array $options = array())
 {
     $options = array_merge(array('term' => '', 'fromStart' => 0, 'emClass' => '', 'stripQuote' => false, 'stripHtml' => false, 'stripPlainTag' => false), $options);
     if ($options['stripHtml']) {
         $string = strip_tags($string);
     } else {
         if ($options['stripPlainTag']) {
             $string = preg_replace('#(?<=^|\\s|[\\](,]|--|@)@\\[(\\d+):(\'|"|&quot;|)(.*)\\2\\]#iU', '\\3', $string);
         } else {
             $string = XenForo_Helper_String::bbCodeStrip($string, $options['stripQuote']);
         }
     }
     if ($maxLength) {
         if ($options['fromStart']) {
             $string = XenForo_Helper_String::wholeWordTrim($string, $maxLength);
         } else {
             $string = XenForo_Helper_String::wholeWordTrimAroundSearchTerm($string, $maxLength, $options['term']);
         }
     }
     $string = trim($string);
     $string = XenForo_Helper_String::censorString($string);
     if ($options['term'] && $options['emClass']) {
         return XenForo_Helper_String::highlightSearchTerm($string, $options['term'], $options['emClass']);
     } else {
         return htmlspecialchars($string);
     }
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:36,代码来源:Core.php


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