本文整理汇总了PHP中elgg_set_page_owner_guid函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_set_page_owner_guid函数的具体用法?PHP elgg_set_page_owner_guid怎么用?PHP elgg_set_page_owner_guid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_set_page_owner_guid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: monashees_profile_page_handler
function monashees_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;
}
// main profile page
/*$params = array (
'content' => elgg_view ( 'profile/wrapper' ),
'num_columns' => 3
);*/
//$content = elgg_view_layout ( 'widgets', $params );
$body = elgg_view_layout('two_sidebar', array('content' => elgg_view('profile/wrapper') . "" . elgg_view("profile/owner_block") . "" . elgg_view("profile/homeposts"), 'username' => $username));
echo elgg_view_page($user->name, $body);
return true;
}
示例2: news_get_page_content_archive
/**
* Get page components to show news with publish dates between $lower and $upper
*
* @param int $owner_guid The GUID of the owner of this page
* @param int $lower Unix timestamp
* @param int $upper Unix timestamp
* @return array
*/
function news_get_page_content_archive($owner_guid, $lower = 0, $upper = 0)
{
$owner = get_entity($owner_guid);
elgg_set_page_owner_guid($owner_guid);
$crumbs_title = $owner->name;
if (elgg_instanceof($owner, 'user')) {
$url = "news/owner/{$owner->username}";
} else {
$url = "news/group/{$owner->guid}/all";
}
elgg_push_breadcrumb($crumbs_title, $url);
elgg_push_breadcrumb(elgg_echo('news:archives'));
if ($lower) {
$lower = (int) $lower;
}
if ($upper) {
$upper = (int) $upper;
}
$options = array('type' => 'object', 'subtype' => 'news', 'full_view' => false, 'no_results' => elgg_echo('news:none'), 'preload_owners' => true, 'distinct' => false);
if ($owner instanceof ElggGroup) {
$options['container_guid'] = $owner_guid;
} elseif ($owner instanceof ElggUser) {
$options['owner_guid'] = $owner_guid;
}
if ($lower) {
$options['created_time_lower'] = $lower;
}
if ($upper) {
$options['created_time_upper'] = $upper;
}
$content = elgg_list_entities($options);
$title = elgg_echo('date:month:' . date('m', $lower), array(date('Y', $lower)));
return array('content' => $content, 'title' => $title, 'filter' => '');
}
示例3: setup
/**
* {@inheritdoc}
*/
public function setup()
{
parent::setup();
$this->post = get_entity($this->guid);
$this->poster = elgg_get_logged_in_user_entity();
// GUIDs of friends that were tagged in the post
if (!is_array($this->friend_guids)) {
$this->friend_guids = string_to_tag_array((string) $this->friend_guids);
}
if (!is_array($this->attachment_guids)) {
$this->attachment_guids = string_to_tag_array((string) $this->attachment_guids);
}
if (!is_array($this->upload_guids)) {
$this->upload_guids = array();
}
$this->subtype = Post::SUBTYPE;
$this->container = $this->poster;
if ($this->container_guid) {
$container = get_entity($this->container_guid);
if ($container) {
$this->container = $container;
}
if ($this->container->guid != $this->poster->guid) {
$this->subtype = hypeWall()->config->getPostSubtype();
}
}
// For underlying views to know who the container is
elgg_set_page_owner_guid($this->container->guid);
}
示例4: page_handler
/**
* Serve pages. URLs in the form:
*
* pg/block_users/blocked_users/<username> - Users blocked by <username>. If not set, defaults to logged in.
* pg/block_users/blocked - The page to display when a user is blocked.
*
* @param array $page
* @return bool Depending on success
*/
function page_handler($page)
{
gatekeeper();
if (!isset($page[0])) {
$page[0] = 'blocked_users';
}
switch ($page[0]) {
case 'blocked_user_content':
$site = elgg_get_site_entity();
elgg_set_page_owner_guid($site->guid);
include dirname(__FILE__) . '/pages/block_users/blocked_user_content.php';
break;
case 'blocked_content':
$site = elgg_get_site_entity();
elgg_set_page_owner_guid($site->guid);
include dirname(__FILE__) . '/pages/block_users/blocked_content.php';
break;
default:
case 'blocked_users':
$logged_in_user = elgg_get_logged_in_user_entity();
if (!isset($page[1])) {
$page[1] = $logged_in_user->username;
}
set_input('blocking_username', $page[1]);
// only admins can see another user's block list
if ($page[1] != $logged_in_user->username) {
admin_gatekeeper();
}
include dirname(__FILE__) . '/pages/block_users/blocked_users.php';
}
return true;
}
示例5: testWriteAccessArray
/**
* https://github.com/Elgg/Elgg/pull/6393
* Hook handlers for 'access:collections:write','all' hook should respect
* group's content access mode and container write permissions
*/
public function testWriteAccessArray()
{
$membersonly = ElggGroup::CONTENT_ACCESS_MODE_MEMBERS_ONLY;
$unrestricted = ElggGroup::CONTENT_ACCESS_MODE_UNRESTRICTED;
$original_page_owner = elgg_get_page_owner_entity();
elgg_set_page_owner_guid($this->group->guid);
$ia = elgg_set_ignore_access(false);
// User is not a member of the group
// Member-only group
$this->group->setContentAccessMode($membersonly);
$write_access = get_write_access_array($this->user->guid, true);
$this->assertFalse(array_key_exists($this->group->group_acl, $write_access));
// Unrestricted group
$this->group->setContentAccessMode($unrestricted);
$write_access = get_write_access_array($this->user->guid, true);
$this->assertFalse(array_key_exists($this->group->group_acl, $write_access));
// User is a member (can write to container)
$this->group->join($this->user);
// Member-only group
$this->group->setContentAccessMode($membersonly);
$write_access = get_write_access_array($this->user->guid, true);
$this->assertTrue(array_key_exists($this->group->group_acl, $write_access));
// Unrestricted group
$this->group->setContentAccessMode($unrestricted);
$write_access = get_write_access_array($this->user->guid, true);
$this->assertTrue(array_key_exists($this->group->group_acl, $write_access));
elgg_set_ignore_access($ia);
$this->group->leave($this->user);
$original_page_owner_guid = elgg_instanceof($original_page_owner) ? $original_page_owner->guid : 0;
elgg_set_page_owner_guid($original_page_owner_guid);
}
示例6: profile_page_handler
/**
* Profile page handler
*
* @param array $page Array of page elements, forwarded by the page handling mechanism
*/
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);
}
// 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;
}
// main profile page
$params = array('content' => elgg_view('profile/wrapper'), 'num_columns' => 3);
$content = elgg_view_layout('widgets', $params);
$body = elgg_view_layout('one_column', array('content' => $content));
echo elgg_view_page($title, $body);
}
示例7: fileTools
/**
* Handle /file_tools URLs
*
* @param array $page URL segments
*
* @return bool
*/
public static function fileTools($page)
{
switch (elgg_extract(0, $page)) {
case 'list':
elgg_ajax_gatekeeper();
$params = [];
elgg_set_page_owner_guid(elgg_extract(1, $page));
$folder_guid = get_input('folder_guid', false);
if ($folder_guid !== false) {
$params['folder_guid'] = (int) $folder_guid;
$params['draw_page'] = false;
}
if (isset($page[2])) {
$params['folder_guid'] = (int) $page[2];
}
echo elgg_view_resource('file_tools/file/list', $params);
return true;
break;
case 'folder':
switch (elgg_extract(1, $page)) {
case 'new':
elgg_set_page_owner_guid(elgg_extract(2, $page));
echo elgg_view_resource('file_tools/folder/new');
return true;
break;
case 'edit':
$params = ['folder_guid' => (int) elgg_extract(2, $page)];
echo elgg_view_resource('file_tools/folder/edit', $params);
return true;
break;
}
break;
}
return false;
}
示例8: stripe_page_handler
/**
* Stripe related pages
*
* @param array $page
* @param string $handler
* @return boolean
*/
function stripe_page_handler($page, $handler)
{
gatekeeper();
$username = elgg_extract(0, $page, false);
if ($username) {
$user = get_user_by_username($username);
}
if (!elgg_instanceof($user) || !$user->canEdit()) {
$user = elgg_get_logged_in_user_entity();
forward("{$handler}/{$user->username}");
}
elgg_set_context('settings');
elgg_set_page_owner_guid($user->guid);
elgg_push_breadcrumb(elgg_echo('stripe:billing'), 'billing');
$context = elgg_extract(1, $page, 'cards');
$action = elgg_extract(2, $page, 'all');
$view = "stripe/pages/{$context}/{$action}";
if (elgg_view_exists($view)) {
$params = array('entity' => $user, 'id' => elgg_extract(3, $page, false), 'context' => $page);
$title = elgg_echo("stripe:{$context}:{$action}");
$content = elgg_view($view, $params);
$sidebar = elgg_view('stripe/sidebar', $params);
$filter = elgg_view("stripe/filters/{$context}/{$action}", $params);
}
if ($content) {
if (elgg_is_xhr()) {
echo $content;
} else {
$layout = elgg_view_layout('content', array('title' => $title, 'content' => $content, 'sidebar' => $sidebar, 'filter' => $filter));
echo elgg_view_page($title, $layout);
}
return true;
}
return false;
}
示例9: 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;
}
示例10: user_settings_page_handler
/**
* User settings page handler
*
* @param array $segments URL segments
* @return bool
*/
function user_settings_page_handler($segments)
{
elgg_gatekeeper();
$page = array_shift($segments);
$username = array_shift($segments);
if (!$page) {
$page = 'user';
}
if (!$username) {
$user = elgg_get_logged_in_user_entity();
} else {
$user = get_user_by_username($username);
}
if (!$user) {
forward('', '404');
}
if (!$user->canEdit()) {
forward('', '403');
}
elgg_set_page_owner_guid($user->guid);
$resource = elgg_view_resource("settings/{$page}", array('username' => $user->username, 'entity' => $user, 'segments' => $segments));
if ($resource) {
echo $resource;
return true;
}
return false;
}
示例11: customstyle_page_handler
function customstyle_page_handler($page)
{
gatekeeper();
elgg_set_context('customstyle');
elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
$title = elgg_echo('customstyle');
$base_dir = elgg_get_plugins_path() . 'customstyle/pages/customstyle';
switch ($page[0]) {
case 'colors':
$body = elgg_view('customstyle/colors');
break;
case 'background':
$body = elgg_view('customstyle/background');
break;
case 'personalize':
$body = elgg_view('customstyle/default');
break;
default:
$body = elgg_view('customstyle/default');
break;
}
$params = array('content' => $body, 'title' => $title);
$body = elgg_view_layout('one_sidebar', $params);
echo elgg_view_page($title, $body);
return true;
}
示例12: 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
echo elgg_view_resource('profile/edit');
return true;
}
echo elgg_view_resource('profile/view', ['username' => $page[0]]);
return true;
}
示例13: au_subgroups_pagehandler
function au_subgroups_pagehandler($page)
{
// dirty check to avoid duplicate page handlers
// since this should only be called from the route, groups hook
if (strpos(current_page_url(), elgg_get_site_url() . 'au_subgroups') === 0) {
return false;
}
switch ($page[0]) {
case 'add':
set_input('au_subgroup', true);
set_input('au_subgroup_parent_guid', $page[1]);
elgg_set_page_owner_guid($page[1]);
echo elgg_view('resources/au_subgroups/add');
return true;
break;
case 'list':
elgg_set_page_owner_guid($page[1]);
echo elgg_view('resources/au_subgroups/list');
break;
case 'delete':
elgg_set_page_owner_guid($page[1]);
echo elgg_view('resources/au_subgroups/delete');
break;
case 'openclosed':
set_input('filter', $page[1]);
echo elgg_view('resources/au_subgroups/openclosed');
return true;
break;
}
return false;
}
示例14: haarlem_tangram_page_handler
/**
* The page handler vor vacaturebank
*
* @param array $page url segments
*
* @return bool
*/
function haarlem_tangram_page_handler($page)
{
$include_file = false;
$pages_root = dirname(dirname(__FILE__)) . '/pages/';
$page_owner_guid = haarlem_tangram_get_page_owner_guid();
if (!empty($page_owner_guid)) {
elgg_set_page_owner_guid($page_owner_guid);
}
switch ($page[0]) {
case 'all':
$include_file = "{$pages_root}all.php";
break;
case 'view':
set_input('vacaturenummer', $page[1]);
$include_file = "{$pages_root}view.php";
break;
default:
forward('vacaturebank/all');
break;
}
if (!empty($include_file)) {
include $include_file;
return true;
}
return false;
}
示例15: file_tools_page_handler
function file_tools_page_handler($page)
{
$include_file = false;
switch ($page[0]) {
case "list":
if (elgg_is_xhr() && !empty($page[1])) {
elgg_set_page_owner_guid($page[1]);
if (get_input("folder_guid", false) !== false) {
set_input("draw_page", false);
}
if (isset($page[2])) {
set_input("folder_guid", $page[2]);
}
$include_file = dirname(dirname(__FILE__)) . "/pages/list.php";
}
break;
case "folder":
if ($page[1] == 'new') {
if (!empty($page[2])) {
elgg_set_page_owner_guid($page[2]);
}
$include_file = dirname(dirname(__FILE__)) . "/pages/folder/new.php";
} elseif ($page[1] == 'edit') {
if (!empty($page[2])) {
set_input("folder_guid", $page[2]);
$include_file = dirname(dirname(__FILE__)) . "/pages/folder/edit.php";
}
}
break;
case "file":
if ($page[1] == 'new') {
if (!empty($page[2])) {
elgg_set_page_owner_guid($page[2]);
}
$include_file = dirname(dirname(__FILE__)) . "/pages/file/new.php";
} elseif ($page[1] == 'edit') {
set_input("guid", $page[2]);
$include_file = dirname(dirname(__FILE__)) . "/pages/file/edit.php";
} elseif ($page[1] == 'download') {
$include_file = dirname(dirname(__FILE__)) . "/pages/file/download.php";
}
break;
case "proc":
if (file_exists(dirname(dirname(__FILE__)) . "/procedures/" . $page[1] . "/" . $page[2] . ".php")) {
$include_file = dirname(dirname(__FILE__)) . "/procedures/" . $page[1] . "/" . $page[2] . ".php";
} else {
echo json_encode(array('valid' => 0));
exit;
}
break;
}
if (!empty($include_file)) {
include $include_file;
return true;
} else {
forward("file/all");
}
}