Пример #1
0
 /**
  * Set a driver
  *
  * Set a driver as active by providing its name as argument to this static method
  *
  * @param string $driver_name
  * @return boolean
  *
  * @access public
  * @static
  */
 function driver($driver_name)
 {
     // class exists ?
     //
     if (class_exists($c = asido::__driver_classname($driver_name))) {
         asido::_driver(new $c());
         return true;
     }
     // file exists ?
     //
     if (!($fp = @fopen($f = asido::__driver_filename($driver_name), 'r', 1))) {
         trigger_error(sprintf('Asido driver file "%s" (for driver "%s") ' . ' not found for including', $f, $driver_name), E_USER_ERROR);
         return false;
     }
     fclose($fp);
     // include it
     //
     require_once $f;
     // file loaded, check again ...
     //
     if (class_exists($c)) {
         asido::_driver(new $c());
         return true;
     }
     trigger_error(sprintf('Asido driver class "%s" (for driver "%s") not found', $c, $driver_name), E_USER_ERROR);
     return false;
 }