Example #1
0
 /**
  * Core registration function for external files
  *
  * @param string $type     Type of external resource (js or css)
  * @param string $name     Identifier used as key
  * @param string $url      URL
  * @param string $location Location in the page to include the file
  * @param int    $priority Loading priority of the file
  *
  * @return bool
  */
 public function register($type, $name, $url, $location, $priority = 500)
 {
     if (empty($name) || empty($url)) {
         return false;
     }
     $url = elgg_format_url($url);
     $url = elgg_normalize_url($url);
     $this->bootstrap($type);
     $name = trim(strtolower($name));
     // normalize bogus priorities, but allow empty, null, and false to be defaults.
     if (!is_numeric($priority)) {
         $priority = 500;
     }
     // no negative priorities right now.
     $priority = max((int) $priority, 0);
     $item = elgg_extract($name, $this->CONFIG->externals_map[$type]);
     if ($item) {
         // updating a registered item
         // don't update loaded because it could already be set
         $item->url = $url;
         $item->location = $location;
         // if loaded before registered, that means it hasn't been added to the list yet
         if ($this->CONFIG->externals[$type]->contains($item)) {
             $priority = $this->CONFIG->externals[$type]->move($item, $priority);
         } else {
             $priority = $this->CONFIG->externals[$type]->add($item, $priority);
         }
     } else {
         $item = new \stdClass();
         $item->loaded = false;
         $item->url = $url;
         $item->location = $location;
         $priority = $this->CONFIG->externals[$type]->add($item, $priority);
     }
     $this->CONFIG->externals_map[$type][$name] = $item;
     return $priority !== false;
 }
Example #2
0
function event_calendar_get_page_content_list($page_type, $container_guid, $start_date, $display_mode, $filter, $region = '-')
{
    elgg_require_js('event_calendar/event_calendar');
    global $autofeed;
    $autofeed = true;
    elgg_push_breadcrumb(elgg_echo('item:object:event_calendar'), 'event_calendar/list');
    if ($page_type == 'group') {
        $group = get_entity($container_guid);
        if (!event_calendar_activated_for_group($group)) {
            forward();
        }
        elgg_push_breadcrumb($group->name, 'event_calendar/group/' . $group->getGUID());
        elgg_push_context('groups');
        elgg_set_page_owner_guid($container_guid);
        if (event_calendar_can_add($container_guid)) {
            elgg_register_menu_item('title', array('name' => 'add', 'href' => "event_calendar/add/" . $container_guid, 'text' => elgg_echo('event_calendar:add'), 'link_class' => 'elgg-button elgg-button-action event-calendar-button-add'));
        }
    } else {
        if ($page_type == 'list') {
            if ($filter == 'mine') {
                $logged_in_user = elgg_get_logged_in_user_entity();
                elgg_push_breadcrumb($logged_in_user->name, 'event_calendar/owner/' . $logged_in_user->username);
            } else {
                if ($filter == 'friends') {
                    $logged_in_user = elgg_get_logged_in_user_entity();
                    elgg_push_breadcrumb($logged_in_user->name, 'event_calendar/owner/' . $logged_in_user->username);
                    elgg_push_breadcrumb(elgg_echo('friends'));
                } else {
                    if ($filter == 'open') {
                        elgg_push_breadcrumb(elgg_echo('event_calendar:show_open'));
                    }
                }
            }
            if (event_calendar_can_add()) {
                elgg_register_menu_item('title', array('name' => 'add', 'href' => "event_calendar/add", 'text' => elgg_echo('event_calendar:add'), 'link_class' => 'elgg-button elgg-button-action event-calendar-button-add'));
            }
        } else {
            $owner = get_entity($container_guid);
            elgg_set_page_owner_guid($container_guid);
            elgg_push_breadcrumb($owner->name, 'event_calendar/owner/' . $owner->username);
            if (event_calendar_can_add()) {
                elgg_register_menu_item('title', array('name' => 'add', 'href' => "event_calendar/add", 'text' => elgg_echo('event_calendar:add'), 'link_class' => 'elgg-button elgg-button-action event-calendar-button-add'));
            }
        }
    }
    $params = event_calendar_generate_listing_params($page_type, $container_guid, $start_date, $display_mode, $filter, $region);
    $title = $params['title'];
    if (elgg_get_plugin_setting('ical_import_export', 'event_calendar') == "yes") {
        $url = current_page_url();
        if (substr_count($url, '?')) {
            $url .= "&view=ical";
        } else {
            $url .= "?view=ical";
        }
        $url = elgg_format_url($url);
        $menu_options = array('name' => 'ical', 'id' => 'event-calendar-ical-link', 'text' => '<img src="' . elgg_get_simplecache_url('event_calendar/ics.png') . '" />', 'href' => $url, 'title' => elgg_echo('feed:ical'), 'priority' => 800);
        $menu_item = ElggMenuItem::factory($menu_options);
        elgg_register_menu_item('extras', $menu_item);
    }
    $body = elgg_view_layout("content", $params);
    return elgg_view_page($title, $body);
}
Example #3
0
/**
 * Most recently voted images - world view only
 *
 */
