コード例 #1
0
ファイル: CMail.php プロジェクト: nunodotferreira/Phred
 /**
  * Generates a CID for a data by which the data can be embedded into the body of a message.
  *
  * The same CID can be used to embed a data in more than one place.
  *
  * For example, an image for which a CID was generated and put into `$cid` variable can be embedded into a message
  * with HTML type of body by `<img src="' . $cid . '" alt="Title" />`.
  *
  * @param  data $data The data to be embedded.
  * @param  string $filename The filename to be associated with the embedded data.
  * @param  string $type The MIME type of the data's contents.
  *
  * @return CUStringObject The embeddable CID of the data.
  */
 public function embeddableCidForData($data, $filename, $type)
 {
     assert('is_cstring($data) && is_cstring($filename) && is_cstring($type)', vs(isset($this), get_defined_vars()));
     assert('isset($this->m_swiftMessage)', vs(isset($this), get_defined_vars()));
     $data = _from_oop_tp($data);
     $embeddedFile = Swift_EmbeddedFile::newInstance($data, $filename, $type);
     return $this->m_swiftMessage->embed($embeddedFile);
 }
コード例 #2
0
ファイル: FType.php プロジェクト: nunodotferreira/Phred
/**
 * @ignore
 */
function _from_oop_tp($value)
{
    // Only used with OOP wrapping for third-party components.
    if (is_carray($value)) {
        $value = splarray($value);
        $len = CArray::length($value);
        for ($i = 0; $i < $len; $i++) {
            $value[$i] = _from_oop_tp($value[$i]);
        }
        return $value->toArray();
    }
    if (is_cmap($value)) {
        $value = parray($value);
        foreach ($value as &$mapValue) {
            $mapValue = _from_oop_tp($mapValue);
        }
        unset($mapValue);
        return $value;
    }
    return $value;
}