-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2624ff9
commit 08b8206
Showing
175 changed files
with
22,186 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of SwiftMailer. | ||
* (c) 2004-2009 Chris Corbyn | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/** | ||
* General utility class in Swift Mailer, not to be instantiated. | ||
* | ||
* | ||
* @author Chris Corbyn | ||
*/ | ||
abstract class Swift | ||
{ | ||
/** Swift Mailer Version number generated during dist release process */ | ||
const VERSION = '@SWIFT_VERSION_NUMBER@'; | ||
|
||
public static $initialized = false; | ||
public static $inits = array(); | ||
|
||
/** | ||
* Registers an initializer callable that will be called the first time | ||
* a SwiftMailer class is autoloaded. | ||
* | ||
* This enables you to tweak the default configuration in a lazy way. | ||
* | ||
* @param mixed $callable A valid PHP callable that will be called when autoloading the first Swift class | ||
*/ | ||
public static function init($callable) | ||
{ | ||
self::$inits[] = $callable; | ||
} | ||
|
||
/** | ||
* Internal autoloader for spl_autoload_register(). | ||
* | ||
* @param string $class | ||
*/ | ||
public static function autoload($class) | ||
{ | ||
// Don't interfere with other autoloaders | ||
if (0 !== strpos($class, 'Swift_')) { | ||
return; | ||
} | ||
|
||
$path = dirname(__FILE__).'/'.str_replace('_', '/', $class).'.php'; | ||
|
||
if (!file_exists($path)) { | ||
return; | ||
} | ||
|
||
require $path; | ||
|
||
if (self::$inits && !self::$initialized) { | ||
self::$initialized = true; | ||
foreach (self::$inits as $init) { | ||
call_user_func($init); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Configure autoloading using Swift Mailer. | ||
* | ||
* This is designed to play nicely with other autoloaders. | ||
* | ||
* @param mixed $callable A valid PHP callable that will be called when autoloading the first Swift class | ||
*/ | ||
public static function registerAutoload($callable = null) | ||
{ | ||
if (null !== $callable) { | ||
self::$inits[] = $callable; | ||
} | ||
spl_autoload_register(array('Swift', 'autoload')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of SwiftMailer. | ||
* (c) 2004-2009 Chris Corbyn | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/** | ||
* Attachment class for attaching files to a {@link Swift_Mime_Message}. | ||
* | ||
* @author Chris Corbyn | ||
*/ | ||
class Swift_Attachment extends Swift_Mime_Attachment | ||
{ | ||
/** | ||
* Create a new Attachment. | ||
* | ||
* Details may be optionally provided to the constructor. | ||
* | ||
* @param string|Swift_OutputByteStream $data | ||
* @param string $filename | ||
* @param string $contentType | ||
*/ | ||
public function __construct($data = null, $filename = null, $contentType = null) | ||
{ | ||
call_user_func_array( | ||
array($this, 'Swift_Mime_Attachment::__construct'), | ||
Swift_DependencyContainer::getInstance() | ||
->createDependenciesFor('mime.attachment') | ||
); | ||
|
||
$this->setBody($data); | ||
$this->setFilename($filename); | ||
if ($contentType) { | ||
$this->setContentType($contentType); | ||
} | ||
} | ||
|
||
/** | ||
* Create a new Attachment. | ||
* | ||
* @param string|Swift_OutputByteStream $data | ||
* @param string $filename | ||
* @param string $contentType | ||
* | ||
* @return Swift_Mime_Attachment | ||
*/ | ||
public static function newInstance($data = null, $filename = null, $contentType = null) | ||
{ | ||
return new self($data, $filename, $contentType); | ||
} | ||
|
||
/** | ||
* Create a new Attachment from a filesystem path. | ||
* | ||
* @param string $path | ||
* @param string $contentType optional | ||
* | ||
* @return Swift_Mime_Attachment | ||
*/ | ||
public static function fromPath($path, $contentType = null) | ||
{ | ||
return self::newInstance()->setFile( | ||
new Swift_ByteStream_FileByteStream($path), | ||
$contentType | ||
); | ||
} | ||
} |
Oops, something went wrong.