本文整理汇总了PHP中Comments::list_by_date_for_anchor方法的典型用法代码示例。如果您正苦于以下问题:PHP Comments::list_by_date_for_anchor方法的具体用法?PHP Comments::list_by_date_for_anchor怎么用?PHP Comments::list_by_date_for_anchor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comments
的用法示例。
在下文中一共展示了Comments::list_by_date_for_anchor方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sprintf
if (is_object($anchor)) {
$values['channel']['title'] = sprintf(i18n::s('Comments for: %s'), $anchor->get_title());
$values['channel']['link'] = $context['url_to_home'] . $context['url_to_root'] . $anchor->get_url();
$values['channel']['description'] = $anchor->get_teaser('quote');
} else {
$values['channel']['title'] = sprintf(i18n::s('Recent comments at %s'), $context['site_name']);
$values['channel']['link'] = $context['url_to_home'] . $context['url_to_root'];
$values['channel']['description'] = i18n::s('Each article also has its own newsfeed.');
}
// the image for this channel
if (isset($context['powered_by_image']) && $context['powered_by_image']) {
$values['channel']['image'] = $context['url_to_home'] . $context['url_to_root'] . $context['powered_by_image'];
}
// list comments from the database -- no more than 100 at a time
if (is_object($anchor)) {
$values['items'] = Comments::list_by_date_for_anchor($anchor->get_reference(), 0, 100, 'feed');
} else {
$values['items'] = Comments::list_by_date(0, 100, 'feed');
}
// make a text
include_once '../services/codec.php';
include_once '../services/rss_codec.php';
$result = rss_Codec::encode($values);
$text = @$result[1];
// put in cache
Safe::file_put_contents($cache_id, $text);
}
//
// transfer to the user agent
//
// handle the output correctly
示例2: layout
/**
* list categories
*
* @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 plain text
$text = '';
// process all items in the list
while ($item = SQL::fetch($result)) {
// one box per category
$box['title'] = '';
$box['text'] = '';
// use the title to label the link
$box['title'] = Skin::strip($item['title'], 50);
// list related categories, if any
if ($items = Categories::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'compact')) {
foreach ($items as $url => $label) {
if (is_array($label)) {
$label = $label[1];
}
$box['text'] .= '<li>' . Skin::build_link($url, $label, 'category') . '</li>' . "\n";
}
}
// info on related sections
$items =& Members::list_sections_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
if ($items) {
foreach ($items as $url => $label) {
if (is_array($label)) {
$label = $label[1];
}
$box['text'] .= '<li>' . Skin::build_link($url, $label, 'section') . '</li>' . "\n";
}
}
// info on related articles
if (isset($item['options']) && preg_match('/\\barticles_by_title\\b/i', $item['options'])) {
$items =& Members::list_articles_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
} else {
$items =& Members::list_articles_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
}
if ($items) {
foreach ($items as $url => $label) {
if (is_array($label)) {
$label = $label[1];
}
$box['text'] .= '<li>' . Skin::build_link($url, $label, 'article') . '</li>' . "\n";
}
}
// info on related files
if (isset($item['options']) && preg_match('/\\bfiles_by_title\\b/i', $item['options'])) {
$items = Files::list_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'category:' . $item['id']);
} else {
$items = Files::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'category:' . $item['id']);
}
if ($items) {
foreach ($items as $url => $label) {
if (is_array($label)) {
$label = $label[1];
}
$box['text'] .= '<li>' . Skin::build_link($url, $label, 'file') . '</li>' . "\n";
}
}
// info on related comments
include_once $context['path_to_root'] . 'comments/comments.php';
if ($items = Comments::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'compact')) {
foreach ($items as $url => $label) {
if (is_array($label)) {
$label = $label[1];
}
$box['text'] .= '<li>' . Skin::build_link($url, $label, 'comment') . '</li>' . "\n";
}
}
// info on related links
include_once $context['path_to_root'] . 'links/links.php';
if (isset($item['options']) && preg_match('/\\blinks_by_title\\b/i', $item['options'])) {
$items = Links::list_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
} else {
$items = Links::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
}
if ($items) {
foreach ($items as $url => $label) {
if (is_array($label)) {
$label = $label[1];
}
$box['text'] .= '<li>' . Skin::build_link($url, $label) . '</li>' . "\n";
}
}
// add a direct link to the category
if (Surfer::is_associate()) {
$box['title'] .= ' ' . Skin::build_link(Categories::get_permalink($item), MORE_IMG, 'basic');
//.........这里部分代码省略.........
示例3: array
if (is_object($layout) && method_exists($layout, 'set_offset')) {
$layout->set_offset($offset);
}
// build a complete box
$box = array('bar' => array(), 'text' => '');
// new comments are allowed
if (Comments::allow_creation($item, $anchor, 'section')) {
$box['text'] .= Comments::get_form('section:' . $item['id']);
}
// a navigation bar for these comments
if ($count = Comments::count_for_anchor('section:' . $item['id'])) {
if ($count > 20) {
$box['bar'] += array('_count' => sprintf(i18n::s('%d comments'), $count));
}
// list comments by date
$items = Comments::list_by_date_for_anchor('section:' . $item['id'], $offset, $items_per_page, $layout, TRUE);
// actually render the html
if (is_array($items)) {
$box['text'] .= Skin::build_list($items, 'rows');
} elseif (is_string($items)) {
$box['text'] .= $items;
}
// navigation commands for comments
$prefix = Comments::get_url('section:' . $item['id'], 'navigate');
$box['bar'] = array_merge($box['bar'], Skin::navigate(NULL, $prefix, $count, $items_per_page, $zoom_index, FALSE, TRUE));
}
// build a box
if ($box['text']) {
// show commands
if (count($box['bar'])) {
// append the menu bar at the end
示例4: render_json
/**
* render comment as json format
*
* @param int $id of the comment
* @param object $anchor of the comment
*/
public static function render_json($id, $anchor)
{
// we'll return json
$output = '';
// get layout and render last comment
$layout = Comments::get_layout($anchor);
$layout->set_variant('no_wrap');
$rendering = Comments::list_by_date_for_anchor($anchor, 0, 1, $layout, true);
$output = json_encode(array('entity' => 'comment', 'id' => $id, 'anchor' => $anchor->get_reference(), 'html' => $rendering));
// allow for data compression
render_raw('application/json');
echo $output;
// the post-processing hook, then exit
finalize_page(TRUE);
}
示例5: array
// list files by date (default) or by title (option :files_by_title:)
$items = array();
if (Articles::has_option('files_by', $anchor, $item) == 'title') {
$items = Files::list_by_title_for_anchor('article:' . $item['id'], 0, 300, 'compact');
} else {
$items = Files::list_by_date_for_anchor('article:' . $item['id'], 0, 300, 'compact');
}
// actually list items
if (count($items)) {
$context['text'] .= Skin::build_box(i18n::s('Files'), utf8::to_unicode(Skin::build_list($items, 'compact')));
}
//
// attached comments
//
// list immutable comments by date
$items = Comments::list_by_date_for_anchor('article:' . $item['id'], 0, 500, 'excerpt');
// actually list items
if ($items) {
$context['text'] .= Skin::build_box(i18n::s('Comments'), utf8::to_unicode($items));
}
//
// related links
//
// list links by date (default) or by title (option :links_by_title:)
$items = array();
if (Articles::has_option('links_by_title', $anchor, $item)) {
$items = Links::list_by_title_for_anchor('article:' . $item['id'], 0, 50, 'compact');
} else {
$items = Links::list_by_date_for_anchor('article:' . $item['id'], 0, 50, 'compact');
}
// actually list items
示例6: layout
/**
* list sections
*
* @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;
}
// the maximum number of items per section
if (!defined('MAXIMUM_ITEMS_PER_SECTION')) {
define('MAXIMUM_ITEMS_PER_SECTION', 100);
}
// we return plain text
$text = '';
// process all items in the list
include_once $context['path_to_root'] . 'comments/comments.php';
include_once $context['path_to_root'] . 'links/links.php';
$family = '';
while ($item = SQL::fetch($result)) {
// change the family
if ($item['family'] != $family) {
$family = $item['family'];
// show the family
$text .= '<h2><span>' . $family . ' </span></h2>' . "\n";
}
// get the related overlay, if any
$overlay = Overlay::load($item, 'section:' . $item['id']);
// get the main anchor
$anchor = Anchors::get($item['anchor']);
// one box per section
$box = array('title' => '', 'text' => '');
// box content
$elements = array();
// use the title to label the link
if (is_object($overlay)) {
$box['title'] .= Codes::beautify_title($overlay->get_text('title', $item));
} else {
$box['title'] .= Codes::beautify_title($item['title']);
}
$details = array();
// info on related articles
if (preg_match('/\\barticles_by_([a-z_]+)\\b/i', $item['options'], $matches)) {
$order = $matches[1];
} else {
$order = 'edition';
}
$items =& Articles::list_for_anchor_by($order, 'section:' . $item['id'], 0, MAXIMUM_ITEMS_PER_SECTION + 1, 'compact');
if (@count($items)) {
// mention the number of items in folded title
$details[] = sprintf(i18n::ns('%d page', '%d pages', count($items)), count($items));
// add one link per item
foreach ($items as $url => $label) {
$prefix = $suffix = '';
if (is_array($label)) {
$prefix = $label[0];
$suffix = $label[2];
$label = $label[1];
}
$elements[] = $prefix . Skin::build_link($url, $label, 'article') . $suffix;
}
}
// info on related files
if (Sections::has_option('files_by', $anchor, $item) == 'title') {
$items = Files::list_by_title_for_anchor('section:' . $item['id'], 0, MAXIMUM_ITEMS_PER_SECTION + 1, 'compact');
} else {
$items = Files::list_by_date_for_anchor('section:' . $item['id'], 0, MAXIMUM_ITEMS_PER_SECTION + 1, 'compact');
}
if ($items) {
// mention the number of sections in folded title
$details[] = sprintf(i18n::ns('%d file', '%d files', count($items)), count($items));
// add one link per item
foreach ($items as $url => $label) {
if (is_array($label)) {
$prefix = $label[0];
$suffix = $label[2];
$label = $label[1];
}
$elements[] = $prefix . Skin::build_link($url, $label, 'file') . $suffix;
}
}
// info on related comments
if ($items = Comments::list_by_date_for_anchor('section:' . $item['id'], 0, MAXIMUM_ITEMS_PER_SECTION + 1, 'compact', TRUE)) {
// mention the number of sections in folded title
$details[] = sprintf(i18n::ns('%d comment', '%d comments', count($items)), count($items));
// add one link per item
foreach ($items as $url => $label) {
$prefix = $suffix = '';
if (is_array($label)) {
$prefix = $label[0];
$suffix = $label[2];
$label = $label[1];
}
//.........这里部分代码省略.........
示例7: layout
/**
* list articles
*
* @param resource the SQL result
* @return a string to be displayed
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// no hovering label
$href_title = '';
// we build an array for the skin::build_tabs() function
$panels = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// get the main anchor
$anchor = Anchors::get($item['anchor']);
// get the related overlay, if any
$overlay = Overlay::load($item, 'article:' . $item['id']);
// panel content
$text = '';
// insert anchor prefix
if (is_object($anchor)) {
$text .= $anchor->get_prefix();
}
// the introduction text, if any
if (is_object($overlay)) {
$text .= Skin::build_block($overlay->get_text('introduction', $item), 'introduction');
} elseif (isset($item['introduction']) && trim($item['introduction'])) {
$text .= Skin::build_block($item['introduction'], 'introduction');
}
// get text related to the overlay, if any
if (is_object($overlay)) {
$text .= $overlay->get_text('view', $item);
}
// filter description, if necessary
if (is_object($overlay)) {
$description = $overlay->get_text('description', $item);
} else {
$description = $item['description'];
}
// the beautified description, which is the actual page body
if ($description) {
// use adequate label
if (is_object($overlay) && ($label = $overlay->get_label('description'))) {
$text .= Skin::build_block($label, 'title');
}
// beautify the target page
$text .= Skin::build_block($description, 'description', '', $item['options']);
}
// list files only to people able to change the page
if (Articles::allow_modification($item, $anchor)) {
$embedded = NULL;
} else {
$embedded = Codes::list_embedded($item['description']);
}
// build a complete box
$box = array('bar' => array(), 'text' => '');
// count the number of files in this article
if ($count = Files::count_for_anchor('article:' . $item['id'], FALSE, $embedded)) {
if ($count > 20) {
$box['bar'] += array('_count' => sprintf(i18n::ns('%d file', '%d files', $count), $count));
}
// list files by date (default) or by title (option files_by_title)
$offset = ($zoom_index - 1) * FILES_PER_PAGE;
if (Articles::has_option('files_by', $anchor, $item) == 'title') {
$items = Files::list_by_title_for_anchor('article:' . $item['id'], 0, 300, 'article:' . $item['id'], $embedded);
} else {
$items = Files::list_by_date_for_anchor('article:' . $item['id'], 0, 300, 'article:' . $item['id'], $embedded);
}
// actually render the html
if (is_array($items)) {
$box['text'] .= Skin::build_list($items, 'decorated');
} elseif (is_string($items)) {
$box['text'] .= $items;
}
// the command to post a new file
if (Files::allow_creation($item, $anchor, 'article')) {
Skin::define_img('FILES_UPLOAD_IMG', 'files/upload.gif');
$box['bar'] += array('files/edit.php?anchor=' . urlencode('article:' . $item['id']) => FILES_UPLOAD_IMG . i18n::s('Add a file'));
}
}
// some files have been attached to this page
if ($page == 1 && $count > 1) {
// the command to download all files
$link = 'files/fetch_all.php?anchor=' . urlencode('article:' . $item['id']);
if ($count > 20) {
$label = i18n::s('Zip 20 first files');
} else {
$label = i18n::s('Zip all files');
}
$box['bar'] += array($link => $label);
//.........这里部分代码省略.........
示例8: layout
/**
* list pages
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// allow for multiple calls
static $accordion_id;
if (!isset($accordion_id)) {
$accordion_id = 1;
} else {
$accordion_id++;
}
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// the maximum number of items per article
if (!defined('MAXIMUM_ITEMS_PER_ACCORDION')) {
define('MAXIMUM_ITEMS_PER_ACCORDION', 100);
}
// we return plain text
$text = '';
// type of listed object
$items_type = $this->listed_type;
// process all items in the list
include_once $context['path_to_root'] . 'comments/comments.php';
include_once $context['path_to_root'] . 'links/links.php';
$family = '';
while ($item = SQL::fetch($result)) {
// get the object interface, this may load parent and overlay
$entity = new $items_type($item);
// change the family (layout of sections)
if (isset($item['family']) && $item['family'] != $family) {
$family = $item['family'];
// show the family
$text .= '<h2><span>' . $family . ' </span></h2>' . "\n";
}
// one box per page
$box = array('title' => '', 'text' => '');
// signal entity to be published
if (isset($item['publish_date']) && ($item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S'))) {
$box['title'] .= DRAFT_FLAG;
}
// signal entity to be activated
if (isset($item['activation_date']) && $item['activation_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
$box['title'] .= DRAFT_FLAG;
}
// signal restricted and private entity
if ($item['active'] == 'N') {
$box['title'] .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$box['title'] .= RESTRICTED_FLAG;
}
// use the title to label the link
if (is_object($entity->overlay)) {
$box['title'] .= Codes::beautify_title($entity->overlay->get_text('title', $item));
} else {
$box['title'] .= Codes::beautify_title($item['title']);
}
// box content
$elements = array();
// complement the title with interesting details
$details = array();
// info on related article, only for sections
if ($items_type == 'section') {
if (preg_match('/\\barticles_by_([a-z_]+)\\b/i', $item['options'], $matches)) {
$order = $matches[1];
} else {
$order = 'edition';
}
$items =& Articles::list_for_anchor_by($order, $entity->get_reference(), 0, MAXIMUM_ITEMS_PER_ACCORDION + 1, 'compact');
if (@count($items)) {
// mention the number of items in folded title
$details[] = sprintf(i18n::ns('%d page', '%d pages', count($items)), count($items));
// add one link per item
foreach ($items as $url => $label) {
$prefix = $suffix = '';
if (is_array($label)) {
$prefix = $label[0];
$suffix = $label[2];
$label = $label[1];
}
$elements[] = $prefix . Skin::build_link($url, $label, 'article') . $suffix;
}
}
}
// info on related files
if ($entity->has_option('files_by') == 'title') {
$items = Files::list_by_title_for_anchor($entity->get_reference(), 0, MAXIMUM_ITEMS_PER_ACCORDION + 1, 'compact');
} else {
$items = Files::list_by_date_for_anchor($entity->get_reference(), 0, MAXIMUM_ITEMS_PER_ACCORDION + 1, 'compact');
}
if ($items) {
//.........这里部分代码省略.........
示例9: isset
}
$context['text'] .= Skin::finalize_list($menu, 'assistant_bar');
}
// insert anchor suffix
if (is_object($anchor)) {
$context['text'] .= $anchor->get_suffix();
}
} else {
///// json output
// get comment layout
$layout = Comments::get_layout($anchor);
// set variant, if any
if (isset($_REQUEST['variant'])) {
$layout->set_variant($_REQUEST['variant']);
}
// get offset
$offset = isset($_REQUEST['start']) && is_numeric($_REQUEST['start']) ? $_REQUEST['start'] : 0;
$count = isset($_REQUEST['batch']) && is_numeric($_REQUEST['batch']) ? $_REQUEST['batch'] : COMMENTS_PER_PAGE;
// do the request, get them from the end (reversed)
$comments = Comments::list_by_date_for_anchor($anchor, $offset, $count, $layout, true);
// how many left for next batch ?
$comment_left = Comments::count_for_anchor($anchor) - $offset - $count;
$output = json_encode(array('comments' => $comments, 'anchor' => $anchor->get_reference(), 'left' => $comment_left));
// allow for data compression
render_raw('application/json');
echo $output;
// the post-processing hook, then exit
finalize_page(TRUE);
}
// render the skin
render_skin();
示例10: array
//
// the comments section
//
// layout for printed comments
$layout = 'no_anchor';
// the maximum number of comments per page
if (is_object($layout)) {
$items_per_page = $layout->items_per_page();
} else {
$items_per_page = COMMENTS_PER_PAGE;
}
// build a complete box
$box['bar'] = array();
$box['text'] = '';
// list comments by date
$items = Comments::list_by_date_for_anchor('section:' . $item['id'], 0, $items_per_page, $layout);
// actually render the html
if (is_array($items)) {
$box['text'] .= Skin::build_list($items, 'rows');
} elseif (is_string($items)) {
$box['text'] .= $items;
}
// build a box
if ($box['text']) {
$context['text'] .= Skin::build_box('', $box['text']);
}
//
// related link
//
// list links by date (default) or by title (option :links_by_title:)
if (preg_match('/\\blinks_by_title\\b/i', $item['options'])) {
示例11: array
if (!$zoom_type || $zoom_type == 'comments') {
// build a complete box
$box = array('bar' => array(), 'text' => '');
// count the number of comments in this category
if ($zoom_type == 'comments') {
$url = '_count';
} else {
$url = Categories::get_permalink($item) . '#comments';
}
if ($count = Comments::count_for_anchor('category:' . $item['id'])) {
if ($count > 20) {
$box['bar'] = array('_count' => sprintf(i18n::ns('%d comment', '%d comments', $count), $count));
}
// list comments by date
$offset = ($zoom_index - 1) * COMMENTS_PER_PAGE;
$items = Comments::list_by_date_for_anchor('category:' . $item['id'], $offset, COMMENTS_PER_PAGE);
if (is_array($items)) {
$box['text'] .= Skin::build_list($items, 'rows');
}
// navigation commands for comments
$home = Categories::get_permalink($item);
$prefix = Categories::get_url($item['id'], 'navigate', 'comments');
if ($zoom_type == 'comments') {
$box['bar'] = array_merge($box['bar'], Skin::navigate($home, $prefix, $count, COMMENTS_PER_PAGE, $zoom_index, TRUE));
}
}
// the command to post a new comment
if (Comments::allow_creation($item, $anchor, 'category')) {
Skin::define_img('COMMENTS_ADD_IMG', 'comments/add.gif');
$url = 'comments/edit.php?anchor=' . urlencode('category:' . $item['id']);
$box['bar'] += array($url => COMMENTS_ADD_IMG . i18n::s('Post a comment'));
示例12: layout
/**
* list sections
*
* @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;
}
// the maximum number of items per section
if (!defined('MAXIMUM_ITEMS_PER_SECTION')) {
define('MAXIMUM_ITEMS_PER_SECTION', 50);
}
// we return plain text
$text = '';
// process all items in the list
include_once $context['path_to_root'] . 'comments/comments.php';
while ($item = SQL::fetch($result)) {
// get the related overlay, if any
$overlay = Overlay::load($item, 'section:' . $item['id']);
// get the main anchor
$anchor = Anchors::get($item['anchor']);
// the url to view this item
$url = Sections::get_permalink($item);
// use the title to label the link
if (is_object($overlay)) {
$title = Codes::beautify_title($overlay->get_text('title', $item));
} else {
$title = Codes::beautify_title($item['title']);
}
// initialize variables
$prefix = $suffix = $icon = '';
// flag sections that are draft, dead, or created or updated very recently
if ($item['activation_date'] >= $context['now']) {
$prefix .= DRAFT_FLAG;
} elseif ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$prefix .= EXPIRED_FLAG;
}
if ($item['create_date'] >= $context['fresh']) {
$suffix .= NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix .= UPDATED_FLAG;
}
// signal restricted and private sections
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// one box per section
$box = array('title' => '', 'text' => '');
// add a direct link to the section
$box['title'] = $prefix . Skin::build_link($url, $title, 'basic') . $suffix;
// box content
$elements = array();
// info on related articles
if (preg_match('/\\barticles_by_([a-z_]+)\\b/i', $item['options'], $matches)) {
$order = $matches[1];
} else {
$order = 'edition';
}
$items =& Articles::list_for_anchor_by($order, 'section:' . $item['id'], 0, MAXIMUM_ITEMS_PER_SECTION + 1, 'compact');
if (@count($items)) {
foreach ($items as $url => $label) {
$prefix = $suffix = '';
if (is_array($label)) {
$prefix = $label[0];
$suffix = $label[2];
$label = $label[1];
}
$elements[] = $prefix . Skin::build_link($url, $label, 'article') . $suffix;
}
}
// info on related files
if (Sections::has_option('files_by', $anchor, $item) == 'title') {
$items = Files::list_by_title_for_anchor('section:' . $item['id'], 0, MAXIMUM_ITEMS_PER_SECTION + 1, 'compact');
} else {
$items = Files::list_by_date_for_anchor('section:' . $item['id'], 0, MAXIMUM_ITEMS_PER_SECTION + 1, 'compact');
}
if ($items) {
foreach ($items as $url => $label) {
if (is_array($label)) {
$prefix = $label[0];
$suffix = $label[2];
$label = $label[1];
}
$elements[] = $prefix . Skin::build_link($url, $label, 'file') . $suffix;
}
}
// info on related comments
if ($items = Comments::list_by_date_for_anchor('section:' . $item['id'], 0, MAXIMUM_ITEMS_PER_SECTION + 1, 'compact', TRUE)) {
foreach ($items as $url => $label) {
$prefix = $suffix = '';
//.........这里部分代码省略.........