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


PHP rcube_utils::explode_quoted_string方法代码示例

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


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

示例1: import

 /**
  *
  */
 public function import($csv)
 {
     // convert to UTF-8
     $head = substr($csv, 0, 4096);
     $fallback = rcube::get_instance()->config->get('default_charset', 'ISO-8859-1');
     // fallback to Latin-1?
     $charset = rcube_charset::detect($head, RCMAIL_CHARSET);
     $csv = rcube_charset::convert($csv, $charset);
     $head = '';
     $this->map = array();
     // Parse file
     foreach (preg_split("/[\r\n]+/", $csv) as $i => $line) {
         $line = trim($line);
         if (empty($line)) {
             continue;
         }
         $elements = rcube_utils::explode_quoted_string(',', $line);
         if (empty($elements)) {
             continue;
         }
         // Parse header
         if (empty($this->map)) {
             $this->parse_header($elements);
             if (empty($this->map)) {
                 break;
             }
         } else {
             $this->csv_to_vcard($elements);
         }
     }
 }
开发者ID:netcon-source,项目名称:roundcubemail,代码行数:34,代码来源:rcube_csv2vcard.php

示例2: parse_line

 /**
  * Parse CSV file line
  */
 protected function parse_line($line)
 {
     $line = trim($line);
     if (empty($line)) {
         return null;
     }
     $fields = rcube_utils::explode_quoted_string(',', $line);
     // remove quotes if needed
     if (!empty($fields)) {
         foreach ($fields as $idx => $value) {
             if (($len = strlen($value)) > 1 && $value[0] == '"' && $value[$len - 1] == '"') {
                 // remove surrounding quotes
                 $value = substr($value, 1, -1);
                 // replace doubled quotes inside the string with single quote
                 $value = str_replace('""', '"', $value);
                 $fields[$idx] = $value;
             }
         }
     }
     return $fields;
 }
开发者ID:BIGGANI,项目名称:zpanelx,代码行数:24,代码来源:rcube_csv2vcard.php

示例3: fix_email

 /**
  * Try to fix invalid email addresses
  */
 public static function fix_email($email)
 {
     $parts = rcube_utils::explode_quoted_string('@', $email);
     foreach ($parts as $idx => $part) {
         // remove redundant quoting (#1490040)
         if ($part[0] == '"' && preg_match('/^"([a-zA-Z0-9._+=-]+)"$/', $part, $m)) {
             $parts[$idx] = $m[1];
         }
     }
     return implode('@', $parts);
 }
开发者ID:bbspike,项目名称:sentora-core,代码行数:14,代码来源:rcube_mime.php

示例4: test_explode_quoted_string_compat

 /**
  * Check rcube_utils::explode_quoted_string() compat. with explode()
  */
 function test_explode_quoted_string_compat()
 {
     $data = array('', 'a,b,c', 'a', ',', ',a');
     foreach ($data as $text) {
         $result = rcube_utils::explode_quoted_string(',', $text);
         $this->assertSame(explode(',', $text), $result);
     }
 }
开发者ID:netcon-source,项目名称:roundcubemail,代码行数:11,代码来源:Utils.php

示例5: _parse_rfc822

 /**
  * Take a set of recipients and parse them, returning an array of
  * bare addresses (forward paths) that can be passed to sendmail
  * or an smtp server with the rcpt to: command.
  *
  * @param mixed Either a comma-seperated list of recipients
  *              (RFC822 compliant), or an array of recipients,
  *              each RFC822 valid.
  *
  * @return array An array of forward paths (bare addresses).
  * @access private
  */
 private function _parse_rfc822($recipients)
 {
     // if we're passed an array, assume addresses are valid and implode them before parsing.
     if (is_array($recipients)) {
         $recipients = implode(', ', $recipients);
     }
     $addresses = array();
     $recipients = rcube_utils::explode_quoted_string(',', $recipients);
     reset($recipients);
     while (list($k, $recipient) = each($recipients)) {
         $a = rcube_utils::explode_quoted_string(' ', $recipient);
         while (list($k2, $word) = each($a)) {
             if (strpos($word, "@") > 0 && $word[strlen($word) - 1] != '"') {
                 $word = preg_replace('/^<|>$/', '', trim($word));
                 if (in_array($word, $addresses) === false) {
                     array_push($addresses, $word);
                 }
             }
         }
     }
     return $addresses;
 }
开发者ID:netcon-source,项目名称:roundcubemail,代码行数:34,代码来源:rcube_smtp.php

示例6: rcube_explode_quoted_string

function rcube_explode_quoted_string($delimiter, $string)
{
    return rcube_utils::explode_quoted_string($delimiter, $string);
}
开发者ID:noikiy,项目名称:roundcubemail,代码行数:4,代码来源:bc.php

