| @@ 105-141 (lines=37) @@ | ||
| 102 | * |
|
| 103 | * @param string $class The fully-qualified class name. |
|
| 104 | */ |
|
| 105 | spl_autoload_register(function ($class) use ($sourcedir) |
|
| 106 | { |
|
| 107 | $classMap = array( |
|
| 108 | 'ReCaptcha\\' => 'ReCaptcha/', |
|
| 109 | 'MatthiasMullie\\Minify\\' => 'minify/src/', |
|
| 110 | 'MatthiasMullie\\PathConverter\\' => 'minify/path-converter/src/', |
|
| 111 | ); |
|
| 112 | ||
| 113 | // Do any third-party scripts want in on the fun? |
|
| 114 | call_integration_hook('integrate_autoload', array(&$classMap)); |
|
| 115 | ||
| 116 | foreach ($classMap as $prefix => $dirName) |
|
| 117 | { |
|
| 118 | // does the class use the namespace prefix? |
|
| 119 | $len = strlen($prefix); |
|
| 120 | if (strncmp($prefix, $class, $len) !== 0) |
|
| 121 | { |
|
| 122 | continue; |
|
| 123 | } |
|
| 124 | ||
| 125 | // get the relative class name |
|
| 126 | $relativeClass = substr($class, $len); |
|
| 127 | ||
| 128 | // replace the namespace prefix with the base directory, replace namespace |
|
| 129 | // separators with directory separators in the relative class name, append |
|
| 130 | // with .php |
|
| 131 | $fileName = $dirName . strtr($relativeClass, '\\', '/') . '.php'; |
|
| 132 | ||
| 133 | // if the file exists, require it |
|
| 134 | if (file_exists($fileName = $sourcedir . '/' . $fileName)) |
|
| 135 | { |
|
| 136 | require_once $fileName; |
|
| 137 | ||
| 138 | return; |
|
| 139 | } |
|
| 140 | } |
|
| 141 | }); |
|
| 142 | ||
| 143 | // Register an error handler. |
|
| 144 | set_error_handler('smf_error_handler'); |
|
| @@ 107-143 (lines=37) @@ | ||
| 104 | * |
|
| 105 | * @param string $class The fully-qualified class name. |
|
| 106 | */ |
|
| 107 | spl_autoload_register(function ($class) use ($sourcedir) |
|
| 108 | { |
|
| 109 | $classMap = array( |
|
| 110 | 'ReCaptcha\\' => 'ReCaptcha/', |
|
| 111 | 'MatthiasMullie\\Minify\\' => 'minify/src/', |
|
| 112 | 'MatthiasMullie\\PathConverter\\' => 'minify/path-converter/src/', |
|
| 113 | ); |
|
| 114 | ||
| 115 | // Do any third-party scripts want in on the fun? |
|
| 116 | call_integration_hook('integrate_autoload', array(&$classMap)); |
|
| 117 | ||
| 118 | foreach ($classMap as $prefix => $dirName) |
|
| 119 | { |
|
| 120 | // does the class use the namespace prefix? |
|
| 121 | $len = strlen($prefix); |
|
| 122 | if (strncmp($prefix, $class, $len) !== 0) |
|
| 123 | { |
|
| 124 | continue; |
|
| 125 | } |
|
| 126 | ||
| 127 | // get the relative class name |
|
| 128 | $relativeClass = substr($class, $len); |
|
| 129 | ||
| 130 | // replace the namespace prefix with the base directory, replace namespace |
|
| 131 | // separators with directory separators in the relative class name, append |
|
| 132 | // with .php |
|
| 133 | $fileName = $dirName . strtr($relativeClass, '\\', '/') . '.php'; |
|
| 134 | ||
| 135 | // if the file exists, require it |
|
| 136 | if (file_exists($fileName = $sourcedir . '/' . $fileName)) |
|
| 137 | { |
|
| 138 | require_once $fileName; |
|
| 139 | ||
| 140 | return; |
|
| 141 | } |
|
| 142 | } |
|
| 143 | }); |
|
| 144 | ||
| 145 | // Primarily, this is to fix the URLs... |
|
| 146 | ob_start('ob_sessrewrite'); |
|