當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。