Beispiel #1
0
function donation_footer_menu_hook($hook, $type, $return_value, $params)
{
    //if (elgg_get_plugin_setting("add_donation_footer_menu_item", "donation") == "yes") {
    $return_value[] = ElggMenuItem::factory(array("name" => "donations", "text" => elgg_echo("donation"), "href" => "donation"));
    //}
    return $return_value;
}
Beispiel #2
0
/**
 * 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;
}
Beispiel #3
0
/**
 * This function gets called during the system initialization
 *
 * @return void
 */
function blog_tools_init()
{
    // extend css
    elgg_extend_view('css/elgg', 'css/blog_tools/site.css');
    // extra blog views
    elgg_extend_view('object/blog', 'blog_tools/full/navigation');
    elgg_extend_view('object/blog', 'blog_tools/full/owner');
    elgg_extend_view('object/blog', 'blog_tools/full/related');
    elgg_extend_view('blog/sidebar', 'blog_tools/full/related');
    // register event handlers
    elgg_register_event_handler('upgrade', 'system', '\\ColdTrick\\BlogTools\\Upgrade::moveBlogIcons');
    // register plugin hook handlers
    elgg_register_plugin_hook_handler('entity:url', 'object', '\\ColdTrick\\BlogTools\\Widgets::widgetUrl');
    elgg_register_plugin_hook_handler('cron', 'daily', '\\ColdTrick\\BlogTools\\Cron::daily');
    elgg_register_plugin_hook_handler('route', 'blog', '\\ColdTrick\\BlogTools\\Router::blog');
    elgg_register_plugin_hook_handler('register', 'menu:entity', '\\ColdTrick\\BlogTools\\EntityMenu::register');
    elgg_register_plugin_hook_handler('group_tool_widgets', 'widget_manager', '\\ColdTrick\\BlogTools\\Widgets::groupTools');
    elgg_register_plugin_hook_handler('permissions_check:comment', 'object', '\\ColdTrick\\BlogTools\\Access::blogCanComment');
    elgg_register_plugin_hook_handler('view_vars', 'input/form', '\\ColdTrick\\BlogTools\\Views::blogEditFormVars');
    // extend editmenu
    elgg_extend_view('editmenu', 'blog_tools/editmenu');
    // add featured filter menu item
    elgg_register_menu_item('filter', ElggMenuItem::factory(['name' => 'featured', 'text' => elgg_echo('status:featured'), 'context' => 'blog', 'href' => 'blog/featured', 'priority' => 600]));
    // register index widget
    elgg_register_widget_type('index_blog', elgg_echo('blog'), elgg_echo('blog_tools:widgets:index_blog:description'), ['index'], true);
    elgg_register_widget_type('blog', elgg_echo('blog'), elgg_echo('blog:widget:description'), ['profile', 'dashboard', 'groups']);
    // overrule blog actions
    elgg_register_action('blog/save', dirname(__FILE__) . '/actions/blog/save.php');
    elgg_register_action('blog/auto_save_revision', dirname(__FILE__) . '/actions/blog/auto_save_revision.php');
    // register actions
    elgg_register_action('blog_tools/toggle_metadata', dirname(__FILE__) . '/actions/toggle_metadata.php', 'admin');
    elgg_register_action('blog_tools/upgrades/move_icons', dirname(__FILE__) . '/actions/upgrades/move_icons.php', 'admin');
}
Beispiel #4
0
/**
 * 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 ($item->annotation_id == 0) {
            if ($object->canAnnotate(0, 'likes')) {
                // like button
                $options = array('name' => 'likes', 'href' => false, 'text' => elgg_view('likes/button', array('entity' => $object)), 'is_action' => true, 'priority' => 100);
                $return[] = ElggMenuItem::factory($options);
                // likes count
                $count = elgg_view('likes/count', array('entity' => $object));
                if ($count) {
                    $options = array('name' => 'likes_count', 'text' => $count, 'href' => false, 'priority' => 101);
                    $return[] = ElggMenuItem::factory($options);
                }
            }
        }
    }
    return $return;
}
Beispiel #5
0
 public function getMenuItem(ElggMenuItem $parent, $top_only = false)
 {
     if ($parent) {
         $menu_item = array('name' => "{$parent->getName()}:{$this->guid}", 'parent_name' => "{$parent->getName()}", 'text' => "<img class=\"hj-categories-tree-icon\" src=\"{$this->getIconURL('tiny')}\" width=\"12\" />" . $this->title . ' (' . $this->getFiledEntitiesCount() . ')', 'href' => $this->getURL(), 'class' => 'hj-categories-menu-child', 'priority' => $this->priority, 'data' => array('category_guid' => $this->guid));
     } else {
         $menu_item = array('name' => "{$this->guid}", 'text' => "<img class=\"hj-categories-tree-icon\" src=\"{$this->getIconURL('tiny')}\" width=\"12\" />" . $this->title . ' (' . $this->getFiledEntitiesCount() . ')', 'href' => $this->getURL(), 'class' => 'hj-categories-menu-root', 'priority' => $this->priority, 'data' => array('category_guid' => $this->guid));
     }
     $menu_item = ElggMenuItem::factory($menu_item);
     $return[] = $menu_item;
     // Empty menu item to create html markup
     if ($this->canEdit() && elgg_get_context() == 'category') {
         $add_new = array('name' => "{$menu_item->getName()}:addnew", 'parent_name' => "{$menu_item->getName()}", 'text' => '', 'item_class' => 'hidden', 'href' => false, 'priority' => 1);
         $return[] = ElggMenuItem::factory($add_new);
     }
     if (!$top_only) {
         $children = $this->getChildren();
         if (is_array($children)) {
             foreach ($children as $child) {
                 $submenu = $child->getMenuItem($menu_item);
                 if (is_array($submenu)) {
                     foreach ($submenu as $submenu_item) {
                         $return[] = $submenu_item;
                     }
                 }
             }
         }
     }
     return $return;
 }
Beispiel #6
0
 /**
  * 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;
 }
Beispiel #7
0
 /**
  * @param string $identifier
  * @param array $options
  * @return ElggMenuItem
  */
 public function registerItem($identifier, array $options)
 {
     $options['name'] = $identifier;
     $item = MenuItem::factory($options);
     $this->items[$identifier] = $item;
     return $item;
 }
 /**
  * Add a menu item to the user hover dropdown
  *
  * @param string          $hook         the name of the hook
  * @param string          $type         the type of the hook
  * @param \ElggMenuItem[] $return_value current menu items
  * @param array           $params       supplied params
  *
  * @return void|\ElggMenuItem[]
  */
 public static function register($hook, $type, $return_value, $params)
 {
     static $user_dirs;
     if (!elgg_is_admin_logged_in()) {
         return;
     }
     if (empty($params) || !is_array($params)) {
         return;
     }
     $user = elgg_extract('entity', $params);
     if (!$user instanceof \ElggUser) {
         return;
     }
     if (!isset($user_dirs)) {
         $user_dirs = [];
     }
     // save in a static for performance when viewing user listings
     if (!isset($user_dirs[$user->getGUID()])) {
         $user_dirs[$user->getGUID()] = false;
         $edl = new \Elgg\EntityDirLocator($user->getGUID());
         $path = $edl->getPath();
         if (is_dir(elgg_get_data_path() . $path)) {
             $path = substr($path, 0, -1);
             $user_dirs[$user->getGUID()] = \ElggMenuItem::factory(['name' => 'dataroot-browser', 'text' => elgg_echo('dataroot_browser:menu:user_hover'), 'href' => elgg_http_add_url_query_elements('admin/administer_utilities/dataroot_browser', ['dir' => $path]), 'is_trusted' => true, 'section' => 'admin']);
         }
     }
     if (empty($user_dirs[$user->getGUID()])) {
         return;
     }
     $return_value[] = $user_dirs[$user->getGUID()];
     return $return_value;
 }
