本文整理汇总了PHP中JDatabaseDriver::getConnectors方法的典型用法代码示例。如果您正苦于以下问题:PHP JDatabaseDriver::getConnectors方法的具体用法?PHP JDatabaseDriver::getConnectors怎么用?PHP JDatabaseDriver::getConnectors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JDatabaseDriver
的用法示例。
在下文中一共展示了JDatabaseDriver::getConnectors方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOptions
/**
* Method to get the list of database options.
*
* This method produces a drop down list of available databases supported
* by JDatabaseDriver classes that are also supported by the application.
*
* @return array The field option objects.
*
* @since 11.3
* @see JDatabaseDriver::getConnectors()
*/
protected function getOptions()
{
// This gets the connectors available in the platform and supported by the server.
$available = JDatabaseDriver::getConnectors();
/**
* This gets the list of database types supported by the application.
* This should be entered in the form definition as a comma separated list.
* If no supported databases are listed, it is assumed all available databases
* are supported.
*/
$supported = $this->element['supported'];
if (!empty($supported)) {
$supported = explode(',', $supported);
foreach ($supported as $support) {
if (in_array($support, $available)) {
$options[$support] = JText::_(ucfirst($support));
}
}
} else {
foreach ($available as $support) {
$options[$support] = JText::_(ucfirst($support));
}
}
// This will come into play if an application is installed that requires
// a database that is not available on the server.
if (empty($options)) {
$options[''] = JText::_('JNONE');
}
return $options;
}
示例2: testGetConnectors
/**
* Tests the JDatabaseDriver::getConnectors method.
*
* @return void
*
* @since 1.0
*/
public function testGetConnectors()
{
$this->assertContains('sqlite', $this->db->getConnectors(), 'The getConnectors method should return an array with Sqlite as an available option.');
}
示例3: getPhpOptions
/**
* Gets PHP options.
*
* @return array Array of PHP config options
*
* @since 3.1
*/
public function getPhpOptions()
{
$options = array();
// Check the PHP Version.
$option = new stdClass();
$option->label = JText::_('INSTL_PHP_VERSION') . ' >= 5.3.10';
$option->state = version_compare(PHP_VERSION, '5.3.10', '>=');
$option->notice = null;
$options[] = $option;
// Check for magic quotes gpc.
$option = new stdClass();
$option->label = JText::_('INSTL_MAGIC_QUOTES_GPC');
$option->state = ini_get('magic_quotes_gpc') == false;
$option->notice = null;
$options[] = $option;
// Check for register globals.
$option = new stdClass();
$option->label = JText::_('INSTL_REGISTER_GLOBALS');
$option->state = ini_get('register_globals') == false;
$option->notice = null;
$options[] = $option;
// Check for zlib support.
$option = new stdClass();
$option->label = JText::_('INSTL_ZLIB_COMPRESSION_SUPPORT');
$option->state = extension_loaded('zlib');
$option->notice = null;
$options[] = $option;
// Check for XML support.
$option = new stdClass();
$option->label = JText::_('INSTL_XML_SUPPORT');
$option->state = extension_loaded('xml');
$option->notice = null;
$options[] = $option;
// Check for database support.
// We are satisfied if there is at least one database driver available.
$available = JDatabaseDriver::getConnectors();
$option = new stdClass();
$option->label = JText::_('INSTL_DATABASE_SUPPORT');
$option->label .= '<br />(' . implode(', ', $available) . ')';
$option->state = count($available);
$option->notice = null;
$options[] = $option;
// Check for mbstring options.
if (extension_loaded('mbstring')) {
// Check for default MB language.
$option = new stdClass();
$option->label = JText::_('INSTL_MB_LANGUAGE_IS_DEFAULT');
$option->state = strtolower(ini_get('mbstring.language')) == 'neutral';
$option->notice = $option->state ? null : JText::_('INSTL_NOTICEMBLANGNOTDEFAULT');
$options[] = $option;
// Check for MB function overload.
$option = new stdClass();
$option->label = JText::_('INSTL_MB_STRING_OVERLOAD_OFF');
$option->state = ini_get('mbstring.func_overload') == 0;
$option->notice = $option->state ? null : JText::_('INSTL_NOTICEMBSTRINGOVERLOAD');
$options[] = $option;
}
// Check for a missing native parse_ini_file implementation.
$option = new stdClass();
$option->label = JText::_('INSTL_PARSE_INI_FILE_AVAILABLE');
$option->state = $this->getIniParserAvailability();
$option->notice = null;
$options[] = $option;
// Check for missing native json_encode / json_decode support.
$option = new stdClass();
$option->label = JText::_('INSTL_JSON_SUPPORT_AVAILABLE');
$option->state = function_exists('json_encode') && function_exists('json_decode');
$option->notice = null;
$options[] = $option;
// Check for configuration file writable.
$writable = is_writable(JPATH_CONFIGURATION . '/configuration.php') || !file_exists(JPATH_CONFIGURATION . '/configuration.php') && is_writable(JPATH_ROOT);
$option = new stdClass();
$option->label = JText::sprintf('INSTL_WRITABLE', 'configuration.php');
$option->state = $writable;
$option->notice = $option->state ? null : JText::_('INSTL_NOTICEYOUCANSTILLINSTALL');
$options[] = $option;
return $options;
}
示例4: getConnectors
/**
* Get a list of available database connectors. The list will only be populated with connectors that both
* the class exists and the static test method returns true. This gives us the ability to have a multitude
* of connector classes that are self-aware as to whether or not they are able to be used on a given system.
*
* @return array An array of available database connectors.
*
* @since 11.1
* @deprecated 13.1
*/
public static function getConnectors()
{
JLog::add('JDatabase::getConnectors() is deprecated, use JDatabaseDriver::getConnectors() instead.', JLog::WARNING, 'deprecated');
return JDatabaseDriver::getConnectors();
}
示例5: getConnectors
/**
* Get a list of available database connectors. The list will only be populated with connectors that both
* the class exists and the static test method returns true. This gives us the ability to have a multitude
* of connector classes that are self-aware as to whether or not they are able to be used on a given system.
*
* @return array An array of available database connectors.
*
* @since 11.1
* @deprecated 13.1
*/
public static function getConnectors()
{
// Deprecation warning.
JLog::add('JDatabase::getConnectors() is deprecated, use JDatabaseDriver::getConnectors() instead.', JLog::NOTICE, 'deprecated');
return JDatabaseDriver::getConnectors();
}