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


PHP Horde_String::ipos方法代码示例

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


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

示例1: search


//.........这里部分代码省略.........
             }
             if ($opts['count_only']) {
                 $results += $search;
                 continue;
             } elseif (!$search instanceof Turba_List) {
                 continue;
             }
             $rfc822 = new Horde_Mail_Rfc822();
             while ($ob = $search->next()) {
                 $emails = $seen = array();
                 if ($ob->isGroup()) {
                     /* Is a distribution list. */
                     $members = $ob->listMembers();
                     if (!$members instanceof Turba_List || !count($members)) {
                         continue;
                     }
                     $listatt = $ob->getAttributes();
                     $listName = $ob->getValue('name');
                     while ($ob = $members->next()) {
                         foreach (array_keys($ob->getAttributes()) as $key) {
                             $value = $ob->getValue($key);
                             if (empty($value)) {
                                 continue;
                             }
                             $seen_key = trim(Horde_String::lower($ob->getValue('name'))) . trim(Horde_String::lower(is_array($value) ? $value['load']['file'] : $value));
                             if (isset($attributes[$key]) && $attributes[$key]['type'] == 'email' && empty($seen[$seen_key])) {
                                 $emails[] = $value;
                                 $seen[$seen_key] = true;
                             }
                         }
                     }
                     if (empty($opts['rfc822Return'])) {
                         $out[] = array('email' => implode(', ', $emails), 'id' => $listatt['__key'], 'name' => $listName, 'source' => $source);
                     } else {
                         $results->add(new Horde_Mail_Rfc822_Group($listName, $emails));
                     }
                 } else {
                     /* Not a group. */
                     $att = array('__key' => $ob->getValue('__key'));
                     foreach (array_keys($ob->driver->getCriteria()) as $key) {
                         $att[$key] = $ob->getValue($key);
                     }
                     $email = new Horde_Mail_Rfc822_List();
                     $display_name = $ob->hasValue('name') || !isset($ob->driver->alternativeName) ? Turba::formatName($ob) : $ob->getValue($ob->driver->alternativeName);
                     unset($tdisplay_name);
                     foreach (array_keys($att) as $key) {
                         if ($ob->getValue($key) && isset($attributes[$key]) && $attributes[$key]['type'] == 'email') {
                             $e_val = $ob->getValue($key);
                             if (strlen($trimname)) {
                                 /* Ticket #12480: Don't return email if it
                                  * doesn't contain the search string, since
                                  * an entry can contain multiple e-mail
                                  * fields. Return all e-mails if it
                                  * occurs in the name. */
                                 if (!isset($tname)) {
                                     $tname = Horde_String_Transliterate::toAscii($name);
                                 }
                                 if (!isset($tdisplay_name)) {
                                     $tdisplay_name = Horde_String_Transliterate::toAscii($display_name);
                                 }
                                 $add = Horde_String::ipos(Horde_String_Transliterate::toAscii($e_val), $tname) !== false || Horde_String::ipos($tdisplay_name, $tname) !== false;
                             } else {
                                 $add = true;
                             }
                             if ($add) {
                                 // Multiple addresses support
                                 $email->add($rfc822->parseAddressList($e_val, array('limit' => isset($attributes[$key]['params']) && is_array($attributes[$key]['params']) && !empty($attributes[$key]['params']['allow_multi']) ? 0 : 1)));
                             }
                         }
                     }
                     if (count($email)) {
                         foreach ($email as $val) {
                             $seen_key = trim(Horde_String::lower($display_name)) . '/' . Horde_String::lower($val->bare_address);
                             if (empty($seen[$seen_key])) {
                                 $seen[$seen_key] = true;
                                 if (empty($opts['rfc822Return'])) {
                                     $emails[] = $val->bare_address;
                                 } else {
                                     $val->personal = $display_name;
                                     $results->add($val);
                                 }
                             }
                         }
                     } elseif (empty($opts['rfc822Return'])) {
                         $emails[] = null;
                     }
                     if (empty($opts['rfc822Return'])) {
                         foreach ($emails as $val) {
                             $out[] = array_merge($att, array('__type' => 'Object', 'email' => $val, 'id' => $att['__key'], 'name' => $display_name, 'source' => $source));
                         }
                     }
                 }
             }
             if (!empty($out)) {
                 $results[$name] = $out;
             }
         }
     }
     return $results;
 }
开发者ID:Gomez,项目名称:horde,代码行数:101,代码来源:Api.php

示例2: searchUsers

 /**
  * Searches the users for a substring.
  *
  * @since Horde_Auth 2.2.0
  *
  * @param string $search  The search term.
  *
  * @return array  A list of all matching users.
  */
 public function searchUsers($search)
 {
     try {
         $users = $this->listUsers();
     } catch (Horde_Auth_Exception $e) {
         return array();
     }
     $matches = array();
     foreach ($users as $user) {
         if (Horde_String::ipos($user, $search) !== false) {
             $matches[] = $user;
         }
     }
     return $matches;
 }
开发者ID:horde,项目名称:horde,代码行数:24,代码来源:Base.php


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