Beispiel #9
0
/**
 * Add a button to the file page to allow the user to create a new document
 *
 * @param string $hook         the 'route' hook
 * @param string $type         for the 'file' page handler
 * @param bool   $return_value tells which page is handled, contains:
 *               $return_value['handler'] => requested handler
 *               $return_value['segments'] => url parts ($page)
 * @param null   $params       no params provided
 */
function odt_editor_file_menu_title_hook($hook, $type, $return_value, $params)
{
    if (elgg_in_context('file')) {
        $return_value[] = ElggMenuItem::factory(array("name" => "view", "text" => elgg_echo('odt_editor:newdocument'), "class" => "elgg-button elgg-button-action", "id" => "file_tools_list_new_document_toggle", "priority" => 50));
    }
    return $return_value;
}
Beispiel #10
0
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;
}
Beispiel #11
0
/**
 * 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;
}
 /**
  * Set folder breadcrumb menu
  *
  * @param string         $hook        the name of the hook
  * @param string         $type        the type of the hook
  * @param ElggMenuItem[] $return_value current return value
  * @param array          $params      supplied params
  *
  * @return void|ElggMenuItem[]
  */
 public static function register($hook, $type, $return_value, $params)
 {
     if (empty($params) || !is_array($params)) {
         return;
     }
     $container = elgg_get_page_owner_entity();
     /* @var $folder \ElggObject */
     $folder = elgg_extract('entity', $params);
     if (elgg_instanceof($folder, 'object', FILE_TOOLS_SUBTYPE)) {
         $container = $folder->getContainerEntity();
         $priority = 9999999;
         $return_value[] = \ElggMenuItem::factory(['name' => "folder_{$folder->getGUID()}", 'text' => $folder->getDisplayName(), 'href' => false, 'priority' => $priority]);
         $parent_guid = (int) $folder->parent_guid;
         while (!empty($parent_guid)) {
             $parent = get_entity($parent_guid);
             if (!elgg_instanceof($parent, 'object', FILE_TOOLS_SUBTYPE)) {
                 break;
             }
             $priority--;
             $return_value[] = \ElggMenuItem::factory(['name' => "folder_{$parent->getGUID()}", 'text' => $parent->getDisplayName(), 'href' => $parent->getURL(), 'priority' => $priority]);
             $parent_guid = (int) $parent->parent_guid;
         }
     }
     // make main folder item
     $main_folder_options = ['name' => 'main_folder', 'text' => elgg_echo('file_tools:list:folder:main'), 'priority' => 0];
     if ($container instanceof \ElggGroup) {
         $main_folder_options['href'] = "file/group/{$container->getGUID()}/all#";
     } else {
         $main_folder_options['href'] = "file/owner/{$container->username}/all#";
     }
     $return_value[] = \ElggMenuItem::factory($main_folder_options);
     return $return_value;
 }
