/** * Correct the (file)name of a driver * * @param string $name The name of the driver * @param string $type The type of the driver * @return mixed Either true or a PEAR_Error object * @access private */ function _correctDriverName($name, $type) { $driverNameMap = array('DataSource' => array('DBDataObject' => 'DataObject', 'XLS' => 'Excel'), 'Renderer' => array('ConsoleTable' => 'Console', 'Excel' => 'XLS')); // replace underscores (e.g. HTML_Table driver has filename HTMLTable.php) $name = str_replace('_', '', $name); // does the file exist? if (Structures_DataGrid::fileExists("Structures/DataGrid/{$type}/{$name}.php")) { return $name; } // check, whether a name mapping exists (e.g. from 'Excel' to 'XLS') if (isset($driverNameMap[$type][$name])) { return $driverNameMap[$type][$name]; } // we could not find a valid driver name => return an error $error = PEAR::raiseError("Unknown {$type} driver. Please specify an " . 'existing driver.'); return $error; }