本文整理汇总了PHP中Fisharebest\Webtrees\Theme::installedThemes方法的典型用法代码示例。如果您正苦于以下问题:PHP Theme::installedThemes方法的具体用法?PHP Theme::installedThemes怎么用?PHP Theme::installedThemes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Theme
的用法示例。
在下文中一共展示了Theme::installedThemes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PageController
$controller = new PageController();
$controller->restrictAccess(Auth::isAdmin());
// Valid values for form variables
$ALL_EDIT_OPTIONS = array('none' => I18N::translate('Visitor'), 'access' => I18N::translate('Member'), 'edit' => I18N::translate('Editor'), 'accept' => I18N::translate('Moderator'), 'admin' => I18N::translate('Manager'));
// Form actions
switch (Filter::post('action')) {
case 'save':
if (Filter::checkCsrf()) {
$user_id = Filter::postInteger('user_id');
$user = User::find($user_id);
$username = Filter::post('username');
$real_name = Filter::post('real_name');
$email = Filter::postEmail('email');
$pass1 = Filter::post('pass1', WT_REGEX_PASSWORD);
$pass2 = Filter::post('pass2', WT_REGEX_PASSWORD);
$theme = Filter::post('theme', implode('|', array_keys(Theme::installedThemes())), '');
$language = Filter::post('language');
$timezone = Filter::post('timezone');
$contact_method = Filter::post('contact_method');
$comment = Filter::post('comment');
$auto_accept = Filter::postBool('auto_accept');
$canadmin = Filter::postBool('canadmin');
$visible_online = Filter::postBool('visible_online');
$verified = Filter::postBool('verified');
$approved = Filter::postBool('approved');
if ($user_id === 0) {
// Create a new user
if (User::findByIdentifier($username)) {
FlashMessages::addMessage(I18N::translate('Duplicate user name. A user with that user name already exists. Please choose another user name.'));
} elseif (User::findByIdentifier($email)) {
FlashMessages::addMessage(I18N::translate('Duplicate email address. A user with that email already exists.'));
示例2: menuThemes
/**
* Themes menu.
*
* @return Menu|null
*/
public function menuThemes()
{
if ($this->tree && Site::getPreference('ALLOW_USER_THEMES') && $this->tree->getPreference('ALLOW_THEME_DROPDOWN')) {
$submenus = array();
foreach (Theme::installedThemes() as $theme) {
$class = 'menu-theme-' . $theme->themeId() . ($theme === $this ? ' active' : '');
$submenus[] = new Menu($theme->themeName(), '#', $class, array('onclick' => 'return false;', 'data-theme' => $theme->themeId()));
}
usort($submenus, function (Menu $x, Menu $y) {
return I18N::strcasecmp($x->getLabel(), $y->getLabel());
});
$menu = new Menu(I18N::translate('Theme'), '#', 'menu-theme', array(), $submenus);
return $menu;
} else {
return null;
}
}
示例3: foreach
} else {
// Last theme used?
$theme_id = Session::get('theme_id');
// Default for tree
if (!array_key_exists($theme_id, Theme::themeNames()) && $WT_TREE) {
$theme_id = $WT_TREE->getPreference('THEME_DIR');
}
// Default for site
if (!array_key_exists($theme_id, Theme::themeNames())) {
$theme_id = Site::getPreference('THEME_DIR');
}
// Default
if (!array_key_exists($theme_id, Theme::themeNames())) {
$theme_id = 'webtrees';
}
foreach (Theme::installedThemes() as $theme) {
if ($theme->themeId() === $theme_id) {
Theme::theme($theme)->init($WT_TREE);
// Remember this setting
if (Site::getPreference('ALLOW_USER_THEMES')) {
Session::put('theme_id', $theme_id);
}
break;
}
}
}
// Search engines are only allowed to see certain pages.
if (Auth::isSearchEngine() && !in_array(WT_SCRIPT_NAME, array('index.php', 'indilist.php', 'module.php', 'mediafirewall.php', 'individual.php', 'family.php', 'mediaviewer.php', 'note.php', 'repo.php', 'source.php'))) {
http_response_code(403);
$controller = new PageController();
$controller->setPageTitle(I18N::translate('Search engine'));