Beispiel #13
0
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;
}
Beispiel #14
0
/**
 * This function gets called during the system initialization
 *
 * @return void
 */
function blog_tools_init()
{
    // extend css
    elgg_extend_view("css/elgg", "css/blog_tools/site");
    elgg_extend_view("js/elgg", "js/blog_tools/site");
    // extra blog views
    elgg_extend_view("object/blog", "blog_tools/full/navigation");
    elgg_extend_view("object/blog", "blog_tools/full/owner");
    elgg_extend_view("object/blog", "blog_tools/full/related");
    elgg_extend_view("blog/sidebar", "blog_tools/full/related");
    // register event handlers
    elgg_register_event_handler("delete", "object", array("\\ColdTrick\\BlogTools\\DeleteHandler", "cleanupBlogIcon"));
    // register plugin hook handlers
    elgg_register_plugin_hook_handler("entity:url", "object", array("\\ColdTrick\\BlogTools\\Widgets", "widgetUrl"));
    elgg_register_plugin_hook_handler("cron", "daily", array("\\ColdTrick\\BlogTools\\Cron", "daily"));
    elgg_register_plugin_hook_handler("entity:icon:url", "object", array("\\ColdTrick\\BlogTools\\EntityIcon", "blogIcon"));
    elgg_register_plugin_hook_handler("route", "blog", array("\\ColdTrick\\BlogTools\\Router", "blog"));
    elgg_register_plugin_hook_handler("register", "menu:entity", array("\\ColdTrick\\BlogTools\\EntityMenu", "register"));
    elgg_register_plugin_hook_handler("group_tool_widgets", "widget_manager", array("\\ColdTrick\\BlogTools\\Widgets", "groupTools"));
    elgg_register_plugin_hook_handler("permissions_check:comment", "object", array("\\ColdTrick\\BlogTools\\Access", "blogCanComment"));
    // extend editmenu
    elgg_extend_view("editmenu", "blog_tools/editmenu");
    // add featured filter menu item
    elgg_register_menu_item("filter", ElggMenuItem::factory(array("name" => "featured", "text" => elgg_echo("blog_tools:menu:filter:featured"), "context" => "blog", "href" => "blog/featured", "priority" => 600)));
    // register index widget
    elgg_register_widget_type("index_blog", elgg_echo("blog"), elgg_echo("blog_tools:widgets:index_blog:description"), array("index"), true);
    elgg_register_widget_type("blog", elgg_echo("blog"), elgg_echo("blog:widget:description"), array("profile", "dashboard", "groups"));
    // overrule blog actions
    elgg_register_action("blog/save", dirname(__FILE__) . "/actions/blog/save.php");
    elgg_register_action("blog/auto_save_revision", dirname(__FILE__) . "/actions/blog/auto_save_revision.php");
    // register actions
    elgg_register_action("blog_tools/toggle_metadata", dirname(__FILE__) . "/actions/toggle_metadata.php", "admin");
}
Beispiel #15
0
function friend_request_entity_menu_handler($hook, $type, $returnvalue, $params)
{
    $result = $returnvalue;
    if (!empty($params) && is_array($params) && ($user = elgg_get_logged_in_user_entity())) {
        $entity = elgg_extract("entity", $params);
        if (elgg_instanceof($entity, "user") && $entity->getGUID() != $user->getGUID()) {
            if (!empty($result) && !is_array($result)) {
                $result = array($result);
            } elseif (empty($result)) {
                $result = array();
            }
            // are we friends
            if (!$entity->isFriendOf($user->getGUID())) {
                // no, check if pending request
                if (check_entity_relationship($user->getGUID(), "friendrequest", $entity->getGUID())) {
                    // pending request
                    $result[] = ElggMenuItem::factory(array("name" => "friend_request", "text" => elgg_echo("friend_request:friend:add:pending"), "href" => "friend_request/" . $user->username . "#friend_request_sent_listing", "priority" => 500));
                } else {
                    // add as friend
                    $result[] = ElggMenuItem::factory(array("name" => "add_friend", "text" => elgg_echo("friend:add"), "href" => "action/friends/add?friend=" . $entity->getGUID(), "is_action" => true, "priority" => 500));
                }
            } else {
                // is friend, se remove friend link
                $result[] = ElggMenuItem::factory(array("name" => "remove_friend", "text" => elgg_echo("friend:remove"), "href" => "action/friends/remove?friend=" . $entity->getGUID(), "is_action" => true, "priority" => 500));
            }
        }
    }
    return $result;
}
Beispiel #16
0
/**
 * Allow a user to delete his or her own account.
 */
