[piwi] r580 committed - added autoloadwrapper for swift

3 views
Skip to first unread message

pi...@googlecode.com

unread,
Nov 19, 2010, 8:33:28 AM11/19/10
to piwi...@googlegroups.com
Revision: 580
Author: grobmeier
Date: Fri Nov 19 05:32:23 2010
Log: added autoloadwrapper for swift
http://code.google.com/p/piwi/source/detail?r=580

Added:
/framework/trunk/piwi/lib/piwi/SwiftWrapper.class.php
Modified:
/framework/trunk/piwi/index.php

=======================================
--- /dev/null
+++ /framework/trunk/piwi/lib/piwi/SwiftWrapper.class.php Fri Nov 19
05:32:23 2010
@@ -0,0 +1,13 @@
+<?php
+
+class SwiftWrapper {
+ private static $dependency = false;
+ public static function autoload($class) {
+ if(!self::$dependency) {
+ require_once 'lib/swiftmailer/swift_init.php';
+ self::$dependency = true;
+ }
+ Swift::autoload($class);
+ }
+}
+?>
=======================================
--- /framework/trunk/piwi/index.php Fri Nov 19 05:21:09 2010
+++ /framework/trunk/piwi/index.php Fri Nov 19 05:32:23 2010
@@ -29,9 +29,9 @@
*
-------------------------------------------------------------------------
*/

-error_reporting(0); // hide all errors
+//error_reporting(0); // hide all errors
//error_reporting(E_ERROR); // show only errors
-//error_reporting(E_ALL); // show all errors
+error_reporting(E_ALL); // show all errors

/**
*
-------------------------------------------------------------------------
@@ -65,7 +65,11 @@

spl_autoload_register( array( 'ezcBase', 'autoload' ) );
spl_autoload_register( array( 'ClassLoader', 'autoload' ) );
-spl_autoload_register( array('Swift', 'autoload') );
+spl_autoload_register( array('SwiftWrapper', 'autoload') );
+
+//Create the message
+$message = Swift_Message::newInstance();
+$message->setSubject('My subject');

/* Enable logging */
$logger = Logger :: getLogger('index.php');

Reply all
Reply to author
Forward
0 new messages