mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
use Ytake\LaravelSmarty\Smarty;
|
|
|
|
function load_plugin_dependency($filename)
|
|
{
|
|
global $smarty;
|
|
|
|
if (! isset($smarty)) {
|
|
$smarty = new Smarty();
|
|
}
|
|
|
|
switch (true) {
|
|
case is_string($smarty->getPluginsDir()) && is_dir($smarty->getPluginsDir()):
|
|
$plugins_dir = $smarty->getPluginsDir();
|
|
require_once $plugins_dir.DIRECTORY_SEPARATOR.$filename;
|
|
break;
|
|
case is_array($smarty->getPluginsDir()):
|
|
$plugins_dir = '';
|
|
foreach ($smarty->getPluginsDir() 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);
|
|
}
|
|
}
|