function delete_me_init()
{
    $actions_dir = dirname(__FILE__) . '/actions/delete_me';
    elgg_register_action('delete_me/delete', "{$actions_dir}/delete.php");
    $link = elgg_view('output/url', array('href' => 'action/delete_me/delete', 'text' => elgg_echo('delete_me'), 'confirm' => elgg_echo('delete_me:confirm')));
    $menu_item = ElggMenuItem::factory(array('name' => 'delete_me', 'text' => $link, 'href' => false, 'context' => 'settings'));
    elgg_register_menu_item('page', $menu_item);
}
 /**
  * Add a menu item to the themeing sandbox
  *
  * @param string          $hook         the name of the hook
  * @param string          $type         the type of the hook
  * @param \ElggMenuItem[] $return_value current return value
  * @param array           $params       supplied params
  *
  * @return void|\ElggMenuItem[]
  */
 public static function menu($hook, $type, $return_value, $params)
 {
     if (!elgg_is_admin_logged_in()) {
         return;
     }
     $return_value[] = \ElggMenuItem::factory(['name' => 'html_email_handler', 'text' => elgg_echo('html_email_handler:theme_preview:menu'), 'href' => 'html_email_handler/test', 'target' => '_blank']);
     return $return_value;
 }
 /**
  * Add menu items to the site menu
  *
  * @param string          $hook   the name of the hook
  * @param string          $type   the type of the hook
  * @param \ElggMenuItem[] $return current menu items
  * @param array           $params provided params
  *
  * @return void|\ElggMenuItem[]
  */
 public static function register($hook, $type, $return, $params)
 {
     if (!translation_editor_is_translation_editor()) {
         return;
     }
     $return[] = \ElggMenuItem::factory(array('name' => 'translation_editor', 'text' => elgg_echo('translation_editor:menu:title'), 'href' => 'translation_editor'));
     return $return;
 }
