本文整理汇总了PHP中elgg_push_breadcrumb函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_push_breadcrumb函数的具体用法?PHP elgg_push_breadcrumb怎么用?PHP elgg_push_breadcrumb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_push_breadcrumb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: _elgg_comments_page_handler
/**
* Page handler for generic comments manipulation.
*
* @param array $page
* @return bool
* @access private
*/
function _elgg_comments_page_handler($page)
{
switch ($page[0]) {
case 'edit':
elgg_gatekeeper();
if (empty($page[1])) {
register_error(elgg_echo('generic_comment:notfound'));
forward(REFERER);
}
$comment = get_entity($page[1]);
if (!$comment instanceof \ElggComment || !$comment->canEdit()) {
register_error(elgg_echo('generic_comment:notfound'));
forward(REFERER);
}
$target = $comment->getContainerEntity();
if (!$target instanceof \ElggEntity) {
register_error(elgg_echo('generic_comment:notfound'));
forward(REFERER);
}
$title = elgg_echo('generic_comments:edit');
elgg_push_breadcrumb($target->getDisplayName(), $target->getURL());
elgg_push_breadcrumb($title);
$params = array('entity' => $target, 'comment' => $comment, 'is_edit_page' => true);
$content = elgg_view_form('comment/save', null, $params);
$params = array('content' => $content, 'title' => $title, 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
return true;
break;
default:
return false;
break;
}
}
示例3: crud_page_handler
/**
* CRUD page handler
*
* URLs take the form of
* List crud objects in group: <crud_type>/owner/<guid>
* View crud object: <crud_type>/view/<guid>
* Add crud object: <crud_type>/add/<guid>
* Edit crud object: <crud_type>/edit/<guid>
*
* @param array $page Array of url segments for routing
* @return bool
*/
function crud_page_handler($page)
{
elgg_load_library('elgg:crud');
if (!isset($page[0])) {
$page[0] = 'all';
}
$page_url = current_page_url();
$site_url = elgg_get_site_url();
$current_url = str_replace($site_url, "", $page_url);
$crud_type = current(explode('/', $current_url));
$crud_handler = crud_get_handler($crud_type);
$crud_module = $crud_handler->module;
elgg_push_breadcrumb(elgg_echo($crud_module), '');
switch ($page[0]) {
case 'owner':
case 'group':
crud_handle_list_page($crud_handler, $page[1]);
break;
case 'add':
crud_handle_edit_page($crud_handler, 'add', $page[1]);
break;
case 'edit':
crud_handle_edit_page($crud_handler, 'edit', $page[1]);
break;
case 'view':
crud_handle_view_page($crud_handler, $page[1]);
break;
case 'edit_general':
crud_handle_edit_page($crud_handler, 'edit_general', $page[1]);
break;
default:
return false;
}
return true;
}
示例4: recursive_breadcrumb
/**
* View a single blogbook
*
* @package Elggtblogs
*/
function recursive_breadcrumb($tblog)
{
if ($tblog->parent_guid != '') {
recursive_breadcrumb(get_entity($tblog->parent_guid));
}
elgg_push_breadcrumb($tblog->title, "/blogbook/view/{$tblog->guid}");
}
示例5: au_group_tag_menu_page_handler
function au_group_tag_menu_page_handler($page, $identifier)
{
//show the page of search results
// assumes url of group/guid/tag
// if the tag is 'all' then will display a tagcloud
switch ($page[0]) {
case 'group':
$entity = get_entity($page[1]);
if (!elgg_instanceof($entity, 'group') || $entity->au_group_tag_menu_enable == 'no') {
return false;
}
elgg_push_breadcrumb($entity->name, $entity->getURL());
//should be OK if this is empty
$tag = $page[2];
elgg_push_breadcrumb($tag);
if ($tag == "all") {
//show a tag cloud for all group tags
//arbitrarily set to a max of 640 tags - should be enough for anyone :-)
$title = elgg_echo("au_group_tag_menu:tagcloud");
$options = array('container_guid' => $entity->getGUID(), 'type' => 'object', 'threshold' => 0, 'limit' => 640, 'tag_names' => array('tags'));
$thetags = elgg_get_tags($options);
//make it an alphabetical tag cloud, not with most popular first
sort($thetags);
//find the highest tag count for scaling the font
$max = 0;
foreach ($thetags as $key) {
if ($key->total > $max) {
$max = $key->total;
}
}
$content = " ";
//loop through and generate tags so they display nicely
//in the group, not as a dumb search page
foreach ($thetags as $key) {
$url = elgg_get_site_url() . "group_tag_menu/group/" . $entity->getGUID() . "/" . urlencode($key->tag);
$taglink = elgg_view('output/url', array('text' => ' ' . $key->tag, 'href' => $url, 'title' => "{$key->tag} ({$key->total})", 'rel' => 'tag'));
// get the font size for the tag (taken from elgg's own tagcloud code - not sure I love this)
$size = round(log($key->total) / log($max + 0.0001) * 100) + 30;
if ($size < 100) {
$size = 100;
}
// generate the link
$content .= " <a href='{$url}' style='font-size:{$size}%'>" . $key->tag . "</a> ";
}
} else {
//show the results for the selected tag
$title = elgg_echo("au_group_tag_menu:title") . "{$tag}";
$options = array('type' => 'object', 'metadata_name' => 'tags', 'metadata_value' => $tag, 'container_guid' => $entity->guid, 'full_view' => false);
$content = elgg_list_entities_from_metadata($options);
}
//display the page
if (!$content) {
$content = elgg_echo('au_group_tag_menu:noresults');
}
$layout = elgg_view_layout('content', array('title' => elgg_view_title($title), 'content' => $content, 'filter' => false));
echo elgg_view_page($title, $layout);
break;
}
return true;
}
示例6: blog_get_page_content_edit
/**
* Returns HTML to edit a blog post.
*
* @param int $guid
* @param int annotation id optional revision to edit
* @return string html
*/
function blog_get_page_content_edit($guid, $revision = NULL)
{
$vars = array();
if ($guid) {
$blog = get_entity((int) $guid);
if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) {
$vars['entity'] = $blog;
if ($revision) {
$revision = get_annotation((int) $revision);
$vars['revision'] = $revision;
if (!$revision || !($revision->entity_guid == $guid)) {
$content = elgg_echo('blog:error:revision_not_found');
}
}
elgg_push_breadcrumb($blog->title, $blog->getURL());
elgg_push_breadcrumb(elgg_echo('edit'));
$content = elgg_view('blog/forms/edit', $vars);
$sidebar = elgg_view('blog/sidebar_revisions', array('entity' => $blog));
//$sidebar .= elgg_view('blog/sidebar_related');
} else {
$content = elgg_echo('blog:error:post_not_found');
}
} else {
elgg_push_breadcrumb(elgg_echo('blog:new'));
$content = elgg_view('blog/forms/edit', $vars);
//$sidebar = elgg_view('blog/sidebar_related');
}
return array('content' => $content, 'sidebar' => $sidebar);
}
示例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 array|bool
*/
public static function blog($hook, $type, $return_value, $params)
{
if (empty($return_value) || !is_array($return_value)) {
// someone else had a route hook
return $return_value;
}
$page = elgg_extract("segments", $return_value);
if (empty($page)) {
return $return_value;
}
$pages_path = elgg_get_plugins_path() . "blog_tools/pages/";
switch ($page[0]) {
case "owner":
$user = get_user_by_username($page[1]);
if (!empty($user)) {
$return_value = false;
// push all blogs breadcrumb
elgg_push_breadcrumb(elgg_echo("blog:blogs"), "blog/all");
set_input("owner_guid", $user->guid);
include $pages_path . "owner.php";
}
break;
case "read":
// Elgg 1.7 compatibility
// Elgg 1.7 compatibility
case "view":
if (!elgg_is_logged_in()) {
$setting = elgg_get_plugin_setting("advanced_gatekeeper", "blog_tools");
if ($setting != "no") {
if (isset($page[1]) && !get_entity($page[1])) {
elgg_gatekeeper();
}
}
}
set_input("guid", $page[1]);
// to be used in the blog_tools/full/related view
break;
case "add":
case "edit":
$return_value = false;
// push all blogs breadcrumb
elgg_push_breadcrumb(elgg_echo("blog:blogs"), "blog/all");
set_input("page_type", $page[0]);
if (isset($page[1])) {
set_input("guid", $page[1]);
}
if (isset($page[2])) {
set_input("revision", $page[2]);
}
include $pages_path . "edit.php";
break;
case "featured":
$return_value = false;
include $pages_path . "featured.php";
break;
}
return $return_value;
}
示例8: bookmarks_page_handler
/**
* Dispatcher for bookmarks.
*
* URLs take the form of
* All bookmarks: bookmarks/all
* User's bookmarks: bookmarks/owner/<username>
* Friends' bookmarks: bookmarks/friends/<username>
* View bookmark: bookmarks/view/<guid>/<title>
* New bookmark: bookmarks/add/<guid> (container: user, group, parent)
* Edit bookmark: bookmarks/edit/<guid>
* Group bookmarks: bookmarks/group/<guid>/owner
* Bookmarklet: bookmarks/bookmarklet/<guid> (user)
*
* Title is ignored
*
* @param array $page
*/
function bookmarks_page_handler($page)
{
elgg_load_library('elgg:bookmarks');
elgg_push_breadcrumb(elgg_echo('bookmarks'), 'bookmarks/all');
elgg_push_context('bookmarks');
// old group usernames
if (substr_count($page[0], 'group:')) {
preg_match('/group\\:([0-9]+)/i', $page[0], $matches);
$guid = $matches[1];
if ($entity = get_entity($guid)) {
bookmarks_url_forwarder($page);
}
}
// user usernames
$user = get_user_by_username($page[0]);
if ($user) {
bookmarks_url_forwarder($page);
}
$pages = dirname(__FILE__) . '/pages/bookmarks';
switch ($page[0]) {
case "all":
include "{$pages}/all.php";
break;
case "owner":
include "{$pages}/owner.php";
break;
case "friends":
include "{$pages}/friends.php";
break;
case "read":
case "view":
set_input('guid', $page[1]);
include "{$pages}/view.php";
break;
case "add":
gatekeeper();
include "{$pages}/add.php";
break;
case "edit":
gatekeeper();
set_input('guid', $page[1]);
include "{$pages}/edit.php";
break;
case 'group':
group_gatekeeper();
include "{$pages}/owner.php";
break;
case "bookmarklet":
set_input('container_guid', $page[1]);
include "{$pages}/bookmarklet.php";
break;
default:
return false;
}
elgg_pop_context();
return true;
}
示例9: tblog_get_page_content_list
function tblog_get_page_content_list($guid)
{
$container_guid = NULL;
$return = array();
$return['filter_context'] = $container_guid ? 'mine' : 'all';
$options = array('type' => 'object', 'subtype' => 'blog', 'full_view' => FALSE);
$loggedin_userid = elgg_get_logged_in_user_guid();
if ($container_guid) {
// access check for closed groups
group_gatekeeper();
$options['container_guid'] = $container_guid;
$container = get_entity($container_guid);
if (!$container) {
}
$return['title'] = elgg_echo('blog:title:user_blogs', array($container->name));
$crumbs_title = $container->name;
elgg_push_breadcrumb($crumbs_title);
if ($container_guid == $loggedin_userid) {
$return['filter_context'] = 'mine';
} else {
if (elgg_instanceof($container, 'group')) {
$return['filter'] = false;
} else {
// do not show button or select a tab when viewing someone else's posts
$return['filter_context'] = 'none';
}
}
} else {
$return['filter_context'] = 'all';
$return['title'] = elgg_echo('blogbook:select a blog');
elgg_pop_breadcrumb();
elgg_push_breadcrumb(elgg_echo('blog:blogs'));
}
//elgg_register_title_button();
// show all posts for admin or users looking at their own blogs
// show only published posts for other users.
if (!(elgg_is_admin_logged_in() || elgg_is_logged_in() && $container_guid == $loggedin_userid)) {
$options['metadata_name_value_pairs'] = array(array('name' => 'status', 'value' => 'published'));
}
$tblog = get_entity($guid);
$bidlist = explode(",", $tblog->bids);
foreach ($bidlist as $value) {
$aBlog = get_entity($value);
$form_data .= "<input type='checkbox' name='bids[]' value='{$value}' /> {$aBlog->title}<br />";
}
$form_data .= "<input type='hidden' name='guid' value='{$guid}' />";
// TODO the problem is thst $guid is empty
$form_data .= elgg_view('input/submit', array('value' => elgg_echo('Remove')));
$list .= elgg_view("input/form", array("body" => $form_data, "action" => "/action/blogbook/remove", "id" => "tblog_insert_form", "class" => "elgg-form-alt"));
if (!$list) {
$return['content'] = elgg_echo('blog:none');
} else {
$return['content'] = $list;
}
return $return;
}
示例10: testCrumbLinksAreNormalized
public function testCrumbLinksAreNormalized()
{
$this->markTestIncomplete('Needs DB');
// TODO make this unnecessary
elgg_set_view_location('output/url', __DIR__ . '/../../../views/');
elgg_set_view_location('navigation/breadcrumbs', __DIR__ . '/../../../views/');
elgg_push_breadcrumb('test', 'link');
$html = elgg_view('navigation/breadcrumbs');
$this->assertNotFalse(strpos($html, '"http://localhost/link"'));
}
示例11: etherpad_page_handler
function etherpad_page_handler($page, $handler)
{
// elgg_load_library('elgg:pages');
if ($handler == 'pages') {
// add the jquery treeview files for navigation
elgg_load_js('jquery-treeview');
elgg_load_css('jquery-treeview');
}
if (!isset($page[0])) {
$page[0] = 'all';
}
elgg_push_breadcrumb(elgg_echo($handler), "{$handler}/all");
$base_dir = elgg_get_plugins_path() . "etherpad/pages/{$handler}";
$page_type = $page[0];
switch ($page_type) {
case 'owner':
include "{$base_dir}/owner.php";
break;
case 'friends':
include "{$base_dir}/friends.php";
break;
case 'view':
set_input('guid', $page[1]);
include "{$base_dir}/view.php";
break;
case 'add':
set_input('guid', $page[1]);
include "{$base_dir}/new.php";
break;
case 'edit':
set_input('guid', $page[1]);
include "{$base_dir}/edit.php";
break;
case 'group':
include "{$base_dir}/owner.php";
break;
case 'history':
set_input('guid', $page[1]);
include "{$base_dir}/history.php";
break;
case 'revision':
set_input('id', $page[1]);
include "{$base_dir}/revision.php";
break;
case 'all':
include "{$base_dir}/world.php";
break;
case "cross":
include "{$base_dir}/cross.php";
break;
default:
return false;
}
return true;
}
示例12: get_create_forms
function get_create_forms($page)
{
$parent_guid = 0;
switch ($page[0]) {
case "blog":
echo "<h2>Add a Blog</h2>";
elgg_load_library('elgg:blog');
$body_vars = blog_prepare_form_vars();
echo elgg_view_form('blog/save', array(), array_merge($body_vars, $vars));
exit;
case "event":
echo "<h2>Add an Event</h2>";
elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
echo elgg_view("event_manager/forms/event/edit");
exit;
case "group":
echo "<h2>" . elgg_echo('groups:add') . "</h2>";
elgg_load_library('elgg:groups');
elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
elgg_push_breadcrumb($title);
if (elgg_get_plugin_setting('limited_groups', 'groups') != 'yes' || elgg_is_admin_logged_in()) {
$content = elgg_view('groups/edit');
} else {
$content = elgg_echo('groups:cantcreate');
}
echo $content;
exit;
case "project":
echo "<h2>" . elgg_echo('projects:add') . "</h2>";
$vars = projects_prepare_form_vars(null, $parent_guid);
$content = elgg_view_form('projects/edit', array('enctype' => 'multipart/form-data'), $vars);
echo $content;
exit;
case "page":
elgg_load_library('elgg:pages');
echo "<h2>" . elgg_echo('pages:add') . "</h2>";
$vars = pages_prepare_form_vars(null, $parent_guid);
$content = elgg_view_form('pages/edit', array(), $vars);
echo $content;
exit;
case "answer":
echo "<h2>" . elgg_echo('answers:add') . "</h2>";
elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
echo elgg_view("answers/forms/question", array('container_guid' => elgg_get_page_owner_guid()));
exit;
case "task":
elgg_load_library('elgg:tasks');
echo "<h2>" . elgg_echo('tasks:add') . "</h2>";
$vars = tasks_prepare_form_vars(null, $parent_guid);
$content = elgg_view_form('tasks/edit', array(), $vars);
echo $content;
exit;
}
}
示例13: pushBreadcrumbs
public function pushBreadcrumbs(ElggEntity $entity)
{
$breadcrumbs = $this->getBreadcrumbs($entity);
foreach ($breadcrumbs as $breadcrumb) {
$text = elgg_extract('text', $breadcrumb, '');
$href = elgg_extract('href', $breadcrumb);
if ($text) {
elgg_push_breadcrumb($text, $href);
}
}
}
示例14: testTrailingNonLinkIsRemoved
public function testTrailingNonLinkIsRemoved()
{
$this->markTestIncomplete('Needs DB');
// TODO make this unnecessary
elgg_set_view_location('output/url', __DIR__ . '/../../../views/');
elgg_set_view_location('navigation/breadcrumbs', __DIR__ . '/../../../views/');
elgg_push_breadcrumb('Foo', 'foo');
elgg_push_breadcrumb('Bar');
$html = elgg_view('navigation/breadcrumbs');
$this->assertFalse(strpos($html, 'Bar'));
}
示例15: avatar_wall_page_handler
function avatar_wall_page_handler($page)
{
elgg_push_breadcrumb(elgg_echo('avatar_wall:title'));
$title = elgg_echo('avatar_wall:title');
$area = elgg_view('avatar_wall/wall');
// Format page
$body = elgg_view('page/layouts/one_column', array('content' => $area, 'title' => $title));
// Draw it
echo elgg_view_page(elgg_echo('avatar_wall:title'), $body);
return true;
}