本文整理汇总了PHP中Skin::finalize_list方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::finalize_list方法的具体用法?PHP Skin::finalize_list怎么用?PHP Skin::finalize_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skin
的用法示例。
在下文中一共展示了Skin::finalize_list方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_endpoints
/**
* retrieve endpoints of last calls
*
* This is useful to list all servers notified after a publication.
*
* @param string title of the folded box generated
* @return mixed text to be integrated into the page, or array with one item per recipient, or ''
*/
public static function build_endpoints($title = NULL)
{
global $context;
// nothing to show
if (!Surfer::get_id() || !isset($context['servers_endpoints']) || !$context['servers_endpoints']) {
return '';
}
// return the bare list
if (!$title) {
return $context['servers_endpoints'];
}
// build a nice list
$list = array();
foreach ($context['servers_endpoints'] as $recipient) {
$list[] = htmlspecialchars($recipient);
}
return Skin::build_box($title, Skin::finalize_list($list, 'compact'), 'folded');
}
示例2: die
Safe::header('Status: 401 Unauthorized', TRUE, 401);
die(i18n::s('You are not allowed to perform this operation.'));
// the watch list
} elseif ($action == 'watch') {
render_raw();
// we return some HTML
$output = '';
// horizontal menu
$menu = array();
// manage command
if (Surfer::is_associate() || Surfer::get_id() == $item['id']) {
Skin::define_img('USERS_WATCH_IMG', 'users/watch.gif');
$menu[] = Skin::build_link(Users::get_url('user:' . $item['id'], 'select'), USERS_WATCH_IMG . i18n::s('Manage followers'), 'span');
}
// build the menu
$output .= Skin::finalize_list($menu, 'menu_bar');
// list watched users by posts
$watched = '';
if ($items =& Members::list_connections_for_user('user:' . $item['id'], 0, 200, 'watch')) {
if (is_array($items)) {
$items = Skin::build_list($items, 'decorated');
}
$watched .= $items;
} elseif (Surfer::get_id() == $item['id']) {
$watched .= '<p>' . i18n::s('Click on the link above to follow someone.') . '</p>';
} else {
$watched .= '<p>' . sprintf(i18n::s('%s is not yet following other persons.'), $item['full_name']) . '</p>';
}
// the list of followers
$followers = '';
if ($items = Members::list_watchers_by_name_for_anchor('user:' . $item['id'], 0, 1000, 'compact')) {
示例3: sprintf
if (is_object($parent)) {
$details[] = sprintf(i18n::s('in %s'), Skin::build_link($parent->get_url(), ucfirst($parent->get_title()), 'section'));
}
// combine in-line details
if (count($details)) {
$suffix .= ' - <span class="details">' . trim(implode(', ', $details)) . '</span>';
}
// surfer cannot be deselected
if (!strcmp($anchor->get_reference(), 'user:' . $section['owner_id'])) {
$suffix .= ' - <span class="details">' . i18n::s('owner') . '</span>';
} elseif (Surfer::is_associate()) {
$link = $context['script_url'] . '?anchor=' . urlencode($anchor->get_reference()) . '&member=section:' . $section['id'] . '&action=reset';
$suffix .= ' - <span class="details">' . Skin::build_link($link, i18n::s('unassign'), 'basic') . '</span>';
}
// format the item
$new_sections[$url] = array($prefix, $title, $suffix, 'section', $icon);
}
// display attached sections with unlink buttons
$context['text'] .= Skin::build_list($new_sections, 'decorated');
}
// back to the anchor page
$links = array();
$links[] = Skin::build_link($anchor->get_url(), i18n::s('Done'), 'button');
$context['text'] .= Skin::finalize_list($links, 'assistant_bar');
// insert anchor suffix
if (is_object($anchor)) {
$context['text'] .= $anchor->get_suffix();
}
}
// render the skin
render_skin();
示例4: array
// page tools
if (Surfer::is_associate()) {
$context['page_tools'][] = Skin::build_link('sections/edit.php', i18n::s('Add a section'));
$context['page_tools'][] = Skin::build_link('help/populate.php', i18n::s('Content Assistant'));
$context['page_tools'][] = Skin::build_link('sections/check.php', i18n::s('Maintenance'));
}
// display extra information
$cache_id = 'sections/index.php#extra';
if (!($text = Cache::get($cache_id))) {
// see also
$lines = array();
$lines[] = Skin::build_link('categories/', i18n::s('Categories'));
$lines[] = Skin::build_link('search.php', i18n::s('Search'));
$lines[] = Skin::build_link('help/', i18n::s('Help index'));
$lines[] = Skin::build_link('query.php', i18n::s('Contact'));
$text .= Skin::build_box(i18n::s('See also'), Skin::finalize_list($lines, 'compact'), 'boxes');
// list monthly publications in an extra box
$anchor = Categories::get(i18n::c('monthly'));
if (isset($anchor['id']) && ($items = Categories::list_by_date_for_anchor('category:' . $anchor['id'], 0, COMPACT_LIST_SIZE, 'compact'))) {
$text .= Skin::build_box($anchor['title'], Skin::build_list($items, 'compact'), 'boxes') . "\n";
}
// side boxes for related categories, if any
if ($categories = Categories::list_by_date_for_display('section:index', 0, 7, 'raw')) {
foreach ($categories as $id => $attributes) {
// link to the category page from the box title
$label =& Skin::build_box_title(Skin::strip($attributes['title']), Categories::get_permalink($attributes), i18n::s('View the category'));
// box content
if ($items =& Members::list_articles_by_date_for_anchor('category:' . $id, 0, COMPACT_LIST_SIZE, 'compact')) {
$text .= Skin::build_box($label, Skin::build_list($items, 'compact'), 'boxes') . "\n";
}
}
示例5: 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;
}
示例6: layout
//.........这里部分代码省略.........
// 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
if (intval($item['posts']) > 1) {
$details[] = sprintf(i18n::s('%d posts'), intval($item['posts']));
}
if (count($details)) {
if ($this->layout_variant == 'full') {
$suffix .= ' <span class="details">(' . implode(', ', $details) . ')</span>';
} else {
$suffix .= ' <span class="details">' . implode(', ', $details) . '</span>';
}
}
// flag idle users
if (isset($item['click_date']) && $item['click_date'] < $idle) {
$class = 'idle user';
} else {
$class = 'user';
}
// item summary
$box .= $prefix . Skin::build_link($url, $title, 'user') . $suffix;
// use the avatar, if any
if (isset($item['avatar_url']) && isset($context['users_with_avatars']) && $context['users_with_avatars'] == 'Y') {
$icon = $item['avatar_url'];
}
// layout this item
if ($icon) {
// build the complete HTML element
$icon = '<img src="' . $icon . '" alt="" title="' . encode_field(strip_tags($title)) . '" />';
// make it a clickable link
$icon = Skin::build_link($url, $icon, 'basic');
$list = array(array($box, $icon));
$items[] = array($item['score'], Skin::finalize_list($list, 'decorated'));
// put the item in a division
} else {
$items[] = array($item['score'], '<div style="margin: 0 0 1em 0">' . $box . '</div>');
}
}
// end of processing
SQL::free($result);
return $items;
}
示例7: get_view_text_extension
/**
* display available recording, if any
*
* This function retrieves the list of available recordings from the BBB server,
* and displays it to the surfer.
*/
function get_view_text_extension()
{
global $context;
// parameters to list recordings
$parameters = array();
$parameters[] = 'meetingID=' . urlencode($this->attributes['id']);
// link to list recordings
$url = $this->build_link('getRecordings', $parameters);
// query the BBB back-end
if (($response = http::proceed_natively($url)) && ($xml = simplexml_load_string($response)) && $xml->returncode == 'SUCCESS') {
// ok, we have some recording available
if ($recordings = $xml->recordings->children()) {
// enumerate recordings, but use only the first one
foreach ($recordings as $name => $node) {
// sanity checks
if ($name != 'recording') {
continue;
}
if (!isset($node->playback)) {
continue;
}
if (!isset($node->playback->format)) {
continue;
}
if (!isset($node->playback->format->url)) {
continue;
}
// a button to start the replay in a separate window
$menu = array();
$menu[] = Skin::build_link((string) $node->playback->format->url, 'Play the presentation', 'tee');
return Skin::build_box('Presentation', Skin::finalize_list($menu, 'menu_bar'));
}
}
}
}
示例8: layout
/**
* list links
*
* Recognize following variants:
* - 'no_anchor' to list items attached to one particular anchor
* - 'no_author' to list items attached to one user prolink
*
* @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;
}
// sanity check
if (!isset($this->layout_variant)) {
$this->layout_variant = 'no_anchor';
}
// process all items in the list
while ($item = SQL::fetch($result)) {
// get the main anchor
$anchor = Anchors::get($item['anchor']);
// initialize variables
$prefix = $suffix = $icon = '';
// make a label
$label = Links::clean($item['title'], $item['link_url']);
// flag links uploaded recently
if ($item['edit_date'] >= $context['fresh']) {
$prefix = NEW_FLAG . $prefix;
}
// the number of clicks
if ($item['hits'] > 1) {
$suffix .= ' (' . Skin::build_number($item['hits'], i18n::s('clicks')) . ') ';
}
// add a separator
if ($suffix) {
$suffix = ' - ' . $suffix;
}
// details
$details = array();
// item poster
if ($item['edit_name'] && $this->layout_variant != 'no_author') {
if (Surfer::is_member() || (!isset($context['content_without_details']) || $context['content_without_details'] != 'Y') || is_object($anchor) && $anchor->has_option('with_details')) {
$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']));
}
}
// show an anchor link
if ($this->layout_variant != 'no_anchor' && $this->layout_variant != 'no_author' && $item['anchor'] && ($anchor = Anchors::get($item['anchor']))) {
$anchor_url = $anchor->get_url();
$anchor_label = ucfirst($anchor->get_title());
$details[] = sprintf(i18n::s('in %s'), Skin::build_link($anchor_url, $anchor_label, 'article'));
}
// the menu bar for associates and poster
if (Surfer::is_empowered() || Surfer::is($item['edit_id'])) {
$details[] = Skin::build_link('links/edit.php?id=' . $item['id'], i18n::s('edit'), 'span');
$details[] = Skin::build_link('links/delete.php?id=' . $item['id'], i18n::s('delete'), 'span');
}
// append details to the suffix
if (count($details)) {
$suffix .= BR . Skin::finalize_list($details, 'menu');
}
// description
if ($item['description']) {
$suffix .= BR . Codes::beautify($item['description']);
}
// build the actual link to check it
if ($this->layout_variant == 'review') {
$icon = $item['link_url'];
}
// url is the link itself -- hack for xhtml compliance
$url = str_replace('&', '&', $item['link_url']);
// let the rendering engine guess the type of link
$link_type = NULL;
// except if we want to stay within this window
if (isset($item['link_target']) && $item['link_target'] != 'I') {
$link_type = 'external';
}
// hovering title
$link_title = NULL;
if (isset($item['link_title']) && $item['link_title']) {
$link_title = $item['link_title'];
}
// pack everything
$items[$url] = array($prefix, $label, $suffix, $link_type, $icon, $link_title);
}
// end of processing
SQL::free($result);
return $items;
}
示例9: array
$menu = array();
$delete_label = '';
if (is_object($overlay)) {
$delete_label = $overlay->get_label('delete_confirmation', 'comments');
}
if (!$delete_label) {
$delete_label = i18n::s('Yes, I want to delete this comment');
}
$menu[] = Skin::build_submit_button($delete_label, NULL, NULL, 'confirmed', $render_overlaid ? 'button submit-overlaid' : 'button');
if (isset($item['id']) && !$render_overlaid) {
$menu[] = Skin::build_link(Comments::get_url($item['id']), i18n::s('Cancel'), 'span');
} elseif ($render_overlaid) {
$menu[] = '<a href="javascript:;" onclick="Yacs.closeModalBox()">' . i18n::s('Cancel') . '</a>' . "\n";
}
// the submit button
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form">' . "\n" . Skin::finalize_list($menu, 'menu_bar') . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="confirm" value="yes" />' . "\n" . (isset($_REQUEST['follow_up']) ? '<input type="hidden" name="follow_up" value="' . $_REQUEST['follow_up'] . '" />' . "\n" : '') . '</form>' . "\n";
// set the focus
Page::insert_script('$("#confirmed").focus();');
// display the full comment
$context['text'] .= '<div style="padding: 1em; background-color:#CCC;">' . Codes::beautify($item['description']) . '</div>' . "\n";
// details
$details = array();
// the poster of this comment
$details[] = sprintf(i18n::s('by %s %s'), Users::get_link($item['create_name'], $item['create_address'], $item['create_id']), Skin::build_date($item['create_date']));
// the last edition of this comment
if ($item['create_name'] != $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']));
}
// the complete details
if ($details) {
$context['text'] .= '<p class="details">' . ucfirst(implode(', ', $details)) . "</p>\n";
示例10: layout
//.........这里部分代码省略.........
} 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
$content .= Skin::build_block($item['description'], 'description', '', $item['options']);
// 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[] = Skin::build_link($url . '#_attachments', FILES_LIST_IMG . sprintf(i18n::ns('%d file', '%d files', $count), $count), 'span');
}
// 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);
}
// count replies
if ($count = Comments::count_for_anchor('article:' . $item['id'])) {
$details[] = Skin::build_link($url . '#_discussion', sprintf(i18n::ns('%d comment', '%d comments', $count), $count), 'span');
}
// the command to reply
if (Comments::allow_creation($item, $anchor)) {
Skin::define_img('COMMENTS_ADD_IMG', 'comments/add.gif');
$details[] = Skin::build_link(Comments::get_url('article:' . $item['id'], 'comment'), COMMENTS_ADD_IMG . i18n::s('Post a comment'), 'span');
}
// describe attachments
$content .= Skin::finalize_list($details, 'menu_bar');
// end the row
$text .= $content . '</td></tr>';
}
// end of processing
SQL::free($result);
// return the table
$text .= Skin::table_suffix();
return $text;
}
示例11: array_merge
if (Surfer::is_associate()) {
$links[] = Skin::build_link('locations/', 'locations', 'shortcut');
}
if (Surfer::is_associate()) {
$links[] = Skin::build_link('overlays/', 'overlays', 'shortcut');
}
$links[] = Skin::build_link('scripts/', 'scripts', 'shortcut');
$links[] = Skin::build_link('sections/', 'sections', 'shortcut');
$links[] = Skin::build_link('servers/', 'servers', 'shortcut');
$links[] = Skin::build_link('services/', 'services', 'shortcut');
$links[] = Skin::build_link('skins/', 'skins', 'shortcut');
$links[] = Skin::build_link('smileys/', 'smileys', 'shortcut');
if (Surfer::is_associate()) {
$links[] = Skin::build_link('tables/', 'tables', 'shortcut');
}
if (Surfer::is_associate()) {
$links[] = Skin::build_link('tools/', 'tools', 'shortcut');
}
$links[] = Skin::build_link('users/', 'users', 'shortcut');
// the hook for more modules
if (is_callable(array('Hooks', 'link_scripts')) && ($more_links = Hooks::link_scripts('control/index.php#modules', 'array'))) {
$links = array_merge($links, $more_links);
}
// list modules in an extra box
$context['components']['boxes'] .= Skin::build_box(i18n::s('Modules'), Skin::finalize_list($links, 'compact'), 'boxes');
}
}
}
}
// render the skin
render_skin();
示例12: array
// get a PDF version
Skin::define_img('ARTICLES_PDF_IMG', 'articles/export_pdf.gif');
$lines[] = Skin::build_link(Articles::get_url($item['id'], 'fetch_as_pdf'), ARTICLES_PDF_IMG . i18n::s('Save as PDF'), 'basic', i18n::s('Save as PDF'));
// open in Word
Skin::define_img('ARTICLES_WORD_IMG', 'articles/export_word.gif');
$lines[] = Skin::build_link(Articles::get_url($item['id'], 'fetch_as_msword'), ARTICLES_WORD_IMG . i18n::s('Copy in MS-Word'), 'basic', i18n::s('Copy in MS-Word'));
}
}
// print this page
if (Surfer::is_logged() || isset($context['with_anonymous_export_tools']) && $context['with_anonymous_export_tools'] == 'Y') {
Skin::define_img('TOOLS_PRINT_IMG', 'tools/print.gif');
$lines[] = Skin::build_link(Articles::get_url($item['id'], 'print'), TOOLS_PRINT_IMG . i18n::s('Print this page'), 'basic', i18n::s('Get a paper copy of this page.'));
}
// in a side box
if (count($lines)) {
$context['components']['share'] = Skin::build_box(i18n::s('Share'), Skin::finalize_list($lines, 'newlines'), 'share', 'share');
}
// 'Information channels' box
//
$lines = array();
// watch command is provided to logged surfers
if (Surfer::get_id()) {
$link = Users::get_url('article:' . $item['id'], 'track');
if ($in_watch_list) {
$label = i18n::s('Stop notifications');
} else {
$label = i18n::s('Watch this page');
}
Skin::define_img('TOOLS_WATCH_IMG', 'tools/watch.gif');
$lines[] = Skin::build_link($link, TOOLS_WATCH_IMG . $label, 'basic', i18n::s('Manage your watch list'));
}
示例13: layout
/**
* list files
*
* @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;
}
// sanity check
if (!isset($this->layout_variant)) {
$this->layout_variant = '';
}
// process all items in the list
while ($item = SQL::fetch($result)) {
// get the main anchor
$anchor = Anchors::get($item['anchor']);
// initialize variables
$prefix = $suffix = $icon = '';
// more details
$url = Files::get_permalink($item);
// codes
$codes = array();
// files that can be embedded
if (preg_match('/\\.(3gp|flv|gan|m4v|mm|mov|mp4|swf)$/i', $item['file_name'])) {
$codes[] = '[embed=' . $item['id'] . ']';
}
// link for direct download
$codes[] = '[file=' . $item['id'] . ']';
$codes[] = '[download=' . $item['id'] . ']';
// integrate codes
if (!isset($_SESSION['surfer_editor']) || $_SESSION['surfer_editor'] == 'yacs') {
foreach ($codes as $code) {
$suffix .= '<a onclick="edit_insert(\'\', \' ' . $code . '\');return false;" title="insert" tabindex="2000">' . $code . '</a> ';
}
} else {
$suffix .= join(' ', $codes);
}
$suffix .= BR . '<span class="details">';
// signal restricted and private files
if ($item['active'] == 'N') {
$suffix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$suffix .= RESTRICTED_FLAG;
}
// file title or file name
$label = Codes::beautify_title($item['title']);
if (!$label) {
$label = ucfirst(str_replace(array('%20', '-', '_'), ' ', $item['file_name']));
}
$suffix .= $label;
// flag files uploaded recently
if ($item['create_date'] >= $context['fresh']) {
$suffix .= NEW_FLAG;
} elseif ($item['edit_date'] >= $context['fresh']) {
$suffix .= UPDATED_FLAG;
}
$suffix .= '</span>';
// details
$details = array();
if (Surfer::is_logged() && $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']));
}
// the menu bar for associates and poster
if (Surfer::is_empowered()) {
$details[] = Skin::build_link($url, i18n::s('details'), 'basic');
$details[] = Skin::build_link(Files::get_url($item['id'], 'edit'), i18n::s('edit'), 'basic');
$details[] = Skin::build_link(Files::get_url($item['id'], 'delete'), i18n::s('delete'), 'basic');
}
// append details
if (count($details)) {
$suffix .= BR . Skin::finalize_list($details, 'menu');
}
// explicit icon
if ($item['thumbnail_url']) {
$icon = $item['thumbnail_url'];
} else {
$icon = $context['url_to_root'] . Files::get_icon_url($item['file_name']);
}
// list all components for this item
$items[$url] = array($prefix, '_', $suffix, 'file', $icon);
}
// end of processing
SQL::free($result);
return $items;
}
示例14: 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;
}
示例15: 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;
}