本文整理汇总了PHP中elgg_format_url函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_format_url函数的具体用法?PHP elgg_format_url怎么用?PHP elgg_format_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_format_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
/**
* 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;
}
示例2: event_calendar_get_page_content_list
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);
}
示例3: elgg_push_breadcrumb
/**
* 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);
示例4: elgg_view
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>";
示例5: elgg_views_add_rss_link
/**
* 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')));
}
}
示例6: elgg_view
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>';
}
示例7: array
/**
* 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;
}
示例8: event_calendar_get_page_content_list
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);
}
示例9: getBatchImages
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;
}
示例10: elgg_view
<?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>";
}
示例11: event_calendar_get_page_content_list
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);
}
示例12: elgg_extract
}
$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));
示例13: _elgg_views_prepare_head
/**
* 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;
}
示例14: elgg_normalize_url
<?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>";
示例15: elgg_log
<?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}/>";