本文整理汇总了PHP中elgg_add_action_tokens_to_url函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_add_action_tokens_to_url函数的具体用法?PHP elgg_add_action_tokens_to_url怎么用?PHP elgg_add_action_tokens_to_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_add_action_tokens_to_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: event_manager_entity_menu
function event_manager_entity_menu($hook, $entity_type, $returnvalue, $params)
{
$result = $returnvalue;
if (elgg_in_context("widgets")) {
return $result;
}
if (($entity = elgg_extract("entity", $params)) && elgg_instanceof($entity, "object", Event::SUBTYPE)) {
$attendee_menu_options = array("name" => "attendee_count", "priority" => 50, "text" => elgg_echo("event_manager:event:relationship:event_attending:entity_menu", array($entity->countAttendees())), "href" => false);
$result[] = ElggMenuItem::factory($attendee_menu_options);
// change some of the basic menus
if (!empty($result) && is_array($result)) {
foreach ($result as &$item) {
switch ($item->getName()) {
case "edit":
$item->setHref("events/event/edit/" . $entity->getGUID());
break;
case "delete":
$href = elgg_get_site_url() . "action/event_manager/event/delete?guid=" . $entity->getGUID();
$href = elgg_add_action_tokens_to_url($href);
$item->setHref($href);
$item->setConfirmText(elgg_echo("deleteconfirm"));
break;
}
}
}
// show an unregister link for non logged in users
if (!elgg_is_logged_in() && $entity->register_nologin) {
$result[] = ElggMenuItem::factory(array("name" => "unsubscribe", "text" => elgg_echo("event_manager:menu:unsubscribe"), "href" => "events/unsubscribe/" . $entity->getGUID() . "/" . elgg_get_friendly_title($entity->title), "priority" => 300));
}
}
return $result;
}
示例3: 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;
}
示例4: listagem_turma_menu
function listagem_turma_menu($hook, $type, $return, $params)
{
$entity = $params['entity'];
if ($entity->getSubtype() !== "turma") {
return $return;
}
$novoMenu = ElggMenuItem::factory(array("name" => "turma", "text" => "<span class='elgg-icon-delete elgg-icon'></span>", "href" => elgg_add_action_tokens_to_url("action/groups/delete?guid={$entity->guid}&action_type=delete"), "priority" => 300));
array_push($return, $novoMenu);
return $return;
}
示例5: donation_user_hover_menu
function donation_user_hover_menu($hook, $type, $return, $params)
{
$user = $params['entity'];
$url = "action/donation/add?guid={$user->guid}";
$url = elgg_add_action_tokens_to_url($url);
$item = new ElggMenuItem('donation', elgg_echo('donation:add'), $url);
$item->setSection('admin');
$return[] = $item;
return $return;
}
示例6: hook_prepare_entity_menu
function hook_prepare_entity_menu($hook, $type, $menus, $params)
{
$entity = elgg_extract('entity', $params);
if (!$entity->{QUARANTINED}) {
return;
}
$list = new MenuList($menus['default']);
$list->move(\ElggMenuItem::factory(['name' => 'probation_approve_content', 'href' => elgg_add_action_tokens_to_url("action/probation/approve_content?guid={$entity->guid}"), 'text' => 'Approve (probation)', 'title' => 'Restore this content to its desired access level']), 0);
$list->remove('access');
$menus['default'] = $list->getItems();
return $menus;
}
示例7: _elgg_friends_setup_user_hover_menu
/**
* Adds friending to user hover menu
*
* @access private
*/
function _elgg_friends_setup_user_hover_menu($hook, $type, $return, $params)
{
$user = $params['entity'];
/* @var \ElggUser $user */
if (elgg_is_logged_in()) {
if (elgg_get_logged_in_user_guid() != $user->guid) {
$isFriend = $user->isFriend();
// Always emit both to make it super easy to toggle with ajax
$return[] = \ElggMenuItem::factory(array('name' => 'remove_friend', 'href' => elgg_add_action_tokens_to_url("action/friends/remove?friend={$user->guid}"), 'text' => elgg_echo('friend:remove'), 'section' => 'action', 'item_class' => $isFriend ? '' : 'hidden'));
$return[] = \ElggMenuItem::factory(array('name' => 'add_friend', 'href' => elgg_add_action_tokens_to_url("action/friends/add?friend={$user->guid}"), 'text' => elgg_echo('friend:add'), 'section' => 'action', 'item_class' => $isFriend ? 'hidden' : ''));
}
}
return $return;
}
示例8: getURL
/**
* Get album URL
*
* @param string $action Operation
* @return string
*/
public function getURL($action = 'view')
{
switch ($action) {
default:
case 'view':
$friendly_title = elgg_get_friendly_title($this->title);
return "gallery/view/{$this->guid}/{$friendly_title}";
case 'edit':
return "gallery/edit/{$this->guid}";
case 'delete':
return elgg_add_action_tokens_to_url(elgg_get_site_url() . "action/gallery/delete/object?guid={$this->guid}");
case 'manage':
return "gallery/manage/{$this->guid}";
}
}
示例9: getURL
/**
* Get URL for a specific operation
*
* @param string $action Operation name
* @return string
*/
public function getURL($action = 'view')
{
switch ($action) {
default:
case 'view':
$friendly_title = elgg_get_friendly_title($this->title);
return elgg_normalize_url("gallery/view/{$this->guid}/{$friendly_title}");
case 'edit':
return elgg_normalize_url("gallery/manage/{$this->container_guid}#elgg-object-{$this->guid}");
case 'delete':
return elgg_add_action_tokens_to_url(elgg_normalize_url("action/gallery/delete/object?guid={$this->guid}"));
case 'download':
return elgg_normalize_url("gallery/download/{$this->guid}");
}
}
示例10: lti_init
function lti_init()
{
elgg_register_library('BasicLTI_Tool_Provider', elgg_get_plugins_path() . 'blti/lib/BasicLTI_Tool_Provider.php');
elgg_register_library('Utility', elgg_get_plugins_path() . 'blti/lib/Utility.php');
elgg_register_library('LTIGroup', elgg_get_plugins_path() . 'blti/lib/LTIGroup.php');
elgg_register_library('LTIUser', elgg_get_plugins_path() . 'blti/lib/LTIUser.php');
elgg_load_library('BasicLTI_Tool_Provider');
elgg_load_library('Utility');
elgg_load_library('LTIGroup');
elgg_load_library('LTIUser');
// Check DB
CheckDB();
// Set log file
$logfile = elgg_get_config('ltipath') . 'logs/LTI.log';
elgg_set_plugin_setting('logfile', $logfile, 'blti');
$action_path = elgg_get_plugins_path() . 'blti/actions';
// Mechanisms to register and unregister LTI actions
elgg_register_action('blti/return', $action_path . '/return.php');
elgg_register_action('blti/createconsumer', $action_path . '/createconsumer.php');
elgg_register_action('blti/saveconsumer', $action_path . '/saveconsumer.php');
elgg_register_action('blti/enable', $action_path . '/enable.php');
elgg_register_action('blti/createshare', $action_path . '/createshare.php');
elgg_register_action('blti/sync', $action_path . '/sync.php');
elgg_register_action('blti/dosync', $action_path . '/dosync.php');
elgg_register_action('blti/approve', $action_path . '/approve.php');
// Page handler
elgg_register_page_handler(elgg_get_config('ltiname'), 'LTI_page_handler');
elgg_register_plugin_hook_handler('plugin:setting', 'all', 'LTI_ValidateGroupProvision');
// Allow instructors to have owner access
elgg_register_plugin_hook_handler('permissions_check', 'group', 'LTIgroup_operators_permissions_hook');
// Allow instructors to update user details but within context of group
elgg_register_plugin_hook_handler('permissions_check', 'user', 'LTIgroup_operators_permissions_hook');
elgg_register_css('blti_css', '/mod/blti/css/style.css');
if (!empty($_SESSION['return_url'])) {
$url = elgg_add_action_tokens_to_url(elgg_get_config('wwwroot') . 'action/' . elgg_get_config('ltiname') . '/return');
elgg_register_menu_item('topbar', array('href' => $url, 'name' => 'moodle_return', 'priority' => 2, 'section' => 'alt', 'text' => $_SESSION['return_name']));
elgg_load_css('blti_css');
}
elgg_register_admin_menu_item('administer', 'blti', 'administer_utilities');
// Extend the elgg topbar. See views/default/lti/topbar.php for the code run by this function
// elgg_extend_view('topbar','lti/topbar');
}
示例11: tu_spam_report_spammer_menu
/**
* add 'not spammer' and 'delete' links to entity menuy of listed spammers
*
* @param type $hook
* @param type $type
* @param type $return
* @param type $params
*/
function tu_spam_report_spammer_menu($hook, $type, $return, $params)
{
if (!elgg_instanceof($params['entity'], 'user') || elgg_get_context() != 'reported_spammers') {
return $return;
}
// delete (requires new action due to it being deactivated)
$href = elgg_add_action_tokens_to_url('action/reported_spam/delete?guid=' . $params['entity']->guid);
$delete = new ElggMenuItem('delete', elgg_view_icon('delete'), $href);
$delete->setLinkClass('elgg-requires-confirmation');
// unspam - will unmark this as spam and reactivate it
$href = elgg_add_action_tokens_to_url('action/reported_spam/notspammer?guid=' . $params['entity']->guid);
$unspam = new ElggMenuItem('unspam', elgg_echo('tu_spam_report:notspammer'), $href);
$unspam->setLinkClass('elgg-requires-confirmation');
$metadata = elgg_get_metadata(array('guid' => $params['entity']->guid, 'metadata_name' => 'disable_reason', 'metadata_value' => 'content_marked_spam', 'limit' => false));
$href = false;
$reported = new ElggMenuItem('reported', elgg_echo('tu_spam_report:reported', array(date('m/d/Y', $metadata[0]->time_created))), $href);
$return[] = $reported;
$return[] = $unspam;
$return[] = $delete;
return $return;
}
示例12: prepareMenu
public static function prepareMenu($h, $t, $v, $p)
{
if (!elgg_in_context('mrclay_aalborg_topbar')) {
return;
}
$action_section = new MenuList(elgg_extract('action', $v, []));
$action_section->remove('avatar:edit');
$user = $p['entity'];
/* @var \ElggUser $user */
if (elgg_is_active_plugin('notifications')) {
$item = \ElggMenuItem::factory(array('name' => '2_a_user_notify', 'text' => elgg_echo('notifications:subscriptions:changesettings'), 'href' => "notifications/personal/{$user->username}", 'section' => "notifications"));
$action_section->push($item);
if (elgg_is_active_plugin('groups')) {
$item = \ElggMenuItem::factory(array('name' => '2_group_notify', 'text' => elgg_echo('notifications:subscriptions:changesettings:groups'), 'href' => "notifications/group/{$user->username}", 'section' => "notifications"));
$action_section->push($item);
}
}
$item = \ElggMenuItem::factory(array('name' => 'logout', 'text' => elgg_view_icon('sign-out') . elgg_echo('logout'), 'href' => elgg_add_action_tokens_to_url("action/logout")));
$action_section->push($item);
$v['action'] = $action_section->getItems();
return $v;
}
示例13: zhaohu_manager_entity_menu
function zhaohu_manager_entity_menu($hook, $entity_type, $returnvalue, $params)
{
$result = $returnvalue;
if (elgg_in_context("widgets")) {
return $result;
}
if (($entity = elgg_extract("entity", $params)) && elgg_instanceof($entity, "object", Zhaohu::SUBTYPE)) {
$attendee_menu_options = array("name" => "attendee_count", "priority" => 50, "text" => elgg_echo("zhaohu:attending:entity_menu", array($entity->countAttendees())), "href" => false);
$result[] = ElggMenuItem::factory($attendee_menu_options);
// change some of the basic menus
if (!empty($result) && is_array($result)) {
foreach ($result as &$item) {
switch ($item->getName()) {
case "edit":
$item->setHref("zhaohus/zhaohu/edit/" . $entity->getGUID());
break;
case "delete":
$href = elgg_get_site_url() . "action/zhaohu_manager/zhaohu/delete?guid=" . $entity->getGUID();
$href = elgg_add_action_tokens_to_url($href);
$item->setHref($href);
$item->setConfirmText(elgg_echo("deleteconfirm"));
break;
}
}
}
$status_text = elgg_echo("zhaohu:status:{$entity->status}");
$status_mi = array('name' => 'status', 'text' => "<span>{$status_text}</span>", 'href' => false, 'priority' => 50);
$result[] = ElggMenuItem::factory($status_mi);
if ($entity->status == 'published') {
$cancel_href = elgg_get_site_url() . "action/zhaohu_manager/zhaohu/cancel?guid=" . $entity->getGUID();
$cancel_href = elgg_add_action_tokens_to_url($cancel_href);
$cancel_mi = array('name' => 'cancel', 'text' => elgg_echo('cancel'), 'href' => $cancel_href, 'confirm' => elgg_echo('zhaohu:cancelwarning'), 'priority' => 200);
$result[] = ElggMenuItem::factory($cancel_mi);
}
}
return $result;
}
示例14: groups_register_profile_buttons
/**
* Registers the buttons for title area of the group profile page
*
* @param ElggGroup $group
*/
function groups_register_profile_buttons($group)
{
$actions = array();
// group owners
if ($group->canEdit()) {
// edit and invite
$url = elgg_get_site_url() . "groups/edit/{$group->getGUID()}";
$actions[$url] = 'groups:edit';
$url = elgg_get_site_url() . "groups/invite/{$group->getGUID()}";
$actions[$url] = 'groups:invite';
}
// group members
if ($group->isMember(elgg_get_logged_in_user_entity())) {
if ($group->getOwnerGUID() != elgg_get_logged_in_user_guid()) {
// leave
$url = elgg_get_site_url() . "action/groups/leave?group_guid={$group->getGUID()}";
$url = elgg_add_action_tokens_to_url($url);
$actions[$url] = 'groups:leave';
}
} elseif (elgg_is_logged_in()) {
// join - admins can always join.
$url = elgg_get_site_url() . "action/groups/join?group_guid={$group->getGUID()}";
$url = elgg_add_action_tokens_to_url($url);
if ($group->isPublicMembership() || $group->canEdit()) {
$actions[$url] = 'groups:join';
} else {
// request membership
$actions[$url] = 'groups:joinrequest';
}
}
if ($actions) {
foreach ($actions as $url => $text) {
elgg_register_menu_item('title', array('name' => $text, 'href' => $url, 'text' => elgg_echo($text), 'link_class' => 'elgg-button elgg-button-action'));
}
}
}
示例15: registerEntity
/**
* Adds menu items to the entity menu
*
* @param string $hook hook name
* @param string $entity_type hook type
* @param array $returnvalue current return value
* @param array $params parameters
*
* @return array
*/
public static function registerEntity($hook, $entity_type, $returnvalue, $params)
{
if (elgg_in_context('widgets')) {
return;
}
$entity = elgg_extract('entity', $params);
if (!$entity instanceof \Event) {
return;
}
$result = $returnvalue;
$attendee_count = $entity->countAttendees();
if ($attendee_count > 0 || $entity->openForRegistration()) {
$result[] = \ElggMenuItem::factory(['name' => 'attendee_count', 'priority' => 50, 'text' => elgg_echo('event_manager:event:relationship:event_attending:entity_menu', [$attendee_count]), 'href' => false]);
}
// change some of the basic menus
if (!empty($result) && is_array($result)) {
foreach ($result as &$item) {
switch ($item->getName()) {
case 'edit':
$item->setHref('events/event/edit/' . $entity->getGUID());
break;
case 'delete':
$href = elgg_get_site_url() . 'action/event_manager/event/delete?guid=' . $entity->getGUID();
$href = elgg_add_action_tokens_to_url($href);
$item->setHref($href);
$item->setConfirmText(elgg_echo('deleteconfirm'));
break;
}
}
}
// show an unregister link for non logged in users
if (!elgg_is_logged_in() && $entity->register_nologin) {
$result[] = \ElggMenuItem::factory(['name' => 'unsubscribe', 'text' => elgg_echo('event_manager:menu:unsubscribe'), 'href' => 'events/unsubscribe/' . $entity->getGUID() . '/' . elgg_get_friendly_title($entity->title), 'priority' => 300]);
}
return $result;
}