Author: fabien
Date: 2010-01-15 08:20:10 +0100 (Fri, 15 Jan 2010)
New Revision: 26669
Added:
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/Extension/ZendExtension.php
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/zend/
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/zend/logger-1.0.xml
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/zend/mail-1.0.xml
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/schema/zend/
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/schema/zend/zend-1.0.xsd
Log:
Merge branch 'master' of git://github.com/symfony/symfony
Added:
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/Extension/ZendExtension.php
===================================================================
---
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/Extension/ZendExtension.php
(rev 0)
+++
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/Extension/ZendExtension.php
2010-01-15 07:20:10 UTC (rev 26669)
@@ -0,0 +1,121 @@
+<?php
+
+namespace Symfony\Components\DependencyInjection\Loader\Extension;
+
+use Symfony\Components\DependencyInjection\Loader\LoaderExtension;
+use Symfony\Components\DependencyInjection\Loader\XmlFileLoader;
+use Symfony\Components\DependencyInjection\BuilderConfiguration;
+
+/*
+ * This file is part of the symfony framework.
+ *
+ * (c) Fabien Potencier <[email protected]>
+ *
+ * This source file is subject to the MIT license that is bundled
+ * with this source code in the file LICENSE.
+ */
+
+/**
+ * ZendExtension is an extension for the Zend Framework libraries.
+ *
+ * @package symfony
+ * @subpackage dependency_injection
+ * @author Fabien Potencier <[email protected]>
+ */
+class ZendExtension extends LoaderExtension
+{
+ /**
+ * Loads the logger configuration.
+ *
+ * @param array $config A configuration array
+ *
+ * @return BuilderConfiguration A BuilderConfiguration instance
+ */
+ public function loggerLoad($config)
+ {
+ $configuration = new BuilderConfiguration();
+
+ $loader = new XmlFileLoader(__DIR__.'/xml/zend');
+ $configuration->merge($loader->load('logger-1.0.xml'));
+
+ if (isset($config['priority']))
+ {
+ $configuration->setParameter('zend.logger.priority',
is_int($config['priority']) ? $config['priority'] :
constant('\Zend_Log::'.strtoupper($config['priority'])));
+ }
+
+ if (isset($config['path']))
+ {
+ $configuration->setParameter('zend.logger.path', $config['path']);
+ }
+
+ return $configuration;
+ }
+
+ /**
+ * Loads the mail configuration.
+ *
+ * @param array $config A configuration array
+ *
+ * @return BuilderConfiguration A BuilderConfiguration instance
+ */
+ public function mailLoad($config)
+ {
+ $configuration = new BuilderConfiguration();
+
+ $loader = new XmlFileLoader(__DIR__.'/xml/zend');
+ $configuration->merge($loader->load('mail-1.0.xml'));
+
+ if (isset($config['transport']))
+ {
+ if ('gmail' === $config['transport'])
+ {
+ $config['ssl'] = 'ssl';
+ $config['auth'] = 'login';
+ $config['host'] = 'smtp.gmail.com';
+
+ $configuration->setAlias('zend.mail.transport',
'zend.mail.transport.smtp.ssl');
+ }
+ else
+ {
+ if (isset($config['ssl']) && $config['ssl'])
+ {
+ $config['transport'] = $config['transport'].'.ssl';
+ }
+ $configuration->setAlias('zend.mail.transport',
'zend.mail.transport.'.$config['transport']);
+ }
+ }
+
+ if (isset($config['ssl']))
+ {
+ if (true === $config['ssl'] || 'ssl' === $config['ssl'])
+ {
+ $config['ssl'] = 'ssl';
+ if (!isset($config['port']))
+ {
+ $config['port'] = 465;
+ }
+ }
+ $configuration->setParameter('zend.mail.smtp.ssl', $config['ssl']);
+ }
+
+ foreach (array('port', 'host', 'username', 'password', 'auth') as $key)
+ {
+ if (isset($config[$key]))
+ {
+ $configuration->setParameter('zend.mail.smtp.'.$key, $config[$key]);
+ }
+ }
+
+ return $configuration;
+ }
+
+ public function getNamespace()
+ {
+ return 'http://www.symfony-project.org/schema/zend';
+ }
+
+ public function getAlias()
+ {
+ return 'zend';
+ }
+}
Added:
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/zend/logger-1.0.xml
===================================================================
---
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/zend/logger-1.0.xml
(rev 0)
+++
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/zend/logger-1.0.xml
2010-01-15 07:20:10 UTC (rev 26669)
@@ -0,0 +1,32 @@
+<?xml version="1.0" ?>
+
+<container xmlns="http://www.symfony-project.org/schema/services"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.symfony-project.org/schema/services
http://www.symfony-project.org/schema/services/services-1.0.xsd">
+
+ <parameters>
+ <parameter key="zend.logger.class">\Zend_Log</parameter>
+ <parameter key="zend.logger.priority"
type="constant">\Zend_Log::CRIT</parameter>
+ </parameters>
+
+ <services>
+ <service id="zend.logger" class="%zend.logger.class%">
+ <call method="addWriter">
+ <argument type="service" id="zend.logger.writer_stream" />
+ </call>
+ </service>
+
+ <service id="zend.logger.writer_stream" class="Zend_Log_Writer_Stream">
+ <argument>%zend.logger.path%</argument>
+ <call method="addFilter">
+ <argument type="service" id="zend.logger.filter" />
+ </call>
+ </service>
+
+ <service id="zend.logger.filter" class="Zend_Log_Filter_Priority">
+ <argument>%zend.logger.priority%</argument>
+ </service>
+
+ <service id="logger" alias="zend.logger" />
+ </services>
+</container>
Added:
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/zend/mail-1.0.xml
===================================================================
---
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/zend/mail-1.0.xml
(rev 0)
+++
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/Extension/xml/zend/mail-1.0.xml
2010-01-15 07:20:10 UTC (rev 26669)
@@ -0,0 +1,48 @@
+<?xml version="1.0" ?>
+
+<container xmlns="http://www.symfony-project.org/schema/services"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.symfony-project.org/schema/services
http://www.symfony-project.org/schema/services/services-1.0.xsd">
+
+ <parameters>
+ <parameter key="zend.mail.class">Zend_Mail</parameter>
+ <parameter key="zend.mail.smtp.class">Zend_Mail_Transport_Smtp</parameter>
+ <parameter key="zend.mail.smtp.host">localhost</parameter>
+ <parameter key="zend.mail.smtp.username">null</parameter>
+ <parameter key="zend.mail.smtp.password">null</parameter>
+ <parameter key="zend.mail.smtp.auth">null</parameter>
+ <parameter key="zend.mail.smtp.ssl">null</parameter>
+ <parameter key="zend.mail.smtp.port">25</parameter>
+ </parameters>
+
+ <services>
+ <service id="zend.mail" class="%zend.mail.class%" shared="false">
+ <call method="setDefaultTransport">
+ <argument type="service" id="zend.mail.transport" />
+ </call>
+ </service>
+
+ <service id="zend.mail.transport.smtp" class="%zend.mail.smtp.class%">
+ <argument>%zend.mail.smtp.host%</argument>
+ <argument type="collection">
+ <argument key="auth">%zend.mail.smtp.auth%</argument>
+ <argument key="username">%zend.mail.smtp.username%</argument>
+ <argument key="password">%zend.mail.smtp.password%</argument>
+ <argument key="port">%zend.mail.smtp.port%</argument>
+ </argument>
+ </service>
+
+ <service id="zend.mail.transport.smtp.ssl" class="%zend.mail.smtp.class%">
+ <argument>%zend.mail.smtp.host%</argument>
+ <argument type="collection">
+ <argument key="auth">%zend.mail.smtp.auth%</argument>
+ <argument key="username">%zend.mail.smtp.username%</argument>
+ <argument key="password">%zend.mail.smtp.password%</argument>
+ <argument key="ssl">%zend.mail.smtp.ssl%</argument>
+ <argument key="port">%zend.mail.smtp.port%</argument>
+ </argument>
+ </service>
+
+ <service id="zend.mail.transport" alias="zend.mail.transport.smtp" />
+ </services>
+</container>
Added:
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/schema/zend/zend-1.0.xsd
===================================================================
---
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/schema/zend/zend-1.0.xsd
(rev 0)
+++
branches/2.0/src/Symfony/Components/DependencyInjection/Loader/schema/zend/zend-1.0.xsd
2010-01-15 07:20:10 UTC (rev 26669)
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<xsd:schema xmlns="http://www.symfony-project.org/schema/zend"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.symfony-project.org/schema/zend"
+ elementFormDefault="qualified">
+
+ <xsd:element name="logger" type="logger" />
+
+ <xsd:complexType name="logger">
+ <xsd:attribute name="priority" type="priority" />
+ <xsd:attribute name="path" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:simpleType name="priority">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="emerg" />
+ <xsd:enumeration value="alert" />
+ <xsd:enumeration value="crit" />
+ <xsd:enumeration value="err" />
+ <xsd:enumeration value="warn" />
+ <xsd:enumeration value="notice" />
+ <xsd:enumeration value="info" />
+ <xsd:enumeration value="debug" />
+
+ <xsd:enumeration value="0" />
+ <xsd:enumeration value="1" />
+ <xsd:enumeration value="2" />
+ <xsd:enumeration value="3" />
+ <xsd:enumeration value="4" />
+ <xsd:enumeration value="5" />
+ <xsd:enumeration value="6" />
+ <xsd:enumeration value="7" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:element name="mail" type="mail" />
+
+ <xsd:complexType name="mail">
+ <xsd:sequence>
+ <xsd:element name="username" type="xsd:string" minOccurs="0"
maxOccurs="1" />
+ <xsd:element name="password" type="xsd:string" minOccurs="0"
maxOccurs="1" />
+ <xsd:element name="host" type="xsd:string" minOccurs="0" maxOccurs="1" />
+ <xsd:element name="port" type="xsd:string" minOccurs="0" maxOccurs="1" />
+ <xsd:element name="ssl" type="ssl" minOccurs="0" maxOccurs="1" />
+ <xsd:element name="auth" type="auth" minOccurs="0" maxOccurs="1" />
+ </xsd:sequence>
+
+ <xsd:attribute name="transport" type="xsd:string" />
+ </xsd:complexType>
+
+ <xsd:simpleType name="auth">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="plain" />
+ <xsd:enumeration value="login" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="ssl">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="tls" />
+ <xsd:enumeration value="ssl" />
+ </xsd:restriction>
+ </xsd:simpleType>
+</xsd:schema>
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.