Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added autoloader for LS library and base exception class.
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_ci@10940 b72ed6b6-b9f8-46b5-92b4-906544132732
- Loading branch information
Tim Klingenberg
committed
Sep 3, 2011
1 parent
9eb5779
commit d08d060
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
/* | ||
* LimeSurvey | ||
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz | ||
* All rights reserved. | ||
* License: GNU/GPL License v2 or later, see LICENSE.php | ||
* LimeSurvey is free software. This version may have been modified pursuant | ||
* to the GNU General Public License, and as distributed it includes or | ||
* is derivative of works licensed under the GNU General Public License or | ||
* other free or open source software licenses. | ||
* See COPYRIGHT.php for copyright notices and details. | ||
* | ||
* $Id$ | ||
*/ | ||
|
||
/** | ||
* LS Base Exception Class | ||
* | ||
* @author mot | ||
*/ | ||
class LS_Exception extends Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
/* | ||
* LimeSurvey | ||
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz | ||
* All rights reserved. | ||
* License: GNU/GPL License v2 or later, see LICENSE.php | ||
* LimeSurvey is free software. This version may have been modified pursuant | ||
* to the GNU General Public License, and as distributed it includes or | ||
* is derivative of works licensed under the GNU General Public License or | ||
* other free or open source software licenses. | ||
* See COPYRIGHT.php for copyright notices and details. | ||
* | ||
* $Id$ | ||
* | ||
* LS Library bootstrap file, work in progress. | ||
* | ||
* Currently requires require_once to use the library. | ||
*/ | ||
|
||
/** | ||
* LS Library autoloader | ||
* | ||
* @param string $class | ||
*/ | ||
function LS_autoload($class) | ||
{ | ||
$namespace = 'LS'; | ||
$separator = '_'; | ||
if (0 !== strpos($class, $namespace.$separator)) | ||
return; | ||
|
||
$translated = str_replace($separator, DIRECTORY_SEPARATOR, $class); | ||
$libpath = dirname(dirname(__FILE__)); | ||
$file = $libpath.DIRECTORY_SEPARATOR.$translated.'.php'; | ||
|
||
require $file; # provoke fatal error if file does not exists. | ||
} | ||
|
||
spl_autoload_register('LS_autoload'); |