SF.net SVN: postfixadmin:[577] trunk/common.php
Brought to you by:
christian_boltz,
gingerdog
From: <Gin...@us...> - 2009-03-13 20:49:35
|
Revision: 577 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=577&view=rev Author: GingerDog Date: 2009-03-13 20:49:32 +0000 (Fri, 13 Mar 2009) Log Message: ----------- common.php: add autoloading for model classes Modified Paths: -------------- trunk/common.php Modified: trunk/common.php =================================================================== --- trunk/common.php 2009-03-13 20:49:05 UTC (rev 576) +++ trunk/common.php 2009-03-13 20:49:32 UTC (rev 577) @@ -59,5 +59,19 @@ require_once("$incpath/functions.inc.php"); require_once("$incpath/languages/" . check_language () . ".lang"); +/** + * @param string $class + * __autoload implementation, for use with spl_autoload_register(). + */ +function postfixadmin_autoload($class) { + $PATH = dirname(__FILE__) . '/model/' . $class . '.php'; + if(is_file($PATH)) { + require_once($PATH); + return true; + } + return false; +} +spl_autoload_register('postfixadmin_autoload'); + /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |