diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-03-28 03:42:39 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-03-28 03:42:40 +0400 |
commit | ae4b03163792f0b6e933933e5d37df87dc3fd566 (patch) | |
tree | d1d7510a9728f587d3d63ebd03e4ecf3d904838b /core/Mail.php | |
parent | 158c2150f5f2e13ece459b8d131244c11b763997 (diff) |
Mass conversion of all files to the newly agreed coding standard: PSR 1/2
Converting Piwik core source files, PHP, JS, TPL, CSS
More info: http://piwik.org/participate/coding-standards/
Diffstat (limited to 'core/Mail.php')
-rw-r--r-- | core/Mail.php | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/core/Mail.php b/core/Mail.php index 583266e870..833e01fdb6 100644 --- a/core/Mail.php +++ b/core/Mail.php @@ -4,78 +4,78 @@ * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package Piwik */ /** - * Class for sending mails, for more information see: + * Class for sending mails, for more information see: * * @package Piwik * @see Zend_Mail, libs/Zend/Mail.php - * @link http://framework.zend.com/manual/en/zend.mail.html + * @link http://framework.zend.com/manual/en/zend.mail.html */ class Piwik_Mail extends Zend_Mail { - /** - * Default charset utf-8 - * - * @param string $charset charset, defaults to utf-8 - */ - public function __construct($charset = 'utf-8') - { - parent::__construct($charset); - $this->initSmtpTransport(); - } + /** + * Default charset utf-8 + * + * @param string $charset charset, defaults to utf-8 + */ + public function __construct($charset = 'utf-8') + { + parent::__construct($charset); + $this->initSmtpTransport(); + } + + /** + * Sets the sender to use + * + * @param string $email + * @param null|string $name + */ + public function setFrom($email, $name = null) + { + $hostname = Piwik_Config::getInstance()->mail['defaultHostnameIfEmpty']; + $piwikHost = Piwik_Url::getCurrentHost($hostname); + + // If known Piwik URL, use it instead of "localhost" + $piwikUrl = Piwik::getPiwikUrl(); + $url = parse_url($piwikUrl); + if (isset($url['host']) + && $url['host'] != 'localhost' + && $url['host'] != '127.0.0.1' + ) { + $piwikHost = $url['host']; + } + $email = str_replace('{DOMAIN}', $piwikHost, $email); + parent::setFrom($email, $name); + } - /** - * Sets the sender to use - * - * @param string $email - * @param null|string $name - */ - public function setFrom($email, $name = null) - { - $hostname = Piwik_Config::getInstance()->mail['defaultHostnameIfEmpty']; - $piwikHost = Piwik_Url::getCurrentHost($hostname); - - // If known Piwik URL, use it instead of "localhost" - $piwikUrl = Piwik::getPiwikUrl(); - $url = parse_url($piwikUrl); - if(isset($url['host']) - && $url['host'] != 'localhost' - && $url['host'] != '127.0.0.1') - { - $piwikHost = $url['host']; - } - $email = str_replace('{DOMAIN}', $piwikHost, $email); - parent::setFrom($email, $name); - } + /** + * @return void + */ + private function initSmtpTransport() + { + $mailConfig = Piwik_Config::getInstance()->mail; + if (empty($mailConfig['host']) + || $mailConfig['transport'] != 'smtp' + ) { + return; + } + $smtpConfig = array(); + if (!empty($mailConfig['type'])) + $smtpConfig['auth'] = strtolower($mailConfig['type']); + if (!empty($mailConfig['username'])) + $smtpConfig['username'] = $mailConfig['username']; + if (!empty($mailConfig['password'])) + $smtpConfig['password'] = $mailConfig['password']; + if (!empty($mailConfig['encryption'])) + $smtpConfig['ssl'] = $mailConfig['encryption']; - /** - * @return void - */ - private function initSmtpTransport() - { - $mailConfig = Piwik_Config::getInstance()->mail; - if ( empty($mailConfig['host']) - || $mailConfig['transport'] != 'smtp') - { - return; - } - $smtpConfig = array(); - if (!empty($mailConfig['type'])) - $smtpConfig['auth'] = strtolower($mailConfig['type']); - if (!empty($mailConfig['username'])) - $smtpConfig['username'] = $mailConfig['username']; - if (!empty($mailConfig['password'])) - $smtpConfig['password'] = $mailConfig['password']; - if (!empty($mailConfig['encryption'])) - $smtpConfig['ssl'] = $mailConfig['encryption']; - - $tr = new Zend_Mail_Transport_Smtp($mailConfig['host'], $smtpConfig); - Piwik_Mail::setDefaultTransport($tr); - ini_set("smtp_port", $mailConfig['port']); - } + $tr = new Zend_Mail_Transport_Smtp($mailConfig['host'], $smtpConfig); + Piwik_Mail::setDefaultTransport($tr); + ini_set("smtp_port", $mailConfig['port']); + } } |