本文整理汇总了PHP中elgg_is_admin_logged_in函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_is_admin_logged_in函数的具体用法?PHP elgg_is_admin_logged_in怎么用?PHP elgg_is_admin_logged_in使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_is_admin_logged_in函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOptions
protected function getOptions()
{
$options = parent::getOptions();
if ($this->banned === true) {
$options['wheres'][] = "u.banned = 'yes'";
} elseif ($this->banned === false) {
$options['wheres'][] = "u.banned = 'no'";
}
if ($this->admin === true) {
$options['wheres'][] = "u.admin = 'yes'";
} elseif ($this->admin === false) {
$options['wheres'][] = "u.admin = 'no'";
}
if ($this->search) {
$q = sanitize_string($this->search);
$where = "u.name LIKE \"%{$q}%\" OR u.username LIKE \"%{$q}%\"";
if (\elgg_is_admin_logged_in()) {
$where .= " u.email LIKE \"%{$q}%\"";
}
$options['wheres'][] = "({$where})";
}
/*
* "Unvalidated" means metadata of validated is not set or not truthy.
* We can't use elgg_get_entities_from_metadata() because you can't say
* "where the entity has metadata set OR it's not equal to 1".
*/
if ($this->validated === false) {
$validated_id = \elgg_get_metastring_id('validated');
$one_id = \elgg_get_metastring_id('1');
$options['wheres'][] = "NOT EXISTS (\n\t\t\t\tSELECT 1 FROM {$this->getDB()->getPrefix()}metadata validated_md\n\t\t\t\tWHERE validated_md.entity_guid = e.guid\n\t\t\t\t\tAND validated_md.name_id = {$validated_id}\n\t\t\t\t\tAND validated_md.value_id = {$one_id})";
}
return $options;
}
示例2: getFilterOptions
/**
* {@inheritdoc}
*/
public function getFilterOptions()
{
$options = $this->getOptions();
$filter_options = array('', 'open', 'closed', 'featured');
if (elgg_is_logged_in()) {
$filter_options[] = 'member';
if (elgg_get_plugin_setting('limited_groups', 'groups') != 'yes' || elgg_is_admin_logged_in()) {
$filter_options[] = 'admin';
}
$filter_options[] = 'invited';
$filter_options[] = 'membership_request';
}
$params = ['list' => $this];
$filter_options = elgg_trigger_plugin_hook('sort_relationships', 'group', $params, $filter_options);
$subtypes = elgg_extract('subtype', $options);
if (!$subtypes) {
$subtypes = elgg_extract('subtypes', $options);
}
if (!empty($subtypes)) {
$subtypes = (array) $subtypes;
$subtype = $subtypes[0];
$filter_options = elgg_trigger_plugin_hook('sort_relationships', "group:{$subtype}", $params, $filter_options);
}
return $filter_options;
}
示例3: expages_page_handler
/**
* External pages page handler
*
* @param array $page URL segements
* @param string $handler Handler identifier
* @return bool
*/
function expages_page_handler($page, $handler)
{
if ($handler == 'expages') {
expages_url_forwarder($page[1]);
}
$type = strtolower($handler);
$title = elgg_echo("expages:{$type}");
$header = elgg_view_title($title);
$object = elgg_get_entities(array('type' => 'object', 'subtype' => $type, 'limit' => 1));
if ($object) {
$content .= elgg_view('output/longtext', array('value' => $object[0]->description));
} else {
$content .= elgg_echo("expages:notset");
}
$content = elgg_view('expages/wrapper', array('content' => $content));
if (elgg_is_admin_logged_in()) {
elgg_register_menu_item('title', array('name' => 'edit', 'text' => elgg_echo('edit'), 'href' => "admin/appearance/expages?type={$type}", 'link_class' => 'elgg-button elgg-button-action'));
}
if (elgg_is_logged_in() || !elgg_get_config('walled_garden')) {
$body = elgg_view_layout('one_column', array('title' => $title, 'content' => $content));
echo elgg_view_page($title, $body);
} else {
elgg_load_css('elgg.walled_garden');
$body = elgg_view_layout('walled_garden', array('content' => $header . $content));
echo elgg_view_page($title, $body, 'walled_garden');
}
return true;
}
示例4: pool_entity_menu
/**
* Set up entity menu for pool objects
*
* @param string $hook 'register'
* @param string $type 'menu:entity'
* @param ElggMenuItem[] $return
* @param array $params
* @return ElggMenuItem[]
*/
function pool_entity_menu($hook, $type, $return, $params)
{
$handler = elgg_extract('handler', $params, false);
if ($handler != 'task_pool') {
return $return;
}
if (elgg_is_logged_in()) {
$entity = $params['entity'];
$user_guid = elgg_get_logged_in_user_guid();
if ($entity->isMember($user_guid)) {
$text = elgg_echo('pool:leave');
} else {
$text = elgg_echo('pool:join');
}
$return[] = ElggMenuItem::factory(array('name' => 'test', 'text' => "<span>{$text}</span>", 'href' => "action/pool/toggle_membership?pool_guid={$entity->guid}&user_guid={$user_guid}", 'priority' => 150, 'is_action' => true));
if (elgg_is_admin_logged_in()) {
$return[] = ElggMenuItem::factory(array('name' => 'edit', 'text' => elgg_echo('edit'), 'href' => "admin/pool/save?guid={$entity->guid}"));
$return[] = ElggMenuItem::factory(array('name' => 'delete', 'text' => elgg_view_icon('delete'), 'href' => "action/pool/admin/delete?guid={$entity->guid}", 'is_action' => true, 'confirm' => elgg_echo('question:areyousure'), 'priority' => 200));
if ($entity->countMembers()) {
$return[] = ElggMenuItem::factory(array('name' => 'shift', 'text' => elgg_echo('pool:shift'), 'href' => "action/pool/shift?guid={$entity->guid}", 'priority' => 150, 'is_action' => true, 'confirm' => elgg_echo('question:areyousure')));
}
}
}
return $return;
}
示例5: au_staff_options
function au_staff_options($pageowner)
{
$user = elgg_get_logged_in_user_entity();
$group = elgg_get_page_owner_entity();
if (elgg_instanceof($group, 'group')) {
//check group attributes - ignore if au staff
if ($group->staff_only_enable == 'yes') {
elgg_extend_view('group/default', 'groups/sidebar/staff_only', 502);
//do stuff if this is a staff-only group
//system_message("AU staff-only group: only AU staff members can join this group");
if (elgg_is_logged_in()) {
$invited = check_entity_relationship($group->getGUID(), "invited", $user->getGUID());
//allow invited users in
if (is_au_staff_member($user) || elgg_is_admin_logged_in() || $group->canEdit() || $invited) {
//do other stuff - welcome here
} else {
//remove buttons for non staff members who are not members of the group and not invited
if (!$group->isMember($user)) {
elgg_register_plugin_hook_handler('register', 'menu:title', 'au_landing_remove_group_join_button', 9999);
//remove the link we added in groups_ux to allow joining from discussion forum
elgg_unextend_view('discussion/replies', 'discussion/replies/join');
}
}
}
} else {
//this is a normal group
}
} else {
//not a group, do nothing
}
}
示例6: register
/**
* Add some menu items to the entity menu
*
* @param string $hook "register"
* @param string $entity_type "menu:entity"
* @param ElggMenuItem[] $returnvalue the current menu items
* @param array $params supplied params
*
* @return ElggMenuItem[]
*/
public static function register($hook, $entity_type, $returnvalue, $params)
{
if (empty($params) || !is_array($params)) {
return $returnvalue;
}
$entity = elgg_extract("entity", $params);
if (empty($entity) || !elgg_instanceof($entity, "object", "blog")) {
return $returnvalue;
}
// only published blogs
if ($entity->status == "draft") {
return $returnvalue;
}
if (!elgg_in_context("widgets") && elgg_is_admin_logged_in()) {
$returnvalue[] = \ElggMenuItem::factory(array("name" => "blog-feature", "text" => elgg_echo("blog_tools:toggle:feature"), "href" => "action/blog_tools/toggle_metadata?guid=" . $entity->getGUID() . "&metadata=featured", "item_class" => empty($entity->featured) ? "" : "hidden", "is_action" => true, "priority" => 175));
$returnvalue[] = \ElggMenuItem::factory(array("name" => "blog-unfeature", "text" => elgg_echo("blog_tools:toggle:unfeature"), "href" => "action/blog_tools/toggle_metadata?guid=" . $entity->getGUID() . "&metadata=featured", "item_class" => empty($entity->featured) ? "hidden" : "", "is_action" => true, "priority" => 176));
}
if ($entity->canComment()) {
$returnvalue[] = \ElggMenuItem::factory(array("name" => "comments", "text" => elgg_view_icon("speech-bubble"), "title" => elgg_echo("comment:this"), "href" => $entity->getURL() . "#comments"));
$comment_count = $entity->countComments();
if ($comment_count) {
$returnvalue[] = \ElggMenuItem::factory(array("name" => "comments_count", "text" => $comment_count, "title" => elgg_echo("comments"), "href" => false));
}
}
return $returnvalue;
}
示例7: language_selector_get_allowed_translations
function language_selector_get_allowed_translations()
{
$configured_allowed = elgg_get_plugin_setting("allowed_languages", "language_selector");
if (empty($configured_allowed)) {
$allowed = array("en");
$installed_languages = get_installed_translations();
$min_completeness = (int) elgg_get_plugin_setting("min_completeness", "language_selector");
if ($min_completeness > 0) {
$update_completeness = false;
if (elgg_is_active_plugin("translation_editor")) {
if (elgg_is_admin_logged_in()) {
$update_completeness = true;
}
$completeness_function = "translation_editor_get_language_completeness";
} else {
$completeness_function = "get_language_completeness";
}
foreach ($installed_languages as $lang_id => $lang_description) {
if ($lang_id != "en") {
if (($completeness = $completeness_function($lang_id)) >= $min_completeness) {
$allowed[] = $lang_id;
}
}
}
}
elgg_set_plugin_setting("allowed_languages", implode(",", $allowed), "language_selector");
} else {
$allowed = string_to_tag_array($configured_allowed);
}
return $allowed;
}
示例8: delete
/**
* {@inheritdoc}
*/
public function delete(ParameterBag $params)
{
if (!elgg_is_admin_logged_in()) {
throw new GraphException("You are not permitted to delete river items", 403);
}
return elgg_delete_river(array('ids' => sanitize_int($params->id)));
}
示例9: zelev_template_init
function zelev_template_init()
{
// Extend system CSS with our own styles
//elgg_extend_view('page/elements/elgg','page/elements/header_logo');
//elgg_extend_view('page/elements/elgg','page/elements/sidebar');
//elgg_extend_view('css/elements/elgg','css/elements/layout');
elgg_unregister_menu_item('topbar', 'elgg_logo');
$logo_url = elgg_get_site_url() . "mod/zelev/zelev_files/logo.png";
elgg_register_menu_item('topbar', array('name' => 'my_logo', 'href' => '/', 'text' => "<img src=\"{$logo_url}\" alt=\"My logo\" width=\"275\" height=\"45\" />", 'priority' => 1, 'link_class' => 'elgg-topbar-logo'));
//
if (!elgg_is_admin_logged_in()) {
elgg_unregister_page_handler('activity');
}
// Replace the default index page
register_plugin_hook('index', 'system', 'zelev_index');
elgg_unregister_plugin_hook_handler('prepare', 'menu:site', 'elgg_site_menu_setup');
elgg_unregister_menu_item('site', 'file');
elgg_unregister_menu_item('site', 'bookmarks');
elgg_unregister_menu_item('site', 'reportedcontent');
elgg_unregister_menu_item('site', 'izap-contest');
elgg_unregister_menu_item('site', 'activity');
elgg_unregister_menu_item('site', 'groups');
$item_1 = new ElggMenuItem('homw', elgg_echo('Inicio'), '/');
elgg_register_menu_item('site', $item_1);
$user = elgg_get_logged_in_user_entity();
if ($user) {
$url = "groups/member/{$user->username}";
$item = new ElggMenuItem('groups:member', elgg_echo('groups:yours'), $url);
elgg_register_menu_item('site', $item);
}
}
示例10: upgrades
function upgrades()
{
if (elgg_is_admin_logged_in()) {
elgg_load_library(PLUGIN_ID . ':upgrades');
run_function_once(__NAMESPACE__ . '\\upgrade_20150321');
}
}
示例11: views_counter_pagesetup
/**
* Set some views_counter links on elgg system
*/
function views_counter_pagesetup()
{
if (elgg_is_admin_logged_in() && elgg_get_context() == 'admin' || elgg_get_context() == 'views_counter') {
$item = new ElggMenuItem('views_counter_admin', elgg_echo('views_counter:admin_page'), elgg_get_site_url() . 'views_counter/list_entities/user');
elgg_register_menu_item('page', $item);
}
}
示例12: aalborg_theme_pagesetup
function aalborg_theme_pagesetup()
{
elgg_unextend_view('page/elements/header', 'search/header');
if (elgg_is_logged_in()) {
elgg_extend_view('page/elements/sidebar', 'search/header', 0);
}
elgg_unregister_menu_item('topbar', 'dashboard');
if (elgg_is_active_plugin('dashboard')) {
elgg_register_menu_item('site', array('name' => 'dashboard', 'href' => 'dashboard', 'text' => elgg_echo('dashboard')));
}
if (elgg_is_logged_in()) {
$user = elgg_get_logged_in_user_entity();
elgg_register_menu_item('topbar', array('name' => 'account', 'text' => elgg_echo('account'), 'href' => "#", 'priority' => 100, 'section' => 'alt', 'link_class' => 'elgg-topbar-dropdown'));
elgg_unregister_menu_item('topbar', 'usersettings');
elgg_register_menu_item('topbar', array('name' => 'usersettings', 'parent_name' => 'account', 'href' => "/settings/user/{$user->username}", 'text' => elgg_echo('settings'), 'priority' => 103, 'section' => 'alt'));
elgg_unregister_menu_item('topbar', 'logout');
elgg_register_menu_item('topbar', array('name' => 'logout', 'parent_name' => 'account', 'href' => '/action/logout', 'is_action' => TRUE, 'text' => elgg_echo('logout'), 'priority' => 104, 'section' => 'alt'));
elgg_unregister_menu_item('topbar', 'administration');
if (elgg_is_admin_logged_in()) {
elgg_register_menu_item('topbar', array('name' => 'administration', 'parent_name' => 'account', 'href' => 'admin', 'text' => elgg_echo('admin'), 'priority' => 101, 'section' => 'alt'));
}
elgg_unregister_menu_item('footer', 'report_this');
if (elgg_is_active_plugin('reportedcontent')) {
$href = "javascript:elgg.forward('reportedcontent/add'";
$href .= "+'?address='+encodeURIComponent(location.href)";
$href .= "+'&title='+encodeURIComponent(document.title));";
elgg_register_menu_item('extras', array('name' => 'report_this', 'href' => $href, 'title' => elgg_echo('reportedcontent:this:tooltip'), 'text' => elgg_view_icon('report-this'), 'priority' => 500));
}
}
}
示例13: widget_manager_pagesetup
function widget_manager_pagesetup()
{
$context = elgg_get_context();
if (elgg_is_admin_logged_in() && $context == "admin") {
// move defaultwidgets menu item
elgg_unregister_menu_item("page", "appearance:default_widgets");
elgg_register_menu_item('page', array('name' => "appearance:default_widgets", 'href' => "admin/appearance/default_widgets", 'text' => elgg_echo("admin:appearance:default_widgets"), 'context' => 'admin', 'parent_name' => "widgets", 'section' => "configure"));
// add own menu items
elgg_register_admin_menu_item('configure', 'manage', 'widgets');
if (elgg_get_plugin_setting("custom_index", "widget_manager") == "1|0") {
// a special link to manage homepages that are only available if logged out
elgg_register_menu_item('page', array('name' => "admin:widgets:manage:index", 'href' => elgg_get_site_url() . "?override=true", 'text' => elgg_echo("admin:widgets:manage:index"), 'context' => 'admin', 'parent_name' => "widgets", 'section' => "configure"));
}
}
// update fixed widgets if needed
if (in_array($context, array("profile", "dashboard")) && ($page_owner_guid = elgg_get_page_owner_guid())) {
// only check things if you are viewing a profile or dashboard page
$fixed_ts = elgg_get_plugin_setting($context . "_fixed_ts", "widget_manager");
if (empty($fixed_ts)) {
// there should always be a fixed ts, so fix it now. This situation only occurs after activating widget_manager the first time.
$fixed_ts = time();
elgg_set_plugin_setting($context . "_fixed_ts", $fixed_ts, "widget_manager");
}
// get the ts of the profile/dashboard you are viewing
$user_fixed_ts = elgg_get_plugin_user_setting($context . "_fixed_ts", $page_owner_guid, "widget_manager");
if ($user_fixed_ts < $fixed_ts) {
widget_manager_update_fixed_widgets($context, $page_owner_guid);
}
}
if (widget_manager_multi_dashboard_enabled()) {
if (get_input("internal_dashboard") == "yes") {
elgg_set_view_location("page/default", dirname(__FILE__) . "/views_alt/");
}
}
}
示例14: ckeditor_addons_get_toolbar
/**
* Returns toolbar settings
*
* @param string $type User type 'admin'|'user'
* @return array
*/
function ckeditor_addons_get_toolbar($type = null)
{
$toolbar_config = elgg_get_plugin_setting('toolbar_config', 'ckeditor_addons');
if ($toolbar_config) {
$toolbar_config = unserialize($toolbar_config);
} else {
$toolbar_config = array();
}
if (!$type) {
$type = elgg_is_admin_logged_in() ? 'admin' : 'user';
}
$toolbar = elgg_extract($type, $toolbar_config, ckeditor_addons_get_toolbar_defaults());
$options = ckeditor_addons_get_toolbar_options();
foreach ($options as $group => $buttons) {
foreach ($buttons as $key => $button) {
if (!in_array($button, $toolbar)) {
unset($options[$group][$key]);
}
}
if (empty($options[$group])) {
unset($options[$group]);
} else {
$options[$group] = array_values($options[$group]);
}
}
return array_values($options);
}
示例15: profile_page_handler
/**
* Profile page handler
*
* @param array $page Array of URL segments passed by the page handling mechanism
* @return bool
*/
function profile_page_handler($page)
{
if (isset($page[0])) {
$username = $page[0];
$user = get_user_by_username($username);
elgg_set_page_owner_guid($user->guid);
} elseif (elgg_is_logged_in()) {
forward(elgg_get_logged_in_user_entity()->getURL());
}
// short circuit if invalid or banned username
if (!$user || $user->isBanned() && !elgg_is_admin_logged_in()) {
register_error(elgg_echo('profile:notfound'));
forward();
}
$action = NULL;
if (isset($page[1])) {
$action = $page[1];
}
if ($action == 'edit') {
// use the core profile edit page
$base_dir = elgg_get_root_path();
require "{$base_dir}pages/profile/edit.php";
return true;
}
$content = elgg_view('profile/layout', array('entity' => $user));
$body = elgg_view_layout('one_column', array('content' => $content));
echo elgg_view_page($user->name, $body);
return true;
}