本文整理汇总了PHP中BackendModel::getTimeFormats方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendModel::getTimeFormats方法的具体用法?PHP BackendModel::getTimeFormats怎么用?PHP BackendModel::getTimeFormats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BackendModel
的用法示例。
在下文中一共展示了BackendModel::getTimeFormats方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadForm
/**
* Load the form
*
* @return void
*/
private function loadForm()
{
// list of default domains
$defaultDomains = array(str_replace(array('http://', 'www.', 'https://'), '', SITE_URL));
// create form
$this->frm = new BackendForm('settingsIndex');
// general settings
$this->frm->addText('site_title', BackendModel::getModuleSetting('core', 'site_title_' . BL::getWorkingLanguage(), SITE_DEFAULT_TITLE));
$this->frm->addTextarea('site_html_header', BackendModel::getModuleSetting('core', 'site_html_header', null), 'textarea code', 'textareaError code', true);
$this->frm->addTextarea('site_html_footer', BackendModel::getModuleSetting('core', 'site_html_footer', null), 'textarea code', 'textareaError code', true);
$this->frm->addTextarea('site_domains', implode("\n", (array) BackendModel::getModuleSetting('core', 'site_domains', $defaultDomains)), 'textarea code', 'textareaError code');
// facebook settings
$this->frm->addText('facebook_admin_ids', BackendModel::getModuleSetting('core', 'facebook_admin_ids', null));
$this->frm->addText('facebook_application_id', BackendModel::getModuleSetting('core', 'facebook_app_id', null));
$this->frm->addText('facebook_application_secret', BackendModel::getModuleSetting('core', 'facebook_app_secret', null));
// api keys
$this->frm->addText('fork_api_public_key', BackendModel::getModuleSetting('core', 'fork_api_public_key', null));
$this->frm->addText('fork_api_private_key', BackendModel::getModuleSetting('core', 'fork_api_private_key', null));
// date & time formats
$this->frm->addDropdown('time_format', BackendModel::getTimeFormats(), BackendModel::getModuleSetting('core', 'time_format'));
$this->frm->addDropdown('date_format_short', BackendModel::getDateFormatsShort(), BackendModel::getModuleSetting('core', 'date_format_short'));
$this->frm->addDropdown('date_format_long', BackendModel::getDateFormatsLong(), BackendModel::getModuleSetting('core', 'date_format_long'));
// number formats
$this->frm->addDropdown('number_format', BackendModel::getNumberFormats(), BackendModel::getModuleSetting('core', 'number_format'));
// create a list of the languages
foreach (BackendModel::getModuleSetting('core', 'languages', array('nl')) as $abbreviation) {
// is this the default language
$defaultLanguage = $abbreviation == SITE_DEFAULT_LANGUAGE ? true : false;
// attributes
$activeAttributes = array();
$activeAttributes['id'] = 'active_language_' . $abbreviation;
$redirectAttributes = array();
$redirectAttributes['id'] = 'redirect_language_' . $abbreviation;
// fetch label
$label = BL::msg(mb_strtoupper($abbreviation), 'core');
// default may not be unselected
if ($defaultLanguage) {
// add to attributes
$activeAttributes['disabled'] = 'disabled';
$redirectAttributes['disabled'] = 'disabled';
// overrule in $_POST
if (!isset($_POST['active_languages']) || !is_array($_POST['active_languages'])) {
$_POST['active_languages'] = array(SITE_DEFAULT_LANGUAGE);
} elseif (!in_array($abbreviation, $_POST['active_languages'])) {
$_POST['active_languages'][] = $abbreviation;
}
if (!isset($_POST['redirect_languages']) || !is_array($_POST['redirect_languages'])) {
$_POST['redirect_languages'] = array(SITE_DEFAULT_LANGUAGE);
} elseif (!in_array($abbreviation, $_POST['redirect_languages'])) {
$_POST['redirect_languages'][] = $abbreviation;
}
}
// add to the list
$activeLanguages[] = array('label' => $label, 'value' => $abbreviation, 'attributes' => $activeAttributes, 'variables' => array('default' => $defaultLanguage));
$redirectLanguages[] = array('label' => $label, 'value' => $abbreviation, 'attributes' => $redirectAttributes, 'variables' => array('default' => $defaultLanguage));
}
// create multilanguage checkbox
$this->frm->addMultiCheckbox('active_languages', $activeLanguages, BackendModel::getModuleSetting('core', 'active_languages', array(SITE_MULTILANGUAGE)));
$this->frm->addMultiCheckbox('redirect_languages', $redirectLanguages, BackendModel::getModuleSetting('core', 'redirect_languages', array(SITE_MULTILANGUAGE)));
// api keys are not required for every module
if ($this->needsAkismet) {
$this->frm->addText('akismet_key', BackendModel::getModuleSetting('core', 'akismet_key', null));
}
if ($this->needsGoogleMaps) {
$this->frm->addText('google_maps_key', BackendModel::getModuleSetting('core', 'google_maps_key', null));
}
}