Skip to content

Commit

Permalink
Merge pull request #9 from TravisPaul/master
Browse files Browse the repository at this point in the history
Made autoloader work within Phar files
  • Loading branch information
rchouinard committed Sep 8, 2014
2 parents 565df4b + 1e056bb commit 9519feb
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/Phpass/Loader.php
Expand Up @@ -46,16 +46,11 @@ class Loader
*/
public static function load($class)
{
if (substr($class, 0, 6) !== 'Phpass') {
return;
}
if (stripos($class, 'Phpass') === 0) {
$file = str_replace('\\', '/', $class);

$libraryRoot = realpath(__DIR__ . '/../');
$file = str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';
$file = realpath($libraryRoot . DIRECTORY_SEPARATOR . $file);
if (substr($file, 0, strlen($libraryRoot)) == $libraryRoot) {
if (is_readable($file)) {
include $file;
if (file_exists(dirname(__FILE__) . '/../' . $file . '.php')) {
require_once(dirname(__FILE__) . '/../' . $file . '.php');
}
}
}
Expand Down

0 comments on commit 9519feb

Please sign in to comment.