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


PHP CMbString::allowDiacriticsInRegexp方法代码示例

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


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

示例1: getAutocompleteList

 /**
  * @see parent::getAutocompleteList()
  */
 function getAutocompleteList($keywords, $where = null, $limit = null, $ljoin = null, $order = null)
 {
     /** @var self[] $list */
     $list = $this->loadList($where, null, null, null, $ljoin);
     $real_list = array();
     $re = preg_quote($keywords);
     $re = CMbString::allowDiacriticsInRegexp($re);
     $re = str_replace("/", "\\/", $re);
     $re = "/({$re})/i";
     foreach ($list as $_ex_field) {
         if ($keywords == "%" || $keywords == "" || preg_match($re, $_ex_field->_view)) {
             $_ex_field->updateTranslation();
             $_group = $_ex_field->loadRefExGroup();
             $_ex_field->_view = "{$_group->_view} - {$_ex_field->_view}";
             $real_list[$_ex_field->_id] = $_ex_field;
         }
     }
     return $real_list;
 }
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:22,代码来源:CExClassField.class.php

示例2: getAutocompleteList

 function getAutocompleteList($keywords, $where = null, $limit = null, $ljoin = null, $order = null)
 {
     $list = $this->loadList($where, null, null, null, $ljoin);
     /** @var self[] $real_list */
     $real_list = array();
     $re = preg_quote($keywords);
     $re = CMbString::allowDiacriticsInRegexp($re);
     $re = str_replace("/", "\\/", $re);
     $re = "/({$re})/i";
     foreach ($list as $_match) {
         if ($keywords == "%" || $keywords == "" || preg_match($re, $_match->_view)) {
             $_match->loadView();
             $real_list[$_match->_id] = $_match;
         }
     }
     $views = CMbArray::pluck($real_list, "_view");
     array_multisort($views, $real_list);
     $empty = new self();
     $empty->_id = null;
     $empty->_guid = "{$this->_class}-{$this->_id}";
     // FIXME
     $empty->_view = " -- ";
     array_unshift($real_list, $empty);
     return $real_list;
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:25,代码来源:CExClassFieldPredicate.class.php

示例3: CExClassEvent

 * @package    Mediboard
 * @subpackage forms
 * @author     SARL OpenXtrem <dev@openxtrem.com>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 17759 $
 */
CCanDo::checkEdit();
$ex_class_event_id = CValue::get("ex_class_event_id");
$keywords = CValue::get("_host_field_view");
$ex_class_event = new CExClassEvent();
$ex_class_event->load($ex_class_event_id);
$list = $ex_class_event->buildHostFieldsList();
$show_views = false;
// filtrage
if ($keywords) {
    $show_views = true;
    $re = preg_quote($keywords);
    $re = CMbString::allowDiacriticsInRegexp($re);
    $re = str_replace("/", "\\/", $re);
    $re = "/({$re})/i";
    foreach ($list as $_key => $element) {
        if (!preg_match($re, $element["title"])) {
            unset($list[$_key]);
        }
    }
}
$smarty = new CSmartyDP();
$smarty->assign("ex_class_event", $ex_class_event);
$smarty->assign("host_fields", $list);
$smarty->assign("show_views", $show_views);
$smarty->display("inc_autocomplete_hostfields.tpl");
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:ajax_autocomplete_hostfields.php

示例4: emphasize

 /**
  * Emphasize a text, putting <em> nodes around found tokens
  * Example:  {$text|emphasize:$tokens}
  *
  * @param string       $text   The text subject
  * @param array|string $tokens The string tokens to emphasize, space seperated if string
  * @param string       $tag    The HTML tag to use to emphasize
  *
  * @return string
  */
 function emphasize($text, $tokens, $tag = "em")
 {
     if (!is_array($tokens)) {
         $tokens = explode(" ", $tokens);
     }
     CMbArray::removeValue("", $tokens);
     if (count($tokens) == 0) {
         return $text;
     }
     foreach ($tokens as &$token) {
         $token = preg_quote($token);
         $token = CMbString::allowDiacriticsInRegexp($token);
     }
     $regexp = str_replace("/", "\\/", implode("|", $tokens));
     return preg_replace("/({$regexp})/i", "<{$tag}>\$1</{$tag}>", $text);
 }
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:26,代码来源:CSmartyMB.class.php


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