Пример #1
0
 function &setFrontendClass($uiclass)
 {
     if (is_object($GLOBALS['_PEAR_FRONTEND_SINGLETON']) && is_a($GLOBALS['_PEAR_FRONTEND_SINGLETON'], $uiclass)) {
         return $GLOBALS['_PEAR_FRONTEND_SINGLETON'];
     }
     if (!class_exists($uiclass)) {
         $file = str_replace('_', '/', $uiclass) . '.php';
         if (PEAR_Frontend::isIncludeable($file)) {
             include_once $file;
         }
     }
     if (class_exists($uiclass)) {
         $obj =& new $uiclass();
         // quick test to see if this class implements a few of the most
         // important frontend methods
         if (method_exists($obj, 'userConfirm')) {
             $GLOBALS['_PEAR_FRONTEND_SINGLETON'] =& $obj;
             $GLOBALS['_PEAR_FRONTEND_CLASS'] = $uiclass;
             return $obj;
         } else {
             $err = PEAR::raiseError("not a frontend class: {$uiclass}");
             return $err;
         }
     }
     $err = PEAR::raiseError("no such class: {$uiclass}");
     return $err;
 }