本文整理汇总了PHP中AppLocale::isLocaleComplete方法的典型用法代码示例。如果您正苦于以下问题:PHP AppLocale::isLocaleComplete方法的具体用法?PHP AppLocale::isLocaleComplete怎么用?PHP AppLocale::isLocaleComplete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppLocale
的用法示例。
在下文中一共展示了AppLocale::isLocaleComplete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
* @param $request PKPRequest
*/
function __construct($request)
{
parent::__construct($request, 'install/install.tpl');
// FIXME Move the below options to an external configuration file?
$this->supportedLocales = AppLocale::getAllLocales();
$this->localesComplete = array();
foreach ($this->supportedLocales as $key => $name) {
$this->localesComplete[$key] = AppLocale::isLocaleComplete($key);
}
$this->supportedClientCharsets = array('utf-8' => 'Unicode (UTF-8)', 'iso-8859-1' => 'Western (ISO-8859-1)');
$this->supportedConnectionCharsets = array('' => __('common.notApplicable'), 'utf8' => 'Unicode (UTF-8)');
$this->supportedDatabaseCharsets = array('' => __('common.notApplicable'), 'utf8' => 'Unicode (UTF-8)');
$this->supportedDatabaseDrivers = array('mysql' => array('mysql', 'MySQL'), 'mysqli' => array('mysqli', 'MySQLi'), 'postgres' => array('pgsql', 'PostgreSQL'), 'oracle' => array('oci8', 'Oracle'), 'mssql' => array('mssql', 'MS SQL Server'), 'fbsql' => array('fbsql', 'FrontBase'), 'ibase' => array('ibase', 'Interbase'), 'firebird' => array('ibase', 'Firebird'), 'informix' => array('ifx', 'Informix'), 'sybase' => array('sybase', 'Sybase'), 'odbc' => array('odbc', 'ODBC'));
// Validation checks for this form
$this->addCheck(new FormValidatorInSet($this, 'locale', 'required', 'installer.form.localeRequired', array_keys($this->supportedLocales)));
$this->addCheck(new FormValidatorCustom($this, 'locale', 'required', 'installer.form.localeRequired', array('AppLocale', 'isLocaleValid')));
$this->addCheck(new FormValidatorInSet($this, 'clientCharset', 'required', 'installer.form.clientCharsetRequired', array_keys($this->supportedClientCharsets)));
$this->addCheck(new FormValidator($this, 'filesDir', 'required', 'installer.form.filesDirRequired'));
$this->addCheck(new FormValidator($this, 'adminUsername', 'required', 'installer.form.usernameRequired'));
$this->addCheck(new FormValidatorUsername($this, 'adminUsername', 'required', 'installer.form.usernameAlphaNumeric'));
$this->addCheck(new FormValidator($this, 'adminPassword', 'required', 'installer.form.passwordRequired'));
$this->addCheck(new FormValidatorCustom($this, 'adminPassword', 'required', 'installer.form.passwordsDoNotMatch', create_function('$password,$form', 'return $password == $form->getData(\'adminPassword2\');'), array($this)));
$this->addCheck(new FormValidatorEmail($this, 'adminEmail', 'required', 'installer.form.emailRequired'));
$this->addCheck(new FormValidatorInSet($this, 'databaseDriver', 'required', 'installer.form.databaseDriverRequired', array_keys($this->supportedDatabaseDrivers)));
$this->addCheck(new FormValidator($this, 'databaseName', 'required', 'installer.form.databaseNameRequired'));
}
示例2: languages
/**
* Display form to modify site language settings.
* @param $args array
* @param $request object
*/
function languages($args, &$request)
{
$this->validate();
$this->setupTemplate(true);
$site =& $request->getSite();
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('localeNames', AppLocale::getAllLocales());
$templateMgr->assign('primaryLocale', $site->getPrimaryLocale());
$templateMgr->assign('supportedLocales', $site->getSupportedLocales());
$localesComplete = array();
foreach (AppLocale::getAllLocales() as $key => $name) {
$localesComplete[$key] = AppLocale::isLocaleComplete($key);
}
$templateMgr->assign('localesComplete', $localesComplete);
$templateMgr->assign('installedLocales', $site->getInstalledLocales());
$templateMgr->assign('uninstalledLocales', array_diff(array_keys(AppLocale::getAllLocales()), $site->getInstalledLocales()));
$templateMgr->assign('helpTopicId', 'site.siteManagement');
import('classes.i18n.LanguageAction');
$languageAction = new LanguageAction();
if ($languageAction->isDownloadAvailable()) {
$templateMgr->assign('downloadAvailable', true);
$templateMgr->assign('downloadableLocales', $languageAction->getDownloadableLocales());
}
$templateMgr->display('admin/languages.tpl');
}
示例3: InstallForm
/**
* Constructor.
*/
function InstallForm()
{
parent::Form('install/install.tpl');
// FIXME Move the below options to an external configuration file?
$this->supportedLocales = AppLocale::getAllLocales();
$this->localesComplete = array();
foreach ($this->supportedLocales as $key => $name) {
$this->localesComplete[$key] = AppLocale::isLocaleComplete($key);
}
$this->supportedClientCharsets = array('utf-8' => 'Unicode (UTF-8)', 'iso-8859-1' => 'Western (ISO-8859-1)');
$this->supportedConnectionCharsets = array('' => __('common.notApplicable'), 'utf8' => 'Unicode (UTF-8)');
$this->supportedDatabaseCharsets = array('' => __('common.notApplicable'), 'utf8' => 'Unicode (UTF-8)');
$this->supportedEncryptionAlgorithms = array('md5' => 'MD5');
if (function_exists('sha1')) {
$this->supportedEncryptionAlgorithms['sha1'] = 'SHA1';
}
$this->supportedDatabaseDrivers = array('mysql' => array('mysql', 'MySQL'), 'postgres' => array('pgsql', 'PostgreSQL'), 'oracle' => array('oci8', 'Oracle'), 'mssql' => array('mssql', 'MS SQL Server'), 'fbsql' => array('fbsql', 'FrontBase'), 'ibase' => array('ibase', 'Interbase'), 'firebird' => array('ibase', 'Firebird'), 'informix' => array('ifx', 'Informix'), 'sybase' => array('sybase', 'Sybase'), 'odbc' => array('odbc', 'ODBC'));
// Validation checks for this form
$this->addCheck(new FormValidatorInSet($this, 'locale', 'required', 'installer.form.localeRequired', array_keys($this->supportedLocales)));
$this->addCheck(new FormValidatorCustom($this, 'locale', 'required', 'installer.form.localeRequired', array('AppLocale', 'isLocaleValid')));
$this->addCheck(new FormValidatorInSet($this, 'clientCharset', 'required', 'installer.form.clientCharsetRequired', array_keys($this->supportedClientCharsets)));
$this->addCheck(new FormValidator($this, 'filesDir', 'required', 'installer.form.filesDirRequired'));
$this->addCheck(new FormValidatorInSet($this, 'encryption', 'required', 'installer.form.encryptionRequired', array_keys($this->supportedEncryptionAlgorithms)));
$this->addCheck(new FormValidator($this, 'adminUsername', 'required', 'installer.form.usernameRequired'));
$this->addCheck(new FormValidatorAlphaNum($this, 'adminUsername', 'required', 'installer.form.usernameAlphaNumeric'));
$this->addCheck(new FormValidatorLength($this, 'adminPassword', 'required', 'user.register.form.passwordLengthTooShort', '>=', INSTALLER_DEFAULT_MIN_PASSWORD_LENGTH));
$this->addCheck(new FormValidator($this, 'adminPassword', 'required', 'installer.form.passwordRequired'));
$this->addCheck(new FormValidatorCustom($this, 'adminPassword', 'required', 'installer.form.passwordsDoNotMatch', create_function('$password,$form', 'return $password == $form->getData(\'adminPassword2\');'), array(&$this)));
$this->addCheck(new FormValidatorEmail($this, 'adminEmail', 'required', 'installer.form.emailRequired'));
$this->addCheck(new FormValidatorInSet($this, 'databaseDriver', 'required', 'installer.form.databaseDriverRequired', array_keys($this->supportedDatabaseDrivers)));
$this->addCheck(new FormValidator($this, 'databaseName', 'required', 'installer.form.databaseNameRequired'));
$this->addCheck(new FormValidatorPost($this));
}
示例4: loadData
/**
* @copydoc GridHandler::loadData()
*/
protected function loadData($request, $filter)
{
$site = $request->getSite();
$data = array();
$allLocales = AppLocale::getAllLocales();
$installedLocales = $site->getInstalledLocales();
$supportedLocales = $site->getSupportedLocales();
$primaryLocale = $site->getPrimaryLocale();
foreach ($installedLocales as $localeKey) {
$data[$localeKey] = array();
$data[$localeKey]['name'] = $allLocales[$localeKey];
$data[$localeKey]['incomplete'] = !AppLocale::isLocaleComplete($localeKey);
if (in_array($localeKey, $supportedLocales)) {
$supported = true;
} else {
$supported = false;
}
$data[$localeKey]['supported'] = $supported;
if ($this->_canManage($request)) {
$context = $request->getContext();
$primaryLocale = $context->getPrimaryLocale();
}
if ($localeKey == $primaryLocale) {
$primary = true;
} else {
$primary = false;
}
$data[$localeKey]['primary'] = $primary;
}
if ($this->_canManage($request)) {
$data = $this->addManagementData($request, $data);
}
return $data;
}
示例5: testIsLocaleComplete
/**
* @covers PKPLocale
*/
public function testIsLocaleComplete()
{
self::assertTrue(AppLocale::isLocaleComplete('en_US'));
self::assertFalse(AppLocale::isLocaleComplete('pt_BR'));
self::assertFalse(AppLocale::isLocaleComplete('xx_XX'));
}