// set up breadcrumbs
elgg_push_breadcrumb(elgg_echo('photos'), 'photos/siteimagesall');
elgg_push_breadcrumb(elgg_echo('tidypics:recentlyvoted'));
$offset = (int) get_input('offset', 0);
$limit = (int) get_input('limit', 16);
$options = array('type' => 'object', 'subtype' => 'image', 'limit' => $limit, 'offset' => $offset, 'annotation_name' => 'fivestar', 'order_by_annotation' => "n_table.time_created desc", 'full_view' => false, 'list_type' => 'gallery', 'gallery_class' => 'tidypics-gallery');
$result = elgg_list_entities_from_annotations($options);
$title = elgg_echo('tidypics:recentlyvoted');
if (elgg_is_logged_in()) {
    $logged_in_guid = elgg_get_logged_in_user_guid();
    elgg_register_menu_item('title', array('name' => 'addphotos', 'href' => "ajax/view/photos/selectalbum/?owner_guid=" . $logged_in_guid, 'text' => elgg_echo("photos:addphotos"), 'link_class' => 'elgg-button elgg-button-action elgg-lightbox'));
}
// only show slideshow link if slideshow is enabled in plugin settings and there are images
if (elgg_get_plugin_setting('slideshow', 'tidypics') && !empty($result)) {
    elgg_require_js('tidypics/slideshow');
    $url = elgg_get_site_url() . "photos/recentvotes?limit=64&offset={$offset}&view=rss";
    $url = elgg_format_url($url);
    elgg_register_menu_item('title', array('name' => 'slideshow', 'id' => 'slideshow', 'data-slideshowurl' => $url, 'href' => '#', 'text' => "<img src=\"" . elgg_get_simplecache_url("tidypics/slideshow.png") . "\" alt=\"" . elgg_echo('album:slideshow') . "\">", 'title' => elgg_echo('album:slideshow'), 'link_class' => 'elgg-button elgg-button-action'));
}
if (!empty($result)) {
    $area2 = $result;
} else {
    $area2 = elgg_echo('tidypics:recentlyvoted:nosuccess');
}
$body = elgg_view_layout('content', array('filter_override' => '', 'content' => $area2, 'title' => $title, 'sidebar' => elgg_view('photos/sidebar_im', array('page' => 'all'))));
// Draw it
echo elgg_view_page(elgg_echo('tidypics:recentlyvoted'), $body);
 if ($link !== false || $link !== true) {
     $link = true;
 }
 if ($icon !== false || $icon !== true) {
     $icon = true;
 }
 if ($onlineStatus !== false || $onlineStatus !== true) {
     $onlineStatus = true;
 }
 if (empty($iconSize) || !in_array($iconSize, array("tiny", "small", "medium", "large", "profile"))) {
     $iconSize = "tiny";
 }
 $result = "";
 $result .= "<tr class='chatmember'>";
 if ($icon) {
     $result .= "<td>" . elgg_view('output/img', array('src' => elgg_format_url($user->getIconURL($iconSize)), 'class' => 'messageIcon')) . "</td>";
 }
 if ($link) {
     $result .= "<td class='chatmemberinfo'><a href='" . $user->getUrl() . "' title='" . $user->name . "' rel='" . $user->guid . "'>" . $user->name . "</a></td>";
 } else {
     $result .= "<td class='chatmemberinfo'>" . $user->name . "</td>";
 }
 if ($onlineStatus) {
     $diff = time() - $user->last_action;
     $inactive = (int) elgg_get_plugin_setting("onlinestatus_inactive", "elggchat");
     $active = (int) elgg_get_plugin_setting("onlinestatus_active", "elggchat");
     $title = elgg_echo("elggchat:session:onlinestatus", array(elgg_get_friendly_time($user->last_action)));
     if ($diff <= $active) {
         $result .= "<td><div class='online_status_chat' title='" . $title . "'></div></td>";
     } elseif ($diff <= $inactive) {
         $result .= "<td><div class='online_status_chat online_status_idle' title='" . $title . "'></div></td>";
Example #5
0
/**
 * Add the rss link to the extras when if needed
 *
 * @return void
 * @access private
 */
function elgg_views_add_rss_link()
{
    global $autofeed;
    if (isset($autofeed) && $autofeed == true) {
        $url = current_page_url();
        if (substr_count($url, '?')) {
            $url .= "&view=rss";
        } else {
            $url .= "?view=rss";
        }
        $url = elgg_format_url($url);
        elgg_register_menu_item('extras', array('name' => 'rss', 'text' => elgg_view_icon('rss'), 'href' => $url, 'title' => elgg_echo('feed:rss')));
    }
}
Example #6
0
if ($pagination && $count) {
    $nav .= elgg_view('navigation/pagination', array('offset' => $offset, 'count' => $count, 'limit' => $limit, 'offset_key' => $offset_key));
}
if ($position == 'before' || $position == 'both') {
    echo $nav;
}
?>

<div class="row grid-view">




	<?php 
foreach ($items as $item) {
    $icon_url = elgg_format_url($item->getIconURL('medium'));
    $user = elgg_get_logged_in_user_entity();
    ?>
			
<div class="col-lg-3 col-md-4 col-sm-3 col-xs-6">
		<div class="detail3 clearfix">
			<div class="col-lg-12 description">
				<div class="row pro-pic">
                <?php 
    if (elgg_is_active_plugin('profile') && ($user->permission == 'allowed' || elgg_is_admin_logged_in())) {
        echo '<a href="' . elgg_get_site_url() . 'profile/' . $item->username . '">';
    }
    echo '<img alt="mask" src="' . $icon_url . '" alt="' . $item->name . '\'s photo">';
    if (elgg_is_active_plugin('profile') && ($user->permission == 'allowed' || elgg_is_admin_logged_in())) {
        echo '</a>';
    }
Example #7
0
/**
 * File icon view
 *
 * @uses $vars['entity'] The entity the icon represents - uses getIconURL() method
 * @uses $vars['size']   topbar, tiny, small, medium (default), large, master
 * @uses $vars['href']   Optional override for link
 */
$entity = $vars['entity'];
$sizes = array('small', 'medium', 'large', 'tiny', 'master', 'topbar');
// Get size
if (!in_array($vars['size'], $sizes)) {
    $vars['size'] = "medium";
}
$title = $entity->title;
$url = $entity->getURL();
if (isset($vars['href'])) {
    $url = $vars['href'];
}
$class = '';
if ($entity->thumbnail) {
    $class = 'class="elgg-photo"';
}
$img_src = $entity->getIconURL($vars['size']);
$img_src = elgg_format_url($img_src);
$img = "<img {$class} src=\"{$img_src}\" alt=\"{$title}\" />";
if ($url) {
    echo elgg_view('output/url', array('href' => $url, 'text' => $img));
} else {
    echo $img;
}
function event_calendar_get_page_content_list($page_type, $container_guid, $start_date, $display_mode, $filter, $region = '-')
{
    elgg_load_js('elgg.event_calendar');
    global $autofeed;
    $autofeed = true;
    if ($page_type == 'group') {
        if (!event_calendar_activated_for_group($container_guid)) {
            forward();
        }
        elgg_push_breadcrumb(elgg_echo('event_calendar:group_breadcrumb'));
        elgg_push_context('groups');
        elgg_set_page_owner_guid($container_guid);
        $user_guid = elgg_get_logged_in_user_guid();
        $group_calendar = elgg_get_plugin_setting('group_calendar', 'event_calendar');
        if (!$group_calendar || $group_calendar == 'members') {
            if (elgg_get_page_owner_entity()->canWriteToContainer($user_guid)) {
                elgg_register_menu_item('title', array('name' => 'add', 'href' => "event_calendar/add/" . $container_guid, 'text' => elgg_echo('event_calendar:add'), 'class' => 'elgg-button elgg-button-action'));
            }
        } else {
            if ($group_calendar == 'admin') {
                if (elgg_is_admin_logged_in() || $group->owner_guid == $user_guid) {
                    elgg_register_menu_item('title', array('name' => 'add', 'href' => "event_calendar/add/" . $container_guid, 'text' => elgg_echo('event_calendar:add'), 'class' => 'elgg-button elgg-button-action'));
                }
            }
        }
    } else {
        elgg_push_breadcrumb(elgg_echo('item:object:event_calendar'));
        $site_calendar = elgg_get_plugin_setting('site_calendar', 'event_calendar');
        if (!$site_calendar || $site_calendar == 'admin') {
            // only admins can post directly to the site-wide calendar
            if (elgg_is_admin_logged_in()) {
                elgg_register_menu_item('title', array('name' => 'add', 'href' => "event_calendar/add", 'text' => elgg_echo('event_calendar:add'), 'class' => 'elgg-button elgg-button-action'));
            }
        } else {
            if ($site_calendar == 'loggedin') {
                // any logged-in user can post to the site calendar
                if (elgg_is_logged_in()) {
                    elgg_register_menu_item('title', array('name' => 'add', 'href' => "event_calendar/add", 'text' => elgg_echo('event_calendar:add'), 'class' => 'elgg-button elgg-button-action'));
                }
            }
        }
    }
    $params = event_calendar_generate_listing_params($page_type, $container_guid, $start_date, $display_mode, $filter, $region);
    $url = full_url();
    if (substr_count($url, '?')) {
        $url .= "&view=ical";
    } else {
        $url .= "?view=ical";
    }
    $url = elgg_format_url($url);
    $menu_options = array('name' => 'ical', 'id' => 'event-calendar-ical-link', 'text' => '<img src="' . elgg_get_site_url() . 'mod/event_calendar/images/ics.png" />', 'href' => $url, 'title' => elgg_echo('feed:ical'), 'priority' => 800);
    $menu_item = ElggMenuItem::factory($menu_options);
    elgg_register_menu_item('extras', $menu_item);
    $body = elgg_view_layout("content", $params);
    return elgg_view_page($title, $body);
}
Example #9
0
function getBatchImages($id, $user_guid)
{
    // Get images related to this batch
    $results = elgg_get_entities_from_relationship(array('relationship' => 'belongs_to_batch', 'relationship_guid' => $id, 'inverse_relationship' => true, 'type' => 'object', 'subtype' => 'image', 'offset' => 0));
    $site_url = get_config('wwwroot');
    if ($results) {
        foreach ($results as $result) {
            if ($result->enabled == "yes") {
                $file_name = $result->getFilenameOnFilestore();
                $image_owner_guid_entity = $result->getOwnerEntity();
                $image_owner_guid = $image_owner_guid_entity->guid;
                $image_owner_join_date = $image_owner_guid_entity->time_created;
                $position = strrpos($file_name, '/');
                $position = $position + 1;
                $icon_file_name = substr_replace($file_name, 'largethumb', $position, 0);
                $image_icon_url = $site_url . 'services/api/rest/json/?method=image.get_post';
                $image_icon_url = $image_icon_url . '&joindate=' . $image_owner_join_date . '&guid=' . $image_owner_guid . '&name=' . $icon_file_name;
                $icon_url = elgg_format_url($image_icon_url);
                $image_url = $site_url . 'services/api/rest/json/?method=image.get_post';
                $image_url = $image_url . '&joindate=' . $image_owner_join_date . '&guid=' . $image_owner_guid . '&name=' . $file_name;
                $img_url = elgg_format_url($image_url);
                $image['guid'] = $result->guid;
                $image['container_guid'] = $result->container_guid;
                $image['title'] = $result->title;
                $image['time_create'] = $image_owner_join_date;
                $image['owner_guid'] = $result->owner_guid;
                $image['icon_url'] = $icon_url;
                $image['img_url'] = $img_url;
                $image['like_count'] = likes_count_number_of_likes($result->guid);
                $image['comment_count'] = api_get_image_comment_count($result->guid);
                $image['like'] = checkLike($result->guid, $user_guid);
            }
            $return[] = $image;
        }
    }
    return $return;
}
Example #10
0
<?php

if (elgg_is_logged_in()) {
    $body = elgg_view('subsite_manager/account/details');
    $spacer_url = elgg_get_site_url() . '_graphics/spacer.gif';
    $icon_url = elgg_format_url(elgg_get_logged_in_user_entity()->getIconURL("tiny"));
    $icon = elgg_view('output/img', array('src' => $spacer_url, 'alt' => elgg_get_logged_in_user_entity()->name, 'title' => elgg_get_logged_in_user_entity()->name, 'class' => "elgg-avatar elgg-avatar-small", 'style' => "background: url({$icon_url}) no-repeat;"));
    $messages = "";
    if (elgg_is_active_plugin("messages")) {
        if ($message_count = messages_count_unread()) {
            $messages = " <span class='subsite-manager-account-dropdown-messages'>[" . $message_count . "]</span>";
        }
    }
    echo "<div id='subsite-manager-login-dropdown'>";
    echo elgg_view('output/url', array('href' => 'login#login-dropdown-box', 'rel' => 'popup', 'class' => 'elgg-button elgg-button-dropdown subsite-manager-account-dropdown-button', 'text' => $icon . elgg_get_logged_in_user_entity()->name . $messages));
    echo elgg_view_module('dropdown', '', $body, array('id' => 'login-dropdown-box', 'class' => 'subsite-manager-account-dropdown'));
    echo "</div>";
}
Example #11
0
function event_calendar_get_page_content_list($page_type, $container_guid, $start_date, $display_mode, $filter, $region = '-')
{
    elgg_load_js('elgg.event_calendar');
    global $autofeed;
    $autofeed = true;
    if ($page_type == 'group') {
        if (!event_calendar_activated_for_group($container_guid)) {
            forward();
        }
        elgg_push_breadcrumb(elgg_echo('event_calendar:group_breadcrumb'));
        elgg_push_context('groups');
        elgg_set_page_owner_guid($container_guid);
        $user_guid = elgg_get_logged_in_user_guid();
        if (event_calendar_can_add($container_guid)) {
            elgg_register_menu_item('title', array('name' => 'add', 'href' => "event_calendar/add/" . $container_guid, 'text' => elgg_echo('event_calendar:add'), 'class' => 'elgg-button elgg-button-action event-calendar-button-add'));
        }
    } else {
        elgg_push_breadcrumb(elgg_echo('item:object:event_calendar'));
        $user_guid = elgg_get_logged_in_user_guid();
        if (event_calendar_can_add($container_guid)) {
            elgg_register_menu_item('title', array('name' => 'add', 'href' => "event_calendar/add", 'text' => elgg_echo('event_calendar:add'), 'class' => 'elgg-button elgg-button-action event-calendar-button-add'));
        }
    }
    $params = event_calendar_generate_listing_params($page_type, $container_guid, $start_date, $display_mode, $filter, $region);
    $url = current_page_url();
    if (substr_count($url, '?')) {
        $url .= "&view=ical";
    } else {
        $url .= "?view=ical";
    }
    $url = elgg_format_url($url);
    $menu_options = array('name' => 'ical', 'id' => 'event-calendar-ical-link', 'text' => elgg_view_icon('calendar'), 'href' => $url, 'title' => elgg_echo('feed:ical'), 'priority' => 800, 'rel' => 'popup');
    $menu_item = ElggMenuItem::factory($menu_options);
    elgg_register_menu_item('extras', $menu_item);
    $body = elgg_view_layout("content", $params);
    $body .= elgg_view_module('popup', elgg_echo('feed:ical'), elgg_echo('event_calendar:ical_popup_message') . elgg_view('output/url', array('href' => $url, 'text' => elgg_echo('export'), 'class' => 'elgg-button elgg-button-action')), array('id' => 'event-calendar-ical', 'class' => 'event-calendar-ical hidden'));
    return elgg_view_page($title, $body);
}
Example #12
0
}
$use_link = elgg_extract('use_link', $vars, true);
if (!elgg_instanceof($task, 'object', 'task')) {
    return true;
}
$title = htmlspecialchars($task->title, ENT_QUOTES, 'UTF-8', false);
$guid = $task->guid;
$img_class = '';
if (isset($vars['img_class'])) {
    $img_class = $vars['img_class'];
}
$use_hover = elgg_extract('use_hover', $vars, $task->canEdit());
if (isset($vars['hover'])) {
    $use_hover = $vars['hover'];
}
$icon_url = elgg_format_url($task->getIconURL($size));
$icon = elgg_view('output/img', array('src' => $icon_url, 'alt' => $name, 'title' => $name, 'class' => $img_class));
?>
<div class="elgg-avatar elgg-task-icon">
<?php 
if ($use_hover) {
    tasks_register_actions_menu($task);
    $params = array('entity' => $task, 'guid' => $guid, 'title' => $title, 'class' => 'elgg-menu-hover');
    echo elgg_view_icon('hover-menu');
    echo elgg_view_menu('tasks_hover', $params);
    tasks_reset_actions_menu();
}
if ($use_link) {
    $class = elgg_extract('link_class', $vars, '');
    $url = elgg_extract('href', $vars, $task->getURL());
    echo elgg_view('output/url', array('href' => $url, 'text' => $icon, 'is_trusted' => true, 'class' => $class));
Example #13
0
File: views.php Project: elgg/elgg
/**
 * Prepare the variables for the html head
 *
 * @param string $title Page title for <head>
 * @return array
 * @access private
 */
function _elgg_views_prepare_head($title)
{
    $params = array('links' => array(), 'metas' => array());
    if (empty($title)) {
        $params['title'] = elgg_get_config('sitename');
    } else {
        $params['title'] = $title . ' : ' . elgg_get_config('sitename');
    }
    $params['metas']['content-type'] = array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=utf-8');
    $params['metas']['description'] = array('name' => 'description', 'content' => elgg_get_config('sitedescription'));
    // https://developer.chrome.com/multidevice/android/installtohomescreen
    $params['metas']['viewport'] = array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0');
    $params['metas']['mobile-web-app-capable'] = array('name' => 'mobile-web-app-capable', 'content' => 'yes');
    $params['metas']['apple-mobile-web-app-capable'] = array('name' => 'apple-mobile-web-app-capable', 'content' => 'yes');
    // RSS feed link
    if (_elgg_has_rss_link()) {
        $url = current_page_url();
        if (substr_count($url, '?')) {
            $url .= "&view=rss";
        } else {
            $url .= "?view=rss";
        }
        $params['links']['rss'] = array('rel' => 'alternative', 'type' => 'application/rss+xml', 'title' => 'RSS', 'href' => elgg_format_url($url));
    }
    return $params;
}
Example #14
0
<?php

/**
 * zhaohu link view
 *
 * @uses string $vars['href'] the link src url.
 * @uses string $vars['text'] the link text
 */
$vars['href'] = elgg_normalize_url($vars['href']);
$vars['href'] = elgg_format_url($vars['href']);
$text = $vars['text'];
$attributes = elgg_format_attributes($vars);
echo "<a {$attributes}>{$text}</a>";
Example #15
0
File: img.php Project: ibou77/elgg
<?php

/**
 * Elgg image view
 *
 * @uses string $vars['src'] The image src url (required).
 * @uses string $vars['alt'] The alternate text for the image (required).
 */
if (!isset($vars['alt'])) {
    elgg_log("The view output/img requires that the alternate text be set.", 'NOTICE');
}
$vars['src'] = elgg_normalize_url($vars['src']);
$vars['src'] = elgg_format_url($vars['src']);
$attributes = elgg_format_attributes($vars);
echo "<img {$attributes}/>";
Example #16
0
echo elgg_echo('bulk_user_admin:lastaction');
?>
</th>
		<th><?php 
echo elgg_echo('bulk_user_admin:contentcounts');
?>
</th>
	</tr>

<?php 
foreach ($users as $user) {
    $checkbox = elgg_view('input/checkbox', array('name' => 'bulk_user_admin_guids[]', 'value' => $user->guid, 'default' => false, 'id' => 'elgg-user-' . $user->guid));
    $spacer_url = elgg_get_site_url() . '_graphics/spacer.gif';
    $name = htmlspecialchars($user->name, ENT_QUOTES, 'UTF-8', false);
    $username = $user->username;
    $icon_url = elgg_format_url($user->getIconURL('tiny'));
    $icon = elgg_view('output/img', array('src' => $spacer_url, 'alt' => $name, 'title' => $name, 'class' => '', 'style' => "background: url({$icon_url}) no-repeat;"));
    $user_icon = "<div class='elgg-avatar elgg-avatar-tiny'>";
    $user_icon .= elgg_view('output/url', array('href' => $user->getURL(), 'text' => $icon, 'is_trusted' => true, 'class' => "elgg-avatar elgg-avatar-tiny bulk-user-admin-icon"));
    $user_icon .= elgg_view_icon('hover-menu');
    $user_icon .= elgg_view_menu('user_hover', array('entity' => $user, 'username' => $username, 'name' => $name));
    $user_icon .= "</div>";
    foreach (array('time_created', 'last_login', 'last_action') as $ts_name) {
        $ts = $user->{$ts_name};
        if ($ts) {
            ${$ts_name} = elgg_view_friendly_time($ts);
        } else {
            ${$ts_name} = elgg_echo('bulk_user_admin:notavailable');
        }
    }
    $object_count = elgg_get_entities(array('owner_guid' => $user->guid, 'count' => true));
Example #17
0
    if (is_array($group_podcast_settings)) {
        $podcast_title = $group_podcast_settings['title'];
        $podcast_subtitle = $group_podcast_settings['subtitle'];
        $podcast_description = $group_podcast_settings['description'];
    }
    $podcast_settings_url = "podcasts/group/{$page_owner->guid}/edit";
} else {
    if (elgg_instanceof($page_owner, 'user')) {
        $podcast_title = elgg_get_plugin_user_setting('podcast_title', $page_owner->guid, 'podcasts');
        $podcast_subtitle = elgg_get_plugin_user_setting('podcast_subtitle', $page_owner->guid, 'podcasts');
        $podcast_description = elgg_get_plugin_user_setting('podcast_description', $page_owner->guid, 'podcasts');
        $podcast_settings_url = "podcasts/settings/{$page_owner->username}";
    }
}
$body .= $podcast_subtitle ? "<div class='elgg-subtext'>{$podcast_subtitle}</div>" : '';
$body .= $podcast_description ? "<div class='elgg-output'>{$podcast_description}</div>" : '';
if ($body) {
    echo elgg_view_module('aside', $podcast_title, $body);
}
// Add subscribe link
$podcast_feed_url = full_url();
if (substr_count($podcast_feed_url, '?')) {
    $podcast_feed_url .= "&view=rss";
} else {
    $podcast_feed_url .= "?view=rss";
}
$podcast_feed_url = elgg_format_url($podcast_feed_url);
echo elgg_view('output/url', array('name' => 'podcast_rss', 'text' => elgg_view_icon('rss') . elgg_echo('podcasts:subscribe'), 'href' => $podcast_feed_url, 'class' => 'elgg-podcasts-subscribe-link'));
if ($page_owner && $page_owner->canEdit()) {
    echo elgg_view('output/url', array('text' => elgg_echo('podcasts:editpodcastsettings'), 'href' => $podcast_settings_url, 'class' => 'elgg-button elgg-button-action elgg-podcast-edit-button'));
}
Example #18
0
<?php

$entity = elgg_extract('entity', $vars);
if (!elgg_instanceof($entity, 'object', 'file')) {
    return;
}
$mime = elgg_file_viewer_get_mime_type($entity);
$base_type = substr($mime, 0, strpos($mime, '/'));
if ($base_type !== 'image') {
    echo elgg_view("file/specialcontent/{$base_type}/default", $vars);
    return;
}
if (elgg_view_exists("file/specialcontent/{$mime}")) {
    echo elgg_view("file/specialcontent/{$mime}", $vars);
    return;
}
$info = pathinfo($entity->getFilenameOnFilestore());
$extension = $info['extension'];
$app = elgg_get_plugin_setting($extension, 'elgg_file_viewer');
if ($app && $app != 'none') {
    echo elgg_view("elgg_file_viewer/apps/{$app}", $vars);
    return;
}
$image_url = elgg_format_url($entity->getIconURL('large'));
$download_url = elgg_get_site_url() . "file/download/{$entity->getGUID()}";
echo <<<HTML
<div class="file-photo">
\t<a href="{$download_url}"><img class="elgg-photo" src="{$image_url}" /></a>
</div>
HTML
;
Example #19
0
	xmlns:dc="http://purl.org/dc/elements/1.1/">

	<rdf:Description rdf:about="">
		<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/PersonalProfileDocument"/>
		<foaf:maker rdf:resource="#me"/>
		<foaf:primaryTopic rdf:resource="#me"/>
	</rdf:Description>

	<foaf:Person rdf:about="#me">
		<foaf:nick><?php 
echo $owner->username;
?>
</foaf:nick>
		<foaf:name><?php 
echo $owner->name;
?>
</foaf:name>
		<foaf:homepage rdf:resource="<?php 
echo $owner->getURL();
?>
" />
		<foaf:depiction rdf:resource="<?php 
echo elgg_format_url($owner->getIconURL('large'));
?>
" />
<?php 
echo $vars['body'];
?>
	</foaf:Person>
</rdf:RDF>
Example #20
0
 * http://www.opensearch.org/Specifications/OpenSearch/1.1
 */
// reset cache headers because IE8 is stupid
header('Pragma: public', true);
header('Cache-Control: public', true);
$config_ini = dirname(dirname(dirname(dirname(__FILE__)))) . '/config.ini';
$config = parse_ini_file($config_ini);
if ($config == false) {
    elgg_log("Unable to parse OpenSearch config file", 'ERROR');
    return true;
}
extract($config);
$site = elgg_get_site_entity();
$email = $site->email;
$rss_url = elgg_normalize_url('search/?q={searchTerms}&view=opensearch_rss');
$rss_url = elgg_format_url($rss_url);
$html_url = elgg_normalize_url('search/?q={searchTerms}');
$site_url = elgg_get_site_url();
?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
   <ShortName><?php 
echo $shortname;
?>
</ShortName>
   <Description><?php 
echo $description;
?>
</Description>
<?php 
if (isset($longname)) {
    ?>
Example #21
0
<?php

$entity = $vars["entity"];
$size = $vars["size"];
if (isset($vars["override"]) && $vars["override"] == true) {
    $override = true;
} else {
    $override = false;
}
$allowed_sizes = array("tiny", "small", "medium");
if (!in_array($size, $allowed_sizes)) {
    $size = "small";
}
$icon = "<img src='" . elgg_format_url($entity->getIcon($size)) . "' alt='" . htmlentities($entity->title, ENT_QUOTES, "UTF-8") . "' title='" . htmlentities($entity->title, ENT_QUOTES, "UTF-8") . "' />";
if (!$override) {
    echo "<a href='" . $entity->getURL() . "' class='icon'>";
    echo $icon;
    echo "</a>";
} else {
    echo $icon;
}
Example #22
0
function image_get_photos($context, $limit = 20, $offset = 0, $username)
{
    if (!$username) {
        $user = elgg_get_logged_in_user_entity();
        throw new InvalidParameterException('registration:usernamenotvalid');
    } else {
        $user = get_user_by_username($username);
        if (!$user) {
            throw new InvalidParameterException('registration:usernamenotvalid');
        }
    }
    $loginUser = elgg_get_logged_in_user_entity();
    if ($context == "all") {
        $params = array('type' => 'object', 'subtype' => 'image', 'owner_guid' => NULL, 'limit' => $limit, 'offset' => $offset, 'full_view' => false, 'list_type' => 'gallery', 'gallery_class' => 'tidypics-gallery');
    } else {
        if ($context == 'mine') {
            $params = array('type' => 'object', 'subtype' => 'image', 'owner_guid' => $user->guid, 'limit' => $limit, 'offset' => $offset, 'full_view' => false, 'list_type' => 'gallery', 'gallery_class' => 'tidypics-gallery');
        } else {
            if ($context == 'friends') {
                if ($friends = $user->getFriends(array('limit' => false))) {
                    $friendguids = array();
                    foreach ($friends as $friend) {
                        $friendguids[] = $friend->getGUID();
                    }
                    $params = array('type' => 'object', 'subtype' => 'image', 'owner_guids' => $friendguids, 'limit' => $limit, 'offset' => $offset, 'full_view' => false, 'list_type' => 'gallery', 'gallery_class' => 'tidypics-gallery');
                }
            } else {
                $params = array('type' => 'object', 'subtype' => 'image', 'owner_guid' => NULL, 'limit' => $limit, 'offset' => $offset, 'full_view' => false, 'list_type' => 'gallery', 'gallery_class' => 'tidypics-gallery');
            }
        }
    }
    $photos = elgg_get_entities($params);
    $site_url = get_config('wwwroot');
    if ($photos) {
        $return = array();
        foreach ($photos as $single) {
            $photo['guid'] = $single->guid;
            $file_name = $single->getFilenameOnFilestore();
            $image_owner_guid_entity = $single->getOwnerEntity();
            $image_owner_guid = $image_owner_guid_entity->guid;
            $image_owner_join_date = $image_owner_guid_entity->time_created;
            $position = strrpos($file_name, '/');
            $position = $position + 1;
            $icon_file_name = substr_replace($file_name, 'smallthumb', $position, 0);
            $image_icon_url = $site_url . 'services/api/rest/json/?method=image.get_post';
            $icon_url = $image_icon_url . '&joindate=' . $image_owner_join_date . '&guid=' . $image_owner_guid . '&name=' . $icon_file_name;
            $icon_url = elgg_format_url($icon_url);
            $image_url = $site_url . 'services/api/rest/json/?method=image.get_post';
            $img_url = $image_url . '&joindate=' . $image_owner_join_date . '&guid=' . $image_owner_guid . '&name=' . $file_name;
            $img_url = elgg_format_url($img_url);
            $photo['container_guid'] = $single->container_guid;
            if ($single->title != null) {
                $photo['title'] = $single->title;
            } else {
                $photo['title'] = '';
            }
            $photo['time_create'] = time_ago($single->time_created);
            if ($single->description != null) {
                $photo['description'] = $single->description;
            } else {
                $photo['description'] = '';
            }
            $owner = get_entity($single->owner_guid);
            $photo['owner']['guid'] = $owner->guid;
            $photo['owner']['name'] = $owner->name;
            $photo['owner']['username'] = $owner->username;
            $photo['owner']['avatar_url'] = getProfileIcon($owner);
            //$owner->getIconURL('small');
            $photo['icon_url'] = $icon_url;
            $photo['img_url'] = $img_url;
            $photo['like_count'] = likes_count_number_of_likes($single->guid);
            $photo['comment_count'] = api_get_image_comment_count($single->guid);
            $photo['like'] = checkLike($single->guid, $loginUser->guid);
            $return[] = $photo;
        }
    } else {
        $msg = elgg_echo('blog:none');
        throw new InvalidParameterException($msg);
    }
    return $return;
}
Example #23
0
}
$img_class = '';
if (isset($vars['img_class'])) {
    $img_class = $vars['img_class'];
}
$use_hover = elgg_extract('use_hover', $vars, true);
if (isset($vars['override'])) {
    elgg_deprecated_notice("Use 'use_hover' rather than 'override' with user avatars", 1.8, 5);
    $use_hover = false;
}
if (isset($vars['hover'])) {
    // only 1.8.0 was released with 'hover' as the key
    $use_hover = $vars['hover'];
}
$spacer_url = elgg_get_site_url() . '_graphics/spacer.gif';
$icon_url = elgg_format_url($user->getIconURL($size));
$icon = elgg_view('output/img', array('src' => $spacer_url, 'alt' => $name, 'title' => $name, 'class' => $img_class, 'style' => "background: url({$icon_url}) no-repeat;"));
$show_menu = $use_hover && (elgg_is_admin_logged_in() || !$user->isBanned());
?>
<div class="<?php 
echo $class;
?>
">
<?php 
if ($show_menu) {
    $params = array('entity' => $user, 'username' => $username, 'name' => $name);
    echo elgg_view_icon('hover-menu');
    echo elgg_view_menu('user_hover', $params);
}
if ($use_link) {
    $class = elgg_extract('link_class', $vars, '');
Example #24
0
/**
 * Add Tidypics links/info to entity menu
 */
function tidypics_entity_menu_setup($hook, $type, $return, $params)
{
    if (elgg_in_context('widgets')) {
        return $return;
    }
    $entity = $params['entity'];
    $handler = elgg_extract('handler', $params, false);
    if ($handler != 'photos') {
        return $return;
    }
    if (elgg_instanceof($entity, 'object', 'image')) {
        $album = $entity->getContainerEntity();
        $cover_guid = $album->getCoverImageGuid();
        if ($cover_guid != $entity->getGUID() && $album->canEdit()) {
            $url = 'action/photos/album/set_cover' . '?image_guid=' . $entity->getGUID() . '&album_guid=' . $album->getGUID();
            $params = array('href' => $url, 'text' => elgg_echo('album:cover_link'), 'is_action' => true, 'is_trusted' => true, 'confirm' => elgg_echo('album:cover'));
            $text = elgg_view('output/confirmlink', $params);
            $options = array('name' => 'set_cover', 'text' => $text, 'priority' => 80);
            $return[] = ElggMenuItem::factory($options);
        }
        if (elgg_get_plugin_setting('view_count', 'tidypics')) {
            $view_info = $entity->getViewInfo();
            $text = elgg_echo('tidypics:views', array((int) $view_info['total']));
            $options = array('name' => 'views', 'text' => "<span>{$text}</span>", 'href' => false, 'priority' => 90);
            $return[] = ElggMenuItem::factory($options);
        }
        if (elgg_get_plugin_setting('tagging', 'tidypics')) {
            $options = array('name' => 'tagging', 'text' => elgg_echo('tidypics:actiontag'), 'href' => '#', 'title' => elgg_echo('tidypics:tagthisphoto'), 'rel' => 'photo-tagging', 'priority' => 80);
            $return[] = ElggMenuItem::factory($options);
        }
    }
    // only show these options if there are images
    if (elgg_instanceof($entity, 'object', 'album') && $entity->getSize() > 0) {
        $url = $entity->getURL() . '?limit=50&view=rss';
        $url = elgg_format_url($url);
        $slideshow_link = "javascript:PicLensLite.start({maxScale:0, feedUrl:'{$url}'})";
        $options = array('name' => 'slideshow', 'text' => elgg_echo('album:slideshow'), 'href' => $slideshow_link, 'priority' => 80);
        $return[] = ElggMenuItem::factory($options);
        if ($entity->canEdit()) {
            $options = array('name' => 'sort', 'text' => elgg_echo('album:sort'), 'href' => "photos/sort/" . $entity->getGUID(), 'priority' => 90);
            $return[] = ElggMenuItem::factory($options);
        }
    }
    return $return;
}
Example #25
0
<?php

/**
 * Display an image
 *
 * @uses $vars['entity']
 */
$file = $vars['entity'];
$image_url = $file->getIconURL('large');
$image_url = elgg_format_url($image_url);
$download_url = elgg_get_download_url($file);
if ($vars['full_view']) {
    echo <<<HTML
\t\t<div class="file-photo">
\t\t\t<a href="{$download_url}" class="elgg-lightbox-photo"><img class="elgg-photo" src="{$image_url}" /></a>
\t\t</div>
HTML;
}
Example #26
0
<?php

/**
 * Allows users to add a 'cover photo' to their group. This view contains a div that can display a colored box or an image above the group summary.
 *
 * cover_photo description.
 *
 * @version 1.0
 * @author Nick
 */
$site_url = elgg_get_site_url();
$page_owner_guid_c_photo = elgg_get_page_owner_guid();
$cover_photo = elgg_get_page_owner_entity()->cover_photo;
//If the Metadata is the word 'nope' or not set do not show the cover photo div
if ($cover_photo == 'nope' || $cover_photo == '') {
    $cover_photo_holder = '';
} else {
    //Nick - The img src is sent to a page in the wet4 mod to grab the image from the data folder
    //Nick - Mapping directly to the data folder is dangerous according to elgg community
    $cover_photo_link = $site_url . 'mod/wet4/pages/c_photo_image.php?file_guid=' . $page_owner_guid_c_photo;
    $cover_photo_link = elgg_format_url($cover_photo_link);
    //Format Image
    $test_photo = elgg_view('output/img', array('src' => $cover_photo_link, 'alt' => elgg_echo('wet:cover_photo_alt')));
    $cover_photo_holder = '<div><div class="group-cover-photo">' . $test_photo . '</div></div>';
}
echo $cover_photo_holder;
         $info .= $result;
     }
     $info .= "</table></td></tr>";
 } else {
     $info .= "<p>" . elgg_echo('elggchat:session:no_participants') . "</p></td></tr>";
 }
 $info .= "<tr><td class='elggchat-chatsession-text'><label>" . elgg_echo('elggchat:session:session_messages') . "</label>" . "<br>";
 $messages = elgg_get_annotations(array('annotation_names' => array(ELGGCHAT_MESSAGE, ELGGCHAT_SYSTEM_MESSAGE), 'guid' => $session->guid, 'limit' => false, 'order' => 'desc'));
 if ($messages) {
     foreach ($messages as $message) {
         $member = get_entity($message->owner_guid);
         $result = "";
         if ($message->name == ELGGCHAT_MESSAGE) {
             $result .= "<div name='message' id='" . $offset . "' class='messageWrapper'>";
             $result .= "<table><tr><td width='30px' rowspan='2'>";
             $result .= elgg_view('output/img', array('src' => elgg_format_url($member->getIconURL('tiny')), 'class' => 'messageIcon'));
             $result .= "</td><td class='messageName'>" . $member->name . ", " . elgg_get_friendly_time($message->time_created) . "</td></tr>";
             $result .= "<tr><td>";
             $result .= nl2br($message->value);
             $result .= "</td></tr></table>";
             $result .= "</div>";
         } elseif ($message->name == ELGGCHAT_SYSTEM_MESSAGE) {
             $result .= "<div name='message' id='" . $offset . "' class='systemMessageWrapper'>";
             $result .= $message->value;
             $result .= "</div>";
         }
         $info .= $result;
     }
     $info .= "</td></tr>";
 } else {
     $info .= "<p>" . elgg_echo('elggchat:session:no_messages') . "</p></td></tr>";
Example #28
0
File: start.php Project: n8b/VMN
/**
 * Rearrange menu items
 */
function time_theme_pagesetup()
{
    elgg_unextend_view('page/elements/sidebar', 'search/header');
    //elgg_extend_view('page/elements/topbar', 'search/header', 0);
    elgg_register_menu_item('topbar', array('name' => 'sidebar', 'href' => "#", 'text' => '<i class="sb-toggle-left fa fa-bars fa-lg"></i>', 'priority' => 50, 'link_class' => ''));
    elgg_unregister_menu_item('footer', 'powered');
    if (elgg_is_logged_in()) {
        $user = elgg_get_logged_in_user_entity();
        $username = $user->username;
        elgg_unregister_menu_item('topbar', 'messages');
        $text = "<i class=\"fa fa-envelope fa-lg\"></i>";
        $tooltip = elgg_echo("messages");
        // get unread messages
        $num_messages = (int) messages_count_unread();
        if ($num_messages != 0) {
            $text .= "<span class=\"elgg-topbar-new\">{$num_messages}</span>";
            $tooltip .= ": " . elgg_echo("messages:unreadcount", array($num_messages));
        }
        elgg_register_menu_item('topbar', array('name' => 'messages', 'href' => "messages/inbox/{$username}", 'text' => $text, 'section' => 'alt', 'priority' => 100, 'title' => $tooltip));
        elgg_register_menu_item('topbar', array('href' => false, 'name' => 'search', 'text' => '<i class="fa fa-search fa-lg"></i>' . elgg_view('search/header'), 'priority' => 0, 'section' => 'alt'));
        $text = '<i class="fa fa-users fa-lg"></i>';
        $tooltip = elgg_echo("friends");
        $href = "/friends/" . $username;
        if (elgg_is_active_plugin('friend_request')) {
            elgg_unregister_menu_item('topbar', 'friend_request');
            $options = array("type" => "user", "count" => true, "relationship" => "friendrequest", "relationship_guid" => $user->getGUID(), "inverse_relationship" => true);
            $count = elgg_get_entities_from_relationship($options);
            if (!empty($count)) {
                $text .= "<span class=\"elgg-topbar-new\">{$count}</span>";
                $tooltip = elgg_echo("friend_request:menu") . ": " . $count;
                $href = "friend_request/" . $username;
            }
        }
        elgg_unregister_menu_item('topbar', 'friends');
        elgg_register_menu_item('topbar', array('href' => $href, 'name' => 'friends', 'text' => $text, 'section' => 'alt', 'priority' => 200, 'title' => $tooltip));
        $viewer = elgg_get_logged_in_user_entity();
        elgg_unregister_menu_item('topbar', 'profile');
        elgg_register_menu_item('topbar', array('name' => 'profile', 'href' => $viewer->getURL(), 'text' => elgg_view('output/img', array('src' => $viewer->getIconURL('small'), 'alt' => $viewer->name, 'title' => elgg_echo('profile'), 'class' => 'elgg-border-plain elgg-transition')) . '<span class="profile-text">' . elgg_get_excerpt($viewer->name, 20) . '</span>', 'priority' => 500, 'link_class' => 'elgg-topbar-avatar', 'item_class' => 'elgg-avatar elgg-avatar-topbar'));
        elgg_register_menu_item('topbar', array('name' => 'home', 'text' => '<i class="fa fa-home fa-lg"></i> ', 'href' => "/", 'priority' => 90, 'section' => 'alt'));
        elgg_register_menu_item('topbar', array('name' => 'account', 'text' => '<i class="fa fa-cog fa-lg"></i> ', 'href' => "#", 'priority' => 300, 'section' => 'alt', 'link_class' => 'elgg-topbar-dropdown'));
        if (elgg_is_active_plugin('dashboard')) {
            $item = elgg_unregister_menu_item('topbar', 'dashboard');
            if ($item) {
                $item->setText(elgg_echo('dashboard'));
                $item->setSection('default');
                elgg_register_menu_item('site', $item);
            }
        }
        $item = elgg_unregister_menu_item('extras', 'bookmark');
        if ($item) {
            $item->setText('<i class="fa fa-bookmark fa-lg"></i>');
            elgg_register_menu_item('extras', $item);
        }
        elgg_unregister_menu_item('extras', 'rss');
        /*if ($item) {
        			$item->setText('<i class="fa fa-rss fa-lg"></i>');
        			elgg_register_menu_item('extras', $item);
        		}*/
        $url = elgg_format_url($url);
        elgg_register_menu_item('extras', array('name' => 'rss', 'text' => '<i class="fa fa-rss fa-lg"></i>', 'href' => $url, 'title' => elgg_echo('feed:rss')));
        $item = elgg_get_menu_item('topbar', 'usersettings');
        if ($item) {
            $item->setParentName('account');
            $item->setText(elgg_echo('settings'));
            $item->setPriority(103);
        }
        $item = elgg_get_menu_item('topbar', 'logout');
        if ($item) {
            $item->setParentName('account');
            $item->setText(elgg_echo('logout'));
            $item->setPriority(104);
        }
        $item = elgg_get_menu_item('topbar', 'administration');
        if ($item) {
            $item->setParentName('account');
            $item->setText(elgg_echo('admin'));
            $item->setPriority(101);
        }
        if (elgg_is_active_plugin('site_notifications')) {
            $item = elgg_get_menu_item('topbar', 'site_notifications');
            if ($item) {
                $item->setParentName('account');
                $item->setText(elgg_echo('site_notifications:topbar'));
                $item->setPriority(102);
            }
        }
        if (elgg_is_active_plugin('reportedcontent')) {
            $item = elgg_unregister_menu_item('footer', 'report_this');
            if ($item) {
                $item->setText('<i class="fa fa-flag fa-lg"></i>');
                $item->setPriority(500);
                $item->setSection('default');
                elgg_register_menu_item('extras', $item);
            }
        }
    }
}
Example #29
0
/**
 * Builds a URL from the a parts array like one returned by {@link parse_url()}.
 *
 * @note If only partial information is passed, a partial URL will be returned.
 *
 * @param array $parts       Associative array of URL components like parse_url() returns
 * @param bool  $html_encode HTML Encode the url?
 *
 * @return str Full URL
 * @since 1.7.0
 */
function elgg_http_build_url(array $parts, $html_encode = TRUE)
{
    // build only what's given to us.
    $scheme = isset($parts['scheme']) ? "{$parts['scheme']}://" : '';
    $host = isset($parts['host']) ? "{$parts['host']}" : '';
    $port = isset($parts['port']) ? ":{$parts['port']}" : '';
    $path = isset($parts['path']) ? "{$parts['path']}" : '';
    $query = isset($parts['query']) ? "?{$parts['query']}" : '';
    $string = $scheme . $host . $port . $path . $query;
    if ($html_encode) {
        return elgg_format_url($string);
    } else {
        return $string;
    }
}
Example #30
0
/**
 * Add Tidypics links/info to entity menu
 */
function tidypics_entity_menu_setup($hook, $type, $return, $params)
{
    if (elgg_in_context('widgets')) {
        return $return;
    }
    $entity = $params['entity'];
    $handler = elgg_extract('handler', $params, false);
    if ($handler != 'photos') {
        return $return;
    }
    if (elgg_instanceof($entity, 'object', 'album')) {
        foreach ($return as $index => $item) {
            if ($item->getName() == 'access') {
                unset($return[$index]);
            }
        }
        $album = $entity;
        // feature link
        if (elgg_is_admin_logged_in()) {
            if ($album->featured == "y") {
                $url = "action/photos/album/feature?album_guid=" . $album->getGUID() . "&action_type=unfeature";
                $wording = elgg_echo("album:unfeature");
            } else {
                $url = "action/photos/album/feature?album_guid=" . $album->getGUID() . "&action_type=feature";
                $wording = elgg_echo("album:feature");
            }
            $options = array('name' => 'feature', 'text' => $wording, 'href' => $url, 'is_action' => true);
            $return[] = ElggMenuItem::factory($options);
        }
        if ($album->canEdit()) {
            $options = array('name' => 'upload', 'href' => 'photos/upload/' . $album->getGUID(), 'text' => elgg_echo('images:upload'));
            $return[] = ElggMenuItem::factory($options);
        }
        // only show sort button if there are images
        if ($album->canEdit() && $album->getSize() > 0) {
            $options = array('name' => 'sort', 'href' => "photos/sort/" . $album->getGUID(), 'text' => elgg_echo('album:sort'));
            $return[] = ElggMenuItem::factory($options);
        }
        // only show slideshow link if slideshow is enabled in plugin settings and there are images
        if (elgg_get_plugin_setting('slideshow', 'tidypics') && $album->getSize() > 0) {
            $offset = (int) get_input('offset', 0);
            $url = $album->getURL() . "?limit=64&offset={$offset}&view=rss";
            $url = elgg_format_url($url);
            $slideshow_link = "javascript:PicLensLite.start({maxScale:0, feedUrl:'{$url}'})";
            $options = array('name' => 'slideshow', 'href' => $slideshow_link, 'text' => "<img src=\"" . elgg_get_site_url() . "mod/tidypics/graphics/slideshow.png\" alt=\"" . elgg_echo('album:slideshow') . "\">", 'title' => elgg_echo('album:slideshow'));
            $return[] = ElggMenuItem::factory($options);
        }
    }
    //album
    if (elgg_instanceof($entity, 'object', 'image')) {
        foreach ($return as $index => $item) {
            if ($item->getName() == 'access') {
                unset($return[$index]);
            }
        }
        $album = $entity->getContainerEntity();
        $options = array('name' => 'back2album', 'href' => $album->getURL(), 'text' => elgg_echo('image:back2album'), 'priority' => 70);
        $return[] = ElggMenuItem::factory($options);
        $cover_guid = $album->getCoverImageGuid();
        if ($cover_guid != $entity->getGUID() && $album->canEdit()) {
            $url = 'action/photos/album/set_cover' . '?image_guid=' . $entity->getGUID() . '&album_guid=' . $album->getGUID();
            $params = array('href' => $url, 'text' => elgg_echo('album:cover_link'), 'is_action' => true, 'is_trusted' => true, 'confirm' => elgg_echo('album:cover'));
            $text = elgg_view('output/confirmlink', $params);
            $options = array('name' => 'set_cover', 'text' => $text, 'priority' => 80);
            $return[] = ElggMenuItem::factory($options);
        }
        if (elgg_get_plugin_setting('download_link', 'tidypics')) {
            $options = array('name' => 'download', 'href' => "photos/download/{$entity->guid}", 'text' => elgg_echo('image:download'), 'priority' => 85);
            $return[] = ElggMenuItem::factory($options);
        }
        if (elgg_get_plugin_setting('view_count', 'tidypics')) {
            $view_info = $entity->getViewInfo();
            $text = elgg_echo('tidypics:views', array((int) $view_info['total']));
            $options = array('name' => 'views', 'text' => "<span>{$text}</span>", 'href' => false, 'priority' => 1000);
            $return[] = ElggMenuItem::factory($options);
        }
        if (elgg_get_plugin_setting('tagging', 'tidypics') && elgg_is_logged_in()) {
            $options = array('name' => 'tagging', 'text' => elgg_echo('tidypics:actiontag'), 'href' => '#', 'title' => elgg_echo('tidypics:tagthisphoto'), 'rel' => 'photo-tagging', 'priority' => 80);
            $return[] = ElggMenuItem::factory($options);
        }
    }
    return $return;
}