本文整理汇总了PHP中Skin::build_tags方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::build_tags方法的具体用法?PHP Skin::build_tags怎么用?PHP Skin::build_tags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skin
的用法示例。
在下文中一共展示了Skin::build_tags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: layout
/**
* list users
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!($count = SQL::count($result))) {
return $text;
}
// allow for several lists in the same page
static $serial;
if (isset($serial)) {
$serial++;
} else {
$serial = 1;
}
// don't blast too many people
if ($count > 100) {
$checked = '';
} elseif (isset($this->layout_variant) && $this->layout_variant == 'unchecked') {
$checked = '';
} else {
$checked = ' checked="checked"';
}
// div prefix
$text .= '<div id="users_as_mail_panel_' . $serial . '">';
// allow to select/deslect multiple rows at once
$text .= '<input type="checkbox" class="row_selector" onclick="check_user_as_mail_panel_' . $serial . '(\'div#users_as_mail_panel_' . $serial . '\', this);"' . $checked . ' /> ' . i18n::s('Select all/none') . BR;
// process all items in the list
$count = 0;
while ($item = SQL::fetch($result)) {
// we need some address
if (!$item['email']) {
continue;
}
// do not write to myself
if ($item['id'] == Surfer::get_id()) {
continue;
}
// get the related overlay, if any
$overlay = Overlay::load($item, 'user:' . $item['id']);
// column to select the row
$text .= '<input type="checkbox" name="selected_users[]" class="row_selector" value="' . encode_field($item['email']) . '"' . $checked . ' />';
// signal restricted and private users
if ($item['active'] == 'N') {
$text .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$text .= RESTRICTED_FLAG;
}
// the url to view this item
$url = Users::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['full_name']);
}
// sanity check
if (!$title) {
$title = $item['nick_name'];
}
// link to this page
$text .= Skin::build_link($url, $title, 'user');
// the introductory text
if ($item['introduction']) {
$text .= '<span class="tiny"> - ' . Codes::beautify_introduction($item['introduction']) . '</span>';
}
// insert overlay data, if any
if (is_object($overlay)) {
$text .= $overlay->get_text('list', $item);
}
// display all tags
if ($item['tags']) {
$text .= ' <span class="tags">' . Skin::build_tags($item['tags'], 'user:' . $item['id']) . '</span>';
}
// append the row
$text .= BR;
$count++;
}
// the script used to check all items at once
Page::insert_script('function check_user_as_mail_panel_' . $serial . '(scope, handle) {' . "\n" . ' $(scope + " input[type=\'checkbox\'].row_selector").each(' . "\n" . ' function() { $(this).attr("checked", $(handle).is(":checked"));}' . "\n" . ' );' . "\n" . '}' . "\n");
// div suffix
$text .= '</div>';
// no valid account has been found
if (!$count) {
$text = '';
}
// end of processing
SQL::free($result);
return $text;
}
示例2: layout_recent
/**
* layout one recent article
*
* @param array the article
* @return an array ($prefix, $label, $suffix)
**/
function layout_recent($item)
{
global $context;
// permalink
$url = Articles::get_permalink($item);
// get the related overlay, if any
$overlay = Overlay::load($item, 'article:' . $item['id']);
// get the anchor
$anchor = Anchors::get($item['anchor']);
// 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']);
}
// reset everything
$prefix = $suffix = '';
// signal restricted and private articles
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// rating
if ($item['rating_count']) {
$suffix .= Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
}
// the introductory text
$introduction = '';
if (is_object($overlay)) {
$introduction = $overlay->get_text('introduction', $item);
} elseif ($item['introduction']) {
$introduction = $item['introduction'];
}
if ($introduction) {
$suffix .= ' - ' . Codes::beautify_introduction($introduction);
}
// other details
$details = array();
// the author
$author = '';
if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') {
$author = sprintf(i18n::s('by %s'), $item['create_name']) . ' ';
}
// date
$details[] = $author . Skin::build_date($item['publish_date']);
// info on related files
if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = Skin::build_link($url . '#_attachments', sprintf(i18n::ns('%d file', '%d files', $count), $count), 'basic');
}
// info on related comments
$link = Comments::get_url('article:' . $item['id'], 'list');
if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = Skin::build_link($link, sprintf(i18n::ns('%d comment', '%d comments', $count), $count), 'basic');
}
// discuss
if (Comments::allow_creation($item, $anchor)) {
$details[] = Skin::build_link(Comments::get_url('article:' . $item['id'], 'comment'), i18n::s('Discuss'), 'basic');
}
// info on related links
if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = Skin::build_link($url . '#_attachments', sprintf(i18n::ns('%d link', '%d links', $count), $count), 'basic');
}
// append a menu
$suffix .= Skin::finalize_list($details, 'menu');
// display all tags
if ($item['tags']) {
$suffix .= ' <p class="tags" style="margin-top: 3px;">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</p>';
}
// insert an array of links
return array($prefix, $title, $suffix);
}
示例3: layout
/**
* list users
*
* @param resource the SQL result
* @return array of resulting items ($score, $summary), or NULL
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// we return an array of array($score, $summary)
$items = array();
// empty list
if (!SQL::count($result)) {
return $items;
}
// flag idle users
$idle = gmstrftime('%Y-%m-%d %H:%M:%S', time() - 600);
// process all items in the list
while ($item = SQL::fetch($result)) {
// one box at a time
$box = '';
// initialize variables
$prefix = $suffix = $icon = '';
// the url to view this item
$url = Users::get_permalink($item);
// flag profiles updated recently
if ($item['create_date'] >= $context['fresh']) {
$suffix .= NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix .= UPDATED_FLAG;
}
// signal restricted and private articles
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// signal locked profiles
if ($item['capability'] == '?') {
$prefix .= EXPIRED_FLAG;
}
// item title
if ($item['full_name']) {
$title = ucfirst(Skin::strip($item['full_name'], 10));
$hover = $item['nick_name'];
} else {
$title = ucfirst(Skin::strip($item['nick_name'], 10));
$hover = $item['full_name'];
}
// show contact information
if (Surfer::may_contact()) {
$suffix .= Users::build_presence($item);
}
// the introduction
if ($item['introduction']) {
if (is_callable(array('codes', 'beautify'))) {
$suffix .= ' - ' . Codes::beautify($item['introduction']);
} else {
$suffix .= ' - ' . $item['introduction'];
}
}
// display all tags
if ($item['tags']) {
$suffix .= ' <span class="tags">' . Skin::build_tags($item['tags'], 'user:' . $item['id']) . '</span>';
}
// details
$details = array();
// capability
if ($item['capability'] == 'A') {
$details[] = i18n::s('Associate');
} elseif ($item['capability'] == 'S') {
$details[] = i18n::s('Subscriber');
} else {
$details[] = i18n::s('Member');
}
// creation date
if ($item['create_date']) {
$details[] = sprintf(i18n::s('registered %s'), Skin::build_date($item['create_date']));
}
// last login
if ($this->layout_variant == 'dates') {
if (isset($item['login_date']) && $item['login_date'] > NULL_DATE) {
$address = '';
if ($item['login_address']) {
$address = ' (' . $item['login_address'] . ')';
}
$details[] = sprintf(i18n::s('last login %s'), Skin::build_date($item['login_date']) . $address);
} else {
$details[] = i18n::s('no login');
}
}
// last post
if ($this->layout_variant == 'dates') {
if (isset($item['post_date']) && $item['post_date'] > NULL_DATE) {
$details[] = sprintf(i18n::s('last post %s'), Skin::build_date($item['post_date']));
}
}
// posts
//.........这里部分代码省略.........
示例4: layout
//.........这里部分代码省略.........
// signal articles to be published
if ($item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
$prefix .= DRAFT_FLAG;
}
// signal restricted and private articles
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// introduction
$introduction = '';
if (is_object($overlay)) {
$introduction = $overlay->get_text('introduction', $item);
} else {
$introduction = $item['introduction'];
}
// the introductory text
if ($introduction) {
$suffix .= ' - ' . Codes::beautify_introduction($introduction);
// link to description, if any
if ($item['description']) {
$suffix .= ' ' . Skin::build_link($url, MORE_IMG, 'more', i18n::s('View the page')) . ' ';
}
}
// insert overlay data, if any
if (is_object($overlay)) {
$suffix .= $overlay->get_text('list', $item);
}
// details
$details = array();
// the author
if ($item['create_name'] != $item['edit_name']) {
$details[] = sprintf(i18n::s('by %s, %s'), Users::get_link($item['create_name'], $item['create_address'], $item['create_id']), Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']));
} else {
$details[] = sprintf(i18n::s('by %s'), Users::get_link($item['create_name'], $item['create_address'], $item['create_id']));
}
// the last action
$details[] = Anchors::get_action_label($item['edit_action']) . ' ' . Skin::build_date($item['edit_date']);
// the number of hits
if (Surfer::is_logged() && $item['hits'] > 1) {
$details[] = Skin::build_number($item['hits'], i18n::s('hits'));
}
// info on related files
if ($count = Files::count_for_anchor('article:' . $item['id'])) {
$details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
}
// info on related links
if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
}
// info on related comments
if ($count = Comments::count_for_anchor('article:' . $item['id'])) {
$details[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count);
}
// rating
if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
$details[] = Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
}
// the main anchor link
if (is_object($anchor)) {
$details[] = sprintf(i18n::s('in %s'), Skin::build_link($anchor->get_url(), ucfirst($anchor->get_title()), 'section'));
}
// display all tags
if ($item['tags']) {
$details[] = '<span class="tags">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</span>';
}
// combine in-line details
if (count($details)) {
$suffix .= '<p class="details">' . Skin::finalize_list($details, 'menu') . '</p>';
}
// insert a suffix separator
if (trim($suffix)) {
$suffix = ' ' . $suffix;
}
// item summary
$box .= $prefix . Skin::build_link($url, $title, 'article') . $suffix;
// the icon to put in the left column
if ($item['thumbnail_url']) {
$icon = $item['thumbnail_url'];
} elseif (is_callable(array($anchor, 'get_bullet_url'))) {
$icon = $anchor->get_bullet_url();
}
// build the complete HTML element
if ($icon) {
$icon = '<img src="' . $icon . '" alt="" title="' . encode_field(strip_tags($title)) . '" />';
// make it a clickable link
$icon = Skin::build_link($url, $icon, 'basic');
// default icon
} else {
$icon = DECORATED_IMG;
}
// layout this item
$list = array(array($box, $icon));
$items[] = array($item['score'], Skin::finalize_list($list, 'decorated'));
}
// end of processing
SQL::free($result);
return $items;
}
示例5: array
if (isset($item['edit_date']) && $item['edit_date']) {
$context['page_date'] = $item['edit_date'];
}
if (isset($item['publish_name']) && $item['publish_name']) {
$context['page_publisher'] = $item['publish_name'];
}
}
//
// set page details -- $context['page_details']
//
$text = '';
// do not mention details at follow-up pages, nor to crawlers
if (!$zoom_type && !Surfer::is_crawler()) {
// tags, if any
if (isset($item['tags'])) {
$context['page_tags'] =& Skin::build_tags($item['tags']);
}
// one detail per line
$text .= '<p class="details">';
$details = array();
// add details from the overlay, if any
if (is_object($overlay) && ($more = $overlay->get_text('details', $item))) {
$details[] = $more;
}
// the source, if any
if ($item['source']) {
if (preg_match('/(http|https|ftp):\\/\\/([^\\s]+)/', $item['source'], $matches)) {
$item['source'] = Skin::build_link($matches[0], $matches[0], 'external');
} elseif (strpos($item['source'], '[') === 0) {
if ($attributes = Links::transform_reference($item['source'])) {
list($link, $title, $description) = $attributes;
示例6: layout
/**
* list articles as topics in a forum
*
* @param resource the SQL result
* @return string the rendered text
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// start a table
$text .= Skin::table_prefix('jive');
// headers
$text .= Skin::table_row(array(i18n::s('Topic'), i18n::s('Content')), 'header');
// build a list of articles
$odd = FALSE;
include_once $context['path_to_root'] . 'comments/comments.php';
include_once $context['path_to_root'] . 'links/links.php';
while ($item = SQL::fetch($result)) {
// get the related overlay, if any
$overlay = Overlay::load($item, 'article:' . $item['id']);
// get the anchor
$anchor = Anchors::get($item['anchor']);
// the url to view this item
$url = Articles::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']);
}
// one row per article
$text .= '<tr class="' . ($odd ? 'odd' : 'even') . '"><td>';
$odd = !$odd;
// signal articles to be published
if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
$text .= DRAFT_FLAG;
}
// signal restricted and private articles
if ($item['active'] == 'N') {
$text .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$text .= RESTRICTED_FLAG;
}
// use the title as a link to the page
$text .= Skin::build_link($url, '<strong>' . $title . '</strong>', 'basic');
// signal locked articles
if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
$text .= ' ' . LOCKED_FLAG;
}
// flag articles updated recently
if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$text .= ' ' . EXPIRED_FLAG;
} elseif ($item['create_date'] >= $context['fresh']) {
$text .= ' ' . NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$text .= ' ' . UPDATED_FLAG;
}
// add details, if any
$details = array();
// poster name
if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') {
if ($item['create_name']) {
$details[] = sprintf(i18n::s('posted by %s %s'), Users::get_link($item['create_name'], $item['create_address'], $item['create_id']), Skin::build_date($item['create_date']));
}
}
// last update
$details[] = sprintf(i18n::s('Updated %s'), Skin::build_date($item['edit_date']));
// add details to the title
if (count($details)) {
$text .= '<p class="details" style="margin: 3px 0">' . join(', ', $details) . '</p>';
}
// display all tags
if ($item['tags']) {
$text .= '<p class="tags">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</p>';
}
// next cell for the content
$text .= '</td><td width="70%">';
// the content to be displayed
$content = '';
// rating
if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
$content .= Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
}
// the introductory text
if (is_object($overlay)) {
$content .= Codes::beautify_introduction($overlay->get_text('introduction', $item));
} else {
$content .= Codes::beautify_introduction($item['introduction']);
}
// insert overlay data, if any
if (is_object($overlay)) {
$content .= $overlay->get_text('list', $item);
}
// the description
//.........这里部分代码省略.........
示例7: layout
//.........这里部分代码省略.........
if ($introduction) {
$suffix .= ' - ' . Codes::beautify_introduction($introduction);
// link to description, if any
if ($item['description']) {
$suffix .= ' ' . Skin::build_link($url, MORE_IMG, 'more', i18n::s('View the page')) . ' ';
}
}
// insert overlay data, if any
if (is_object($overlay)) {
$suffix .= $overlay->get_text('list', $item);
}
// next line, except if we already are at the beginning of a line
if ($suffix && !preg_match('/<br\\s*\\/>$/', rtrim($suffix))) {
$suffix .= BR;
}
// append details to the suffix
$suffix .= '<span class="details">';
// details
$details = array();
// display details only at the main index page, and also at anchor pages
if (isset($this->focus) && $item['anchor'] != $this->focus) {
// the author
if (isset($context['with_author_information']) && $context['with_author_information'] == 'Y') {
if ($item['create_name'] != $item['edit_name']) {
$details[] = sprintf(i18n::s('by %s, %s'), $item['create_name'], $item['edit_name']);
} else {
$details[] = sprintf(i18n::s('by %s'), $item['create_name']);
}
}
// the last action
$details[] = Anchors::get_action_label($item['edit_action']) . ' ' . Skin::build_date($item['edit_date']);
// the number of hits
if (Surfer::is_logged() && $item['hits'] > 1) {
$details[] = Skin::build_number($item['hits'], i18n::s('hits'));
}
// info on related files
if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
}
// info on related links
if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
}
// info on related comments
if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count);
}
// rating
if ($item['rating_count'] && !(is_object($anchor) && $anchor->has_option('without_rating'))) {
$details[] = Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
}
// unusual ranks are signaled to associates and owners
if ($item['rank'] != 10000 && Articles::is_owned($item, $anchor)) {
$details[] = '{' . $item['rank'] . '}';
}
}
// at the user page
if ($this->layout_variant == 'no_author' && Surfer::get_id()) {
if (Members::check('article:' . $item['id'], 'user:' . Surfer::get_id())) {
$label = i18n::s('Stop notifications');
} else {
$label = i18n::s('Watch this page');
}
$menu = array('users/track.php?anchor=' . urlencode('article:' . $item['id']) => $label);
$details[] = Skin::build_list($menu, 'menu');
}
// the main anchor link
if (is_object($anchor) && (!isset($this->focus) || $item['anchor'] != $this->focus)) {
$details[] = sprintf(i18n::s('in %s'), Skin::build_link($anchor->get_url(), ucfirst($anchor->get_title()), 'section'));
}
// combine in-line details
if (count($details)) {
$suffix .= ucfirst(trim(implode(', ', $details)));
}
// end of details
$suffix .= '</span>';
// display all tags
if ($item['tags']) {
$suffix .= ' <span class="tags">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</span>';
}
// strip empty details
$suffix = str_replace(BR . '<span class="details"></span>', '', $suffix);
$suffix = str_replace('<span class="details"></span>', '', $suffix);
// insert a suffix separator
if (trim($suffix)) {
$suffix = ' ' . $suffix;
}
// the icon to put in the left column
if ($item['thumbnail_url']) {
$icon = $item['thumbnail_url'];
} elseif (is_callable(array($anchor, 'get_bullet_url'))) {
$icon = $anchor->get_bullet_url();
}
// list all components for this item
$items[$url] = array($prefix, $title, $suffix, 'article', $icon);
}
// end of processing
SQL::free($result);
return $items;
}
示例8: layout
//.........这里部分代码省略.........
$details[] = sprintf(i18n::s('with %s'), $friends);
}
// people details
if ($details) {
$text .= '<p class="details">' . join(', ', $details) . "</p>\n";
}
// the introductory text
$introduction = '';
if (is_object($overlay)) {
$introduction = $overlay->get_text('introduction', $item);
} elseif ($item['introduction']) {
$introduction = $item['introduction'];
}
if ($introduction) {
$text .= '<div style="margin: 1em 0;">' . Codes::beautify_introduction($introduction) . '</div>';
}
// insert overlay data, if any
if (is_object($overlay)) {
$text .= $overlay->get_text('list', $item);
}
// info on related comments
if (($count = Comments::count_for_anchor('article:' . $item['id'])) > 1) {
$text .= '<div style="margin-top: 1em;"><p class="details">' . sprintf(i18n::s('%d contributions, including:'), $count) . '</p></div>';
}
// avoid first file if mentioned in last contribution
$file_offset = 0;
// get last contribution for this page
if ($comment = Comments::get_newest_for_anchor('article:' . $item['id'])) {
if (preg_match('/\\[(download|file)=/', $comment['description'])) {
$file_offset++;
}
// bars around the last contribution
$bottom_menu = array();
// last contributor
$contributor = Users::get_link($comment['create_name'], $comment['create_address'], $comment['create_id']);
$flag = '';
if ($comment['create_date'] >= $context['fresh']) {
$flag = NEW_FLAG;
} elseif ($comment['edit_date'] >= $context['fresh']) {
$flag = UPDATED_FLAG;
}
$bottom_menu[] = sprintf(i18n::s('By %s'), $contributor) . ' ' . Skin::build_date($comment['create_date']) . $flag;
// offer to reply
if (Comments::allow_creation($item, $anchor)) {
$link = Comments::get_url($comment['id'], 'reply');
$bottom_menu[] = Skin::build_link($link, i18n::s('Reply'), 'basic');
}
// gather pieces
$pieces = array();
// last contribution, and user signature
$pieces[] = ucfirst(trim($comment['description'])) . Users::get_signature($comment['create_id']);
// bottom
if ($bottom_menu) {
$pieces[] = '<div style="margin-top: 1em;">' . ucfirst(trim(Skin::finalize_list($bottom_menu, 'menu'))) . '</div>';
}
// put all pieces together
$text .= '<div class="last_comment">' . "\n" . join("\n", $pieces) . '</div>' . "\n";
}
// list more recent files
if ($items = Files::list_by_date_for_anchor('article:' . $item['id'], $file_offset, 3, 'dates')) {
// more files than listed
$more = '';
if (($count = Files::count_for_anchor('article:' . $item['id'])) > 3) {
$more = '<span class="details">' . sprintf(i18n::s('%d files, including:'), $count) . '</span>';
}
if (is_array($items)) {
$items = Skin::build_list($items, 'compact');
}
$text .= '<div style="margin: 1em 0;">' . $more . $items . '</div>';
}
// display all tags
if ($item['tags']) {
$text .= ' <p class="tags">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</p>';
}
// navigation links
$menu = array();
// permalink
$menu[] = Skin::build_link($url, i18n::s('View the page'), 'span');
// info on related links
if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
$menu[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
}
// the main anchor link
if (is_object($anchor) && (!isset($this->focus) || $item['anchor'] != $this->focus)) {
$menu[] = Skin::build_link($anchor->get_url(), sprintf(i18n::s('in %s'), ucfirst($anchor->get_title())), 'span', i18n::s('View the section'));
}
// actually insert details
$text .= Skin::finalize_list($menu, 'menu_bar');
// bottom of the box
$text .= '</div>';
}
// close the list of articles
$text .= '</div>';
// beautify everything at once
$text = Codes::beautify($text);
// end of processing
SQL::free($result);
// done
return $text;
}
示例9: layout
/**
* list users
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// we return an array of ($url => $attributes)
$items = array();
// empty list
if (!SQL::count($result)) {
return $items;
}
// flag idle users
$idle = gmstrftime('%Y-%m-%d %H:%M:%S', time() - 600);
// default variant
if (!isset($this->layout_variant)) {
$this->layout_variant == 'full';
}
// process all items in the list
while ($item = SQL::fetch($result)) {
// initialize variables
$prefix = $suffix = $icon = '';
// the url to view this item
$url = Users::get_permalink($item);
// flag profiles updated recently
if ($item['create_date'] >= $context['fresh']) {
$suffix .= NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix .= UPDATED_FLAG;
}
// signal restricted and private articles
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// signal locked profiles
if ($item['capability'] == '?') {
$prefix .= EXPIRED_FLAG;
}
// item title
if ($item['full_name']) {
$label = ucfirst(Skin::strip($item['full_name'], 10));
$hover = $item['nick_name'];
} else {
$label = ucfirst(Skin::strip($item['nick_name'], 10));
$hover = $item['full_name'];
}
// show contact information
if (Surfer::may_contact()) {
$suffix .= Users::build_presence($item);
}
// the introduction
if ($item['introduction']) {
if (is_callable(array('codes', 'beautify'))) {
$suffix .= ' - ' . Codes::beautify($item['introduction']);
} else {
$suffix .= ' - ' . $item['introduction'];
}
}
// display all tags
if ($item['tags']) {
$suffix .= ' <span class="tags">' . Skin::build_tags($item['tags'], 'user:' . $item['id']) . '</span>';
}
// details
$details = array();
// capability
if ($item['capability'] == 'A') {
$details[] = i18n::s('Associate');
} elseif ($item['capability'] == 'S') {
$details[] = i18n::s('Subscriber');
} else {
$details[] = i18n::s('Member');
}
// creation date
if ($item['create_date']) {
$details[] = sprintf(i18n::s('registered %s'), Skin::build_date($item['create_date']));
}
// last login
if ($this->layout_variant == 'dates') {
if (isset($item['login_date']) && $item['login_date'] > NULL_DATE) {
$address = '';
if ($item['login_address']) {
$address = ' (' . $item['login_address'] . ')';
}
$details[] = sprintf(i18n::s('last login %s'), Skin::build_date($item['login_date']) . $address);
} else {
$details[] = i18n::s('no login');
}
}
// last post
if ($this->layout_variant == 'dates') {
if (isset($item['post_date']) && $item['post_date'] > NULL_DATE) {
$details[] = sprintf(i18n::s('last post %s'), Skin::build_date($item['post_date']));
}
//.........这里部分代码省略.........
示例10: layout
/**
* list articles as alistapart did
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!SQL::count($result)) {
$output = '<p>' . i18n::s('No page to display.');
if (Surfer::is_associate()) {
$output .= ' ' . sprintf(i18n::s('Use the %s to populate this server.'), Skin::build_link('help/populate.php', i18n::s('Content Assistant'), 'shortcut'));
}
$output .= '</p>';
return $output;
}
// menu at page bottom
$this->menu = array();
// build a list of articles
$item_count = 0;
$future = array();
$others = array();
include_once $context['path_to_root'] . 'comments/comments.php';
include_once $context['path_to_root'] . 'links/links.php';
while ($item = SQL::fetch($result)) {
// get the related overlay
$overlay = Overlay::load($item, 'article:' . $item['id']);
// get the main anchor
$anchor = Anchors::get($item['anchor']);
// the url to view this item
$url = Articles::get_permalink($item);
// build a title
if (is_object($overlay)) {
$title = Codes::beautify_title($overlay->get_text('title', $item));
} else {
$title = Codes::beautify_title($item['title']);
}
// initialize variables
$prefix = $suffix = '';
// signal restricted and private articles
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// signal locked articles
if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
$suffix .= LOCKED_FLAG;
}
// flag expired articles, and articles updated recently
if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$suffix = EXPIRED_FLAG . ' ';
} elseif ($item['create_date'] >= $context['fresh']) {
$suffix = NEW_FLAG . ' ';
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix = UPDATED_FLAG . ' ';
}
// list separately articles to be published
if ($item['publish_date'] <= NULL_DATE) {
$prefix = DRAFT_FLAG . $prefix;
$future[$url] = array($prefix, $title, $suffix);
} elseif ($item['publish_date'] > $context['now']) {
$future[$url] = array($prefix, $title, $suffix);
} else {
$item_count += 1;
// layout the newest article
if ($item_count == 1) {
$text .= $this->layout_newest($item);
// display all tags
if ($item['tags']) {
$context['page_tags'] = Skin::build_tags($item['tags']);
}
// layout recent articles
} else {
$others[$url] = array($prefix, $title, $suffix);
}
}
}
// build the list of future articles
if (@count($future)) {
$this->menu[] = Skin::build_sliding_box(i18n::s('Pages under preparation'), Skin::build_list($future, 'compact'), NULL, TRUE);
}
// build the list of other articles
if (@count($others)) {
$this->menu[] = Skin::build_sliding_box(i18n::s('Previous pages'), Skin::build_list($others, 'compact'), NULL, TRUE);
}
// talk about it
if (@count($this->menu)) {
$text .= Skin::build_box(strlen($text) > 1024 ? i18n::s('Follow-up') : '', Skin::finalize_list($this->menu, 'menu_bar'));
}
// end of processing
SQL::free($result);
return $text;
}
示例11: layout
/**
* list articles as a table of content of a manual
*
* @param resource the SQL result
* @return string the rendered text
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// build a list of articles
include_once $context['path_to_root'] . 'links/links.php';
$text .= '<ul class="manual">';
while ($item = SQL::fetch($result)) {
// get the related overlay, if any
$overlay = Overlay::load($item, 'article:' . $item['id']);
// get the anchor
$anchor = Anchors::get($item['anchor']);
// the url to view this item
$url = Articles::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']);
}
// reset everything
$prefix = $label = $suffix = $icon = $details = '';
// signal articles to be published
if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
$prefix .= DRAFT_FLAG;
}
// signal restricted and private articles
if (isset($item['active']) && $item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif (isset($item['active']) && $item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// flag articles updated recently
if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$suffix .= ' ' . EXPIRED_FLAG;
} elseif ($item['create_date'] >= $context['fresh']) {
$suffix .= ' ' . NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix .= ' ' . UPDATED_FLAG;
}
// attachment details
$details = array();
// info on related files
if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
Skin::define_img('FILES_LIST_IMG', 'files/list.gif');
$details[] = FILES_LIST_IMG . sprintf(i18n::ns('%d file', '%d files', $count), $count);
}
// info on related links
if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
Skin::define_img('LINKS_LIST_IMG', 'links/list.gif');
$details[] = LINKS_LIST_IMG . sprintf(i18n::ns('%d link', '%d links', $count), $count);
}
// rating
if ($item['rating_count']) {
$details[] = Skin::build_link(Articles::get_url($item['id'], 'like'), Skin::build_rating_img((int) round($item['rating_sum'] / $item['rating_count'])), 'basic');
}
// describe attachments
if (count($details)) {
$suffix .= ' <span class="details">' . join(', ', $details) . '</span>';
}
// display all tags
if ($item['tags']) {
$suffix .= ' <span class="details">- ' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</span>';
}
// make a link
$label = $prefix . Skin::build_link($url, $title, 'basic') . $suffix;
// use the title as a link to the page
$text .= '<li>' . $label . "</li>\n";
}
$text .= '</ul>' . "\n";
// end of processing
SQL::free($result);
return $text;
}
示例12: layout
//.........这里部分代码省略.........
$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 = rtrim(Codes::strip(' ' . $label[2]), '- ');
$label = $label[1];
}
$elements[] = $prefix . Skin::build_link($url, $label, 'comment') . $suffix;
}
}
// info on related links
if ($entity->has_option('links_by_title')) {
$items = Links::list_by_title_for_anchor($entity->get_reference(), 0, MAXIMUM_ITEMS_PER_ACCORDION + 1, 'compact');
} else {
$items = Links::list_by_date_for_anchor($entity->get_reference(), 0, MAXIMUM_ITEMS_PER_ACCORDION + 1, 'compact');
}
if ($items) {
// mention the number of items in folded title
$details[] = sprintf(i18n::ns('%d link', '%d links', 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) . $suffix;
}
}
// list related sub-sections, if any
if ($items_type == 'section') {
if ($items =& Sections::list_by_title_for_anchor($entity->get_reference(), 0, MAXIMUM_ITEMS_PER_ACCORDION + 1, 'compact')) {
// mention the number of sections in folded title
$details[] = sprintf(i18n::ns('%d section', '%d sections', 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, 'section') . $suffix;
}
}
}
// a link to the page
$permalink = $entity->get_permalink($item);
$elements[] = Skin::build_link($permalink, sprintf(i18n::s('View the %s'), $items_type) . MORE_IMG, 'shortcut');
// complement title
if (count($details)) {
$box['title'] .= ' <span class="details">(' . join(', ', $details) . ')</span>';
}
// insert introduction, if any
if (is_object($entity->overlay)) {
$box['text'] .= Skin::build_block($entity->overlay->get_text('introduction', $item), 'introduction');
} elseif (trim($item['introduction'])) {
$box['text'] .= Skin::build_block($item['introduction'], 'introduction');
} else {
// insert overlay data, if any
if (is_object($entity->overlay)) {
$box['text'] .= $entity->overlay->get_text('box', $item);
}
// the content of this box
$box['text'] .= Codes::beautify($item['description'], $item['options']);
}
// make a full list
if (count($elements)) {
$box['text'] .= Skin::finalize_list($elements, 'compact');
}
// display all tags
if ($item['tags']) {
$box['text'] .= ' <p class="tags" style="margin-bottom: 0">' . Skin::build_tags($item['tags'], $entity->get_reference()) . '</p>';
}
// if we have an icon for this page, use it
if (isset($item['thumbnail_url']) && $item['thumbnail_url']) {
// adjust the class
$class = '';
if (isset($context['classes_for_thumbnail_images'])) {
$class = 'class="' . $context['classes_for_thumbnail_images'] . '" ';
}
// build the complete HTML element
$icon = '<img src="' . $item['thumbnail_url'] . '" alt="" title="' . encode_field(Codes::beautify_title($item['title'])) . '" ' . $class . '/>';
// make it clickable
$link = Skin::build_link($permalink, $icon, 'basic');
// put this aside
$box['text'] = '<table class="decorated"><tr>' . '<td class="image">' . $link . '</td>' . '<td class="content">' . $box['text'] . '</td>' . '</tr></table>';
}
// always make a box
$text .= $this->build_accordion_box($box['title'], $box['text'], 'accordion_' . $accordion_id);
}
// we have bounded styles and scripts
$this->load_scripts_n_styles();
// end of processing
SQL::free($result);
return $text;
}
示例13: layout
/**
* list articles as rows in a table
*
* @param resource the SQL result
* @return string the rendered text
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// build a list of articles
$rows = array();
include_once $context['path_to_root'] . 'comments/comments.php';
include_once $context['path_to_root'] . 'links/links.php';
while ($item = SQL::fetch($result)) {
// get the related overlay
$overlay = Overlay::load($item, 'article:' . $item['id']);
// get the anchor
$anchor = Anchors::get($item['anchor']);
// the url to view this item
$url = Articles::get_permalink($item);
// reset everything
$id = $summary = $owner = $type = $status = $update = $progress = '';
// link to the page
$id = Skin::build_link($url, $item['id'], 'basic');
// signal articles to be published
if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
$summary .= DRAFT_FLAG;
}
// signal restricted and private articles
if ($item['active'] == 'N') {
$summary .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$summary .= RESTRICTED_FLAG;
}
// indicate the id in the hovering popup
$hover = i18n::s('View the page');
if (Surfer::is_member()) {
$hover .= ' [article=' . $item['id'] . ']';
}
// use the title to label the link
if (is_object($overlay)) {
$label = Codes::beautify_title($overlay->get_text('title', $item));
} else {
$label = Codes::beautify_title($item['title']);
}
// use the title as a link to the page
$summary .= Skin::build_link($url, $label, 'basic', $hover);
// signal locked articles
if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
$summary .= ' ' . LOCKED_FLAG;
}
// flag articles updated recently
if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$summary .= ' ' . EXPIRED_FLAG;
} elseif ($item['create_date'] >= $context['fresh']) {
$summary .= ' ' . NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$summary .= ' ' . UPDATED_FLAG;
}
// attachment details
$details = array();
// info on related files
if ($count = Files::count_for_anchor('article:' . $item['id'])) {
Skin::define_img('FILES_LIST_IMG', 'files/list.gif');
$details[] = FILES_LIST_IMG . sprintf(i18n::ns('%d file', '%d files', $count), $count);
}
// info on related links
if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
Skin::define_img('LINKS_LIST_IMG', 'links/list.gif');
$details[] = LINKS_LIST_IMG . sprintf(i18n::ns('%d link', '%d links', $count), $count);
}
// comments
if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) {
Skin::define_img('COMMENTS_LIST_IMG', 'comments/list.gif');
$details[] = Skin::build_link(Comments::get_url('article:' . $item['id'], 'list'), COMMENTS_LIST_IMG . sprintf(i18n::ns('%d comment', '%d comments', $count), $count));
}
// combine in-line details
if (count($details)) {
$summary .= ' <span class="details">' . trim(implode(' ', $details)) . '</span>';
}
// dates
$summary .= BR . '<span class="details">' . join(BR, Articles::build_dates($anchor, $item)) . '</span>';
// display all tags
if ($item['tags']) {
$summary .= BR . '<span class="tags">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</span>';
}
// page owner
if (isset($item['owner_id']) && ($owner = Users::get($item['owner_id']))) {
$owner = Users::get_link($owner['full_name'], $owner['email'], $owner['id']);
}
// type is provided by the overlay
if (is_object($overlay)) {
$type = $overlay->get_value('type', '');
}
//.........这里部分代码省略.........
示例14: layout
/**
* list articles as rows in a table
*
* @param resource the SQL result
* @return string the rendered text
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// we list pages for one surfer
// sanity check
if (!isset($this->focus)) {
$this->focus = Surfer::get_id();
}
// build a list of articles
Skin::define_img('CHECKED_IMG', 'ajax/accept.png', '*');
$rows = array();
include_once $context['path_to_root'] . 'comments/comments.php';
include_once $context['path_to_root'] . 'links/links.php';
while ($item = SQL::fetch($result)) {
// get the related overlay
$overlay = Overlay::load($item, 'article:' . $item['id']);
// get the anchor
$anchor = Anchors::get($item['anchor']);
// the url to view this item
$url = Articles::get_permalink($item);
// reset everything
$summary = $update = $owner = $editor = $watcher = '';
// signal articles to be published
if (!isset($item['publish_date']) || $item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
$summary .= DRAFT_FLAG;
}
// signal restricted and private articles
if ($item['active'] == 'N') {
$summary .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$summary .= RESTRICTED_FLAG;
}
// indicate the id in the hovering popup
$hover = i18n::s('View the page');
if (Surfer::is_member()) {
$hover .= ' [article=' . $item['id'] . ']';
}
// use the title to label the link
if (is_object($overlay)) {
$label = Codes::beautify_title($overlay->get_text('title', $item));
} else {
$label = Codes::beautify_title($item['title']);
}
// use the title as a link to the page
$summary .= Skin::build_link($url, $label, 'basic', $hover);
// signal locked articles
if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
$summary .= ' ' . LOCKED_FLAG;
}
// flag articles updated recently
if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$summary .= ' ' . EXPIRED_FLAG;
} elseif ($item['create_date'] >= $context['fresh']) {
$summary .= ' ' . NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$summary .= ' ' . UPDATED_FLAG;
}
// insert overlay data, if any
if (is_object($overlay)) {
$summary .= $overlay->get_text('list', $item);
}
// attachment details
$details = array();
// info on related files
if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
}
// info on related links
if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
}
// comments
if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d comment', '%d comments', $count), $count);
}
// the main anchor link
if (is_object($anchor) && (!isset($this->focus) || $item['anchor'] != $this->focus)) {
$details[] = sprintf(i18n::s('in %s'), Skin::build_link($anchor->get_url(), ucfirst($anchor->get_title()), 'basic'));
}
// combine in-line details
if (count($details)) {
$summary .= BR . '<span class="details">' . trim(implode(' · ', $details)) . '</span>';
}
// display all tags
if ($item['tags']) {
$summary .= BR . '<span class="tags">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</span>';
}
// dates
//.........这里部分代码省略.........
示例15: layout
/**
* list articles
*
* @param resource the SQL result
* @return array of resulting items, or NULL
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// we return an array of ($url => $attributes)
$items = array();
// empty list
if (!SQL::count($result)) {
return $items;
}
// process all items in the list
include_once $context['path_to_root'] . 'comments/comments.php';
include_once $context['path_to_root'] . 'links/links.php';
while ($item = SQL::fetch($result)) {
// get the related overlay, if any
$overlay = Overlay::load($item, 'article:' . $item['id']);
// get the main anchor
$anchor = Anchors::get($item['anchor']);
// the url to view this item
$url = Articles::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 sticky pages
if ($item['rank'] < 10000) {
$prefix .= STICKY_FLAG;
}
// signal articles to be published
if ($item['publish_date'] <= NULL_DATE || $item['publish_date'] > gmstrftime('%Y-%m-%d %H:%M:%S')) {
$prefix .= DRAFT_FLAG;
}
// signal restricted and private articles
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// signal locked articles
if (isset($item['locked']) && $item['locked'] == 'Y' && Articles::is_owned($item, $anchor)) {
$suffix .= ' ' . LOCKED_FLAG;
}
// flag articles that are dead, or created or updated very recently
if ($item['expiry_date'] > NULL_DATE && $item['expiry_date'] <= $context['now']) {
$prefix .= EXPIRED_FLAG;
} elseif ($item['create_date'] >= $context['fresh']) {
$suffix .= ' ' . NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix .= ' ' . UPDATED_FLAG;
}
// info on related comments
if ($count = Comments::count_for_anchor('article:' . $item['id'], TRUE)) {
$suffix .= ' (' . $count . ')';
}
// the introductory text
$introduction = '';
if (is_object($overlay)) {
$introduction = $overlay->get_text('introduction', $item);
} elseif ($item['introduction']) {
$introduction = $item['introduction'];
}
if ($introduction) {
$suffix .= ' - ' . Codes::beautify_introduction($introduction);
}
// details
$details = array();
// info on related files
if ($count = Files::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d file', '%d files', $count), $count);
}
// info on related links
if ($count = Links::count_for_anchor('article:' . $item['id'], TRUE)) {
$details[] = sprintf(i18n::ns('%d link', '%d links', $count), $count);
}
// combine in-line details
if (count($details)) {
$suffix .= ' <span class="details">' . trim(implode(', ', $details)) . '</span>';
}
// display all tags
if ($item['tags']) {
$suffix .= ' <span class="tags">' . Skin::build_tags($item['tags'], 'article:' . $item['id']) . '</span>';
}
// list all components for this item
$items[$url] = array($prefix, $title, $suffix, 'article');
}
// end of processing
SQL::free($result);
return $items;
}