mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 09:18:54 +00:00
39 lines
820 B
PHP
39 lines
820 B
PHP
<?php
|
|
|
|
function load_plugin_dependency($filename)
|
|
{
|
|
global $smarty;
|
|
|
|
if (!isset($smarty)) {
|
|
$smarty = new Smarty();
|
|
}
|
|
|
|
switch (true) {
|
|
case is_string($smarty->plugins_dir) && is_dir($smarty->plugins_dir):
|
|
$plugins_dir = $smarty->plugins_dir;
|
|
require_once $plugins_dir . DIRECTORY_SEPARATOR . $filename;
|
|
break;
|
|
case is_array($smarty->plugins_dir):
|
|
$plugins_dir = '';
|
|
foreach ($smarty->plugins_dir as $dir) {
|
|
if (is_string($dir) && is_dir($dir)) {
|
|
$file = $dir . DIRECTORY_SEPARATOR . $filename;
|
|
if (file_exists($file) && is_readable($file)) {
|
|
$plugins_dir = $dir;
|
|
require_once $file;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
default:
|
|
$plugins_dir = '';
|
|
}
|
|
|
|
if (!is_dir($plugins_dir)) {
|
|
exit('Fatal: Unable to find smarty plugins directory.' . PHP_EOL);
|
|
}
|
|
}
|
|
|
|
?>
|