Skip to content

Commit

Permalink
Add SwiftMailer
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasReschke committed Mar 11, 2015
1 parent 2624ff9 commit 08b8206
Show file tree
Hide file tree
Showing 175 changed files with 22,186 additions and 4 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"pimple/pimple": "~3.0",
"ircmaxell/password-compat": "1.0.*",
"nikic/php-parser": "~1.1",
"icewind/Streams": "0.2.0"
"icewind/Streams": "0.2.0",
"swiftmailer/swiftmailer": "@stable"
}
}
59 changes: 56 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions composer/autoload_files.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
$vendorDir . '/kriswallsmith/assetic/src/functions.php',
$vendorDir . '/ircmaxell/password-compat/lib/password.php',
$vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Random.php',
$vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php',
);
54 changes: 54 additions & 0 deletions composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -2222,5 +2222,59 @@
],
"description": "Symfony Process Component",
"homepage": "http://symfony.com"
},
{
"name": "swiftmailer/swiftmailer",
"version": "v5.3.1",
"version_normalized": "5.3.1.0",
"source": {
"type": "git",
"url": "https://github.com/swiftmailer/swiftmailer.git",
"reference": "c5f963e7f9d6f6438fda4f22d5cc2db296ec621a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/c5f963e7f9d6f6438fda4f22d5cc2db296ec621a",
"reference": "c5f963e7f9d6f6438fda4f22d5cc2db296ec621a",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"mockery/mockery": "~0.9.1"
},
"time": "2014-12-05 14:17:14",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.3-dev"
}
},
"installation-source": "dist",
"autoload": {
"files": [
"lib/swift_required.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Chris Corbyn"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "Swiftmailer, free feature-rich PHP mailer",
"homepage": "http://swiftmailer.org",
"keywords": [
"mail",
"mailer"
]
}
]
80 changes: 80 additions & 0 deletions swiftmailer/swiftmailer/lib/classes/Swift.php
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'));
}
}
71 changes: 71 additions & 0 deletions swiftmailer/swiftmailer/lib/classes/Swift/Attachment.php
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
);
}
}

0 comments on commit 08b8206

Please sign in to comment.