summaryrefslogtreecommitdiff
path: root/ext/spl/examples/autoload.inc
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2010-01-07 13:31:53 +0100
committerOndřej Surý <ondrej@sury.org>2010-01-07 13:31:53 +0100
commit0fab6db7cac8d2be99579dd049f812a8ff98e74f (patch)
tree91f01b0d06916c78262404096bfd466b8e95e5b5 /ext/spl/examples/autoload.inc
parentd3a8757891280dc6650ca7eead67830c794b0e7b (diff)
downloadphp-upstream/5.3.1.tar.gz
Imported Upstream version 5.3.1upstream/5.3.1
Diffstat (limited to 'ext/spl/examples/autoload.inc')
-rwxr-xr-xext/spl/examples/autoload.inc98
1 files changed, 49 insertions, 49 deletions
diff --git a/ext/spl/examples/autoload.inc b/ext/spl/examples/autoload.inc
index acb2e11e0..5871e7d63 100755
--- a/ext/spl/examples/autoload.inc
+++ b/ext/spl/examples/autoload.inc
@@ -1,50 +1,50 @@
-<?php
-
-/** @file autoload.inc
- * @ingroup Examples
- * @brief function __autoload
- * @author Marcus Boerger
- * @date 2003 - 2005
- *
- * SPL - Standard PHP Library
- */
-
-/** \internal
- * Tries to load class $classname from directory $dir.
- */
-function __load_class($classname, $dir)
-{
- $file = $dir . '/' . $classname . '.inc';
- if (file_exists($file))
- {
- require_once($file);
- return true;
- }
- return false;
-}
-
-/**
- * @brief Class loader for SPL example classes
- * @author Marcus Boerger
- * @version 1.0
- *
- * Loads classes automatically from include_path as given by ini or from
- * current directory of script or include file.
- */
-function __autoload($classname) {
- $classname = strtolower($classname);
- $inc = split(':', ini_get('include_path'));
- $inc[] = '.';
- $inc[] = dirname($_SERVER['PATH_TRANSLATED']);
- foreach($inc as $dir)
- {
- if (__load_class($classname, $dir))
- {
- fprintf(STDERR, 'Loading class('.$classname.")\n");
- return;
- }
- }
- fprintf(STDERR, 'Class not found ('.$classname.")\n");
-}
-
+<?php
+
+/** @file autoload.inc
+ * @ingroup Examples
+ * @brief function __autoload
+ * @author Marcus Boerger
+ * @date 2003 - 2005
+ *
+ * SPL - Standard PHP Library
+ */
+
+/** \internal
+ * Tries to load class $classname from directory $dir.
+ */
+function __load_class($classname, $dir)
+{
+ $file = $dir . '/' . $classname . '.inc';
+ if (file_exists($file))
+ {
+ require_once($file);
+ return true;
+ }
+ return false;
+}
+
+/**
+ * @brief Class loader for SPL example classes
+ * @author Marcus Boerger
+ * @version 1.0
+ *
+ * Loads classes automatically from include_path as given by ini or from
+ * current directory of script or include file.
+ */
+function __autoload($classname) {
+ $classname = strtolower($classname);
+ $inc = split(':', ini_get('include_path'));
+ $inc[] = '.';
+ $inc[] = dirname($_SERVER['PATH_TRANSLATED']);
+ foreach($inc as $dir)
+ {
+ if (__load_class($classname, $dir))
+ {
+ fprintf(STDERR, 'Loading class('.$classname.")\n");
+ return;
+ }
+ }
+ fprintf(STDERR, 'Class not found ('.$classname.")\n");
+}
+
?> \ No newline at end of file