Exemplo n.º 1
0
 /**
  * Overrides setData() in MIME so that a filename can be set
  * @param mixed The data to set for the body
  * @param boolean If the stream is a file, should it's filename be used?
  * @throws Swift_FileException If the stream cannot be read
  */
 public function setData($data, $read_filename = true)
 {
     parent::setData($data);
     if ($read_filename && $data instanceof Swift_file) {
         $this->setFileName($data->getFileName());
     }
 }
Exemplo n.º 2
0
 /**
  * Overrides setData() in MIME so that a filename can be set
  * @param mixed The data to set for the body
  * @param boolean If the stream is a file, should it's filename be used?
  * @throws Swift_FileException If the stream cannot be read
  */
 function setData($data, $read_filename = true)
 {
     parent::setData($data);
     if ($read_filename && is_a($data, "Swift_file")) {
         $this->setFileName($data->getFileName());
     }
 }
Exemplo n.º 3
0
 /**
  * Put the original values back in the message after it was modified before sending.
  * @param Swift_Message_Mime The message (or part)
  * @param array The location of the stored values
  */
 protected function recursiveRestore(Swift_Message_Mime $mime, &$store)
 {
     //Restore headers
     foreach ($store["headers"] as $name => $array) {
         if ($array["value"] !== false) {
             $mime->headers->set($name, $array["value"]);
         }
         foreach ($array["attributes"] as $att_name => $att_value) {
             $mime->headers->setAttribute($name, $att_name, $att_value);
         }
     }
     //Restore body
     if ($store["body"] !== false) {
         $mime->setData($store["body"]);
     }
     //Restore children
     foreach ($store["children"] as $id => $child_store) {
         $child = $mime->getChild($id);
         $this->recursiveRestore($child, $child_store);
     }
 }