當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Horde_Mime_Part::setMimeId方法代碼示例

本文整理匯總了PHP中Horde_Mime_Part::setMimeId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Horde_Mime_Part::setMimeId方法的具體用法?PHP Horde_Mime_Part::setMimeId怎麽用?PHP Horde_Mime_Part::setMimeId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Horde_Mime_Part的用法示例。


在下文中一共展示了Horde_Mime_Part::setMimeId方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _partAction

 /**
  * Function used to find a specific MIME part by ID and perform an action
  * on it.
  *
  * @param string $id                  The MIME ID.
  * @param string $action              The action to perform ('get',
  *                                    'remove', or 'alter').
  * @param Horde_Mime_Part $mime_part  The object to use for 'alter'.
  *
  * @return mixed  See calling functions.
  */
 protected function _partAction($id, $action, $mime_part = null)
 {
     $this_id = $this->getMimeId();
     /* Need strcmp() because, e.g., '2.0' == '2'. */
     if ($action === 'get' && strcmp($id, $this_id) === 0) {
         return $this;
     }
     if ($this->_reindex) {
         $this->buildMimeIds(is_null($this_id) ? '1' : $this_id);
     }
     foreach ($this->_parts as $key => $val) {
         $partid = $val->getMimeId();
         if (($match = strcmp($id, $partid) === 0) || strpos($id, $partid . '.') === 0 || strrchr($partid, '.') === '.0') {
             switch ($action) {
                 case 'alter':
                     if ($match) {
                         $mime_part->setMimeId($partid);
                         $this->_parts[$key] = $mime_part;
                         return true;
                     }
                     return $val->alterPart($id, $mime_part);
                 case 'get':
                     return $match ? $val : $val->getPart($id);
                 case 'remove':
                     if ($match) {
                         unset($this->_parts[$key]);
                         $this->_reindex = true;
                         return true;
                     }
                     return $val->removePart($id);
             }
         }
     }
     return $action === 'get' ? null : false;
 }
開發者ID:evltuma,項目名稱:moodle,代碼行數:46,代碼來源:Part.php

示例2: _partAction

 /**
  * Function used to find a specific MIME part by ID and perform an action
  * on it.
  *
  * @param string $id                  The MIME ID.
  * @param string $action              The action to perform ('get',
  *                                    'remove', or 'alter').
  * @param Horde_Mime_Part $mime_part  The object to use for 'alter'.
  *
  * @return mixed  See calling functions.
  */
 protected function _partAction($id, $action, $mime_part = null)
 {
     $this_id = $this->getMimeId();
     /* Need strcmp() because, e.g., '2.0' == '2'. */
     if ($action == 'get' && strcmp($id, $this_id) === 0) {
         return $this;
     }
     if ($this->_reindex) {
         $this->buildMimeIds(is_null($this_id) ? '1' : $this_id);
     }
     foreach (array_keys($this->_parts) as $val) {
         $partid = $this->_parts[$val]->getMimeId();
         if (strcmp($id, $partid) === 0) {
             switch ($action) {
                 case 'alter':
                     $mime_part->setMimeId($this->_parts[$val]->getMimeId());
                     $this->_parts[$val] = $mime_part;
                     return true;
                 case 'get':
                     return $this->_parts[$val];
                 case 'remove':
                     unset($this->_parts[$val]);
                     $this->_reindex = true;
                     return true;
             }
         }
         if (strpos($id, $partid . '.') === 0 || strrchr($partid, '.') === '.0') {
             return $this->_parts[$val]->_partAction($id, $action, $mime_part);
         }
     }
     return $action == 'get' ? null : false;
 }
開發者ID:netcon-source,項目名稱:apps,代碼行數:43,代碼來源:Part.php


注:本文中的Horde_Mime_Part::setMimeId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。