svn: /pear2/Autoload/trunk/src/ Autoload.php

From: Date: Tue, 10 Nov 2009 11:27:34 +0000
Subject: svn: /pear2/Autoload/trunk/src/ Autoload.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-9020@lists.php.net to get a copy of this message
saltybeagle Tue, 10 Nov 2009 11:27:34 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=290472 Log: Convert line endings from mac to unix. Changed paths: U pear2/Autoload/trunk/src/Autoload.php Modified: pear2/Autoload/trunk/src/Autoload.php =================================================================== --- pear2/Autoload/trunk/src/Autoload.php 2009-11-10 09:35:19 UTC (rev 290471) +++ pear2/Autoload/trunk/src/Autoload.php 2009-11-10 11:27:34 UTC (rev 290472) @@ -1,59 +1,59 @@ -<?php -namespace pear2; -function Autoload($class) -{ - if ((substr($class, 0, 6) !== 'PEAR2_') && (substr($class, 0, 6) !== 'pear2\\')) { - return false; - } - $fp = @fopen(str_replace('_', '/', $class) . '.php', 'r', true); - if ($fp) { - fclose($fp); - require str_replace('_', '/', $class) . '.php'; - if (!class_exists($class, false) && !interface_exists($class, false)) { - die(new Exception('Class ' . $class . ' was not present in ' . - str_replace('_', '/', $class) . '.php (include_path="' . get_include_path() . - '") [PEAR2_Autoload version 1.0]')); - } - return true; - } - $e = new \Exception('Class ' . $class . ' could not be loaded from ' . - str_replace('_', '/', $class) . '.php, file does not exist (include_path="' . get_include_path() . - '") [PEAR2_Autoload version 1.0]'); - $trace = $e->getTrace(); - if (isset($trace[2]) && isset($trace[2]['function']) && - in_array($trace[2]['function'], array('class_exists', 'interface_exists'))) { - return false; - } - if (isset($trace[1]) && isset($trace[1]['function']) && - in_array($trace[1]['function'], array('class_exists', 'interface_exists'))) { - return false; - } - die ((string) $e); -} - -// set up __autoload -if (!($_____t = spl_autoload_functions()) || !in_array('pear2\Autoload', spl_autoload_functions())) { - spl_autoload_register('pear2\Autoload'); - if (function_exists('__autoload') && ($_____t === false)) { - // __autoload() was being used, but now would be ignored, add - // it to the autoload stack - spl_autoload_register('__autoload'); - } -} -unset($_____t); - -// set up include_path if it doesn't register our current location -$____paths = explode(PATH_SEPARATOR, get_include_path()); -$____found = false; -foreach ($____paths as $____path) { - if ($____path == dirname(dirname(__FILE__))) { - $____found = true; - break; - } -} -if (!$____found) { - set_include_path(get_include_path() . PATH_SEPARATOR . dirname(dirname(__FILE__))); -} -unset($____paths); -unset($____path); -unset($____found); +<?php +namespace pear2; +function Autoload($class) +{ + if ((substr($class, 0, 6) !== 'PEAR2_') && (substr($class, 0, 6) !== 'pear2\\')) { + return false; + } + $fp = @fopen(str_replace('_', '/', $class) . '.php', 'r', true); + if ($fp) { + fclose($fp); + require str_replace('_', '/', $class) . '.php'; + if (!class_exists($class, false) && !interface_exists($class, false)) { + die(new Exception('Class ' . $class . ' was not present in ' . + str_replace('_', '/', $class) . '.php (include_path="' . get_include_path() . + '") [PEAR2_Autoload version 1.0]')); + } + return true; + } + $e = new \Exception('Class ' . $class . ' could not be loaded from ' . + str_replace('_', '/', $class) . '.php, file does not exist (include_path="' . get_include_path() . + '") [PEAR2_Autoload version 1.0]'); + $trace = $e->getTrace(); + if (isset($trace[2]) && isset($trace[2]['function']) && + in_array($trace[2]['function'], array('class_exists', 'interface_exists'))) { + return false; + } + if (isset($trace[1]) && isset($trace[1]['function']) && + in_array($trace[1]['function'], array('class_exists', 'interface_exists'))) { + return false; + } + die ((string) $e); +} + +// set up __autoload +if (!($_____t = spl_autoload_functions()) || !in_array('pear2\Autoload', spl_autoload_functions())) { + spl_autoload_register('pear2\Autoload'); + if (function_exists('__autoload') && ($_____t === false)) { + // __autoload() was being used, but now would be ignored, add + // it to the autoload stack + spl_autoload_register('__autoload'); + } +} +unset($_____t); + +// set up include_path if it doesn't register our current location +$____paths = explode(PATH_SEPARATOR, get_include_path()); +$____found = false; +foreach ($____paths as $____path) { + if ($____path == dirname(dirname(__FILE__))) { + $____found = true; + break; + } +} +if (!$____found) { + set_include_path(get_include_path() . PATH_SEPARATOR . dirname(dirname(__FILE__))); +} +unset($____paths); +unset($____path); +unset($____found);

« previous php.pear.core (#9020) next »