本文整理汇总了PHP中elgg_view_icon函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_view_icon函数的具体用法?PHP elgg_view_icon怎么用?PHP elgg_view_icon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_view_icon函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reportedcontent_init
/**
* Initialize the plugin
*/
function reportedcontent_init()
{
// Register a page handler, so we can have nice URLs
elgg_register_page_handler('reportedcontent', 'reportedcontent_page_handler');
// Extend CSS
elgg_extend_view('css/elgg', 'reportedcontent/css');
elgg_extend_view('css/admin', 'reportedcontent/admin_css');
// Extend footer with report content link
if (elgg_is_logged_in()) {
$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, 'section' => 'default'));
}
elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'reportedcontent_user_hover_menu');
// Add admin menu item
// @todo Might want to move this to a 'feedback' section. something other than utils
elgg_register_admin_menu_item('administer', 'reportedcontent', 'administer_utilities');
elgg_register_widget_type('reportedcontent', elgg_echo('reportedcontent'), elgg_echo('reportedcontent:widget:description'), array('admin'));
// Register actions
$action_path = elgg_get_plugins_path() . "reportedcontent/actions/reportedcontent";
elgg_register_action('reportedcontent/add', "{$action_path}/add.php");
elgg_register_action('reportedcontent/delete', "{$action_path}/delete.php", 'admin');
elgg_register_action('reportedcontent/archive', "{$action_path}/archive.php", 'admin');
}
示例2: setUp
/**
*
*/
public function setUp($hook, $type, $menu, $params)
{
if (!elgg_is_logged_in()) {
return $menu;
}
$user = elgg_get_logged_in_user_entity();
if (!$user->isAdmin() && $user->role !== 'curator') {
return $menu;
}
$entity = $params['entity'];
if (elgg_get_plugin_user_setting('not_exposable', $entity->owner_guid, 'expozeum') == false) {
// We don't want to feature users, sites nor groups
if (!elgg_instanceof($entity, 'object', 'hjalbumimage')) {
return $menu;
}
if ($entity->expozeum) {
$action = 'unexpozeum';
$icon = 'eye-alt';
//$text = 'unexpozeum';
} else {
$action = 'expozeum';
$icon = 'eye';
//$text = 'expozeum';
}
$menu[] = ElggMenuItem::factory(array('name' => 'expozeum', 'text' => elgg_view_icon($icon), 'href' => "action/expozeum_content/{$action}?guid={$entity->guid}", 'is_action' => true));
return $menu;
}
return $menu;
}
示例3: friend_request_pagesetup
function friend_request_pagesetup()
{
$context = elgg_get_context();
$page_owner = elgg_get_page_owner_entity();
// Remove link to friendsof
elgg_unregister_menu_item("page", "friends:of");
if ($user = elgg_get_logged_in_user_entity()) {
$options = array("type" => "user", "count" => true, "relationship" => "friendrequest", "relationship_guid" => $user->getGUID(), "inverse_relationship" => true);
if ($count = elgg_get_entities_from_relationship($options)) {
$params = array("name" => "friend_request", "href" => "friend_request/" . $user->username, "text" => elgg_view_icon("user") . "<span class='friend-request-new'>" . $count . "</span>", "title" => elgg_echo("friend_request:menu"), "priority" => 301);
elgg_register_menu_item("topbar", $params);
}
}
// Show menu link in the correct context
if (in_array($context, array("friends", "friendsof", "collections", "messages")) && !empty($page_owner) && $page_owner->canEdit()) {
$options = array("type" => "user", "count" => true, "relationship" => "friendrequest", "relationship_guid" => $page_owner->getGUID(), "inverse_relationship" => true);
if ($count = elgg_get_entities_from_relationship($options)) {
$extra = " [" . $count . "]";
} else {
$extra = "";
}
// add menu item
$menu_item = array("name" => "friend_request", "text" => elgg_echo("friend_request:menu") . $extra, "href" => "friend_request/" . $page_owner->username, "contexts" => array("friends", "friendsof", "collections", "messages"), "section" => "friend_request");
elgg_register_menu_item("page", $menu_item);
}
}
示例4: 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;
}
示例5: basic_pagesetup_handler
function basic_pagesetup_handler()
{
elgg_unextend_view('page/elements/header', 'search/header');
elgg_unregister_menu_item('topbar', 'dashboard');
elgg_unregister_menu_item('topbar', 'elgg_logo');
// Extend footer with copyright
$year = date('Y');
$href = "http://www.perjensen-online.dk";
elgg_register_menu_item('footer', array('name' => 'copyright_this', 'href' => $href, 'title' => elgg_echo('basic_light:tooltip'), 'text' => elgg_echo('basic_light:copyright') . $year . elgg_echo(' Elggzone'), 'priority' => 1, 'section' => 'alt'));
// Extend footer with elgg link
$href = "http://elgg.org";
elgg_register_menu_item('footer', array('name' => 'elgg', 'href' => $href, 'text' => elgg_echo('basic_light:elgg'), 'priority' => 2, 'section' => 'alt'));
if (elgg_is_logged_in()) {
$user = elgg_get_logged_in_user_entity();
if (elgg_is_active_plugin('dashboard')) {
elgg_register_menu_item('topbar', array('name' => 'dashboard', 'href' => 'dashboard', 'text' => elgg_view_icon('home') . elgg_echo('dashboard'), 'priority' => 1000, 'section' => 'alt'));
}
if (elgg_is_active_plugin('reportedcontent')) {
elgg_unregister_menu_item('footer', 'report_this');
$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, 'text' => elgg_view_icon('report-this') . elgg_echo(''), 'title' => elgg_echo('reportedcontent:this:tooltip'), 'priority' => 100));
}
}
}
示例6: _elgg_friends_page_setup
/**
* Register some menu items for friends UI
* @access private
*/
function _elgg_friends_page_setup() {
$owner = elgg_get_page_owner_entity();
$viewer = elgg_get_logged_in_user_entity();
if ($owner) {
$params = array(
'name' => 'friends',
'text' => elgg_echo('friends'),
'href' => 'friends/' . $owner->username,
'contexts' => array('friends')
);
elgg_register_menu_item('page', $params);
$params = array(
'name' => 'friends:of',
'text' => elgg_echo('friends:of'),
'href' => 'friendsof/' . $owner->username,
'contexts' => array('friends')
);
elgg_register_menu_item('page', $params);
}
// topbar
if ($viewer) {
elgg_register_menu_item('topbar', array(
'name' => 'friends',
'href' => "friends/{$viewer->username}",
'text' => elgg_view_icon('users'),
'title' => elgg_echo('friends'),
'priority' => 300,
));
}
}
示例7: dashboard_init
function dashboard_init()
{
elgg_register_page_handler('dashboard', 'dashboard_page_handler');
elgg_extend_view('css/elgg', 'dashboard/css');
elgg_register_menu_item('topbar', array('name' => 'dashboard', 'href' => 'dashboard', 'text' => elgg_view_icon('home') . elgg_echo('dashboard'), 'priority' => 450, 'section' => 'alt'));
elgg_register_plugin_hook_handler('get_list', 'default_widgets', 'dashboard_default_widgets');
}
示例8: likes_river_menu_setup
/**
* Add a like button to river actions
*/
function likes_river_menu_setup($hook, $type, $return, $params)
{
if (elgg_is_logged_in()) {
$item = $params['item'];
// only like group creation #3958
if ($item->type == "group" && $item->view != "river/group/create") {
return $return;
}
// don't like users #4116
if ($item->type == "user") {
return $return;
}
$object = $item->getObjectEntity();
if (!elgg_in_context('widgets') && $item->annotation_id == 0) {
if ($object->canAnnotate(0, 'likes')) {
$hasLiked = elgg_annotation_exists($object->guid, 'likes');
// Always register both. That makes it super easy to toggle with javascript
$return[] = ElggMenuItem::factory(array('name' => 'like', 'href' => elgg_add_action_tokens_to_url("/action/likes/add?guid={$object->guid}"), 'text' => elgg_view_icon('thumbs-up'), 'title' => elgg_echo('likes:likethis'), 'item_class' => $hasLiked ? 'hidden' : '', 'priority' => 100));
$return[] = ElggMenuItem::factory(array('name' => 'unlike', 'href' => elgg_add_action_tokens_to_url("/action/likes/delete?guid={$object->guid}"), 'text' => elgg_view_icon('thumbs-up-alt'), 'title' => elgg_echo('likes:remove'), 'item_class' => $hasLiked ? '' : 'hidden', 'priority' => 100));
// likes count
$count = elgg_view('likes/count', array('entity' => $object));
if ($count) {
$return[] = ElggMenuItem::factory(array('name' => 'likes_count', 'text' => $count, 'href' => false, 'priority' => 101));
}
}
}
}
return $return;
}
示例9: bookmarks_init
/**
* Bookmark init
*/
function bookmarks_init()
{
$root = dirname(__FILE__);
elgg_register_library('elgg:bookmarks', "{$root}/lib/bookmarks.php");
// actions
$action_path = "{$root}/actions/bookmarks";
elgg_register_action('bookmarks/save', "{$action_path}/save.php");
elgg_register_action('bookmarks/delete', "{$action_path}/delete.php");
elgg_register_action('bookmarks/share', "{$action_path}/share.php");
// menus
elgg_register_menu_item('site', array('name' => 'bookmarks', 'text' => elgg_echo('bookmarks'), 'href' => 'bookmarks/all'));
elgg_register_plugin_hook_handler('register', 'menu:page', 'bookmarks_page_menu');
elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'bookmarks_owner_block_menu');
elgg_register_page_handler('bookmarks', 'bookmarks_page_handler');
elgg_extend_view('css/elgg', 'bookmarks/css');
elgg_extend_view('js/elgg', 'bookmarks/js');
elgg_register_widget_type('bookmarks', elgg_echo('bookmarks'), elgg_echo('bookmarks:widget:description'));
if (elgg_is_logged_in()) {
$user_guid = elgg_get_logged_in_user_guid();
$address = urlencode(current_page_url());
elgg_register_menu_item('extras', array('name' => 'bookmark', 'text' => elgg_view_icon('push-pin-alt'), 'href' => "bookmarks/add/{$user_guid}?address={$address}", 'title' => elgg_echo('bookmarks:this'), 'rel' => 'nofollow'));
}
// Register granular notification for this type
register_notification_object('object', 'bookmarks', elgg_echo('bookmarks:new'));
// Listen to notification events and supply a more useful message
elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'bookmarks_notify_message');
// Register a URL handler for bookmarks
elgg_register_entity_url_handler('object', 'bookmarks', 'bookmark_url');
// Register entity type for search
elgg_register_entity_type('object', 'bookmarks');
// Groups
add_group_tool_option('bookmarks', elgg_echo('bookmarks:enablebookmarks'), true);
elgg_extend_view('groups/tool_latest', 'bookmarks/group_module');
}
示例10: 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;
}
示例11: custom_river_menu_setup
function custom_river_menu_setup($hook, $type, $return, $params)
{
$item = $params['item'];
$options = array('name' => 'delete', 'href' => elgg_add_action_tokens_to_url("action/river/delete?id={$item->id}&subjectId={$item->subject_guid}"), 'text' => elgg_view_icon('delete'), 'title' => elgg_echo('delete'), 'confirm' => elgg_echo('deleteconfirm'), 'priority' => 200);
$return[] = ElggMenuItem::factory($options);
return $return;
}
示例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: prepareMenu
public static function prepareMenu($h, $t, $v, $p)
{
$default = new MenuList(elgg_extract('default', $v, []));
$alt = new MenuList(elgg_extract('alt', $v, []));
// dump alt items into default
$default->appendList($alt);
$avatar = $default->get('profile');
$account = $default->get('account');
if ($avatar && $account) {
$user = elgg_get_logged_in_user_entity();
// copy account children under avatar
$children = new MenuList($account->getChildren());
// copy admin out
$admin = $children->remove('administration');
$url = $avatar->getHref();
$profile = new \ElggMenuItem('view-profile', elgg_echo('profile'), $url);
$children->move($profile, 0);
$avatar->setHref(null);
elgg_push_context('mrclay_aalborg_topbar');
$avatar->setText(elgg_view_entity_icon($user, 'tiny'));
elgg_pop_context();
$default->remove($account);
$default->push($avatar);
if ($admin) {
$admin->setTooltip(elgg_echo('admin'));
$admin->setText(elgg_view_icon('settings-alt'));
$default->move($admin, 0);
}
}
return ['default' => $default->getItems()];
}
示例14: bookmarks_init
/**
* Bookmark init
*/
function bookmarks_init()
{
$root = dirname(__FILE__);
elgg_register_library('elgg:bookmarks', "{$root}/lib/bookmarks.php");
// actions
$action_path = "{$root}/actions/bookmarks";
elgg_register_action('bookmarks/save', "{$action_path}/save.php");
elgg_register_action('bookmarks/delete', "{$action_path}/delete.php");
elgg_register_action('bookmarks/share', "{$action_path}/share.php");
// menus
elgg_register_menu_item('site', array('name' => 'bookmarks', 'text' => elgg_echo('bookmarks'), 'href' => 'bookmarks/all'));
elgg_register_plugin_hook_handler('register', 'menu:page', 'bookmarks_page_menu');
elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'bookmarks_owner_block_menu');
elgg_register_page_handler('bookmarks', 'bookmarks_page_handler');
elgg_extend_view('elgg.css', 'bookmarks/css');
elgg_extend_view('elgg.js', 'bookmarks/js');
elgg_register_widget_type('bookmarks', elgg_echo('bookmarks'), elgg_echo('bookmarks:widget:description'));
if (elgg_is_logged_in()) {
$user_guid = elgg_get_logged_in_user_guid();
$address = urlencode(current_page_url());
elgg_register_menu_item('extras', array('name' => 'bookmark', 'text' => elgg_view_icon('push-pin-alt'), 'href' => "bookmarks/add/{$user_guid}?address={$address}", 'title' => elgg_echo('bookmarks:this'), 'rel' => 'nofollow'));
}
// Register for notifications
elgg_register_notification_event('object', 'bookmarks', array('create'));
elgg_register_plugin_hook_handler('prepare', 'notification:create:object:bookmarks', 'bookmarks_prepare_notification');
// Register bookmarks view for ecml parsing
elgg_register_plugin_hook_handler('get_views', 'ecml', 'bookmarks_ecml_views_hook');
// Register a URL handler for bookmarks
elgg_register_plugin_hook_handler('entity:url', 'object', 'bookmark_set_url');
// Register entity type for search
elgg_register_entity_type('object', 'bookmarks');
// Groups
add_group_tool_option('bookmarks', elgg_echo('bookmarks:enablebookmarks'), true);
elgg_extend_view('groups/tool_latest', 'bookmarks/group_module');
}
示例15: questions_entity_menu_handler
/**
* Add menu items to the entity menu
*
* @param string $hook the name of the hook
* @param string $type the type of the hook
* @param ElggMenuItem[] $items current return value
* @param array $params supplied params
*
* @return void|ElggMenuItem[]
*/
function questions_entity_menu_handler($hook, $type, $items, $params)
{
if (empty($params) || !is_array($params)) {
return;
}
$entity = elgg_extract('entity', $params);
if (empty($entity) || !$entity instanceof ElggQuestion && !$entity instanceof ElggAnswer) {
return;
}
if ($entity->canComment()) {
if (elgg_extract('full_view', $params, false) || $entity instanceof ElggAnswer) {
$items[] = ElggMenuItem::factory(['name' => 'comments', 'rel' => 'toggle', 'link_class' => 'elgg-toggler', 'href' => "#comments-add-{$entity->getGUID()}", 'text' => elgg_view_icon('speech-bubble'), 'priority' => 600]);
}
}
if (elgg_in_context('questions') && $entity instanceof ElggAnswer && questions_can_mark_answer($entity)) {
$question = $entity->getContainerEntity();
$answer = $question->getMarkedAnswer();
if (empty($answer)) {
$items[] = ElggMenuItem::factory(['name' => 'questions_mark', 'text' => elgg_echo('questions:menu:entity:answer:mark'), 'href' => "action/answers/toggle_mark?guid={$entity->getGUID()}", 'is_action' => true]);
} elseif ($entity->getGUID() === $answer->getGUID()) {
// there is an anwser and it's this entity
$items[] = ElggMenuItem::factory(['name' => 'questions_mark', 'text' => elgg_echo('questions:menu:entity:answer:unmark'), 'href' => "action/answers/toggle_mark?guid={$entity->getGUID()}", 'is_action' => true]);
}
}
return $items;
}