Beispiel #19
0
 /**
  * Add a menu item to the walled garden menu
  *
  * @param string         $hook        the name of the hook
  * @param string         $type        the type of the hook
  * @param ElggMenuItem[] $returnvalue current return value
  * @param array          $params      supplied params
  *
  * @return ElggMenuItem[]
  */
 public function menu($hook, $type, $returnvalue, $params)
 {
     if (elgg_get_plugin_setting("wg_contact", "contact") === "yes") {
         // add a menu item to the contact form
         $returnvalue[] = \ElggMenuItem::factory(array("name" => "contact", "text" => elgg_echo("contact:title"), "href" => "contact"));
     }
     return $returnvalue;
 }
Beispiel #20
0
 /**
  * add a page menu item for site announcements
  *
  * @param string          $hook        the name of the hook
  * @param string          $type        the type of the hook
  * @param \ElggMenuItem[] $returnvalue current returnvalue
  * @param array           $params      supplied params
  *
  * @return \ElggMenuItem[]
  */
 public static function register($hook, $type, $returnvalue, $params)
 {
     if (!elgg_in_context('admin')) {
         return $returnvalue;
     }
     $returnvalue[] = \ElggMenuItem::factory(array('name' => 'site_announcements', 'text' => elgg_echo('site_annoucements'), 'href' => 'announcements/all', 'is_trusted' => true, 'section' => 'administer', 'parent_name' => 'administer_utilities'));
     return $returnvalue;
 }
Beispiel #21
0
/**
 * Register menu items for the title menu
 *
 * @param string $hook   Hook
 * @param string $type   Type
 * @param array  $return Current return value
 * @param array  $params Hook parameters
 * @return array
 *
 * @access private
 *
 * @since 3.0
 */
function _elgg_activity_owner_block_menu($hook, $type, $return, $params)
{
    $entity = elgg_extract('entity', $params);
    if ($entity instanceof \ElggUser) {
        $return[] = \ElggMenuItem::factory(['name' => 'activity:owner', 'text' => elgg_echo('activity:owner'), 'href' => "activity/owner/{$entity->username}"]);
    }
    return $return;
}
Beispiel #22
0
/**
 * Add a menu item to user hover menu
 *
 * @param string $hook   Plugin hook name
 * @param string $type   Hook type
 * @param array  $menu   Array of ElggMenuItem objects
 * @param array  $params Array of parameters related to menu
 * @return array
 */
function admin_notes_hover_menu($hook, $type, $menu, $params)
{
    $user = $params['entity'];
    $url = "action/admin_notes/add?user_guid={$user->guid}";
    $menu[] = ElggMenuItem::factory(array('name' => 'admin_notes_add', 'text' => elgg_echo('admin_notes:add_note'), 'href' => $url, 'is_action' => true, 'section' => 'admin'));
    $menu[] = ElggMenuItem::factory(array('name' => 'admin_notes_view', 'text' => elgg_echo('admin_notes:view_notes'), 'href' => 'admin_notes/' . $user->username, 'section' => 'admin'));
    return $menu;
}
Beispiel #23
0
function shortcodes_longtext_menu($hook, $type, $items, $vars)
{
    $url = 'shortcodes';
    $items[] = ElggMenuItem::factory(array('name' => 'shortcodes', 'href' => $url, 'text' => elgg_echo('shortcodes:link'), 'rel' => 'lightbox', 'link_class' => "elgg-longtext-control elgg-lightbox", 'priority' => 50));
    elgg_load_js('lightbox');
    elgg_load_css('lightbox');
    return $items;
}
Beispiel #24
0
/**
 * Called during page setup
 *
 * @return void
 */
