Exemplo n.º 1
0
function __autoload($cls)
{
    global $globals;
    if (!pl_autoload($cls)) {
        $cls = strtolower($cls);
        // handler the *Select
        if (substr($cls, -6) == 'select') {
            pl_autoload(substr($cls, 0, -6));
            return;
        }
        // handler the *Schema
        if (substr($cls, -6) == 'schema') {
            pl_autoload(substr($cls, 0, -6));
            return;
        }
        // Handle PlFilter
        if (substr($cls, 0, 8) == 'plfilter' || substr($cls, 0, 4) == 'pfc_' || substr($cls, 0, 4) == 'pfo_') {
            pl_autoload('plfilter');
            return;
        }
        // Handle FrankizFilter
        if (substr($cls, 0, 13) == 'frankizfilter') {
            pl_autoload('frankizfilter');
            return;
        }
        // Handle the *Filter classes
        if (substr($cls, -6) == 'filter') {
            pl_autoload($cls, array('classes/filters'));
            return;
        }
        // Handle the *fc_* and *fo_*
        $filters = array('g' => 'groupfilter', 'c' => 'castefilter', 'n' => 'newsfilter', 'u' => 'userfilter', 'v' => 'validatefilter', 'a' => 'activityfilter', 'ai' => 'activityinstancefilter', 'i' => 'imagefilter');
        foreach ($filters as $key => $class) {
            $length = 3 + mb_strlen($key);
            if (substr($cls, 0, $length) == $key . 'fc_' || substr($cls, 0, $length) == $key . 'fo_') {
                pl_autoload($class, array('classes/filters'));
                return;
            }
        }
        if (substr($cls, -8) == 'validate') {
            pl_autoload($cls, array('classes/validate'));
            return;
        }
        if (substr($cls, -4) == 'feed') {
            pl_autoload($cls, array('classes/feed'));
            return;
        }
        // Handle the rest
        if (file_exists($globals->spoolroot . "/include/{$cls}.inc.php")) {
            require_once $globals->spoolroot . "/include/{$cls}.inc.php";
        } else {
            throw new Exception("Trying to include unavailable ressource: {$cls}");
        }
    }
}
Exemplo n.º 2
-1
function xorg_autoload($cls)
{
    if (!pl_autoload($cls)) {
        $cls = strtolower($cls);
        if (substr($cls, 0, 4) == 'ufc_' || substr($cls, 0, 4) == 'ufo_' || $cls == 'profilefilter' || $cls == 'userfiltercondition' || $cls == 'userfilterorder') {
            xorg_autoload('userfilter');
            return;
        } else {
            if (substr($cls, 0, 4) == 'pfc_' || substr($cls, 0, 4) == 'pfo_' || substr($cls, 0, 8) == 'plfilter') {
                xorg_autoload('plfilter');
                return;
            } else {
                if ($cls == 'direnumeration' || substr($cls, 0, 3) == 'de_') {
                    xorg_autoload('direnum');
                    return;
                } else {
                    if ($cls == 'validate' || substr($cls, -3, 3) == 'req' || substr($cls, -8, 8) == 'validate' || substr($cls, 0, 8) == 'validate') {
                        require_once 'validations.inc.php';
                        return;
                    } else {
                        if (substr($cls, 0, 6) == 'banana') {
                            require_once 'banana/hooks.inc.php';
                            Banana::load(substr($cls, 6));
                            return;
                        } else {
                            if (substr($cls, 0, 5) == 'raven') {
                                // Handled by Raven autoloader.
                                return;
                            }
                        }
                    }
                }
            }
        }
        include "{$cls}.inc.php";
    }
}