本文整理汇总了PHP中JDatabase::getConnectors方法的典型用法代码示例。如果您正苦于以下问题:PHP JDatabase::getConnectors方法的具体用法?PHP JDatabase::getConnectors怎么用?PHP JDatabase::getConnectors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JDatabase
的用法示例。
在下文中一共展示了JDatabase::getConnectors方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOptions
/**
* Method to get the list of database options.
*
* This method produces a drop down list of available databases supported
* by JDatabase drivers that are also supported by the application.
*
* @return array The field option objects.
*
* @since 11.3
* @see JDatabase
*/
protected function getOptions()
{
// Initialize variables.
// This gets the connectors available in the platform and supported by the server.
$available = JDatabase::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] = ucfirst($support);
}
}
} else {
foreach ($available as $support) {
$options[$support] = 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: getPhpOptions
/**
* Gets PHP options.
*
* @return array
* @since 1.6
*/
public function getPhpOptions()
{
// Initialise variables.
$options = array();
// Check the PHP Version.
$option = new stdClass();
$option->label = JText::_('INSTL_PHP_VERSION') . ' >= 5.2.4';
$option->state = version_compare(PHP_VERSION, '5.2.4', '>=');
$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 = JDatabase::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 writeable.
$option = new stdClass();
$option->label = 'configuration.php ' . JText::_('INSTL_WRITABLE');
$option->state = is_writable('../configuration.php') || !file_exists('../configuration.php') && is_writable('../');
$option->notice = $option->state ? null : JText::_('INSTL_NOTICEYOUCANSTILLINSTALL');
$options[] = $option;
return $options;
}