Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Y
yii2bootstrap
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
yii2bootstrap
Commits
2a326c7d
Commit
2a326c7d
authored
Oct 25, 2013
by
Paul Klimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'email' renamed to 'mail'.
'SwiftMailer' recomposed into extension.
parent
a3dd0d57
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
153 additions
and
77 deletions
+153
-77
LICENSE.md
extensions/swiftmailer/LICENSE.md
+32
-0
README.md
extensions/swiftmailer/README.md
+58
-0
composer.json
extensions/swiftmailer/composer.json
+28
-0
Mailer.php
extensions/swiftmailer/yii/swiftmailer/Mailer.php
+1
-38
Message.php
extensions/swiftmailer/yii/swiftmailer/Message.php
+3
-3
autoload.php
framework/yii/email/swift/autoload.php
+0
-9
BaseMailer.php
framework/yii/mail/BaseMailer.php
+7
-7
BaseMessage.php
framework/yii/mail/BaseMessage.php
+3
-3
Message.php
framework/yii/mail/Message.php
+3
-3
MessageInterface.php
framework/yii/mail/MessageInterface.php
+1
-1
ViewResolver.php
framework/yii/mail/ViewResolver.php
+1
-1
MailerTest.php
tests/unit/extensions/swiftmailer/MailerTest.php
+3
-3
MessageTest.php
tests/unit/extensions/swiftmailer/MessageTest.php
+3
-3
BaseMailerTest.php
tests/unit/framework/mail/BaseMailerTest.php
+4
-4
ViewResolverTest.php
tests/unit/framework/mail/ViewResolverTest.php
+6
-2
No files found.
extensions/swiftmailer/LICENSE.md
0 → 100644
View file @
2a326c7d
The Yii framework is free software. It is released under the terms of
the following BSD License.
Copyright © 2008-2013 by Yii Software LLC (http://www.yiisoft.com)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
*
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
*
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
*
Neither the name of Yii Software LLC nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
extensions/swiftmailer/README.md
0 → 100644
View file @
2a326c7d
Yii 2.0 Public Preview - SwiftMailer Mail Solution
==================================================
Thank you for choosing Yii - a high-performance component-based PHP framework.
If you are looking for a production-ready PHP framework, please use
[
Yii v1.1
](
https://github.com/yiisoft/yii
)
.
Yii 2.0 is still under heavy development. We may make significant changes
without prior notices.
**Yii 2.0 is not ready for production use yet.**
[

](http://travis-ci.org/yiisoft/yii2)
This is the yii2-swiftmailer extension.
Installation
------------
The preferred way to install this extension is through
[
composer
](
http://getcomposer.org/download/
)
.
Either run
```
php composer.phar require yiisoft/yii2-swiftmailer "*"
```
or add
```
json
"yiisoft/yii2-swiftmailer"
:
"*"
```
to the require section of your composer.json.
*Note: You might have to run `php composer.phar selfupdate`*
Usage & Documentation
---------------------
This extension has to be registered prior to usage.
To enable this view renderer add it to the $rendereres property of your view object.
Example:
```
php
<?php
// config.php
return
[
//....
'components'
=>
[
'mail'
=>
[
'class'
=>
'yii\swiftmailer\Mailer'
,
],
],
];
```
For further instructions refer to the related section in the yii guide.
extensions/swiftmailer/composer.json
0 → 100644
View file @
2a326c7d
{
"name"
:
"yiisoft/yii2-swiftmailer"
,
"description"
:
"The SwiftMailer integration for the Yii framework"
,
"keywords"
:
[
"yii"
,
"swift"
,
"swiftmailer"
,
"mail"
,
"email"
,
"mailer"
],
"type"
:
"yii2-extension"
,
"license"
:
"BSD-3-Clause"
,
"support"
:
{
"issues"
:
"https://github.com/yiisoft/yii2/issues?state=open"
,
"forum"
:
"http://www.yiiframework.com/forum/"
,
"wiki"
:
"http://www.yiiframework.com/wiki/"
,
"irc"
:
"irc://irc.freenode.net/yii"
,
"source"
:
"https://github.com/yiisoft/yii2"
},
"authors"
:
[
{
"name"
:
"Paul Klimov"
,
"email"
:
"klimov.paul@gmail.com"
}
],
"minimum-stability"
:
"dev"
,
"require"
:
{
"yiisoft/yii2"
:
"*"
,
"swiftmailer/swiftmailer"
:
">=v5.0"
},
"autoload"
:
{
"psr-0"
:
{
"yii
\\
swiftmailer
\\
"
:
""
}
}
}
framework/yii/email/swift
/Mailer.php
→
extensions/swiftmailer/yii/swiftmailer
/Mailer.php
View file @
2a326c7d
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* @license http://www.yiiframework.com/license/
* @license http://www.yiiframework.com/license/
*/
*/
namespace
yii\
email\swift
;
namespace
yii\
swiftmailer
;
use
yii\base\InvalidConfigException
;
use
yii\base\InvalidConfigException
;
use
yii\email\BaseMailer
;
use
yii\email\BaseMailer
;
...
@@ -40,12 +40,6 @@ use yii\email\BaseMailer;
...
@@ -40,12 +40,6 @@ use yii\email\BaseMailer;
*/
*/
class
Mailer
extends
BaseMailer
class
Mailer
extends
BaseMailer
{
{
/**
* @var string|callback SwiftMailer autoloader callback or path to autoloader file.
* If the SwiftMailer classes autoloading is already managed in some other place,
* for example via Composer, you should leave this field blank.
*/
public
$autoload
;
/**
/**
* @var \Swift_Mailer Swift mailer instance.
* @var \Swift_Mailer Swift mailer instance.
*/
*/
...
@@ -89,37 +83,6 @@ class Mailer extends BaseMailer
...
@@ -89,37 +83,6 @@ class Mailer extends BaseMailer
return
$this
->
_transport
;
return
$this
->
_transport
;
}
}
/**
* @inheritdoc
*/
public
function
init
()
{
$this
->
setupSwiftMailerAutoload
();
}
/**
* Sets up the SwiftMailer autoloader, if it is specified.
*/
protected
function
setupSwiftMailerAutoload
()
{
if
(
!
class_exists
(
'Swift'
,
false
))
{
if
(
empty
(
$this
->
autoload
))
{
$this
->
autoload
=
__DIR__
.
'/autoload.php'
;
}
if
(
is_string
(
$this
->
autoload
))
{
if
(
file_exists
(
$this
->
autoload
))
{
require_once
(
$this
->
autoload
);
}
elseif
(
function_exists
(
$this
->
autoload
))
{
spl_autoload_register
(
$this
->
autoload
);
}
else
{
throw
new
InvalidConfigException
(
'"'
.
get_class
(
$this
)
.
'::autoload" value "'
.
$this
->
autoload
.
'" is invalid: no such function or file exists.'
);
}
}
else
{
spl_autoload_register
(
$this
->
autoload
);
}
}
}
/**
/**
* @inheritdoc
* @inheritdoc
*/
*/
...
...
framework/yii/email/swift
/Message.php
→
extensions/swiftmailer/yii/swiftmailer
/Message.php
View file @
2a326c7d
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* @license http://www.yiiframework.com/license/
* @license http://www.yiiframework.com/license/
*/
*/
namespace
yii\
email\swift
;
namespace
yii\
swiftmailer
;
use
yii\email\BaseMessage
;
use
yii\email\BaseMessage
;
...
@@ -13,9 +13,9 @@ use yii\email\BaseMessage;
...
@@ -13,9 +13,9 @@ use yii\email\BaseMessage;
* Email message based on SwiftMailer library.
* Email message based on SwiftMailer library.
*
*
* @see http://swiftmailer.org/docs/messages.html
* @see http://swiftmailer.org/docs/messages.html
* @see \yii\
email\swift
\Mailer
* @see \yii\
swiftmailer
\Mailer
*
*
* @method
\yii\email\swift\
Mailer getMailer() returns mailer instance.
* @method Mailer getMailer() returns mailer instance.
* @property \Swift_Message $swiftMessage vendor message instance.
* @property \Swift_Message $swiftMessage vendor message instance.
*
*
* @author Paul Klimov <klimov.paul@gmail.com>
* @author Paul Klimov <klimov.paul@gmail.com>
...
...
framework/yii/email/swift/autoload.php
deleted
100644 → 0
View file @
a3dd0d57
<?php
/**
* This file attempts to register autoloader for the Swift library, assuming
* it is located under the 'vendor' path.
*
* @var $this \yii\email\swift\Mailer
*/
$swiftMailerLibPath
=
Yii
::
getAlias
(
'@vendor/swiftmailer/swiftmailer/lib'
);
require_once
$swiftMailerLibPath
.
'/swift_required.php'
;
\ No newline at end of file
framework/yii/
e
mail/BaseMailer.php
→
framework/yii/mail/BaseMailer.php
View file @
2a326c7d
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* @license http://www.yiiframework.com/license/
* @license http://www.yiiframework.com/license/
*/
*/
namespace
yii\
e
mail
;
namespace
yii\mail
;
use
yii\base\Component
;
use
yii\base\Component
;
use
yii\base\InvalidConfigException
;
use
yii\base\InvalidConfigException
;
...
@@ -19,7 +19,7 @@ use Yii;
...
@@ -19,7 +19,7 @@ use Yii;
* @see BaseMessage
* @see BaseMessage
*
*
* @property \yii\base\View|array $view view instance or its array configuration.
* @property \yii\base\View|array $view view instance or its array configuration.
* @property \yii\
e
mail\ViewResolver|array $viewResolver view resolver instance or its array configuration.
* @property \yii\mail\ViewResolver|array $viewResolver view resolver instance or its array configuration.
* @property array $defaultMessageConfig configuration, which should be applied by default to any
* @property array $defaultMessageConfig configuration, which should be applied by default to any
* new created email message instance.
* new created email message instance.
*
*
...
@@ -33,7 +33,7 @@ abstract class BaseMailer extends Component
...
@@ -33,7 +33,7 @@ abstract class BaseMailer extends Component
*/
*/
private
$_view
=
[];
private
$_view
=
[];
/**
/**
* @var \yii\
e
mail\ViewResolver|array view resolver instance or its array configuration.
* @var \yii\mail\ViewResolver|array view resolver instance or its array configuration.
*/
*/
private
$_viewResolver
=
[];
private
$_viewResolver
=
[];
/**
/**
...
@@ -74,7 +74,7 @@ abstract class BaseMailer extends Component
...
@@ -74,7 +74,7 @@ abstract class BaseMailer extends Component
}
}
/**
/**
* @param array|\yii\
e
mail\ViewResolver $viewResolver view resolver instance or its array configuration.
* @param array|\yii\mail\ViewResolver $viewResolver view resolver instance or its array configuration.
* @throws \yii\base\InvalidConfigException on invalid argument.
* @throws \yii\base\InvalidConfigException on invalid argument.
*/
*/
public
function
setViewResolver
(
$viewResolver
)
public
function
setViewResolver
(
$viewResolver
)
...
@@ -86,7 +86,7 @@ abstract class BaseMailer extends Component
...
@@ -86,7 +86,7 @@ abstract class BaseMailer extends Component
}
}
/**
/**
* @return \yii\
e
mail\ViewResolver view resolver.
* @return \yii\mail\ViewResolver view resolver.
*/
*/
public
function
getViewResolver
()
public
function
getViewResolver
()
{
{
...
@@ -128,12 +128,12 @@ abstract class BaseMailer extends Component
...
@@ -128,12 +128,12 @@ abstract class BaseMailer extends Component
/**
/**
* Creates view resolver instance from given configuration.
* Creates view resolver instance from given configuration.
* @param array $config view resolver configuration.
* @param array $config view resolver configuration.
* @return \yii\
e
mail\ViewResolver view resolver instance.
* @return \yii\mail\ViewResolver view resolver instance.
*/
*/
protected
function
createViewResolver
(
array
$config
)
protected
function
createViewResolver
(
array
$config
)
{
{
if
(
!
array_key_exists
(
'class'
,
$config
))
{
if
(
!
array_key_exists
(
'class'
,
$config
))
{
$config
[
'class'
]
=
'\yii\
e
mail\ViewResolver'
;
$config
[
'class'
]
=
'\yii\mail\ViewResolver'
;
}
}
return
Yii
::
createObject
(
$config
);
return
Yii
::
createObject
(
$config
);
}
}
...
...
framework/yii/
e
mail/BaseMessage.php
→
framework/yii/mail/BaseMessage.php
View file @
2a326c7d
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* @license http://www.yiiframework.com/license/
* @license http://www.yiiframework.com/license/
*/
*/
namespace
yii\
e
mail
;
namespace
yii\mail
;
use
yii\base\InvalidParamException
;
use
yii\base\InvalidParamException
;
use
yii\base\Object
;
use
yii\base\Object
;
...
@@ -20,7 +20,7 @@ use Yii;
...
@@ -20,7 +20,7 @@ use Yii;
*
*
* @see BaseMailer
* @see BaseMailer
*
*
* @property \yii\
e
mail\BaseMailer $mailer mailer component instance. This property is read-only.
* @property \yii\mail\BaseMailer $mailer mailer component instance. This property is read-only.
* @property string|array $from sender email address.
* @property string|array $from sender email address.
* @property string|array $to receiver email address.
* @property string|array $to receiver email address.
* @property string|array $cc copy receiver email address.
* @property string|array $cc copy receiver email address.
...
@@ -35,7 +35,7 @@ use Yii;
...
@@ -35,7 +35,7 @@ use Yii;
abstract
class
BaseMessage
extends
Object
implements
MessageInterface
abstract
class
BaseMessage
extends
Object
implements
MessageInterface
{
{
/**
/**
* @return \yii\
e
mail\BaseMailer
* @return \yii\mail\BaseMailer
*/
*/
public
function
getMailer
()
public
function
getMailer
()
{
{
...
...
framework/yii/
e
mail/Message.php
→
framework/yii/mail/Message.php
View file @
2a326c7d
...
@@ -5,9 +5,9 @@
...
@@ -5,9 +5,9 @@
* @license http://www.yiiframework.com/license/
* @license http://www.yiiframework.com/license/
*/
*/
namespace
yii\
e
mail
;
namespace
yii\mail
;
use
yii\
email\swift
\Message
as
SwiftMessage
;
use
yii\
swiftmailer
\Message
as
SwiftMessage
;
/**
/**
* Message provides the email message sending functionality.
* Message provides the email message sending functionality.
...
@@ -36,7 +36,7 @@ use yii\email\swift\Message as SwiftMessage;
...
@@ -36,7 +36,7 @@ use yii\email\swift\Message as SwiftMessage;
* This particular class uses 'SwiftMailer' library to perform the message sending.
* This particular class uses 'SwiftMailer' library to perform the message sending.
* Note: you can replace usage of this class by your own one, using [[Yii::$classMap]]:
* Note: you can replace usage of this class by your own one, using [[Yii::$classMap]]:
* ~~~
* ~~~
* Yii::$classMap['yii\
e
mail\Message'] = '/path/to/my/email/Message.php'
* Yii::$classMap['yii\mail\Message'] = '/path/to/my/email/Message.php'
* ~~~
* ~~~
*
*
* @author Paul Klimov <klimov.paul@gmail.com>
* @author Paul Klimov <klimov.paul@gmail.com>
...
...
framework/yii/
e
mail/MessageInterface.php
→
framework/yii/mail/MessageInterface.php
View file @
2a326c7d
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* @license http://www.yiiframework.com/license/
* @license http://www.yiiframework.com/license/
*/
*/
namespace
yii\
e
mail
;
namespace
yii\mail
;
/**
/**
* Class MessageInterface
* Class MessageInterface
...
...
framework/yii/
e
mail/ViewResolver.php
→
framework/yii/mail/ViewResolver.php
View file @
2a326c7d
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* @license http://www.yiiframework.com/license/
* @license http://www.yiiframework.com/license/
*/
*/
namespace
yii\
e
mail
;
namespace
yii\mail
;
use
yii\base\Component
;
use
yii\base\Component
;
use
Yii
;
use
Yii
;
...
...
tests/unit/
framework/email/swift
/MailerTest.php
→
tests/unit/
extensions/swiftmailer
/MailerTest.php
View file @
2a326c7d
<?php
<?php
namespace
yiiunit\
framework\email\swift
;
namespace
yiiunit\
extensions\swiftmailer
;
use
Yii
;
use
Yii
;
use
yii\
email\swift
\Mailer
;
use
yii\
swiftmailer
\Mailer
;
use
yii\
email\swift
\Message
;
use
yii\
swiftmailer
\Message
;
use
yiiunit\TestCase
;
use
yiiunit\TestCase
;
/**
/**
...
...
tests/unit/
framework/email/swift
/MessageTest.php
→
tests/unit/
extensions/swiftmailer
/MessageTest.php
View file @
2a326c7d
<?php
<?php
namespace
yiiunit\
framework\email\swift
;
namespace
yiiunit\
extensions\swiftmailer
;
use
Yii
;
use
Yii
;
use
yii\
email\swift
\Mailer
;
use
yii\
swiftmailer
\Mailer
;
use
yii\
email\swift
\Message
;
use
yii\
swiftmailer
\Message
;
use
yiiunit\TestCase
;
use
yiiunit\TestCase
;
/**
/**
...
...
tests/unit/framework/
e
mail/BaseMailerTest.php
→
tests/unit/framework/mail/BaseMailerTest.php
View file @
2a326c7d
<?php
<?php
namespace
yiiunit\framework\
e
mail
;
namespace
yiiunit\framework\mail
;
use
Yii
;
use
Yii
;
use
yii\base\View
;
use
yii\base\View
;
use
yii\
e
mail\BaseMailer
;
use
yii\mail\BaseMailer
;
use
yii\
e
mail\BaseMessage
;
use
yii\mail\BaseMessage
;
use
yii\
e
mail\ViewResolver
;
use
yii\mail\ViewResolver
;
use
yii\helpers\FileHelper
;
use
yii\helpers\FileHelper
;
use
yiiunit\TestCase
;
use
yiiunit\TestCase
;
...
...
tests/unit/framework/
e
mail/ViewResolverTest.php
→
tests/unit/framework/mail/ViewResolverTest.php
View file @
2a326c7d
<?php
<?php
namespace
yiiunit\framework\
e
mail
;
namespace
yiiunit\framework\mail
;
use
yii\
e
mail\ViewResolver
;
use
yii\mail\ViewResolver
;
use
Yii
;
use
Yii
;
use
yiiunit\TestCase
;
use
yiiunit\TestCase
;
...
@@ -16,6 +16,10 @@ class ViewResolverTest extends TestCase
...
@@ -16,6 +16,10 @@ class ViewResolverTest extends TestCase
*/
*/
protected
$testViewPath
=
'@yiiunit/emails'
;
protected
$testViewPath
=
'@yiiunit/emails'
;
/**
* Data provider for [[testFindViewFile()]]
* @return array test data.
*/
public
function
dataProviderFindViewFile
()
public
function
dataProviderFindViewFile
()
{
{
$alias
=
'@yiiunit'
;
$alias
=
'@yiiunit'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment