本文整理匯總了PHP中Images::get_url方法的典型用法代碼示例。如果您正苦於以下問題:PHP Images::get_url方法的具體用法?PHP Images::get_url怎麽用?PHP Images::get_url使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Images
的用法示例。
在下文中一共展示了Images::get_url方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: layout
/**
* list images
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// url to view the image
$url = Images::get_url($item['id']);
// initialize variables
$prefix = $suffix = '';
// flag new images
if ($item['edit_date'] >= $context['fresh']) {
$suffix .= NEW_FLAG;
}
// image title or image name
$label = Skin::strip($item['title'], 10);
if (!$label) {
$name_as_title = TRUE;
$label = ucfirst($item['image_name']);
}
$label = str_replace('_', ' ', str_replace('%20', ' ', $label));
// list all components for this item
$items[$url] = array($prefix, $label, $suffix, 'basic', NULL);
}
// end of processing
SQL::free($result);
return $items;
}
示例2: layout
/**
* list images
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// get the anchor for this image
if ($item['anchor']) {
$anchor = Anchors::get($item['anchor']);
}
// url to view the image
$url = $context['url_to_home'] . $context['url_to_root'] . Images::get_url($item['id']);
// time of last update
$time = SQL::strtotime($item['edit_date']);
// the title as the label
if ($item['title']) {
$label = ucfirst($item['title']) . ' (' . $item['image_name'] . ')';
} else {
$label = $item['image_name'];
}
// the section
$section = '';
if (is_object($anchor)) {
$section = ucfirst($anchor->get_title());
}
// the author(s) is an e-mail address, according to rss 2.0 spec
$author = $item['create_address'] . ' (' . $item['create_name'] . ')';
if ($item['create_address'] != $item['edit_address']) {
if ($author) {
$author .= ', ';
}
$author .= $item['edit_address'] . ' (' . $item['edit_name'] . ')';
}
// the description
$description = Codes::beautify($item['description']);
// cap the number of words
$description = Skin::cap($description, 300);
// fix image references
$description = preg_replace('#"/([^">]+?)"#', '"' . $context['url_to_home'] . '/$1"', $description);
$introduction = $description;
// other rss fields
$extensions = array();
// url for enclosure
$type = Files::get_mime_type($item['image_name']);
$extensions[] = '<enclosure url="' . $context['url_to_home'] . $context['url_to_root'] . Files::get_path($item['anchor'], 'images') . '/' . $item['image_name'] . '"' . ' length="' . $item['image_size'] . '"' . ' type="' . $type . '" />';
// list all components for this item
$items[$url] = array($time, $label, $author, $section, NULL, $introduction, $description, $extensions);
}
// end of processing
SQL::free($result);
return $items;
}
示例3: get_neighbours
/**
* get next and previous items, if any
*
* @param string the item type (eg, 'image', 'file', etc.)
* @param array the anchored item asking for neighbours
* @return an array($previous_url, $previous_label, $next_url, $next_label, $option_url, $option_label), or NULL
*
* @see shared/anchor.php
*/
function get_neighbours($type, $item)
{
global $context;
// no item bound
if (!isset($this->item['id'])) {
return NULL;
}
// initialize components
$previous_url = $previous_label = $next_url = $next_label = $option_url = $option_label = '';
// previous and next images
if ($type == 'image') {
// load the adequate library
include_once $context['path_to_root'] . 'images/images.php';
// extract all images references from the description
preg_match_all('/\\[image=(\\d+)/', $this->item['description'], $matches);
// locate the previous image, if any
$previous = NULL;
reset($matches[1]);
$index = 0;
while (list($key, $value) = each($matches[1])) {
$index++;
if ($item['id'] == $value) {
break;
}
$previous = $value;
}
// make a link to the previous image
if ($previous) {
$previous_url = Images::get_url($previous);
$previous_label = i18n::s('Previous image');
}
// locate the next image, if any
if (!(list($key, $next) = each($matches[1]))) {
$next = NULL;
} else {
$next_url = Images::get_url($next);
$next_label = i18n::s('Next image');
}
// add a label
$option_label = sprintf(i18n::s('Image %d of %d'), $index, count($matches[1]));
}
// return navigation info
return array($previous_url, $previous_label, $next_url, $next_label, $option_url, $option_label);
}
示例4: transform_reference
/**
* reference another page at this site
*
* The function transforms a local reference (e.g;, [code][user=2][/code])
* to an actual link relative to the YACS directory (e.g., [code]users/view.php/2[/code]),
* adds a title and, sometimes, set a description as well.
*
* @param string any string, maybe with a local reference in it
* @return an array($url, $title, $description) or NULL
*
* @see images/view.php
* @see links/edit.php
* @see shared/codes.php
*/
public static function transform_reference($text)
{
global $context;
// translate this reference to an internal link
if (preg_match("/^\\[(article|section|file|image|category|user)=(.+?)\\]/i", $text, $matches)) {
switch ($matches[1]) {
// article link
case 'article':
if ($item = Articles::get($matches[2])) {
return array(Articles::get_permalink($item), $item['title'], $item['introduction']);
}
return array('', $text, '');
// section link
// section link
case 'section':
if ($item = Sections::get($matches[2])) {
return array(Sections::get_permalink($item), $item['title'], $item['introduction']);
}
return array('', $text, '');
// file link
// file link
case 'file':
if ($item = Files::get($matches[2])) {
return array(Files::get_url($matches[2]), $item['title'] ? $item['title'] : str_replace('_', ' ', ucfirst($item['file_name'])));
}
return array('', $text, '');
// image link
// image link
case 'image':
include_once $context['path_to_root'] . 'images/images.php';
if ($item = Images::get($matches[2])) {
return array(Images::get_url($matches[2]), $item['title'] ? $item['title'] : str_replace('_', ' ', ucfirst($item['image_name'])));
}
return array('', $text, '');
// category link
// category link
case 'category':
if ($item = Categories::get($matches[2])) {
return array(Categories::get_permalink($item), $item['title'], $item['introduction']);
}
return array('', $text, '');
// user link
// user link
case 'user':
if ($item = Users::get($matches[2])) {
return array(Users::get_permalink($item), $item['full_name'] ? $item['full_name'] : $item['nick_name']);
}
return array('', $text, '');
}
}
return array('', $text, '');
}
示例5: get_neighbours
/**
* get next and previous items, if any
*
* @see shared/anchor.php
*
* @param string the item type (eg, 'image', 'file', etc.)
* @param array the anchored item asking for neighbours
* @return an array($previous_url, $previous_label, $next_url, $next_label, $option_url, $option_label), or NULL
*/
function get_neighbours($type, $item)
{
global $context;
// no item bound
if (!isset($this->item['id'])) {
return NULL;
}
// initialize components
$previous_url = $previous_label = $next_url = $next_label = $option_url = $option_label = '';
// previous and next comments
if ($type == 'comment') {
// load the adequate library
include_once $context['path_to_root'] . 'comments/comments.php';
$order = 'date';
// get previous url
if ($previous_url = Comments::get_previous_url($item, 'article:' . $this->item['id'], $order)) {
$previous_label = i18n::s('Previous');
}
// get next url
if ($next_url = Comments::get_next_url($item, 'article:' . $this->item['id'], $order)) {
$next_label = i18n::s('Next');
}
// previous and next files
} elseif ($type == 'file') {
// select appropriate order
if (preg_match('/\\bfiles_by_title\\b/', $this->item['options'])) {
$order = 'title';
} else {
$order = 'date';
}
// get previous url
if ($previous_url = Files::get_previous_url($item, 'article:' . $this->item['id'], $order)) {
$previous_label = i18n::s('Previous');
}
// get next url
if ($next_url = Files::get_next_url($item, 'article:' . $this->item['id'], $order)) {
$next_label = i18n::s('Next');
}
// previous and next images
} elseif ($type == 'image') {
// load the adequate library
include_once $context['path_to_root'] . 'images/images.php';
// extract all images references from the introduction and from the description
preg_match_all('/\\[image=(\\d+)/', $this->item['introduction'] . $this->item['description'], $matches);
// locate the previous image, if any
$previous = NULL;
reset($matches[1]);
$index = 0;
while (list($key, $value) = each($matches[1])) {
$index++;
if ($item['id'] == $value) {
break;
}
$previous = $value;
}
// make a link to the previous image
if ($previous) {
$previous_url = Images::get_url($previous);
$previous_label = i18n::s('Previous');
}
// locate the next image, if any
if (!(list($key, $next) = each($matches[1]))) {
$next = NULL;
} else {
$next_url = Images::get_url($next);
$next_label = i18n::s('Next');
}
// add a label
$option_label = sprintf(i18n::s('Image %d of %d'), $index, count($matches[1]));
// previous and next location
} elseif ($type == 'location') {
// load the adequate library
include_once $context['path_to_root'] . 'locations/locations.php';
// extract all location references from the introduction and from the description
preg_match_all('/\\[location=(\\d+)/', $this->item['introduction'] . $this->item['description'], $matches);
// locate the previous location, if any
$previous = NULL;
reset($matches[1]);
$index = 0;
while (list($key, $value) = each($matches[1])) {
$index++;
if ($item['id'] == $value) {
break;
}
$previous = $value;
}
// make a link to the previous location
if ($previous) {
$previous_url = Locations::get_url($previous);
$previous_label = i18n::s('Previous');
}
//.........這裏部分代碼省略.........
示例6: elseif
//.........這裏部分代碼省略.........
*/
public static function &build_image($variant, $href, $title, $link = '', $id = '')
{
global $context;
// sanity check
if (!$variant) {
$variant = 'inline';
}
// sanity check
if (!$href) {
$output = '';
return $output;
}
// provide absolute references
if ($href && $href[0] == '/') {
$href = $context['url_to_home'] . $href;
}
if ($link && $link[0] == '/') {
$link = $context['url_to_home'] . $link;
}
// always display captions aside large images
if (preg_match('/\\blarge\\b/i', $variant)) {
$with_caption = TRUE;
} elseif (isset($context['thumbnails_without_caption']) && $context['thumbnails_without_caption'] == 'Y') {
$with_caption = FALSE;
} else {
$with_caption = TRUE;
}
// document the image
if ($title) {
$hover = $title;
} else {
$hover = '';
}
// remove YACS codes from alternate label and hovering title
if (is_callable(array('Codes', 'strip'))) {
$hover = Codes::strip($hover, FALSE);
}
// split components of the variant
if ($position = strpos($variant, ' ')) {
$complement = substr($variant, 0, $position);
$variant = substr($variant, $position + 1);
} else {
$complement = '';
}
// wrapper begins --don't use div, because of surrounding link
$tag_wrapper = SKIN_HTML5 ? 'figure' : 'span';
$text = "\n" . '<' . $tag_wrapper . ' class="' . encode_field($variant) . '_image">';
// styling freedom --outside anchor, which is inline
if ($complement) {
$text .= '<span class="' . $complement . '">';
}
// configured styles
$more_styles = '';
if ($complement == 'large' && isset($context['classes_for_large_images']) && $context['classes_for_large_images']) {
$more_styles = ' class="' . encode_field($context['classes_for_large_images']) . '"';
} elseif ($variant == 'thumbnail' && isset($context['classes_for_thumbnail_images']) && $context['classes_for_thumbnail_images']) {
$more_styles = ' class="' . encode_field($context['classes_for_thumbnail_images']) . '"';
} elseif ($variant == 'avatar' && isset($context['classes_for_avatar_images']) && $context['classes_for_avatar_images']) {
$more_styles = ' class="' . encode_field($context['classes_for_avatar_images']) . '"';
}
// the image itself
$image = '<img src="' . $href . '" alt="" title="' . encode_field(strip_tags($hover)) . '"' . $more_styles . ' />';
// add a link
if ($link && preg_match('/\\.(gif|jpeg|jpg|png)$/i', $link) && !preg_match('/\\blarge\\b/', $variant)) {
$text .= '<a href="' . $link . '" class="image_show">' . $image . '</a>';
} elseif ($link) {
$external = FALSE;
if (!strncmp($link, 'http:', 5) && strncmp($link, 'http://' . $context['host_name'], strlen('http://' . $context['host_name']))) {
$external = TRUE;
} elseif (!strncmp($link, 'https:', 6) && strncmp($link, 'https://' . $context['host_name'], strlen('https://' . $context['host_name']))) {
$external = TRUE;
}
if ($external) {
$text .= '<a href="' . $link . '" onclick="window.open(this.href); return false;">' . $image . '</a>';
} else {
$text .= '<a href="' . $link . '">' . $image . '</a>';
}
} else {
$text .= $image;
}
// make the title visible as a caption
$tag_caption = SKIN_HTML5 ? 'figcaption' : 'span';
if ($title && $with_caption) {
$text .= '<' . $tag_caption . ' class="image_caption">' . ucfirst($title) . '</' . $tag_caption . '>';
}
// end of freedom
if ($complement) {
$text .= '</span>';
}
//edit image direct access
if (($variant == 'center' || $variant == 'right' || $variant == 'left' || $variant == 'thumbnail' || $complement == 'large') && $id) {
Skin::define_img('IMAGES_EDIT_IMG', 'images/edit.gif');
$text .= '<span class="image_edit">' . Skin::build_link(Images::get_url($id, 'edit'), IMAGES_EDIT_IMG, NULL, i18n::s('Update this image') . ' [' . $id . ']') . '</span>';
}
// end of wrapper
$text .= '</' . $tag_wrapper . '>';
// job done
return $text;
}
示例7:
// back to the anchor page
if (is_object($anchor) && $anchor->is_viewable()) {
$context['text'] .= Skin::build_block(Skin::build_link($anchor->get_url(), i18n::s('Back to main page'), 'button'), 'bottom');
}
// page tools
//
if ($editable) {
Skin::define_img('IMAGES_EDIT_IMG', 'images/edit.gif');
$context['page_tools'][] = Skin::build_link(Images::get_url($item['id'], 'edit'), IMAGES_EDIT_IMG . i18n::s('Update this image'), 'basic', i18n::s('Press [e] to edit'), FALSE, 'e');
}
// the delete command is available to associates and editors
if ($item['id'] && (Surfer::is_associate() || is_object($anchor) && $anchor->is_assigned())) {
Skin::define_img('IMAGES_DELETE_IMG', 'images/delete.gif');
$context['page_tools'][] = Skin::build_link(Images::get_url($item['id'], 'delete'), IMAGES_DELETE_IMG . i18n::s('Delete this image'));
}
// general help on this page
//
$help = '<p>' . i18n::s('To save this image on your hard drive, drag the mouse above the image and use the right button. A contextual pop-up menu should appear. Select the adequate command depending on the browser used.') . '</p>';
$context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help');
// thumbnail, in an extra box
//
if (Surfer::is_associate() && $item['thumbnail_name'] && $item['thumbnail_name'] != $item['image_name']) {
$url = $context['url_to_root'] . Files::get_path($item['anchor'], 'images') . '/' . $item['thumbnail_name'];
$context['components']['boxes'] .= Skin::build_box(i18n::s('Thumbnail'), '<img src="' . $url . '" />', 'boxes');
}
// referrals, if any
//
$context['components']['referrals'] =& Skin::build_referrals(Images::get_url($item['id']));
}
// render the skin
render_skin();
示例8: while
// parse the whole list
} else {
// fetch one anchor and the linked member
$errors_count = 0;
while ($row = SQL::fetch($result)) {
// animate user screen and take care of time
$count++;
if (!($count % 100)) {
$context['text'] .= sprintf(i18n::s('%d records have been processed'), $count) . BR . "\n";
// ensure enough execution time
Safe::set_time_limit(30);
}
if (!Images::get_icon_href($row)) {
$errors_count++;
$anchor = Anchors::get($row['anchor']);
$context['text'] .= sprintf(i18n::s('Missing: %s'), 'image ' . Skin::build_link(Images::get_url($row['id']), $row['id'] . ' ' . $row['image_name'])) . ' ' . i18n::s('in') . ' ' . (is_object($anchor) ? Skin::build_link($anchor->get_url(), $row['anchor']) : '') . BR . "\n";
}
}
}
// ending message
$context['text'] .= sprintf(i18n::s('%d records have been processed'), $count) . BR . "\n";
$context['text'] .= sprintf(i18n::s('%d missing files'), $errors_count) . BR . "\n";
// display the execution time
$time = round(get_micro_time() - $context['start_time'], 2);
$context['text'] .= '<p>' . sprintf(i18n::s('Script terminated in %.2f seconds.'), $time) . '</p>';
// forward to the index page
$menu = array('images/' => i18n::s('Images'));
$context['text'] .= Skin::build_list($menu, 'menu_bar');
// which check?
} else {
// the splash message
示例9: elseif
$action = 'image:set_as_icon';
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'set_as_avatar') {
$action = 'image:set_as_avatar';
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'set_as_thumbnail') {
$action = 'image:set_as_thumbnail';
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'set_as_both') {
$action = 'image:set_as_both';
} else {
$action = 'image:update';
}
// touch the related anchor
$anchor->touch($action, $_REQUEST['id'], isset($_REQUEST['silent']) && $_REQUEST['silent'] == 'Y');
// clear cache
Images::clear($_REQUEST);
// forward to the view page
Safe::redirect($context['url_to_home'] . $context['url_to_root'] . Images::get_url($_REQUEST['id']));
}
// display the form on GET
} else {
$with_form = TRUE;
}
// display the form
if ($with_form) {
// the form to edit an image
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form" enctype="multipart/form-data"><div>';
$fields = array();
// the section
if ($anchor) {
$context['text'] .= '<input type="hidden" name="anchor" value="' . $anchor->get_reference() . '" />';
}
// the image
示例10: elseif
Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'images/');
}
}
// deletion has to be confirmed
} elseif (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
Logger::error(i18n::s('The action has not been confirmed.'));
} else {
// commands
$menu = array();
$class_submit = $render_overlaid ? 'submit-overlaid' : 'button';
$menu[] = Skin::build_submit_button(i18n::s('Yes, I want to delete this image'), NULL, NULL, 'confirmed', $class_submit);
if (isset($item['id'])) {
if ($render_overlaid) {
$menu[] = Skin::build_link($anchor->get_permalink(), i18n::s('Cancel'), 'overlaid');
} else {
$menu[] = Skin::build_link(Images::get_url($item['id']), i18n::s('Cancel'), 'span');
}
}
// the submit button
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . "\n" . Skin::finalize_list($menu, 'menu_bar') . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="confirm" value="yes" />' . "\n";
// transmit the follow_up param if any
if (isset($_REQUEST['follow_up'])) {
$context['text'] .= '<input type="hidden" name="follow_up" value="' . $_REQUEST['follow_up'] . '" />' . "\n";
}
$context['text'] .= '</p></form>' . "\n";
// set the focus
Page::insert_script('$("#confirmed").focus();');
// the title of the image
if ($item['title']) {
$context['text'] .= Skin::build_block($item['title'], 'title');
} else {
示例11: render_object
//.........這裏部分代碼省略.........
$output =& Skin::build_link($url, $text, 'category');
// the introduction text, if any
$output .= BR . Codes::beautify($item['introduction']);
// load overlay, if any
if (isset($item['overlay']) && $item['overlay']) {
$overlay = Overlay::load($item, 'category:' . $item['id']);
// get text related to the overlay, if any
if (is_object($overlay)) {
$output .= $overlay->get_text('view', $item);
}
}
// the description, which is the actual page body
$output .= '<div>' . Codes::beautify($item['description']) . '</div>';
}
return $output;
// link to a comment
// link to a comment
case 'comment':
include_once $context['path_to_root'] . 'comments/comments.php';
// maybe an alternate title has been provided
$attributes = preg_split("/\\s*,\\s*/", $id, 2);
$id = $attributes[0];
// load the record from the database
if (!($item = Comments::get($id))) {
$output = '[comment=' . $id . ']';
} else {
// ensure we have a label for this link
if (isset($attributes[1])) {
$text = $attributes[1];
} else {
$text = i18n::s('View this comment');
}
// make a link to the target page
$url = $context['url_to_home'] . $context['url_to_root'] . Comments::get_url($item['id']);
// return a complete anchor
$output =& Skin::build_link($url, $text, 'basic');
}
return $output;
// link to a download
// link to a download
case 'download':
// maybe an alternate title has been provided
$attributes = preg_split("/\\s*,\\s*/", $id, 2);
$id = $attributes[0];
// load the record from the database
if (!($item = Files::get($id))) {
// file does not exist anymore
if (isset($attributes[1]) && $attributes[1]) {
$output = $attributes[1] . '<p class="details">' . i18n::s('[this file has been deleted]') . '</p>';
} else {
$output = '[download=' . $id . ']';
}
} else {
// label for this file
$prefix = $text = $suffix = '';
// signal restricted and private files
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// ensure we have a label for this link
if (isset($attributes[1]) && $attributes[1]) {
$text .= $attributes[1];
// this may describe a previous file, which has been replaced
if ($item['edit_action'] != 'file:create' && $attributes[1] != $item['file_name']) {
示例12: layout
/**
* list images
*
* Recognize following variants:
* - 'compact' - to build short lists in boxes and sidebars
* - '<a valid anchor>' - example: 'section:123' - to list images attached to an anchor page
*
* @param resource the SQL result
* @return array one item per image
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
if (!isset($this->layout_variant)) {
$this->layout_variant = '';
}
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// initialize variables
$prefix = $suffix = $icon = '';
// the url to view this item
$url = Images::get_url($item['id']);
$label = '_';
// the title
if ($item['title']) {
$suffix .= Skin::strip($item['title'], 10) . BR;
}
// there is an anchor
if ($item['anchor'] && ($anchor = Anchors::get($item['anchor']))) {
// codes to embed this image
if ($this->focus == $anchor->get_reference()) {
// help to insert in textarea
// if(!isset($_SESSION['surfer_editor']) || ($_SESSION['surfer_editor'] == 'yacs'))
// $suffix .= '<a onclick="edit_insert(\'\', \' [image='.$item['id'].']\');return false;" title="insert" tabindex="2000">[image='.$item['id'].']</a>'
// .' <a onclick="edit_insert(\'\', \' [image='.$item['id'].', left]\');return false;" title="insert" tabindex="2000">[image='.$item['id'].',left]</a>'
// .' <a onclick="edit_insert(\'\', \' [image='.$item['id'].', right]\');return false;" title="insert" tabindex="2000">[image='.$item['id'].',right]</a>'
// .' <a onclick="edit_insert(\'\', \' [image='.$item['id'].', center]\');return false;" title="insert" tabindex="2000">[image='.$item['id'].',center]</a>';
//
// else
$suffix .= '[image=' . $item['id'] . ']' . ' [image=' . $item['id'] . ',left]' . ' [image=' . $item['id'] . ',right]' . ' [image=' . $item['id'] . ',center]';
$suffix .= BR;
// show an anchor link
} else {
$anchor_url = $anchor->get_url();
$anchor_label = ucfirst($anchor->get_title());
$suffix .= sprintf(i18n::s('In %s'), Skin::build_link($anchor_url, $anchor_label)) . BR;
}
}
// details
$details = array();
// file name
if ($item['image_name']) {
$details[] = $item['image_name'];
}
// file size
if ($item['image_size'] > 1) {
$details[] = number_format($item['image_size']) . ' ' . i18n::s('bytes');
}
// poster
if ($item['edit_name']) {
$details[] = sprintf(i18n::s('edited by %s %s'), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']), Skin::build_date($item['edit_date']));
}
// append details
if (count($details)) {
$suffix .= '<span class="details">' . ucfirst(implode(', ', $details)) . '</span>' . BR;
}
// the menu bar
$menu = array();
// change the image
if (Surfer::is_empowered() || Surfer::is($item['edit_id'])) {
$menu = array_merge($menu, array(Images::get_url($item['id'], 'edit') => i18n::s('Update this image')));
}
// use the image
if (Surfer::is_empowered() && Surfer::is_member()) {
if (preg_match('/\\buser\\b/', $this->layout_variant)) {
$menu = array_merge($menu, array(Images::get_url($item['id'], 'set_as_thumbnail') => i18n::s('Set as profile picture')));
} elseif (preg_match('/\\b(article|category|section)\\b/', $this->layout_variant)) {
$menu = array_merge($menu, array(Images::get_url($item['id'], 'set_as_icon') => i18n::s('Set as page image')));
$menu = array_merge($menu, array(Images::get_url($item['id'], 'set_as_thumbnail') => i18n::s('Set as page thumbnail')));
}
}
// delete the image
if (Surfer::is_empowered() || Surfer::is($item['edit_id'])) {
$menu = array_merge($menu, array(Images::get_url($item['id'], 'delete') => i18n::s('Delete this image')));
}
if (count($menu)) {
$suffix .= Skin::build_list($menu, 'menu');
}
// link to the thumbnail image, if any
$icon = '<span class="small_image"><img src="' . Images::get_thumbnail_href($item) . '" title="' . encode_field(strip_tags($item['title'])) . '" alt="" /></span>';
// list all components for this item
//.........這裏部分代碼省略.........