function account_removal_pagesetup()
{
    $user = elgg_get_logged_in_user_entity();
    if (empty($user) || $user->isAdmin()) {
        return;
    }
    elgg_register_menu_item("page", ElggMenuItem::factory(array("name" => "account_removal", "text" => elgg_echo('account_removal:menu:title'), "href" => "account_removal/" . $user->username, "context" => "settings")));
}
Beispiel #25
0
/**
 * Adds a menu item to quickly inspect the entity via the DB explorer
 *
 * @param string $hook   "register"
 * @param string $type   "menu:entity"
 * @param array  $menu   Menu
 * @param array  $params Hook params
 * @return array
 */
function entity_menu_setup($hook, $type, $menu, $params)
{
    $entity = elgg_extract('entity', $params);
    if (!elgg_instanceof($entity)) {
        return $menu;
    }
    $menu['db_explorer'] = \ElggMenuItem::factory(array('name' => 'db_explorer', 'text' => elgg_echo('db_explorer:inspect'), 'href' => 'admin/developers/db_explorer?guid=' . $entity->guid));
    return $menu;
}
Beispiel #26
0
function zhaohu_manager_init()
{
    zhaohu_expose_restapi();
    // owner block menu
    if (elgg_get_viewtype() == 'default') {
        elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'zh_owner_block_menu');
    }
    // remove rss icon
    elgg_unregister_plugin_hook_handler('output:before', 'layout', 'elgg_views_add_rss_link');
    // Register subtype
    // Register entity_type for search
    elgg_register_entity_type("object", Zhaohu::SUBTYPE);
    elgg_register_entity_type("object", Coupon::SUBTYPE);
    // Extend system CSS with our own styles
    elgg_extend_view("css/elgg", "zhaohu_manager/css/site");
    // Register a page handler, so we can have nice URLs
    elgg_register_page_handler('zhaohus', 'zhaohu_page_handler');
    elgg_register_page_handler('zhaohu_icon', 'zhaohu_icon_handler');
    // Add a menu item to the main site menu
    elgg_register_menu_item('site', ElggMenuItem::factory(array('name' => 'zhaohu', 'href' => '/zhaohus', 'text' => elgg_echo('zhaohu_manager:zhaohu'))));
    // register default elgg zhaohus
    elgg_register_plugin_hook_handler("register", "menu:entity", "zhaohu_manager_entity_menu", 600);
    //actions
    elgg_register_action("zhaohu/broadcast", dirname(__FILE__) . "/actions/zhaohu/broadcast.php");
    elgg_register_action("zhaohu/invite", dirname(__FILE__) . "/actions/zhaohu/invite.php");
    elgg_register_action("zhaohu_manager/zhaohu/cancel", dirname(__FILE__) . "/actions/zhaohu/cancel.php");
    elgg_register_action("zhaohu_manager/zhaohu/delete", dirname(__FILE__) . "/actions/zhaohu/delete.php");
    elgg_register_action("zhaohu_manager/zhaohu/edit", dirname(__FILE__) . "/actions/zhaohu/edit.php");
    elgg_register_action("zhaohu_manager/zhaohu/feature", dirname(__FILE__) . "/actions/zhaohu/feature.php");
    elgg_register_action("zhaohu_manager/zhaohu/publish", dirname(__FILE__) . "/actions/zhaohu/publish.php");
    elgg_register_action("zhaohu_manager/zhaohu/rsvp", dirname(__FILE__) . "/actions/zhaohu/rsvp.php");
    elgg_register_action("coupon/delete", dirname(__FILE__) . "/actions/coupon/delete.php");
    elgg_register_action("coupon/use", dirname(__FILE__) . "/actions/coupon/use.php");
    elgg_register_action("coupons/gen", dirname(__FILE__) . "/actions/coupons/gen.php");
    elgg_register_action("coupons/send", dirname(__FILE__) . "/actions/coupons/send.php");
    // add widgets
    //elgg_register_widget_type("zhaohus", elgg_echo("zhaohu:widgets:title"), elgg_echo("zhaohu:widgets:description"), "index,dashboard,profile,groups");
    //elgg_register_plugin_hook_handler("widget_url", "widget_manager", "zhaohu_manager_widget_zhaohus_url");
    // register js libraries
    //$maps_key = elgg_get_plugin_setting("google_api_key", "zhaohu_manager");
    $maps_key = "";
    elgg_register_simplecache_view("js/zhaohu_manager/gm_div");
    $gm_div_js = elgg_get_simplecache_url("js", "zhaohu_manager/gm_div");
    elgg_register_js("zhaohu_manager.maps.gm.div", $gm_div_js, 'footer');
    elgg_register_js("zhaohu_manager.maps.base", "//maps.googleapis.com/maps/api/js?sensor=false", 'footer');
    elgg_register_simplecache_view("js/addthisevent/atemin");
    $addthisevent_js = elgg_get_simplecache_url("js", "addthisevent/atemin");
    elgg_register_js("addthisevent.base", $addthisevent_js, 'footer');
    //
    $view_type = elgg_get_viewtype();
    elgg_register_simplecache_view("js/zhaohu_manager/search");
    $search_js = elgg_get_simplecache_url("js", "zhaohu_manager/search");
    elgg_register_js("zhaohu_manager.search", $search_js);
    elgg_register_simplecache_view("js/zhaohu_manager/edit");
    $edit_js = elgg_get_simplecache_url("js", "zhaohu_manager/edit");
    elgg_register_js("zhaohu_manager.edit", $edit_js);
}
Beispiel #27
0
 /**
  * Add items to the file entity menu
  *
  * @param string         $hook        the name of the hook
  * @param string         $type        the type of the hook
  * @param ElggMenuItem[] $return_value current return value
  * @param array          $params      supplied params
  *
  * @return void|ElggMenuItem[]
  */
 public static function registerFile($hook, $type, $return_value, $params)
 {
     $entity = elgg_extract('entity', $params);
     if (!$entity instanceof \ElggFile) {
         return;
     }
     $return_value[] = \ElggMenuItem::factory(['name' => 'download', 'text' => elgg_view_icon('download'), 'title' => elgg_echo('download'), 'href' => elgg_get_download_url($entity), 'priority' => 200]);
     return $return_value;
 }
