Пример #1
0
function __autoload($className)
{
    try {
        ezcBase::autoload($className);
    } catch (Exception $e) {
        echo $e->getMessage();
    }
}
Пример #2
0
function __autoload($className)
{
    if (strpos($className, '_') !== false) {
        $file = str_replace('_', '/', $className) . '.php';
        @($val = (require_once $file));
        return $val === true;
    }
    ezcBase::autoload($className);
}
Пример #3
0
 function glpiautoload($classname)
 {
     global $DEBUG_AUTOLOAD, $CFG_GLPI;
     static $notfound = array();
     // empty classname or non concerted plugin
     if (empty($classname) || is_numeric($classname)) {
         return false;
     }
     $dir = GLPI_ROOT . "/inc/";
     //$classname="PluginExampleProfile";
     if ($plug = isPluginItemType($classname)) {
         $plugname = strtolower($plug['plugin']);
         $dir = GLPI_ROOT . "/plugins/{$plugname}/inc/";
         $item = strtolower($plug['class']);
         // Is the plugin activate ?
         // Command line usage of GLPI : need to do a real check plugin activation
         if (isCommandLine()) {
             $plugin = new Plugin();
             if (count($plugin->find("directory='{$plugname}' AND state=" . Plugin::ACTIVATED)) == 0) {
                 // Plugin does not exists or not activated
                 return false;
             }
         } else {
             // Standard use of GLPI
             if (!in_array($plugname, $_SESSION['glpi_plugins'])) {
                 // Plugin not activated
                 return false;
             }
         }
     } else {
         // Is ezComponent class ?
         if (preg_match('/^ezc([A-Z][a-z]+)/', $classname, $matches)) {
             include_once GLPI_EZC_BASE;
             ezcBase::autoload($classname);
             return true;
         } else {
             $item = strtolower($classname);
         }
     }
     // No errors for missing classes due to implementation
     if (!isset($CFG_GLPI['missingclasses']) or !in_array($item, $CFG_GLPI['missingclasses'])) {
         if (file_exists("{$dir}{$item}.class.php")) {
             include_once "{$dir}{$item}.class.php";
             if ($_SESSION['glpi_use_mode'] == DEBUG_MODE) {
                 $DEBUG_AUTOLOAD[] = $classname;
             }
         } else {
             if (!isset($notfound["x{$classname}"])) {
                 // trigger an error to get a backtrace, but only once (use prefix 'x' to handle empty case)
                 //logInFile('debug',"file $dir$item.class.php not founded trying to load class $classname\n");
                 trigger_error("GLPI autoload : file {$dir}{$item}.class.php not founded trying to load class '{$classname}'");
                 $notfound["x{$classname}"] = true;
             }
         }
     }
 }
Пример #4
0
function __autoload($className)
{
    ezcBase::autoload($className);
}
Пример #5
0
function __autoload($className)
{
    ezcBase::autoload($className);
    @(include SITE_ROOT . '/app/model/' . $className . '.php');
}
Пример #6
0
 public static function autoload($className)
 {
     if (class_exists('ezcBase')) {
         ezcBase::autoload($className);
     }
 }
Пример #7
0
/**
 * To load classes
 *
 * @param $classname : class to load
**/
function glpi_autoload($classname)
{
    global $DEBUG_AUTOLOAD, $CFG_GLPI;
    static $notfound = array('xStates' => true, 'xAllAssets' => true);
    // empty classname or non concerted plugin or classname containing dot (leaving GLPI main treee)
    if (empty($classname) || is_numeric($classname) || strpos($classname, '.') !== false) {
        die("Security die. trying to load an forbidden class name");
    }
    $dir = GLPI_ROOT . "/inc/";
    if ($plug = isPluginItemType($classname)) {
        $plugname = strtolower($plug['plugin']);
        $dir = GLPI_ROOT . "/plugins/{$plugname}/inc/";
        $item = strtolower($plug['class']);
        // Is the plugin activate ?
        // Command line usage of GLPI : need to do a real check plugin activation
        if (isCommandLine()) {
            $plugin = new Plugin();
            if (count($plugin->find("directory='{$plugname}' AND state=" . Plugin::ACTIVATED)) == 0) {
                // Plugin does not exists or not activated
                return false;
            }
        } else {
            // Standard use of GLPI
            if (!in_array($plugname, $_SESSION['glpi_plugins'])) {
                // Plugin not activated
                return false;
            }
        }
    } else {
        // Is ezComponent class ?
        if (preg_match('/^ezc([A-Z][a-z]+)/', $classname, $matches)) {
            include_once GLPI_EZC_BASE;
            ezcBase::autoload($classname);
            return true;
        }
        // Do not try to load phpcas using GLPI autoload
        if (preg_match('/^CAS_.*/', $classname)) {
            return false;
        }
        // Do not try to load Zend using GLPI autoload
        if (preg_match('/^Zend.*/', $classname)) {
            return false;
        }
        // Do not try to load Simplepie using GLPI autoload
        if (preg_match('/^SimplePie.*/', $classname)) {
            return false;
        }
        $item = strtolower($classname);
    }
    if (file_exists("{$dir}{$item}.class.php")) {
        include_once "{$dir}{$item}.class.php";
        if (isset($_SESSION['glpi_use_mode']) && $_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
            $DEBUG_AUTOLOAD[] = $classname;
        }
    } else {
        if (!isset($notfound["x{$classname}"])) {
            // trigger an error to get a backtrace, but only once (use prefix 'x' to handle empty case)
            //          trigger_error("GLPI autoload : file $dir$item.class.php not founded trying to load class '$classname'");
            $notfound["x{$classname}"] = true;
        }
    }
}
Пример #8
0
/**
 * Autoload ezc classes 
 * 
 * @param string $className 
 */
function webdav_autoload($className)
{
    ezcBase::autoload($className);
}
 public static function autoload($class)
 {
   return ezcBase::autoload($class);
 }
Пример #10
0
function ezc_autoload($className)
{
    if (strpos($className, '_') === false) {
        ezcBase::autoload($className);
    }
}
Пример #11
0
function __autoload($className)
{
    // EZ Component
    ezcBase::autoload($className);
}
Пример #12
0
function __autoload($class)
{
    ezcBase::autoload($class);
}
Пример #13
0
function autoload($class)
{
    \ezcBase::autoload($class);
}
Пример #14
0
 /**
  * Autoload-Method
  *
  * @param string $class name of the class
  */
 public function autoload($class)
 {
     ezcBase::autoload($class);
 }
Пример #15
0
/**
 * Autoload ezc classes 
 * 
 * @param string $className 
 */
function __autoload($className)
{
    if (ezcBase::autoload($className)) {
        return;
    }
}