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


PHP Misc::trim方法代码示例

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


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

示例1: updateAssociatedIssuesRelations

 /**
  * Update the issue associations
  *
  * @param int $issue_id issue to associate
  * @param array $associated_issues issue_id's to associate with
  */
 private function updateAssociatedIssuesRelations($issue_id, $associated_issues)
 {
     global $errors;
     // trim and remove empty values
     $associated_issues = array_filter(Misc::trim($associated_issues));
     // make sure all associated issues are valid (and in this project)
     foreach ($associated_issues as $i => $iss_id) {
         if ($iss_id == $issue_id) {
             // skip issue itself
             unset($associated_issues[$i]);
             continue;
         }
         if (!self::exists($iss_id, false)) {
             $error = ev_gettext('Issue #%s does not exist and was removed from the list of associated issues.', $iss_id);
             $errors['Associated Issues'][] = $error;
             unset($associated_issues[$i]);
         }
     }
     // this reindexes the array and removes duplicates filled by user
     $associated_issues = array_unique($associated_issues);
     $current = self::getDetails($issue_id);
     $association_diff = Misc::arrayDiff($current['associated_issues'], $associated_issues);
     if (!$association_diff) {
         // no diffs, return back
         return;
     }
     $usr_id = Auth::getUserID();
     // go through the new associations, if association already exists, skip it
     $associations_to_remove = $current['associated_issues'];
     if (count($associated_issues) > 0) {
         foreach ($associated_issues as $associated_id) {
             if (!in_array($associated_id, $current['associated_issues'])) {
                 self::addAssociation($issue_id, $associated_id, $usr_id);
             } else {
                 // already assigned, remove this user from list of issues to remove
                 unset($associations_to_remove[array_search($associated_id, $associations_to_remove)]);
             }
         }
     }
     if ($associations_to_remove) {
         foreach ($associations_to_remove as $associated_id) {
             self::deleteAssociation($issue_id, $associated_id);
         }
     }
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:51,代码来源:class.issue.php

示例2: getRemoteUserInfo

 /**
  * Retrieve information from LDAP
  *
  * @param string $uid login or email
  * @return array
  */
 public function getRemoteUserInfo($uid)
 {
     if (strpos($uid, '@') === false) {
         $filter = Net_LDAP2_Filter::create('uid', 'equals', $uid);
     } else {
         $filter = Net_LDAP2_Filter::create('mail', 'equals', $uid);
     }
     if (!empty($this->user_filter_string)) {
         $user_filter = Net_LDAP2_Filter::parse($this->user_filter_string);
         $filter = Net_LDAP2_Filter::combine('and', array($filter, $user_filter));
     }
     $search = $this->connect()->search($this->basedn, $filter, array('sizelimit' => 1));
     $entry = $search->shiftEntry();
     if (!$entry || Misc::isError($entry)) {
         return null;
     }
     $details = array('uid' => $entry->get_value('uid'), 'full_name' => Misc::trim($entry->get_value('cn')), 'emails' => Misc::trim(Misc::lowercase($entry->get_value('mail', 'all'))), 'customer_id' => Misc::trim($entry->get_value($this->customer_id_attribute)) ?: null, 'contact_id' => Misc::trim($entry->get_value($this->contact_id_attribute)) ?: null);
     return $details;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:25,代码来源:class.ldap_auth_backend.php

示例3: get_queries

function get_queries($file)
{
    $contents = file_get_contents($file);
    $queries = explode(';', $contents);
    $queries = Misc::trim($queries);
    $queries = array_filter($queries);
    return $queries;
}
开发者ID:dabielkabuto,项目名称:eventum,代码行数:8,代码来源:index.php

示例4: createMailHandler

 /**
  * Get mail handler if configured
  *
  * @return \Monolog\Handler\MailHandler
  */
 private static function createMailHandler()
 {
     $setup = Setup::get();
     if ($setup['email_error']['status'] != 'enabled') {
         return null;
     }
     $notify_list = trim($setup['email_error']['addresses']);
     if (!$notify_list) {
         return null;
     }
     // recipient list can be comma separated
     $to = Misc::trim(explode(',', $notify_list));
     $subject = APP_SITE_NAME . ' - Error found!';
     $handler = new Monolog\Handler\NativeMailerHandler($to, $subject, $setup['smtp']['from'], Monolog\Logger::ERROR);
     return $handler;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:21,代码来源:Logger.php

示例5: _getReminderAlertAddresses

 /**
  * Method used to get the list of email addresses to use
  * to send diagnostic information about the reminder system.
  *
  * @return  array The list of alert email addresses
  */
 public static function _getReminderAlertAddresses()
 {
     $emails = array();
     $setup = Setup::get();
     if ($setup['email_reminder']['status'] == 'enabled' && $setup['email_reminder']['addresses']) {
         $emails = explode(',', $setup['email_reminder']['addresses']);
         $emails = Misc::trim($emails);
     }
     return $emails;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:16,代码来源:class.reminder.php

示例6: getAllReferences

 /**
  * Returns the message IDs of all emails this message references.
  *
  * @param   string $text_headers The full headers of the message
  * @return  array An array of message-ids
  */
 public static function getAllReferences($text_headers)
 {
     $references = array();
     if (preg_match('/^In-Reply-To: (.*)/mi', $text_headers, $matches)) {
         $references[] = trim($matches[1]);
     }
     if (preg_match('/^References: (.+?)(\\r?\\n\\r?\\n|\\r?\\n\\r?\\S)/smi', $text_headers, $matches)) {
         $references = array_merge($references, explode(' ', self::unfold(trim($matches[1]))));
         $references = Misc::trim($references);
         $references = array_unique($references);
     }
     foreach ($references as $key => $reference) {
         if (empty($reference)) {
             unset($references[$key]);
         }
     }
     return $references;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:24,代码来源:class.mail_helper.php


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