本文整理汇总了PHP中Fisharebest\Webtrees\Auth::isSearchEngine方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth::isSearchEngine方法的具体用法?PHP Auth::isSearchEngine怎么用?PHP Auth::isSearchEngine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Auth
的用法示例。
在下文中一共展示了Auth::isSearchEngine方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: htmlFormattedName
/**
* Return HTML code for the place formatted as requested.
* The format string should used %n with n to describe the level of division to be printed (in the order of the GEDCOM place).
* For instance "%1 (%2)" will display "Subdivision (Town)".
*
* @param string $format Format for the place
* @param bool $anchor Option to print a link to placelist
* @return string HTML code for formatted place
*/
public function htmlFormattedName($format, $anchor = false)
{
$html = '';
$levels = array_map('trim', explode(',', $this->place->getGedcomName()));
$nbLevels = count($levels);
$displayPlace = $format;
preg_match_all('/%[^%]/', $displayPlace, $matches);
foreach ($matches[0] as $match2) {
$index = str_replace('%', '', $match2);
if (is_numeric($index) && $index > 0 && $index <= $nbLevels) {
$displayPlace = str_replace($match2, $levels[$index - 1], $displayPlace);
} else {
$displayPlace = str_replace($match2, '', $displayPlace);
}
}
if ($anchor && !Auth::isSearchEngine()) {
$html .= '<a href="' . $this->place->getURL() . '">' . $displayPlace . '</a>';
} else {
$html .= $displayPlace;
}
return $html;
}
示例2: ajaxRequest
/**
* Handle AJAX requests - to generate the tab content
*/
public function ajaxRequest()
{
// Search engines should not make AJAX requests
if (Auth::isSearchEngine()) {
http_response_code(403);
exit;
}
// Initialise tabs
$tab = Filter::get('module');
// A request for a non-existant tab?
if (array_key_exists($tab, $this->tabs)) {
$mod = $this->tabs[$tab];
} else {
http_response_code(404);
exit;
}
header("Content-Type: text/html; charset=UTF-8");
// AJAX calls do not have the meta tag headers and need this set
header("X-Robots-Tag: noindex,follow");
// AJAX pages should not show up in search results, any links can be followed though
echo $mod->getTabContent();
if (WT_DEBUG_SQL) {
echo Database::getQueryLog();
}
}
示例3: canLoadAjax
/** {@inheritdoc} */
public function canLoadAjax()
{
return !Auth::isSearchEngine();
// Search engines cannot use AJAX
}
示例4: getMenu
public function getMenu()
{
global $controller, $WT_TREE;
$menu_titles = $this->getMenuList();
$lang = '';
$min_block = webtrees\Database::prepare("SELECT MIN(block_order) FROM `##block` WHERE module_name=?")->execute(array($this->getName()))->fetchOne();
foreach ($menu_titles as $items) {
$languages = $this->getBlockSetting($items->block_id, 'languages');
if (in_array(WT_LOCALE, explode(',', $languages))) {
$lang = WT_LOCALE;
} else {
$lang = '';
}
}
$default_block = webtrees\Database::prepare("SELECT ##block.block_id FROM `##block`, `##block_setting` WHERE block_order=? AND module_name=? AND ##block.block_id = ##block_setting.block_id AND ##block_setting.setting_value LIKE ?")->execute(array($min_block, $this->getName(), '%' . $lang . '%'))->fetchOne();
$main_menu_address = webtrees\Database::prepare("SELECT setting_value FROM `##block_setting` WHERE block_id=? AND setting_name=?")->execute(array($default_block, 'menu_address'))->fetchOne();
if (count($menu_titles) > 1) {
$main_menu_title = $this->getMenuTitle();
} else {
$main_menu_title = webtrees\Database::prepare("SELECT setting_value FROM `##block_setting` WHERE block_id=? AND setting_name=?")->execute(array($default_block, 'menu_title'))->fetchOne();
}
if (webtrees\Auth::isSearchEngine()) {
return null;
}
if (file_exists(WT_MODULES_DIR . $this->getName() . '/themes/' . webtrees\Theme::theme()->themeId() . '/')) {
echo '<link rel="stylesheet" href="' . WT_MODULES_DIR . $this->getName() . '/themes/' . webtrees\Theme::theme()->themeId() . '/style.css" type="text/css">';
} else {
echo '<link rel="stylesheet" href="' . WT_MODULES_DIR . $this->getName() . '/themes/webtrees/style.css" type="text/css">';
}
//-- main menu item
$menu = new webtrees\Menu($main_menu_title, $main_menu_address, $this->getName());
$menu->addClass('menuitem', 'menuitem_hover', '');
foreach ($menu_titles as $items) {
if (count($menu_titles) > 1) {
$languages = $this->getBlockSetting($items->block_id, 'languages');
if ((!$languages || in_array(WT_LOCALE, explode(',', $languages))) && $items->menu_access >= webtrees\Auth::accessLevel($WT_TREE)) {
$submenu = new webtrees\Menu(webtrees\I18N::translate($items->menu_title), $items->menu_address, $this->getName() . '-' . str_replace(' ', '', $items->menu_title));
$menu->addSubmenu($submenu);
}
}
}
if (webtrees\Auth::isAdmin()) {
$submenu = new webtrees\Menu(webtrees\I18N::translate('Edit menus'), $this->getConfigLink(), $this->getName() . '-edit');
$menu->addSubmenu($submenu);
}
return $menu;
}
示例5: hasSidebarContent
/** {@inheritdoc} */
public function hasSidebarContent()
{
return !Auth::isSearchEngine();
}
示例6: hasTabContent
/** {@inheritdoc} */
public function hasTabContent()
{
return !Auth::isSearchEngine();
}
示例7: getInitialLettersList
/**
* Get the list of initial letters
*
* @return string[]
*/
private function getInitialLettersList()
{
$list = array();
/** @var \Fisharebest\Webtrees\Tree $tree */
$tree = $this->data->get('tree');
$script_base_url = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage';
foreach (QueryName::surnameAlpha($tree, false, false) as $letter => $count) {
switch ($letter) {
case '@':
$html = I18N::translateContext('Unknown surname', '…');
break;
case ',':
$html = I18N::translate('None');
break;
default:
$html = Filter::escapeHtml($letter);
break;
}
if ($count) {
if ($letter == $this->data->get('alpha')) {
$list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" class="warning" title="' . I18N::number($count) . '">' . $html . '</a>';
} else {
$list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" title="' . I18N::number($count) . '">' . $html . '</a>';
}
} else {
$list[] = $html;
}
}
// Search spiders don't get the "show all" option as the other links give them everything.
if (!Auth::isSearchEngine()) {
if ($this->data->get('show_all') === 'yes') {
$list[] = '<span class="warning">' . I18N::translate('All') . '</span>';
} else {
$list[] = '<a href="' . $script_base_url . '&show_all=yes' . '&ged=' . $tree->getNameUrl() . '">' . I18N::translate('All') . '</a>';
}
}
return $list;
}
示例8: rawurlencode
default:
$html = Filter::escapeHtml($givn_initial);
break;
}
if ($count) {
if ($show === 'indi' && $givn_initial === $falpha && $show_all_firstnames === 'no') {
$list[] = '<a class="warning" href="' . $url . '&falpha=' . rawurlencode($givn_initial) . '" title="' . I18N::number($count) . '">' . $html . '</a>';
} else {
$list[] = '<a href="' . $url . '&falpha=' . rawurlencode($givn_initial) . '" title="' . I18N::number($count) . '">' . $html . '</a>';
}
} else {
$list[] = $html;
}
}
// Search spiders don't get the "show all" option as the other links give them everything.
if (!Auth::isSearchEngine()) {
if ($show_all_firstnames === 'yes') {
$list[] = '<span class="warning">' . I18N::translate('All') . '</span>';
} else {
$list[] = '<a href="' . $url . '&show_all_firstnames=yes">' . I18N::translate('All') . '</a>';
}
}
if ($show_all === 'no') {
echo '<h2 class="center">', I18N::translate('Individuals with surname %s', $legend), '</h2>';
}
echo '<p class="center alpha_index">', implode(' | ', $list), '</p>';
}
}
if ($show === 'indi') {
echo FunctionsPrintLists::individualTable(QueryName::individuals($WT_TREE, $surname, $alpha, $falpha, $show_marnm === 'yes', false));
}
示例9: foreach
echo $active_blocks[$module_name]->getBlock($block_id);
} else {
// Load the block asynchronously
echo '<div id="block_', $block_id, '"><div class="loading-image"> </div></div>';
$controller->addInlineJavascript('jQuery("#block_' . $block_id . '").load("index.php?ctype=' . $ctype . '&action=ajax&block_id=' . $block_id . '");');
}
}
}
echo '</div>';
}
if ($blocks['side']) {
if ($blocks['main']) {
echo '<div id="index_small_blocks">';
} else {
echo '<div id="index_full_blocks">';
}
foreach ($blocks['side'] as $block_id => $module_name) {
if (array_key_exists($module_name, $active_blocks)) {
if (Auth::isSearchEngine() || !$active_blocks[$module_name]->loadAjax()) {
// Load the block directly
echo $active_blocks[$module_name]->getBlock($block_id);
} else {
// Load the block asynchronously
echo '<div id="block_', $block_id, '"><div class="loading-image"> </div></div>';
$controller->addInlineJavascript('jQuery("#block_' . $block_id . '").load("index.php?ctype=' . $ctype . '&action=ajax&block_id=' . $block_id . '");');
}
}
}
echo '</div>';
}
echo '</div>';
示例10: foreach
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'));
$controller->pageHeader();
echo '<p class="ui-state-error">', I18N::translate('You do not have permission to view this page.'), '</p>';
exit;
}
示例11: getMenu
/** {@inheritdoc} */
public function getMenu()
{
global $controller;
if (!Auth::isSearchEngine()) {
Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
static $menu;
// Function has already run
if ($menu !== null && count($menu->getSubmenus()) > 0) {
return $menu;
}
$FTV_SETTINGS = unserialize($this->getSetting('FTV_SETTINGS'));
if (!empty($FTV_SETTINGS)) {
foreach ($FTV_SETTINGS as $FTV_ITEM) {
if ($FTV_ITEM['TREE'] == $this->tree_id && !empty($FTV_ITEM['PID']) && $FTV_ITEM['ACCESS_LEVEL'] >= Auth::accessLevel($this->tree)) {
$FTV_GED_SETTINGS[] = $FTV_ITEM;
}
}
if (!empty($FTV_GED_SETTINGS)) {
if (Theme::theme()->themeId() !== '_administration') {
// load the module stylesheets
echo $this->module()->getStylesheet();
// add javascript files and scripts
$this->module()->includeJs($controller, 'menu');
if (WT_SCRIPT_NAME === 'individual.php') {
$this->module()->includeJs($controller, 'tab');
}
}
$tree_name = Filter::escapeUrl($this->tree->getName());
$menu = new Menu(I18N::translate('Family tree overview'), 'module.php?mod=' . $this->getName() . '&mod_action=page&rootid=' . $FTV_GED_SETTINGS[0]['PID'] . '&ged=' . $tree_name, 'menu-fancy_treeview');
foreach ($FTV_GED_SETTINGS as $FTV_ITEM) {
$record = Individual::getInstance($FTV_ITEM['PID'], $this->tree);
if ($record && $record->canShowName()) {
if ($this->module()->options('use_fullname') == true) {
$submenu = new Menu(I18N::translate('Descendants of %s', $record->getFullName()), 'module.php?mod=' . $this->getName() . '&mod_action=page&rootid=' . $FTV_ITEM['PID'] . '&ged=' . $tree_name, 'menu-fancy_treeview-' . $FTV_ITEM['PID']);
} else {
$submenu = new Menu(I18N::translate('Descendants of the %s family', $FTV_ITEM['SURNAME']), 'module.php?mod=' . $this->getName() . '&mod_action=page&rootid=' . $FTV_ITEM['PID'] . '&ged=' . $tree_name, 'menu-fancy_treeview-' . $FTV_ITEM['PID']);
}
$menu->addSubmenu($submenu);
}
}
if (count($menu->getSubmenus()) > 0) {
return $menu;
}
}
}
}
}
示例12: menuLogin
public function menuLogin()
{
if (Auth::check() || Auth::isSearchEngine()) {
return null;
} else {
return '<div class="menu-login btn-group">' . '<a href="' . WT_LOGIN_URL . '?url=' . rawurlencode(Functions::getQueryUrl()) . '" class="btn btn-default">' . I18N::translate('Sign in') . '</a></div>';
}
}