Exemple #1
0
/**
 * Autoloader
 * @global array Config
 * @static array<object>
 * @param string
 * @param bool optional
 * @param string
 * @param bool optional
 * @return object
 **/
function &load_class($class, $instantiate = true, $type, $internal = false)
{
    global $indx;
    static $objects = array();
    $path = DS . load_path($type) . DS;
    $file = $class;
    if ($type === 'db') {
        $file = 'db.' . $indx['sql'];
    }
    if ($type === 'lang') {
        $file = 'index';
    }
    $sub_path = $file . DS;
    $file .= '.php';
    $className = ucfirst($class);
    if (!isset($objects[$class])) {
        if ($internal === false) {
            $file = DIRNAME . BASENAME . $path . $file;
        } else {
            $file = 'index.php';
            $file = DIRNAME . BASENAME . $path . $sub_path . $file;
        }
        if (file_exists($file)) {
            require_once $file;
        } else {
            show_error('class not found');
        }
        if ($instantiate === true) {
            $objects[$class] = new $className();
        } else {
            $objects[$class] = true;
        }
    }
    return $objects[$class];
}
 public function __construct()
 {
     $this->splitUrl();
     load_path(APP, 'controllers/' . $this->url_controller);
     $this->url_controller = new $this->url_controller($this->url_params);
     $this->url_controller->show();
 }
Exemple #3
0
 /**
  * Get the folders and info
  * @return array<string>
  **/
 public function tpl_modules()
 {
     $modules = array();
     $path = DIRNAME . BASENAME . DS . load_path('mod') . DS;
     if (is_dir($path)) {
         if ($fp = opendir($path)) {
             while (($module = readdir($fp)) !== false) {
                 if (preg_match('/^(_|CVS$)/i', $module) === 0 && preg_match('/\\.(php|html)$/i', $module) === 0 && preg_match('/\\.(|DS_Store|svn|git)$/i', $module) === 0 && preg_match('/system/i', $module) === 0) {
                     $modules[] = $module;
                 }
             }
         }
         closedir($fp);
     }
     sort($modules);
     clearstatcache();
     return $modules;
 }
Exemple #4
0
    }
    return false;
}
function get_from_cache($id)
{
    $file = get_cache($id);
    if ($file) {
        return file_get_contents($file);
    } else {
        return false;
    }
}
function set_cache($id, $page)
{
    if (!file_exists(CACHE_DIR)) {
        mkdir(CACHE_DIR);
    }
    $cache_file = implode(DIRECTORY_SEPARATOR, array(CACHE_DIR, $id));
    file_put_contents($cache_file, $page);
}
load_path(ROOT, 'vendor/autoload');
load_path(APP, 'config/config');
load_path(APP, 'core/brevity');
load_path(APP, 'core/minter');
load_path(APP, 'core/model');
load_path(APP, 'models/component_model');
load_path(APP, 'models/findingaid_model');
load_path(APP, 'core/controller');
load_path(APP, 'core/application');
$g_config = new Config();
$g_minter = new Minter('fa');