eZ Publish  [4.0]
eznotificationtransport.php
Go to the documentation of this file.
00001 <?php
00002 //
00003 // Definition of eZNotificationTransport class
00004 //
00005 // Created on: <13-May-2003 12:01:34 sp>
00006 //
00007 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00008 // SOFTWARE NAME: eZ Publish
00009 // SOFTWARE RELEASE: 4.0.x
00010 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS
00011 // SOFTWARE LICENSE: GNU General Public License v2.0
00012 // NOTICE: >
00013 //   This program is free software; you can redistribute it and/or
00014 //   modify it under the terms of version 2.0  of the GNU General
00015 //   Public License as published by the Free Software Foundation.
00016 //
00017 //   This program is distributed in the hope that it will be useful,
00018 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 //   GNU General Public License for more details.
00021 //
00022 //   You should have received a copy of version 2.0 of the GNU General
00023 //   Public License along with this program; if not, write to the Free
00024 //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00025 //   MA 02110-1301, USA.
00026 //
00027 //
00028 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00029 //
00030 
00031 /*! \file eznotificationtransport.php
00032 */
00033 
00034 /*!
00035   \class eZNotificationTransport eznotificationtransport.php
00036   \brief The class eZNotificationTransport does
00037 
00038 */
00039 //include_once( 'kernel/classes/notification/ezmailnotificationtransport.php' );
00040 class eZNotificationTransport
00041 {
00042     /*!
00043      Constructor
00044     */
00045     function eZNotificationTransport()
00046     {
00047     }
00048 
00049     static function instance( $transport = false, $forceNewInstance = false )
00050     {
00051         $ini = eZINI::instance( 'notification.ini' );
00052         if ( $transport == false )
00053         {
00054             $transport = $ini->variable( 'TransportSettings', 'DefaultTransport' );
00055         }
00056         $transportImpl =& $GLOBALS['eZNotificationTransportGlobalInstance_' . $transport ];
00057         $class = strtolower( get_class( $transportImpl ) );
00058 
00059         $fetchInstance = false;
00060         if ( !preg_match( '/.*?transport/', $class ) )
00061             $fetchInstance = true;
00062 
00063         if ( $forceNewInstance  )
00064         {
00065             $fetchInstance = true;
00066         }
00067 
00068         if ( $fetchInstance )
00069         {
00070             $extraPluginPathArray = $ini->variable( 'TransportSettings', 'TransportPluginPath' );
00071             $pluginPathArray = array_merge( array( 'kernel/classes/notification/' ),
00072                                             $extraPluginPathArray );
00073             foreach( $pluginPathArray as $pluginPath )
00074             {
00075                 $transportFile = $pluginPath . $transport . 'notificationtransport.php';
00076                 if ( file_exists( $transportFile ) )
00077                 {
00078                     include_once( $transportFile );
00079                     $className = $transport . 'notificationtransport';
00080                     $impl = new $className( );
00081                     break;
00082                 }
00083             }
00084         }
00085         if ( $impl === null )
00086         {
00087             $impl = new eZNotificationTransport();
00088             eZDebug::writeError( 'Transport implementation not supported: ' . $transport, 'eZNotificationTransport::instance' );
00089         }
00090         return $impl;
00091     }
00092 
00093     function send( $address = array(), $subject, $body, $transportData = null )
00094     {
00095         return true;
00096     }
00097 }
00098 
00099 ?>