当前位置: 首页>>代码示例>>PHP>>正文


PHP elgg_entity_gatekeeper函数代码示例

本文整理汇总了PHP中elgg_entity_gatekeeper函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_entity_gatekeeper函数的具体用法?PHP elgg_entity_gatekeeper怎么用?PHP elgg_entity_gatekeeper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了elgg_entity_gatekeeper函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: blog_get_page_content_read

/**
 * Get page components to view a blog post.
 *
 * @param int $guid GUID of a blog entity.
 * @return array
 */
function blog_get_page_content_read($guid = NULL)
{
    $return = array();
    elgg_entity_gatekeeper($guid, 'object', 'blog');
    $blog = get_entity($guid);
    // no header or tabs for viewing an individual blog
    $return['filter'] = '';
    elgg_set_page_owner_guid($blog->container_guid);
    elgg_group_gatekeeper();
    $return['title'] = $blog->title;
    $container = $blog->getContainerEntity();
    $crumbs_title = $container->name;
    if (elgg_instanceof($container, 'group')) {
        elgg_push_breadcrumb($crumbs_title, "blog/group/{$container->guid}/all");
    } else {
        elgg_push_breadcrumb($crumbs_title, "blog/owner/{$container->username}");
    }
    elgg_push_breadcrumb($blog->title);
    $return['content'] = elgg_view_entity($blog, array('full_view' => true));
    // check to see if we should allow comments
    if ($blog->comments_on != 'Off' && $blog->status == 'published') {
        $return['content'] .= elgg_view_comments($blog);
    }
    return $return;
}
开发者ID:gzachos,项目名称:elgg_ellak,代码行数:31,代码来源:blog.php

示例2: get_input

<?php

$guid = (int) get_input('guid');
elgg_entity_gatekeeper($guid, 'object', \ColdTrick\EventManager\Event\Day::SUBTYPE);
$entity = get_entity($guid);
$title = $entity->title;
if (!$entity->delete()) {
    register_error(elgg_echo('entity:delete:fail', [$title]));
}
开发者ID:coldtrick,项目名称:event_manager,代码行数:9,代码来源:delete.php

示例3: get_input

<?php

$guid = (int) get_input('guid');
elgg_entity_gatekeeper($guid, 'object', \Wizard::SUBTYPE);
$entity = get_entity($guid);
$new_entity = clone $entity;
$new_entity->save();
foreach ($entity->getSteps() as $step) {
    $new_step = clone $step;
    $new_step->container_guid = $new_entity->guid;
    $new_step->save();
}
forward('admin/administer_utilities/wizard');
开发者ID:coldtrick,项目名称:wizard,代码行数:13,代码来源:copy.php

示例4: get_input

<?php

