本文整理汇总了PHP中elgg_view_resource函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_view_resource函数的具体用法?PHP elgg_view_resource怎么用?PHP elgg_view_resource使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_view_resource函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: twitter_api_pagehandler
/**
* Serves pages for twitter.
*
* @param array $page
* @return bool
*/
function twitter_api_pagehandler($page)
{
if (!isset($page[0])) {
return false;
}
switch ($page[0]) {
case 'authorize':
twitter_api_authorize();
break;
case 'revoke':
twitter_api_revoke();
break;
case 'forward':
twitter_api_forward();
break;
case 'login':
twitter_api_login();
break;
case 'interstitial':
elgg_gatekeeper();
// only let twitter users do this.
$guid = elgg_get_logged_in_user_guid();
$twitter_name = elgg_get_plugin_user_setting('twitter_name', $guid, 'twitter_api');
if (!$twitter_name) {
register_error(elgg_echo('twitter_api:invalid_page'));
forward();
}
echo elgg_view_resource('twitter_api/interstitial');
break;
default:
return false;
}
return true;
}
示例2: 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;
}
示例3: messageboard_page_handler
/**
* Messageboard dispatcher for flat message board.
* Profile (and eventually group) widgets handle their own.
*
* URLs take the form of
* User's messageboard: messageboard/owner/<username>
* Y's history of posts on X's board: messageboard/owner/<X>/history/<Y>
* New post: messageboard/add/<guid> (container: user or group)
* Group messageboard: messageboard/group/<guid>/all (not implemented)
*
* @param array $page Array of page elements
* @return bool
*/
function messageboard_page_handler($page)
{
$vars = [];
switch ($page[0]) {
case 'owner':
//@todo if they have the widget disabled, don't allow this.
$owner_name = elgg_extract(1, $page);
$owner = get_user_by_username($owner_name);
$vars['page_owner_guid'] = $owner->guid;
$history = elgg_extract(2, $page);
$username = elgg_extract(3, $page);
if ($history && $username) {
$vars['history_username'] = $username;
}
echo elgg_view_resource('messageboard/owner', $vars);
break;
case 'group':
elgg_group_gatekeeper();
$owner_guid = elgg_extract(1, $page);
$vars['page_owner_guid'] = $owner_guid;
echo elgg_view_resource('messageboard/owner', $vars);
break;
default:
return false;
}
return true;
}
示例4: notifications_page_handler
/**
* Route page requests
*
* @param array $page Array of url parameters
* @return bool
*/
function notifications_page_handler($page)
{
elgg_gatekeeper();
$current_user = elgg_get_logged_in_user_entity();
// default to personal notifications
if (!isset($page[0])) {
$page[0] = 'personal';
}
if (!isset($page[1])) {
forward("notifications/{$page[0]}/{$current_user->username}");
}
set_input('username', $page[1]);
// note: $user passed in
switch ($page[0]) {
case 'group':
echo elgg_view_resource('notifications/groups');
break;
case 'personal':
echo elgg_view_resource('notifications/index');
break;
default:
return false;
}
return true;
}
示例5: messageboard_page_handler
/**
* Messageboard dispatcher for flat message board.
* Profile (and eventually group) widgets handle their own.
*
* URLs take the form of
* User's messageboard: messageboard/owner/<username>
* Y's history of posts on X's board: messageboard/owner/<X>/history/<Y>
* New post: messageboard/add/<guid> (container: user or group)
* Group messageboard: messageboard/group/<guid>/all (not implemented)
*
* @param array $page Array of page elements
* @return bool
*/
function messageboard_page_handler($page)
{
switch ($page[0]) {
case 'owner':
//@todo if they have the widget disabled, don't allow this.
$owner_name = elgg_extract(1, $page);
$owner = get_user_by_username($owner_name);
set_input('page_owner_guid', $owner->guid);
$history = elgg_extract(2, $page);
$username = elgg_extract(3, $page);
if ($history && $username) {
set_input('history_username', $username);
}
echo elgg_view_resource('messageboard/owner');
break;
case 'add':
$container_guid = elgg_extract(1, $page);
set_input('container_guid', $container_guid);
echo elgg_view_resource('messageboard/add');
break;
case 'group':
elgg_group_gatekeeper();
$owner_guid = elgg_extract(1, $page);
set_input('page_owner_guid', $owner_guid);
echo elgg_view_resource('messageboard/owner');
break;
default:
return false;
}
return true;
}
示例6: 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;
}
示例7: blog
/**
* Listen to the blog page handler, to takeover some pages
*
* @param string $hook 'route'
* @param string $type 'blog'
* @param array $return_value the current page_handler params
* @param null $params null
*
* @return void|false
*/
public static function blog($hook, $type, $return_value, $params)
{
$page = elgg_extract('segments', $return_value);
if (empty($page)) {
return;
}
$include_file = false;
$resouce_loaded = false;
$pages_path = elgg_get_plugins_path() . 'blog_tools/pages/';
switch ($page[0]) {
case 'read':
// Elgg 1.7 compatibility
// Elgg 1.7 compatibility
case 'view':
set_input('guid', $page[1]);
// to be used in the blog_tools/full/related view
break;
case 'featured':
$resouce_loaded = true;
echo elgg_view_resource('blog_tools/blog/featured');
break;
}
if (!empty($resouce_loaded)) {
return false;
} elseif (!empty($include_file)) {
include $include_file;
return false;
}
}
示例8: 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;
}
示例9: notifications_editor_router
/**
* Route editor pages
*
* @param string $hook "route"
* @param string $type "notifications"
* @param array $return Segments and identifier
* @param array $params Hook params
* @return array|false
*/
function notifications_editor_router($hook, $type, $return, $params)
{
$identifier = elgg_extract('identifier', $return);
$segments = elgg_extract('segments', $return);
if ($identifier == 'notifications' && $segments[0] == 'editor') {
echo elgg_view_resource('notifications/editor', $return);
return false;
}
}
示例10: seo_page_handler
/**
* SEO page handler
* /seo/edit
*
* @param array $segments URL segments
* @return bool
*/
function seo_page_handler($segments)
{
$page = array_shift($segments);
switch ($page) {
case 'edit':
echo elgg_view_resource('seo/edit');
return true;
}
return false;
}
示例11: page_handler
function page_handler(array $segments, $base)
{
switch ($segments[0]) {
case 'hello':
echo elgg_view_resource('react/hello');
return true;
default:
return false;
}
}
示例12: target_blank_init
/**
* Inits the plugin
*
* @return void
*/
function target_blank_init()
{
elgg_require_js('target_blank/target_blank');
// this cached view uses PHP to provide settings from database to javascript
elgg_register_simplecache_view('js/target_blank/settings.js');
elgg_register_action('target_blank/settings/save', dirname(__FILE__) . '/actions/settings/save.php', 'admin');
elgg_register_page_handler('target_blank', function () {
echo elgg_view_resource('target_blank/test');
});
}
示例13: entity_tools_page_handler
/**
* Entity tools page handler
*
* @param array $page url parts
*
* @return true|void
*/
function entity_tools_page_handler($page)
{
$supported = array_keys(entity_tools_get_supported_entity_types());
$subtype = elgg_extract(2, $page, $supported[0]);
switch ($page[0]) {
case 'owner':
case 'group':
echo elgg_view_resource('entity_tools/list', ['subtype' => $subtype]);
return true;
}
}
示例14: reportedcontent_page_handler
/**
* Reported content page handler
*
* Serves the add report page
*
* @param array $page Array of page routing elements
* @return bool
*/
function reportedcontent_page_handler($page)
{
// only logged in users can report things
elgg_gatekeeper();
if (elgg_extract(0, $page) === 'add' && elgg_is_xhr()) {
echo elgg_view_resource('reportedcontent/add_form');
return true;
}
echo elgg_view_resource('reportedcontent/add');
return true;
}
示例15: search_page_handler
/**
* Page handler for search
*
* @param array $page Page elements from core page handler
* @return bool
*/
function search_page_handler($page)
{
// if there is no q set, we're being called from a legacy installation
// it expects a search by tags.
// actually it doesn't, but maybe it should.
// maintain backward compatibility
if (!get_input('q', get_input('tag', NULL))) {
set_input('q', $page[0]);
//set_input('search_type', 'tags');
}
echo elgg_view_resource('search/index');
return true;
}