Beispiel #28
0
/**
 * Add personal activity link to user_hover menu
 * 
 * @param string         $hook   Hook name
 * @param string         $type   Hook type
 * @param ElggMenuItem[] $return Array of ElggMenuItem objects
 * @param array          $params
 * @return ElggMenuItem[] $return Array of ElggMenuItem objects
 */
function personal_activity_user_hover_menu_setup($hook, $type, $return, $params)
{
    if (!elgg_is_logged_in()) {
        return $return;
    }
    $user = $params['entity'];
    $return[] = ElggMenuItem::factory(array('name' => 'personal_activity', 'text' => elgg_echo('personal_activity'), 'href' => "activity/owner/{$user->username}"));
    return $return;
}
Beispiel #29
0
 /**
  * @codeCoverageIgnore
  */
 public static function menu_register()
 {
     $result = array();
     $result[] = ElggMenuItem::factory(array('name' => 'admin/code/diagnostic', 'href' => 'admin/code/diagnostic', 'text' => elgg_echo('admin:code:diagnostic')));
     $result[] = ElggMenuItem::factory(array('name' => 'admin/code/diagnostic/deprecated_list', 'href' => 'admin/code/diagnostic/deprecated_list', 'text' => elgg_echo('admin:code:diagnostic:deprecated_list')));
     $result[] = ElggMenuItem::factory(array('name' => 'admin/code/diagnostic/private_list', 'href' => 'admin/code/diagnostic/private_list', 'text' => elgg_echo('admin:code:diagnostic:private_list')));
     $result[] = ElggMenuItem::factory(array('name' => 'admin/code/diagnostic/functions_list', 'href' => 'admin/code/diagnostic/functions_list', 'text' => elgg_echo('admin:code:diagnostic:functions_list')));
     return $result;
 }
Beispiel #30
0
function ckeditor_longtext_menu($hook, $type, $items, $vars)
{
    $id = elgg_extract('id', $vars);
    if ($id === null) {
        return;
    }
    $items[] = ElggMenuItem::factory(array('name' => 'ckeditor_toggler', 'link_class' => 'ckeditor-toggle-editor elgg-longtext-control hidden', 'href' => "#{$id}", 'text' => elgg_echo('ckeditor:html')));
    return $items;
}