Skip to content
Permalink
Browse files

removed adding $mail to objects Nette\Templating\ITemplate and Nette\…

…Application\UI\ITemplate (BC break)
  • Loading branch information...
dg committed Feb 16, 2015
1 parent a0d61d9 commit 02fc9a47a59aadc665be1cafd730fe9342eb35f9
Showing with 10 additions and 15 deletions.
  1. +9 −9 src/Mail/Message.php
  2. +1 −6 src/Mail/MimePart.php
@@ -214,27 +214,27 @@ public function getPriority()
/**
* Sets HTML body.
* @param string
* @param mixed base-path or FALSE to disable parsing
* @param mixed base-path
* @return self
*/
public function setHtmlBody($html, $basePath = NULL)
{
if ($html instanceof Nette\Templating\ITemplate || $html instanceof Nette\Application\UI\ITemplate) {
trigger_error('Support for Nette\Templating is deprecated.', E_USER_DEPRECATED);
$html->mail = $this;
if ($basePath === NULL && ($html instanceof Nette\Templating\IFileTemplate || $html instanceof Nette\Application\UI\ITemplate)) {
$basePath = dirname($html->getFile());
}
$html = $html->__toString(TRUE);
if ($basePath === NULL && ($html instanceof Nette\Templating\IFileTemplate || $html instanceof Nette\Application\UI\ITemplate)) {
$basePath = dirname($html->getFile());
$bc = TRUE;
}
$html = (string) $html;
if ($basePath !== FALSE) {
if ($basePath) {
$cids = array();
$matches = Strings::matchAll(
$html,
'#(src\s*=\s*|background\s*=\s*|url\()(["\']?)(?![a-z]+:|[/\\#])([^"\')\s]+)#i',
PREG_OFFSET_CAPTURE
);
if ($matches && isset($bc)) {
trigger_error(__METHOD__ . '() missing second argument with image base path.', E_USER_WARNING);
}
foreach (array_reverse($matches) as $m) {
$file = rtrim($basePath, '/\\') . '/' . urldecode($m[3][0]);
if (!isset($cids[$file])) {
@@ -207,12 +207,7 @@ public function addPart(MimePart $part = NULL)
*/
public function setBody($body)
{
if ($body instanceof Nette\Templating\ITemplate || $body instanceof Nette\Application\UI\ITemplate) {
trigger_error('Support for Nette\Templating is deprecated.', E_USER_DEPRECATED);
$body->mail = $this;
$body = $body->__toString(TRUE);
}
$this->body = $body;
$this->body = (string) $body;
return $this;
}

0 comments on commit 02fc9a4

Please sign in to comment.
You can’t perform that action at this time.