示例7: _parse_rfc822

 /**
  * Take a set of recipients and parse them, returning an array of
  * bare addresses (forward paths) that can be passed to sendmail
  * or an smtp server with the rcpt to: command.
  *
  * @param mixed Either a comma-seperated list of recipients
  *              (RFC822 compliant), or an array of recipients,
  *              each RFC822 valid.
  *
  * @return array An array of forward paths (bare addresses).
  */
 private function _parse_rfc822($recipients)
 {
     // if we're passed an array, assume addresses are valid and implode them before parsing.
     if (is_array($recipients)) {
         $recipients = implode(', ', $recipients);
     }
     $addresses = array();
     $recipients = preg_replace('/[\\s\\t]*\\r?\\n/', '', $recipients);
     $recipients = rcube_utils::explode_quoted_string(',', $recipients);
     reset($recipients);
     foreach ($recipients as $recipient) {
         $a = rcube_utils::explode_quoted_string(' ', $recipient);
         foreach ($a as $word) {
             $word = trim($word);
             $len = strlen($word);
             if ($len && strpos($word, "@") > 0 && $word[$len - 1] != '"') {
                 $word = preg_replace('/^<|>$/', '', $word);
                 if (!in_array($word, $addresses)) {
                     array_push($addresses, $word);
                 }
             }
         }
     }
     return $addresses;
 }
开发者ID:jimjag,项目名称:roundcubemail,代码行数:36,代码来源:rcube_smtp.php

示例8: _read_postprocess

 /**
  * Convert sql record into a rcube style event object
  */
 private function _read_postprocess($event)
 {
     $free_busy_map = array_flip($this->free_busy_map);
     $sensitivity_map = array_flip($this->sensitivity_map);
     $event['id'] = $event['event_id'];
     if ($event['allday'] = intval($event['all_day'])) {
         $event['start'] = new DateTime($event['start']);
         $event['end'] = new DateTime($event['end']);
     } else {
         $tz = $event['tzname'] ? $event['tzname'] : 'UTC';
         $event['start'] = new DateTime($event['start'], new DateTimezone($tz));
         $event['end'] = new DateTime($event['end'], new DateTimezone($tz));
     }
     $event['created'] = new DateTime($event['created']);
     $event['created']->setTimezone(new DateTimezone('UTC'));
     $event['changed'] = new DateTime($event['changed']);
     $event['changed']->setTimezone(new DateTimezone('UTC'));
     $event['free_busy'] = $free_busy_map[$event['free_busy']];
     $event['sensitivity'] = $sensitivity_map[$event['sensitivity']];
     $event['calendar'] = $event['calendar_id'];
     $event['recurrence_id'] = intval($event['recurrence_id']);
     // parse recurrence rule
     if ($event['recurrence'] && preg_match_all('/([A-Z]+)=([^;]+);?/', $event['recurrence'], $m, PREG_SET_ORDER)) {
         $event['recurrence'] = array();
         foreach ($m as $rr) {
             if (is_numeric($rr[2])) {
                 $rr[2] = intval($rr[2]);
             } else {
                 if ($rr[1] == 'UNTIL') {
                     $rr[2] = date_create($rr[2]);
                 } else {
                     if ($rr[1] == 'RDATE') {
                         $rr[2] = array_map('date_create', explode(',', $rr[2]));
                     } else {
                         if ($rr[1] == 'EXDATE') {
                             $rr[2] = array_map('date_create', explode(',', $rr[2]));
                         }
                     }
                 }
             }
             $event['recurrence'][$rr[1]] = $rr[2];
         }
     }
     if ($event['exception']) {
         $event['recurrence_date'] = new DateTime($event['exception'], $this->cal->timezone);
     }
     if ($event['_attachments'] > 0) {
         $event['attachments'] = (array) $this->list_attachments($event);
     }
     // decode serialized event attendees
     if ($event['attendees']) {
         $attendees = array();
         foreach (explode("\n", $event['attendees']) as $line) {
             $att = array();
             foreach (rcube_utils::explode_quoted_string(';', $line) as $prop) {
                 list($key, $value) = explode("=", $prop);
                 $att[strtolower($key)] = stripslashes(trim($value, '""'));
             }
             $attendees[] = $att;
         }
         $event['attendees'] = $attendees;
     }
     unset($event['event_id'], $event['calendar_id'], $event['all_day'], $event['_attachments']);
     return $event;
 }
开发者ID:MetallianFR68,项目名称:myroundcube,代码行数:68,代码来源:database_driver.php

示例9: unserialize_attendees

 /**
  * Helper method to decode the attendees list from string
  */
 private function unserialize_attendees($s_attendees)
 {
     $attendees = array();
     // decode json serialized string
     if ($s_attendees[0] == '[') {
         $attendees = json_decode($s_attendees, true);
     } else {
         foreach (explode("\n", $s_attendees) as $line) {
             $att = array();
             foreach (rcube_utils::explode_quoted_string(';', $line) as $prop) {
                 list($key, $value) = explode("=", $prop);
                 $att[strtolower($key)] = stripslashes(trim($value, '""'));
             }
             $attendees[] = $att;
         }
     }
     return $attendees;
 }
开发者ID:claudineyqr,项目名称:Kolab-Roundcube-Calendar,代码行数:21,代码来源:database_driver.php

示例10: rcube_explode_quoted_string

function rcube_explode_quoted_string($delimiter, $string)
{
    _deprecation_warning(__FUNCTION__);
    return rcube_utils::explode_quoted_string($delimiter, $string);
}
开发者ID:JotapePinheiro,项目名称:roundcubemail,代码行数:5,代码来源:bc.php


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