mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Fix some of the autoloading and api issues.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
2015-10-17 DariusIII
|
||||
Fix: Autoloading and api errors
|
||||
2015-10-16 DariusIII
|
||||
Fix: Add getPreviewCount and getPreviewRange functions used in admin preview list
|
||||
Fix: Path to smarty dir
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
require_once 'SPLClassLoader.php';
|
||||
require_once 'constants.php';
|
||||
|
||||
$classLoader = new SplClassLoader('nzedb', [__DIR__ . DIRECTORY_SEPARATOR . 'nzedb']);
|
||||
$classLoader = new SplClassLoader('newznab', [__DIR__ . DIRECTORY_SEPARATOR . 'newznab']);
|
||||
$classLoader->register();
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PSR-0 compliant autoloader for libs
|
||||
*
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
if (file_exists(realpath(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'www' . DIRECTORY_SEPARATOR . 'config.php')) {
|
||||
require_once realpath(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'www' . DIRECTORY_SEPARATOR . 'config.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* An example of a project-specific implementation.
|
||||
*
|
||||
* After registering this autoload function with SPL, the following line
|
||||
* would cause the function to attempt to load the \Foo\Bar\Baz\Qux class
|
||||
* from /path/to/project/src/Baz/Qux.php:
|
||||
*
|
||||
* new \Foo\Bar\Baz\Qux;
|
||||
*
|
||||
* @param string $class The fully-qualified class name.
|
||||
* @return void
|
||||
*/
|
||||
spl_autoload_register(function($class) {
|
||||
|
||||
// project-specific namespace prefix
|
||||
$prefix = 'newznab\\';
|
||||
|
||||
// base directory for the namespace prefix
|
||||
$base_dir = __DIR__ . DIRECTORY_SEPARATOR;
|
||||
|
||||
// If no namespace, add default;
|
||||
$class = preg_match('#\\\#', $class) ? $class : $prefix . 'controllers\\' . $class;
|
||||
|
||||
// does the class use the namespace prefix?
|
||||
$len = strlen($prefix);
|
||||
if (strncmp($prefix, $class, $len) !== 0) {
|
||||
// no, move to the next registered autoloader
|
||||
return;
|
||||
}
|
||||
|
||||
// get the relative class name
|
||||
$relative_class = substr($class, $len);
|
||||
|
||||
// replace the namespace prefix with the base directory, replace namespace
|
||||
// separators with directory separators in the relative class name, append
|
||||
// with .php
|
||||
$file = $base_dir . str_replace('\\', DIRECTORY_SEPARATOR, $relative_class) . '.php';
|
||||
|
||||
// if the file exists, require it
|
||||
if (file_exists($file)) {
|
||||
require_once $file;
|
||||
} elseif (NN_LOGAUTOLOADER) {
|
||||
var_dump($file);
|
||||
}
|
||||
});
|
||||
+4
-5
@@ -3,9 +3,9 @@
|
||||
spl_autoload_register(
|
||||
function ($className) {
|
||||
$paths = [
|
||||
NN_WWW . 'pages' . DS . 'install' . DS,
|
||||
NN_WWW . 'pages' . DS . 'admin' . DS,
|
||||
NN_WWW . 'pages' . DS,
|
||||
NN_WWW . 'pages' . DS . 'admin' . DS,
|
||||
NN_WWW . 'pages' . DS . 'install' . DS,
|
||||
];
|
||||
|
||||
foreach ($paths as $path) {
|
||||
@@ -14,11 +14,10 @@ spl_autoload_register(
|
||||
if (file_exists($spec)) {
|
||||
require_once $spec;
|
||||
break;
|
||||
} else if (NN_LOGAUTOLOADER) {
|
||||
var_dump($spec);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -3,6 +3,8 @@ use newznab\utility\Utility;
|
||||
use newznab\db\Settings;
|
||||
use newznab\controllers\ReleaseComments;
|
||||
use newznab\controllers\Releases;
|
||||
use newznab\controllers\Category;
|
||||
use newznab\controllers\BasePage;
|
||||
|
||||
$rc = new ReleaseComments;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user