$guid = get_input('guid');
elgg_entity_gatekeeper($guid, 'group');
$group = get_entity($guid);
elgg_set_page_owner_guid($guid);
elgg_group_gatekeeper();
$title = elgg_echo('groups:members:title', array($group->name));
elgg_push_breadcrumb($group->name, $group->getURL());
elgg_push_breadcrumb(elgg_echo('groups:members'));
$db_prefix = elgg_get_config('dbprefix');
$content = elgg_list_entities_from_relationship(array('relationship' => 'member', 'relationship_guid' => $group->guid, 'inverse_relationship' => true, 'type' => 'user', 'limit' => (int) get_input('limit', max(20, elgg_get_config('default_limit')), false), 'joins' => array("JOIN {$db_prefix}users_entity u ON e.guid=u.guid"), 'order_by' => 'u.name ASC'));
$params = array('content' => $content, 'title' => $title, 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
开发者ID:elgg,项目名称:groups,代码行数:15,代码来源:members.php

示例5: get_input

<?php

/**
 * View a bookmark
 *
 * @package ElggBookmarks
 */
$guid = get_input('guid');
elgg_entity_gatekeeper($guid, 'object', 'bookmarks');
$bookmark = get_entity($guid);
$page_owner = elgg_get_page_owner_entity();
elgg_group_gatekeeper();
$crumbs_title = $page_owner->name;
if (elgg_instanceof($page_owner, 'group')) {
    elgg_push_breadcrumb($crumbs_title, "bookmarks/group/{$page_owner->guid}/all");
} else {
    elgg_push_breadcrumb($crumbs_title, "bookmarks/owner/{$page_owner->username}");
}
$title = $bookmark->title;
elgg_push_breadcrumb($title);
$content = elgg_view_entity($bookmark, array('full_view' => true));
$content .= elgg_view_comments($bookmark);
$body = elgg_view_layout('content', array('content' => $content, 'title' => $title, 'filter' => ''));
echo elgg_view_page($title, $body);
开发者ID:ibou77,项目名称:elgg,代码行数:24,代码来源:view.php

示例6: get_input

<?php

/**
 * Quickly open/close a discussion
 */
$guid = (int) get_input('guid');
if (empty($guid)) {
    register_error(elgg_echo('error:missing_data'));
    forward(REFERER);
}
elgg_entity_gatekeeper($guid, 'object', 'discussion');
$entity = get_entity($guid);
if (!$entity->canEdit()) {
    register_error(elgg_echo('actionunauthorized'));
    forward(REFERER);
}
if ($entity->status === 'closed') {
    $entity->status = 'open';
    system_message(elgg_echo('discussions_tools:action:discussions:toggle_status:success:open'));
} else {
    $entity->status = 'closed';
    system_message(elgg_echo('discussions_tools:action:discussions:toggle_status:success:close'));
}
forward(REFERER);
开发者ID:coldtrick,项目名称:discussions_tools,代码行数:24,代码来源:toggle_status.php

示例7: elgg_extract

<?php

/**
 * View a question
 *
 * @package ElggQuestions
 */
$guid = (int) elgg_extract('guid', $vars);
elgg_entity_gatekeeper($guid, 'object', 'question');
$question = get_entity($guid);
// set page owner
$page_owner = $question->getContainerEntity();
// set breadcrumb
$crumbs_title = $page_owner->name;
if ($page_owner instanceof ElggGroup) {
    elgg_push_breadcrumb($crumbs_title, "questions/group/{$page_owner->guid}");
} else {
    elgg_push_breadcrumb($crumbs_title, "questions/owner/{$page_owner->username}");
}
$title = $question->title;
elgg_push_breadcrumb($title);
// build page elements
$title_icon = '';
$content = elgg_view_entity($question, ['full_view' => true]);
$answers = '';
// add the answer marked as the correct answer first
$marked_answer = $question->getMarkedAnswer();
if (!empty($marked_answer)) {
    $answers .= elgg_view_entity($marked_answer);
}
// add the rest of the answers
开发者ID:coldtrick,项目名称:questions,代码行数:31,代码来源:view.php

示例8: elgg_gatekeeper

<?php

/**
 * Edit an existing newsletter
 *
 * @uses get_input("guid") the guid of the newsletter to edit
 */
elgg_gatekeeper();
elgg_require_js('newsletter/edit');
$guid = (int) get_input('guid');
$subpage = get_input('subpage');
// validate input
elgg_entity_gatekeeper($guid, 'object', Newsletter::SUBTYPE);
$entity = get_entity($guid);
if (!$entity->canEdit()) {
    register_error(elgg_echo('limited_access'));
    forward(REFERER);
}
// set page owner
$container = $entity->getContainerEntity();
if (elgg_instanceof($container, 'group')) {
    elgg_set_page_owner_guid($entity->getContainerGUID());
} else {
    elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
}
// breadcrumb
elgg_push_breadcrumb(elgg_echo('newsletter:breadcrumb:site'), 'newsletter/site');
if (elgg_instanceof($container, 'group')) {
    elgg_push_breadcrumb($container->name, 'newsletter/group/' . $container->getGUID());
}
elgg_push_breadcrumb($entity->title, $entity->getURL());
开发者ID:coldtrick,项目名称:newsletter,代码行数:31,代码来源:edit.php

示例9: elgg_gatekeeper

<?php

/**
* Read a message page
*
* @package ElggMessages
*/
elgg_gatekeeper();
$guid = get_input('guid');
elgg_entity_gatekeeper($guid, 'object', 'messages');
$message = get_entity($guid);
$from_user = get_user($message->fromId);
$to_user = get_user($message->toId);
// mark the message as read
$message->readYet = true;
elgg_set_page_owner_guid($message->getOwnerGUID());
$page_owner = elgg_get_page_owner_entity();
$title = htmlspecialchars($message->title, ENT_QUOTES, 'UTF-8');
$inbox = false;
if ($page_owner->getGUID() == $message->toId) {
    $inbox = true;
    elgg_push_breadcrumb(elgg_echo('messages:inbox'), 'messages/inbox/' . $page_owner->username);
} else {
    elgg_push_breadcrumb(elgg_echo('messages:sent'), 'messages/sent/' . $page_owner->username);
}
elgg_push_breadcrumb($title);
$from_user->name = utf8_encode($from_user->name);
$to_user->name = utf8_encode($to_user->name);
$message->title = utf8_encode($message->title);
$content = elgg_view_entity($message, array('full_view' => true));
if ($inbox) {
开发者ID:smellems,项目名称:wet4,代码行数:31,代码来源:read.php

示例10: get_input

<?php

$guid = (int) get_input('guid');
$user = (int) get_input('user');
// could also be a registration object
elgg_entity_gatekeeper($guid, 'object', Event::SUBTYPE);
$event = get_entity($guid);
elgg_entity_gatekeeper($user);
$object = get_entity($user);
if (!$event->canEdit()) {
    register_error(elgg_echo('actionunauthorized'));
    forward(REFERER);
}
event_manager_send_registration_validation_email($event, $object);
system_message(elgg_echo('event_manager:action:resend_confirmation:success'));
forward(REFERER);
开发者ID:coldtrick,项目名称:event_manager,代码行数:16,代码来源:resend_confirmation.php

示例11: get_input

<?php

/**
 * View individual wire post
 */
$guid = get_input('guid');
elgg_entity_gatekeeper($guid, 'object', 'thewire');
$post = get_entity($guid);
$owner = $post->getOwnerEntity();
if (!$owner) {
    forward();
}
$title = elgg_echo('thewire:by', array($owner->name));
elgg_push_breadcrumb(elgg_echo('thewire'), 'thewire/all');
elgg_push_breadcrumb($owner->name, 'thewire/owner/' . $owner->username);
elgg_push_breadcrumb($title);
$content = elgg_view_entity($post);
$body = elgg_view_layout('content', array('filter' => false, 'content' => $content, 'title' => $title));
echo elgg_view_page($title, $body);
开发者ID:ibou77,项目名称:elgg,代码行数:19,代码来源:view.php

示例12: elgg_gatekeeper

<?php

elgg_gatekeeper();
$folder_guid = get_input("folder_guid");
elgg_entity_gatekeeper($folder_guid, "object", FILE_TOOLS_SUBTYPE);
$folder = get_entity($folder_guid);
if (!$folder->canEdit()) {
    register_error(elgg_echo("limited_access"));
    forward(REFERER);
}
// set context and page_owner
elgg_set_context("file");
elgg_set_page_owner_guid($folder->getContainerGUID());
// build page elements
$title_text = elgg_echo("file_tools:edit:title");
$form_vars = array("id" => "file_tools_edit_form");
$body_vars = array("folder" => $folder, "page_owner_entity" => elgg_get_page_owner_entity());
$edit = elgg_view_form("file_tools/folder/edit", $form_vars, $body_vars);
// build page
$body = elgg_view_layout("one_sidebar", array("title" => $title_text, "content" => $edit));
echo elgg_view_page($title_text, $body);
开发者ID:lorea,项目名称:Hydra-dev,代码行数:21,代码来源:edit.php

示例13: elgg_admin_gatekeeper

<?php

elgg_admin_gatekeeper();
$guid = (int) elgg_extract('guid', $vars);
elgg_entity_gatekeeper($guid, 'object', WizardStep::SUBTYPE);
/* @var $entity WizardStep */
$entity = get_entity($guid);
/* @var $container Wizard */
$container = $entity->getContainerEntity();
$title = elgg_echo('wizard:step:edit:title', [$entity->getDisplayName(), $container->title]);
$form = elgg_view_form('wizard_step/edit', [], ['entity' => $entity]);
if (elgg_is_xhr()) {
    echo elgg_view_module('inline', $title, $form);
} else {
    $page_data = elgg_view_layout('content', ['title' => $title, 'content' => $form, 'filter' => '']);
    echo elgg_view_page($title, $page_data);
}
开发者ID:coldtrick,项目名称:wizard,代码行数:17,代码来源:edit.php

示例14: get_input

<?php

$guid = (int) get_input('guid');
$post = $_POST;
$registrationFields = [];
elgg_entity_gatekeeper($guid, 'object', EventRegistration::SUBTYPE);
$registration = get_entity($guid);
foreach ($post as $key => $value) {
    if (substr($key, 0, 8) !== 'question') {
        continue;
    }
    $questionId = substr($key, 8, strlen($key));
    $registrationFields[] = $questionId . '|' . $value;
}
$event = $registration->getEntitiesFromRelationship(['relationship' => 'event_user_registered', 'inverse_relationship' => true]);
$registration->clearAnnotations('answer');
foreach ($registrationFields as $answer) {
    $registration->annotate('answer', $answer, $event[0]->access_id);
}
system_message(elgg_echo('event_manager:action:event:edit:ok'));
forward($event[0]->getURL());
开发者ID:coldtrick,项目名称:event_manager,代码行数:21,代码来源:edit.php

示例15: elgg_gatekeeper

elgg_gatekeeper();
$guid = (int) elgg_extract('guid', $vars);
$body_vars = [];
$sidebar = '';
$page_owner = elgg_get_page_owner_entity();
$site = elgg_get_site_entity();
if (!$page_owner instanceof ElggGroup) {
    elgg_set_page_owner_guid($site->getGUID());
    $page_owner = $site;
}
$body_vars['owner'] = $page_owner;
elgg_push_breadcrumb(elgg_echo('static:all'), 'static/all');
$ia = elgg_set_ignore_access(true);
if ($guid) {
    elgg_entity_gatekeeper($guid, 'object', 'static');
    $entity = get_entity($guid);
    if (!$entity->canEdit()) {
        elgg_set_ignore_access($ia);
        forward(REFERER);
    }
    $body_vars['entity'] = $entity;
    elgg_set_page_owner_guid($entity->getOwnerGUID());
    $page_owner = elgg_get_page_owner_entity();
    $body_vars['owner'] = $page_owner;
    $sidebar = elgg_view('static/sidebar/revisions', ['entity' => $entity]);
}
if ($page_owner instanceof ElggGroup) {
    elgg_push_breadcrumb(elgg_echo('static:groups:title'), "static/group/{$page_owner->getGUID()}");
}
if (!empty($entity)) {
开发者ID:coldtrick,项目名称:static,代码行数:30,代码来源:edit.php


注:本文中的elgg_entity_gatekeeper函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。