本文整理汇总了PHP中Swift_DependencyContainer类的典型用法代码示例。如果您正苦于以下问题:PHP Swift_DependencyContainer类的具体用法?PHP Swift_DependencyContainer怎么用?PHP Swift_DependencyContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Swift_DependencyContainer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: email
/**
* Checks if an email matches the current grammars
* @param string $email
*/
public static function email($email)
{
if (self::$grammar === null) {
self::$grammar = Swift_DependencyContainer::getInstance()->lookup('mime.grammar');
}
return preg_match('/^' . self::$grammar->getDefinition('addr-spec') . '$/D', $email);
}
开发者ID:codigoirreverente,项目名称:LampCMS,代码行数:11,代码来源:Validate.php
示例2: getInstance
/**
* Returns a singleton of the DependencyContainer.
*
* @return Swift_DependencyContainer
*/
public static function getInstance()
{
if (!isset(self::$_instance)) {
self::$_instance = new self();
}
return self::$_instance;
}
开发者ID:laiello,项目名称:yii-mail-fix,代码行数:12,代码来源:DependencyContainer.php
示例3: __construct
/**
* Create a new SmtpTransport, optionally with $host, $port and $security.
*
* @param string $host
* @param integer $port
* @param string $security
*/
public function __construct($host = 'localhost', $port = 25, $security = null)
{
call_user_func_array(array($this, 'Swift_Transport_EsmtpTransport::__construct'), Swift_DependencyContainer::getInstance()->createDependenciesFor('transport.smtp'));
$this->setHost($host);
$this->setPort($port);
$this->setEncryption($security);
}
开发者ID:TuxCoffeeCorner,项目名称:tcc,代码行数:14,代码来源:SmtpTransport.php
示例4: __construct
/**
* Create a new NullTransport.
*/
public function __construct()
{
call_user_func_array(
array($this, 'Swift_Transport_NullTransport::__construct'),
Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.null')
);
}
开发者ID:nationalfield,项目名称:symfony,代码行数:11,代码来源:NullTransport.php
示例5: __construct
/**
* Create a new AWSTransport.
* @param string $AWSAccessKeyId Your access key.
* @param string $AWSSecretKey Your secret key.
* @param boolean $debug Set to true to enable debug messages in error log.
* @param string $endpoint The AWS endpoint to use.
*/
public function __construct($AWSAccessKeyId = null, $AWSSecretKey = null, $debug = false, $endpoint = 'https://email.us-east-1.amazonaws.com/')
{
call_user_func_array(array($this, 'Swift_Transport_AWSTransport::__construct'), Swift_DependencyContainer::getInstance()->createDependenciesFor('transport.aws'));
$this->AWSAccessKeyId = $AWSAccessKeyId;
$this->AWSSecretKey = $AWSSecretKey;
$this->endpoint = $endpoint;
$this->debug = $debug;
}
开发者ID:rhymix,项目名称:rhymix,代码行数:15,代码来源:AWSTransport.php
示例6: __construct
/**
* Create a new EmbeddedFile.
* 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_EmbeddedFile::__construct'), Swift_DependencyContainer::getInstance()->createDependenciesFor('mime.embeddedfile'));
$this->setBody($data);
$this->setFilename($filename);
if ($contentType) {
$this->setContentType($contentType);
}
}
开发者ID:HappyKennyD,项目名称:teest,代码行数:16,代码来源:EmbeddedFile.php
示例7: __construct
/**
* 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);
}
}
开发者ID:betes-curieuses-design,项目名称:ElieJosiePhotographie,代码行数:18,代码来源:Attachment.php
示例8: __construct
/**
* Create a new SendmailTransport, optionally using $command for sending.
* @param string $command
*/
public function __construct($command = '/usr/sbin/sendmail -bs')
{
call_user_func_array(
array($this, 'Swift_Transport_SendmailTransport::__construct'),
Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.sendmail')
);
$this->setCommand($command);
}
开发者ID:nationalfield,项目名称:symfony,代码行数:14,代码来源:SendmailTransport.php
示例9: __construct
/**
* Creates a new FailoverTransport with $transports.
* @param array $transports
*/
public function __construct($transports = array())
{
call_user_func_array(
array($this, 'Swift_Transport_FailoverTransport::__construct'),
Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.failover')
);
$this->setTransports($transports);
}
开发者ID:nationalfield,项目名称:symfony,代码行数:14,代码来源:FailoverTransport.php
示例10: __construct
/**
* Create a new MailTransport, optionally specifying $extraParams.
* @param string $extraParams
*/
public function __construct($extraParams = '-f%s')
{
call_user_func_array(
array($this, 'Swift_Transport_MailTransport::__construct'),
Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.mail')
);
$this->setExtraParams($extraParams);
}
开发者ID:nationalfield,项目名称:symfony,代码行数:14,代码来源:MailTransport.php
示例11: testNoLookupsFail
public function testNoLookupsFail()
{
$di = Swift_DependencyContainer::getInstance();
foreach ($di->listItems() as $itemName) {
try {
$di->lookup($itemName);
} catch (Swift_DependencyException $e) {
$this->fail($e->getMessage());
}
}
}
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:11,代码来源:DependencyContainerAcceptanceTest.php
示例12: __construct
/**
* Create a new SpoolTransport.
* @param Swift_Spool $spool
*/
public function __construct(Swift_Spool $spool)
{
$arguments = Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.spool');
$arguments[] = $spool;
call_user_func_array(
array($this, 'Swift_Transport_SpoolTransport::__construct'),
$arguments
);
}
开发者ID:nationalfield,项目名称:symfony,代码行数:16,代码来源:SpoolTransport.php
示例13: __construct
/**
* Create a new MimePart.
*
* Details may be optionally passed into the constructor.
*
* @param string $body
* @param string $contentType
* @param string $charset
*/
public function __construct($body = null, $contentType = null, $charset = null)
{
call_user_func_array(array($this, 'Swift_Mime_MimePart::__construct'), Swift_DependencyContainer::getInstance()->createDependenciesFor('mime.part'));
if (!isset($charset)) {
$charset = Swift_DependencyContainer::getInstance()->lookup('properties.charset');
}
$this->setBody($body);
$this->setCharset($charset);
if ($contentType) {
$this->setContentType($contentType);
}
}
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:21,代码来源:MimePart.php
示例14: __construct
/**
* Create a new Message.
* Details may be optionally passed into the constructor.
* @param string $subject
* @param string $body
* @param string $contentType
* @param string $charset
*/
public function __construct($subject = NULL, $body = NULL, $contentType = NULL, $charset = NULL)
{
call_user_func_array(array($this, 'Swift_Mime_SimpleMessage::__construct'), Swift_DependencyContainer::getInstance()->createDependenciesFor('mime.message'));
if (!isset($charset)) {
$charset = Swift_DependencyContainer::getInstance()->lookup('properties.charset');
}
$this->setSubject($subject);
$this->setBody($body);
$this->setCharset($charset);
if ($contentType) {
$this->setContentType($contentType);
}
}
开发者ID:HappyKennyD,项目名称:teest,代码行数:21,代码来源:Message.php
示例15: __construct
/**
* Swift初期化
*
* @param String $host
* @param String $port
* @param String $user
* @param String $pass
* @param String $charset
* @return vold
* @codeCoverageIgnore
*/
public function __construct($host, $port, $user, $pass, $charset = 'iso-2022-jp')
{
$this->host = $host;
$this->port = $port;
$this->user = $user;
$this->pass = $pass;
$this->charset = $charset;
$this->setPath();
\Swift::init(function () use($charset) {
\Swift_DependencyContainer::getInstance()->register('mime.qpheaderencoder')->asAliasOf('mime.base64headerencoder');
\Swift_Preferences::getInstance()->setCharset($charset);
});
}
开发者ID:kobabasu,项目名称:yumenokousakusitsu-api,代码行数:24,代码来源:Init.php
示例16: prepare
/**
* Выполняется перед каждым запросом браузера
*
* @return void
*/
public function prepare()
{
// Инициализировать директории
$this->_mailDir = $this->_initDir('app_mail_save_dir');
$this->_templateDir = $this->_initDir('app_mail_template_dir', $create = false);
// Очистить директорию с письмами
$this->reset();
// Обработчик писем
$this->_invoker = new myMailInvokerSave($this->_mailDir);
Swift_DependencyContainer::getInstance()->register('transport.mailinvoker')->asValue($this->_invoker);
// Указать ошибочные email
if ($this->_errors) {
$this->_invoker->setErrors($this->_errors);
$this->_errors = null;
}
}
开发者ID:pycmam,项目名称:sf-project-template,代码行数:21,代码来源:myFunctionalTesterMail.php
示例17: _getMailer
protected function _getMailer()
{
switch (SWIFT_SMOKE_TRANSPORT_TYPE) {
case 'smtp':
$transport = Swift_DependencyContainer::getInstance()->lookup('transport.smtp')->setHost(SWIFT_SMOKE_SMTP_HOST)->setPort(SWIFT_SMOKE_SMTP_PORT)->setUsername(SWIFT_SMOKE_SMTP_USER)->setPassword(SWIFT_SMOKE_SMTP_PASS)->setEncryption(SWIFT_SMOKE_SMTP_ENCRYPTION);
break;
case 'sendmail':
$transport = Swift_DependencyContainer::getInstance()->lookup('transport.sendmail')->setCommand(SWIFT_SMOKE_SENDMAIL_COMMAND);
break;
case 'mail':
case 'nativemail':
$transport = Swift_DependencyContainer::getInstance()->lookup('transport.mail');
break;
default:
throw new Exception('Undefined transport [' . SWIFT_SMOKE_TRANSPORT_TYPE . ']');
}
return new Swift_Mailer($transport);
}
开发者ID:Thomvh,项目名称:turbine,代码行数:18,代码来源:SwiftSmokeTestCase.php
示例18: preg_replace
<?php
require __DIR__ . '/../mime_types.php';
Swift_DependencyContainer::getInstance()->register('properties.charset')->asValue('utf-8')->register('email.validator')->asSharedInstanceOf('Egulias\\EmailValidator\\EmailValidator')->register('mime.idgenerator.idright')->asValue(!empty($_SERVER['SERVER_NAME']) && preg_replace('/(?:^\\[)?[a-zA-Z0-9-:\\]_]+\\.?/', '', $_SERVER['SERVER_NAME']) === '' ? $_SERVER['SERVER_NAME'] : 'swift.generated')->register('mime.idgenerator')->asSharedInstanceOf('Swift_Mime_IdGenerator')->withDependencies(array('mime.idgenerator.idright'))->register('mime.message')->asNewInstanceOf('Swift_Mime_SimpleMessage')->withDependencies(array('mime.headerset', 'mime.qpcontentencoder', 'cache', 'mime.idgenerator', 'properties.charset'))->register('mime.part')->asNewInstanceOf('Swift_Mime_MimePart')->withDependencies(array('mime.headerset', 'mime.qpcontentencoder', 'cache', 'mime.idgenerator', 'properties.charset'))->register('mime.attachment')->asNewInstanceOf('Swift_Mime_Attachment')->withDependencies(array('mime.headerset', 'mime.base64contentencoder', 'cache', 'mime.idgenerator'))->addConstructorValue($swift_mime_types)->register('mime.embeddedfile')->asNewInstanceOf('Swift_Mime_EmbeddedFile')->withDependencies(array('mime.headerset', 'mime.base64contentencoder', 'cache', 'mime.idgenerator'))->addConstructorValue($swift_mime_types)->register('mime.headerfactory')->asNewInstanceOf('Swift_Mime_SimpleHeaderFactory')->withDependencies(array('mime.qpheaderencoder', 'mime.rfc2231encoder', 'email.validator', 'properties.charset'))->register('mime.headerset')->asNewInstanceOf('Swift_Mime_SimpleHeaderSet')->withDependencies(array('mime.headerfactory', 'properties.charset'))->register('mime.qpheaderencoder')->asNewInstanceOf('Swift_Mime_HeaderEncoder_QpHeaderEncoder')->withDependencies(array('mime.charstream'))->register('mime.base64headerencoder')->asNewInstanceOf('Swift_Mime_HeaderEncoder_Base64HeaderEncoder')->withDependencies(array('mime.charstream'))->register('mime.charstream')->asNewInstanceOf('Swift_CharacterStream_NgCharacterStream')->withDependencies(array('mime.characterreaderfactory', 'properties.charset'))->register('mime.bytecanonicalizer')->asSharedInstanceOf('Swift_StreamFilters_ByteArrayReplacementFilter')->addConstructorValue(array(array(0xd, 0xa), array(0xd), array(0xa)))->addConstructorValue(array(array(0xa), array(0xa), array(0xd, 0xa)))->register('mime.characterreaderfactory')->asSharedInstanceOf('Swift_CharacterReaderFactory_SimpleCharacterReaderFactory')->register('mime.safeqpcontentencoder')->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoder')->withDependencies(array('mime.charstream', 'mime.bytecanonicalizer'))->register('mime.rawcontentencoder')->asNewInstanceOf('Swift_Mime_ContentEncoder_RawContentEncoder')->register('mime.nativeqpcontentencoder')->withDependencies(array('properties.charset'))->asNewInstanceOf('Swift_Mime_ContentEncoder_NativeQpContentEncoder')->register('mime.qpcontentencoder')->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoderProxy')->withDependencies(array('mime.safeqpcontentencoder', 'mime.nativeqpcontentencoder', 'properties.charset'))->register('mime.7bitcontentencoder')->asNewInstanceOf('Swift_Mime_ContentEncoder_PlainContentEncoder')->addConstructorValue('7bit')->addConstructorValue(true)->register('mime.8bitcontentencoder')->asNewInstanceOf('Swift_Mime_ContentEncoder_PlainContentEncoder')->addConstructorValue('8bit')->addConstructorValue(true)->register('mime.base64contentencoder')->asSharedInstanceOf('Swift_Mime_ContentEncoder_Base64ContentEncoder')->register('mime.rfc2231encoder')->asNewInstanceOf('Swift_Encoder_Rfc2231Encoder')->withDependencies(array('mime.charstream'));
unset($swift_mime_types);
开发者ID:swiftmailer,项目名称:swiftmailer,代码行数:5,代码来源:mime_deps.php
示例19: createHeadersSet
/**
*
* @param array $headersRaw
* @return \Swift_Mime_HeaderSet
*/
protected function createHeadersSet(array $headersRaw)
{
$headers = \Swift_DependencyContainer::getInstance()->lookup('mime.headerset');
foreach ($headersRaw as $name => $value) {
switch (strtolower($name)) {
case "content-type":
$parts = $this->extractHeaderParts($value);
unset($parts["boundary"]);
$headers->addParameterizedHeader($name, $this->extractValueHeader($value), $parts);
break;
case "return-path":
if (preg_match_all('/([a-z][a-z0-9_\\-\\.]*@[a-z0-9\\.\\-]*\\.[a-z]{2,5})/i', $value, $mch)) {
foreach ($mch[0] as $k => $mails) {
$headers->addPathHeader($name, $mch[1][$k]);
}
}
break;
case "date":
$headers->addDateHeader($name, strtotime($value));
case "to":
case "from":
case "bcc":
case "reply-to":
case "cc":
$adresses = array();
if (preg_match_all('/(.*?)<([a-z][a-z0-9_\\-\\.]*@[a-z0-9\\.\\-]*\\.[a-z]{2,5})>\\s*[;,]*/i', $value, $mch)) {
foreach ($mch[0] as $k => $mail) {
if (!$mch[1][$k]) {
$adresses[$mch[2][$k]] = $mch[2][$k];
} else {
$adresses[$mch[2][$k]] = $mch[1][$k];
}
}
} elseif (preg_match_all('/([a-z][a-z0-9_\\-\\.]*@[a-z0-9\\.\\-]*\\.[a-z]{2,5})/i', $value, $mch)) {
foreach ($mch[0] as $k => $mails) {
$adresses[$mch[1][$k]] = $mch[1][$k];
}
}
$headers->addMailboxHeader($name, $adresses);
break;
default:
$headers->addTextHeader($name, $value);
break;
}
}
return $headers;
}
开发者ID:perk11,项目名称:to-swift-mime-parser,代码行数:52,代码来源:MimeParser.php
示例20: _createMessage
protected function _createMessage()
{
Swift_DependencyContainer::getInstance()->register('properties.charset')->asValue(null);
return Swift_Message::newInstance();
}
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:5,代码来源:MessageAcceptanceTest.php
注:本文中的Swift_DependencyContainer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论