本文整理汇总了PHP中Skin::table_row方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::table_row方法的具体用法?PHP Skin::table_row怎么用?PHP Skin::table_row使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skin
的用法示例。
在下文中一共展示了Skin::table_row方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sprintf
// [category.description=id]
$context['text'] .= '[title]' . i18n::s('Category') . ' [escape][category.description=<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][category.description=featured][/escape]</td>' . '<td>[category.description=featured]</td></tr>' . Skin::table_suffix();
// [user=id]
$context['text'] .= '[title]' . i18n::s('User shortcut') . ' [escape][user=<id>] [user=<id>, <label>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . sprintf(i18n::s('Have a look at %s'), '[user=' . Surfer::get_id() . ']') . '[/escape]</td>' . '<td>' . sprintf(i18n::s('Have a look at %s'), '[user=' . Surfer::get_id() . ']') . '</td></tr>' . Skin::table_suffix();
// [server=id]
$context['text'] .= '[title]' . i18n::s('Server shortcut') . ' [escape][server=<id>] [server=<id>, <label>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('Click to view the page of [server=2, this server]') . '[/escape]</td>' . '<td>' . i18n::s('Click to view the page of [server=2, this server]') . '</td></tr>' . Skin::table_suffix();
// [file=id]
$context['text'] .= '[title]' . i18n::s('File shortcut') . ' [escape][file=<id>] [file=<id>, <label>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . sprintf(i18n::s('Have a look at %s'), '[file=' . $file_id . ']') . '[/escape]</td>' . '<td>' . sprintf(i18n::s('Have a look at %s'), '[file=' . $file_id . ']') . '</td></tr>' . Skin::table_suffix();
// [download=id]
$context['text'] .= '[title]' . i18n::s('Download shortcut') . ' [escape][download=<id>] [download=<id>, <label>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . sprintf(i18n::s('Click to %s'), '[download=' . $file_id . ', ' . i18n::s('download the file') . ']') . '[/escape]</td>' . '<td>' . sprintf(i18n::s('Click to %s'), '[download=' . $file_id . ', ' . i18n::s('download the file') . ']') . '</td></tr>' . Skin::table_suffix();
// [clicks=id]
$context['text'] .= '[title]' . i18n::s('Member clicks') . ' [escape][clicks=<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][clicks=' . $file_id . '][/escape]</td>' . '<td>[clicks=' . $file_id . ']</td></tr>' . Skin::table_suffix();
// [action=id]
$context['text'] .= '[title]' . i18n::s('Action shortcut') . ' [escape][action=<id>] [action=<id>, <label>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('Click to view the page of [action=2, this action]') . '[/escape]</td>' . '<td>' . i18n::s('Click to view the page of [action=2, this action]') . '</td></tr>' . Skin::table_suffix();
// [comment=id]
$context['text'] .= '[title]' . i18n::s('Comment shortcut') . ' [escape][comment=<id>] [comment=<id>, <label>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('Click to view the page of [comment=2, this comment]') . '[/escape]</td>' . '<td>' . i18n::s('Click to view the page of [comment=2, this comment]') . '</td></tr>' . Skin::table_suffix();
// [script]index.php[/script]
$context['text'] .= '[title]' . i18n::s('Script shortcut') . ' [escape][script]<path/script.php>[/script][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('You can access the documentation for the script [script]shared/codes.php[/script]') . '[/escape]</td>' . '<td>' . i18n::s('You can access the documentation for the script [script]shared/codes.php[/script]') . '</td></tr>' . Skin::table_suffix();
// [search=yacs]
$context['text'] .= '[title]' . i18n::s('Search') . ' [escape][search] [search=<words>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('All you want to know on [search=yacs]') . '[/escape]</td>' . '<td>' . i18n::s('All you want to know on [search=yacs]') . '</td></tr>' . Skin::table_suffix();
// [wikipedia=keyword, label]
$context['text'] .= '[title]' . i18n::s('Wikipedia') . ' [escape][wikipedia=keyword] [wikipedia=keyword, label][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('All you want to know on [wikipedia=Web_2, the web 2.0]') . '[/escape]</td>' . '<td>' . i18n::s('All you want to know on [wikipedia=Web_2, the web 2.0]') . '</td></tr>' . Skin::table_suffix();
// [proxy]url[/proxy]
$context['text'] .= '[title]' . i18n::s('Proxy') . ' [escape][proxy]web address[/proxy][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][proxy]http://www.google.com/[/proxy][/escape]</td>' . '<td>[proxy]http://www.google.com/[/proxy]</td></tr>' . Skin::table_suffix();
// transform the text
$context['text'] = Codes::beautify($context['text']);
// general help on this page
$help = '<p>' . sprintf(i18n::s('Please note that actual rendering depends on the selected %s.'), Skin::build_link('skins/', i18n::s('skin'), 'shortcut')) . '</p>';
$context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help');
// render the skin
render_skin();
示例2: render_static_table
/**
* render a table
*
* @param string the table content
* @param string the variant, if any
* @return string the rendered text
**/
public static function render_static_table($content, $variant = '')
{
global $context;
// we are providing inline tables
if ($variant) {
$variant = 'inline ' . $variant;
} else {
$variant = 'inline';
}
// do we have headers to proceed?
$in_body = !preg_match('/\\[body\\]/i', $content);
// start at first line, except if headers have to be printed first
if ($in_body) {
$count = 1;
} else {
$count = 2;
}
// split lines
$rows = explode("\n", $content);
if (!is_array($rows)) {
return '';
}
// one row per line - cells are separated by |, \t, or 2 spaces
$text =& Skin::table_prefix($variant);
foreach ($rows as $row) {
// skip blank lines
if (!$row) {
continue;
}
// header row
if (!$in_body) {
if (preg_match('/\\[body\\]/i', $row)) {
$in_body = true;
} else {
$text .= Skin::table_row(preg_split("/([\\|\t]| " . " )/", $row), 'header');
}
// body row
} else {
$text .= Skin::table_row(preg_split("/([\\|\t]| " . " )/", $row), $count++);
}
}
// return the complete table
$text .= Skin::table_suffix();
return $text;
}
示例3: sprintf
// the title of the page
$context['page_title'] = i18n::s('Codes to format lists');
// the date of last modification
if (Surfer::is_associate()) {
$context['page_details'] .= '<p class="details">' . sprintf(i18n::s('Edited %s'), Skin::build_date(getlastmod())) . '</p>';
}
// page header
$context['text'] .= '<p>' . i18n::s('On this page we are introducing some formatting codes and live examples of utilization.') . '</p>';
// add a toc
$context['text'] .= "\n" . '[toc]' . "\n";
// [*]
$context['text'] .= '[title]' . i18n::s('List item') . ' [escape][*][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('A simple list:') . "\n\n" . '[*]' . i18n::s('First item') . "\n\n" . '[*]' . i18n::s('Second item (after one empty line)') . "\n" . '[*]' . i18n::s('Third item (next the previous one)') . '[/escape]</td>' . '<td>' . i18n::s('A simple list:') . "\n\n" . '[*]' . i18n::s('First item') . "\n\n" . '[*]' . i18n::s('Second item (after one empty line)') . "\n" . '[*]' . i18n::s('Third item (next the previous one)') . '</td></tr>' . Skin::table_suffix();
// [list]...[/list]
$context['text'] .= '[title]' . i18n::s('Bulleted list') . ' [escape][list]...[/list][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('A list with bulleted items:') . "\n" . '[list]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list][/escape]</td>' . '<td>' . i18n::s('A list with bulleted items:') . "\n" . '[list]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list]</td></tr>' . Skin::table_suffix();
// [list=1]...[/list]
$context['text'] .= '[title]' . i18n::s('Numbered list') . ' [escape][list=1]...[/list][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('A list with numbered items:') . "\n" . '[list=1]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list][/escape]</td>' . '<td>' . i18n::s('A list with numbered items:') . "\n" . '[list=1]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list]</td></tr>' . Skin::table_suffix();
// [list=a]...[/list]
$context['text'] .= '[title]' . i18n::s('Numbered list') . ' [escape][list=a]...[/list][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('A list with alphabetically numbered items:') . "\n" . '[list=a]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list][/escape]</td>' . '<td>' . i18n::s('A list with alphabetically numbered items:') . "\n" . '[list=a]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list]</td></tr>' . Skin::table_suffix();
// [list=A]...[/list]
$context['text'] .= '[title]' . i18n::s('Numbered list') . ' [escape][list=A]...[/list][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('Another list with alphabetically numbered items:') . "\n" . '[list=A]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list][/escape]</td>' . '<td>' . i18n::s('Another list with alphabetically numbered items:') . "\n" . '[list=A]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list]</td></tr>' . Skin::table_suffix();
// [list=i]...[/list]
$context['text'] .= '[title]' . i18n::s('Numbered list') . ' [escape][list=i]...[/list][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('A list with roman numbers:') . "\n" . '[list=i]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list][/escape]</td>' . '<td>' . i18n::s('A list with roman numbers:') . "\n" . '[list=i]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list]</td></tr>' . Skin::table_suffix();
// [list=I]...[/list]
$context['text'] .= '[title]' . i18n::s('Numbered list') . ' [escape][list=I]...[/list][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('Another list with roman numbers:') . "\n" . '[list=I]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list][/escape]</td>' . '<td>' . i18n::s('Another list with roman numbers:') . "\n" . '[list=I]' . "\n" . '[*]' . i18n::s('First item') . "\n" . '[*]' . i18n::s('Second item') . "\n" . '[/list]</td></tr>' . Skin::table_suffix();
// transform the text
$context['text'] = Codes::beautify($context['text']);
// general help on this page
$help = '<p>' . sprintf(i18n::s('Please note that actual rendering depends on the selected %s.'), Skin::build_link('skins/', i18n::s('skin'), 'shortcut')) . '</p>';
$context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help');
// render the skin
render_skin();
示例4: 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
//.........这里部分代码省略.........
示例5: array
$cells = array(i18n::s('Downloads'), 'left=' . Skin::build_number($item['hits'], i18n::s('downloads')));
$context['text'] .= Skin::table_row($cells, $lines++);
}
// the first poster
if ($item['create_name']) {
$cells = array(i18n::s('Posted by'), $item['create_name']);
$context['text'] .= Skin::table_row($cells, $lines++);
}
// the last poster
if ($item['edit_name'] != $item['create_name']) {
$cells = array(i18n::s('Updated by'), $item['edit_name']);
$context['text'] .= Skin::table_row($cells, $lines++);
}
// date of last action
$cells = array(i18n::s('Last action'), Skin::build_date($item['edit_date']));
$context['text'] .= Skin::table_row($cells, $lines++);
// associates may change the active flag: Yes/public, Restricted/logged, No/associates
if (Surfer::is_associate()) {
if ($item['active'] == 'N' && Surfer::is_associate()) {
$context['text'] .= Skin::table_row(array(i18n::s('Access'), 'left=' . i18n::s('Private - Access is restricted to selected persons')), $lines++);
} elseif ($item['active'] == 'R' && Surfer::is_member()) {
$context['text'] .= Skin::table_row(array(i18n::s('Access'), 'left=' . i18n::s('Community -Access is granted to any identified surfer')), $lines++);
}
}
// end of the table
$context['text'] .= Skin::table_suffix();
// count items related to this file
$context['text'] .= Anchors::stat_related_to('file:' . $item['id'], i18n::s('Following items are attached to this record and will be deleted as well.'));
}
// render the skin
render_skin();
示例6: layout
/**
* list articles
*
* @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)) {
return $text;
}
// the script used to check all pages at once
Page::insert_script('function cascade_selection_to_all_article_rows(handle) {' . "\n" . ' $("div#articles_panel input[type=\'checkbox\'].row_selector").each(' . "\n" . ' function() { $(this).attr("checked", $(handle).is(":checked"));}' . "\n" . ' );' . "\n" . '}' . "\n");
// table prefix
$text .= Skin::table_prefix('yc-grid');
// table headers
$main = '<input type="checkbox" class="row_selector" onclick="cascade_selection_to_all_article_rows(this);" />';
$cells = array($main, i18n::s('Page'), i18n::s('Rank'));
$text .= Skin::table_row($cells, 'header');
// process all items in the list
include_once $context['path_to_root'] . 'comments/comments.php';
include_once $context['path_to_root'] . 'links/links.php';
$count = 0;
while ($item = SQL::fetch($result)) {
$cells = array();
// 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);
// column to select the row
$cells[] = '<input type="checkbox" name="selected_articles[]" id="article_selector_' . $count . '" class="row_selector" value="' . $item['id'] . '" />';
// 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 locked articles
if (isset($item['locked']) && $item['locked'] == 'Y') {
$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;
}
// 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;
}
// the introductory text
if (is_object($overlay)) {
$introduction = $overlay->get_text('introduction', $item);
} else {
$introduction = $item['introduction'];
}
if ($introduction) {
$suffix .= BR . Codes::beautify_introduction($introduction);
}
// insert overlay data, if any
if (is_object($overlay)) {
$suffix .= $overlay->get_text('list', $item);
}
// append details to the suffix
$suffix .= BR . '<span class="details">';
// details
$details = array();
// 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']);
//.........这里部分代码省略.........
示例7: sprintf
// [sections=self]
$context['text'] .= '[title]' . i18n::s('Assigned sections') . ' [escape][sections=self] [sections=user:<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][sections.folded=self][/escape]</td>' . '<td>[sections.folded=self]</td></tr>' . Skin::table_suffix();
// [categories]
$context['text'] .= '[title]' . i18n::s('Categories') . ' [escape][categories] [categories=category:<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][categories][/escape]</td>' . '<td>[categories]</td></tr>' . Skin::table_suffix();
// [categories=self]
$context['text'] .= '[title]' . i18n::s('Assigned categories') . ' [escape][categories=self] [categories=user:<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][categories=self][/escape]</td>' . '<td>[categories=self]</td></tr>' . Skin::table_suffix();
// [published]
$context['text'] .= '[title]' . i18n::s('Recent pages') . ' [escape][published] [published=section:<id>] [published=category:<id>][/escape][/title]' . '<p>' . i18n::s('Use the simplest form to display a compact list of pages, or limit the scope.') . '</p>' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][published.decorated][/escape]</td>' . '<td>[published.decorated]</td></tr>' . Skin::table_suffix();
// [published=self]
$context['text'] .= '[title]' . i18n::s('Personal pages') . ' [escape][published=self] [published=user:<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][published=self, 20][/escape]</td>' . '<td>[published=self, 20]</td></tr>' . Skin::table_suffix();
// [updated]
$context['text'] .= '[title]' . i18n::s('Recent updates') . ' [escape][updated] [updated=section:<id>] [updated=category:<id>][/escape][/title]' . '<p>' . i18n::s('Use the simplest form to display a compact list of pages, or limit the scope.') . '</p>' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][updated.timeline][/escape]</td>' . '<td>[updated.timeline]</td></tr>' . Skin::table_suffix();
// [updated=self]
$context['text'] .= '[title]' . i18n::s('Personal updates') . ' [escape][updated=self] [updated=user:<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][updated=self, 12][/escape]</td>' . '<td>[updated=self, 12]</td></tr>' . Skin::table_suffix();
// [read]
$context['text'] .= '[title]' . i18n::s('Hall of fame') . ' [escape][read] [read=section:<id>][/escape][/title]' . '<p>' . i18n::s('Use the simplest form to display a compact list of pages, or limit the scope.') . '</p>' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][read][/escape]</td>' . '<td>[read]</td></tr>' . Skin::table_suffix();
// [read=self]
$context['text'] .= '[title]' . i18n::s('Personal hits') . ' [escape][read=self] [read=user:<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][read=self][/escape]</td>' . '<td>[read=self]</td></tr>' . Skin::table_suffix();
// [voted]
$context['text'] .= '[title]' . i18n::s('Hall of fame') . ' [escape][voted] [voted=section:<id>][/escape][/title]' . '<p>' . i18n::s('Use the simplest form to display a compact list of pages, or limit the scope.') . '</p>' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][voted][/escape]</td>' . '<td>[voted]</td></tr>' . Skin::table_suffix();
// [voted=self]
$context['text'] .= '[title]' . i18n::s('Personal hits') . ' [escape][voted=self] [voted=user:<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][voted=self][/escape]</td>' . '<td>[voted=self]</td></tr>' . Skin::table_suffix();
// [users=present]
$context['text'] .= '[title]' . i18n::s('Present users') . ' [escape][users=present][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][users=present][/escape]</td>' . '<td>[users=present]</td></tr>' . Skin::table_suffix();
// transform the text
$context['text'] = Codes::beautify($context['text']);
// general help on this page
$help = '<p>' . sprintf(i18n::s('Please note that actual rendering depends on the selected %s.'), Skin::build_link('skins/', i18n::s('skin'), 'shortcut')) . '</p>';
$context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help');
// render the skin
render_skin();
示例8: foreach
/**
* build a complete table
*
* @param array headers
* @param array rows of cells
* @param string a variant, if any, as decribed for table_prefix()
* @return a string to be sent to the browser
*/
public static function &table($headers, &$rows, $variant = 'yc-grid')
{
$text =& Skin::table_prefix($variant);
if (isset($headers) && is_array($headers)) {
$text .= Skin::table_row($headers, 'sortable');
}
$row_count = 1;
if (is_array($rows)) {
foreach ($rows as $cells) {
$text .= Skin::table_row($cells, $row_count++);
}
}
$text .= Skin::table_suffix();
return $text;
}
示例9: array
// check
$value = i18n::s('Configuration files cannot be changed');
$check = i18n::s('WARNING');
} else {
$value = i18n::s('May change configuration files');
$check = i18n::s('OK');
}
// check
$checks[] = array(i18n::s('Permissions'), $value, $check);
// report on prerequisite checks
$context['text'] .= '<h2>' . i18n::s('Pre-installation checks') . '</h2>';
// check results
$context['text'] .= '<table border="1">';
$row_count = 1;
foreach ($checks as $cells) {
$context['text'] .= Skin::table_row($cells, $row_count++);
}
$context['text'] .= '</table>';
// link to the readme file
$context['text'] .= '<p>' . sprintf(i18n::s('Check the provided %s file to ensure prerequisites are fulfilled.'), '<a href="' . i18n::s('readme.txt') . '">' . i18n::s('readme.txt') . '</a>') . "</p>\n";
// link to the configuration page
if (!count($context['error'])) {
// report on checks
$context['text'] .= '<h2>' . i18n::s('Ready to start the installation') . '</h2>';
// splash screen
$context['text'] .= i18n::s("<p>At the moment no configuration file has been found. You will now have to pass through several steps in order to achieve the setup of your server:</p>\n<ul>\n<li>Configure parameters related to the database.</li>\n<li>Load extension hooks.</li>\n<li>Create tables in the database.</li>\n<li>Add one user profile and populate the database.</li>\n<li>Configure the theme of your server.</li>\n</ul>\nIn normal conditions this will take only some minutes. If you have any problems, please consult <a href=\"http://www.yacs.fr/\">www.yacs.fr</a> for additional support.<p>Thank you for having selected the YACS solution.</p>") . "\n";
// add a button to start the installation process
$context['text'] .= '<form method="get" action="control/configure.php" id="main_form">' . "\n" . '<p class="assistant_bar">' . Skin::build_submit_button(i18n::s('Start the installation process'), NULL, NULL, 'confirmed') . '</p>' . "\n" . '</form>' . "\n";
// a place holder for cookies activation
$context['text'] .= '<p id="ask_for_cookies" style="display: none; color: red; text-decoration: blink;"></p>';
// the script used to check that cookies are activated
示例10: array
$cells = array();
$cells[] = '[escape]:! & :!2[/escape]';
$cells[] = i18n::s('warning');
$cells[] = 'left= :! & :!2';
$context['text'] .= Skin::table_row($cells, $lines++);
// :*:
$cells = array();
$cells[] = '[escape]:*:[/escape]';
$cells[] = i18n::s('star');
$cells[] = ':*:';
$context['text'] .= Skin::table_row($cells, $lines++);
// :mac
$cells = array();
$cells[] = '[escape]:mac: :tux: :win:[/escape]';
$cells[] = i18n::s('operating systems');
$cells[] = ':mac: :tux: :win:';
$context['text'] .= Skin::table_row($cells, $lines++);
// Get out
$cells = array();
$cells[] = '[escape]:out:[/escape]';
$cells[] = i18n::s('Ok, i leave');
$cells[] = ':out:';
$context['text'] .= Skin::table_row($cells, $lines++);
// end of the table
$context['text'] .= Skin::table_suffix();
// transform the text
$context['text'] = Codes::beautify($context['text']);
// referrals, if any
$context['components']['referrals'] =& Skin::build_referrals('smileys/index.php');
// render the skin
render_skin();
示例11: stat_related_to
/**
* count related items
*
* This function draws a nice table to show how many items are related to
* the anchor that has the focus.
*
* @param string the target reference
* @param string the label to use, if any
* @return string some XHTML snippet to send to the browser
*/
public static function stat_related_to($anchor, $label = NULL)
{
global $context;
// describe related content
$related = '';
$lines = 2;
// stats for related categories, but only within categories
if (strpos($anchor, 'category:') === 0) {
if (($stats = Categories::stat_for_anchor($anchor)) && $stats['count']) {
$cells = array();
$cells[] = i18n::s('Categories');
$cells[] = 'center=' . $stats['count'];
$cells[] = 'center=' . Skin::build_date($stats['oldest_date']);
$cells[] = 'center=' . Skin::build_date($stats['newest_date']);
$related .= Skin::table_row($cells, $lines++);
}
}
// stats for related sections, but only within sections
if (strpos($anchor, 'section:') === 0) {
if (($stats = Sections::stat_for_anchor($anchor)) && $stats['count']) {
$cells = array();
$cells[] = i18n::s('Sections');
$cells[] = 'center=' . $stats['count'];
$cells[] = 'center=' . Skin::build_date($stats['oldest_date']);
$cells[] = 'center=' . Skin::build_date($stats['newest_date']);
$related .= Skin::table_row($cells, $lines++);
}
}
// stats for related articles, but only within sections
if (strpos($anchor, 'section:') === 0) {
if (($stats = Articles::stat_for_anchor($anchor)) && $stats['count']) {
$cells = array();
$cells[] = i18n::s('Pages');
$cells[] = 'center=' . $stats['count'];
$cells[] = 'center=' . Skin::build_date($stats['oldest_date']);
$cells[] = 'center=' . Skin::build_date($stats['newest_date']);
$related .= Skin::table_row($cells, $lines++);
}
}
// stats for related images
include_once $context['path_to_root'] . 'images/images.php';
if (($stats = Images::stat_for_anchor($anchor)) && $stats['count']) {
$cells = array();
$cells[] = i18n::s('Images');
$cells[] = 'center=' . $stats['count'];
$cells[] = 'center=' . Skin::build_date($stats['oldest_date']);
$cells[] = 'center=' . Skin::build_date($stats['newest_date']);
$related .= Skin::table_row($cells, $lines++);
}
// stats for related locations
include_once $context['path_to_root'] . 'locations/locations.php';
if (($stats = Locations::stat_for_anchor($anchor)) && $stats['count']) {
$cells = array();
$cells[] = i18n::s('Locations');
$cells[] = 'center=' . $stats['count'];
$cells[] = 'center=' . Skin::build_date($stats['oldest_date']);
$cells[] = 'center=' . Skin::build_date($stats['newest_date']);
$related .= Skin::table_row($cells, $lines++);
}
// stats for related tables
include_once $context['path_to_root'] . 'tables/tables.php';
if (($stats = Tables::stat_for_anchor($anchor)) && $stats['count']) {
$cells = array();
$cells[] = i18n::s('Tables');
$cells[] = 'center=' . $stats['count'];
$cells[] = 'center=' . Skin::build_date($stats['oldest_date']);
$cells[] = 'center=' . Skin::build_date($stats['newest_date']);
$related .= Skin::table_row($cells, $lines++);
}
// stats for related files
if (($stats = Files::stat_for_anchor($anchor)) && $stats['count']) {
$cells = array();
$cells[] = i18n::s('Files');
$cells[] = 'center=' . $stats['count'];
$cells[] = 'center=' . Skin::build_date($stats['oldest_date']);
$cells[] = 'center=' . Skin::build_date($stats['newest_date']);
$related .= Skin::table_row($cells, $lines++);
}
// stats for related dates
include_once $context['path_to_root'] . 'dates/dates.php';
if (($stats = Dates::stat_for_anchor($anchor)) && $stats['count']) {
$cells = array();
$cells[] = i18n::s('Dates');
$cells[] = 'center=' . $stats['count'];
$cells[] = 'center=' . Skin::build_date($stats['oldest_date']);
$cells[] = 'center=' . Skin::build_date($stats['newest_date']);
$related .= Skin::table_row($cells, $lines++);
}
// stats for related comments
include_once $context['path_to_root'] . 'comments/comments.php';
//.........这里部分代码省略.........
示例12: sprintf
// the title of the page
$context['page_title'] = i18n::s('Codes to format tables');
// the date of last modification
if (Surfer::is_associate()) {
$context['page_details'] .= '<p class="details">' . sprintf(i18n::s('Edited %s'), Skin::build_date(getlastmod())) . '</p>';
}
// page header
$context['text'] .= '<p>' . i18n::s('On this page we are showing how to build simple tables. Use the char |, or tab, or two successive spaces, to separate column elements.') . '</p>';
// add a toc
$context['text'] .= "\n" . '[toc]' . "\n";
// [table]...[/table]
$context['text'] .= '[title]' . i18n::s('Table') . ' [escape][table]...[/table][/escape][/title]' . '<p>' . i18n::s('In this example cells are separated by tabulation characters or by 2 spaces.') . '</p>' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][table]' . "\n" . i18n::s('Rabbit') . "\t" . i18n::s('Turtle') . "\n" . i18n::s('Stories') . ' ' . i18n::s('Jean[nl]de la Fontaine') . "\n" . '[/table][/escape]</td>' . '<td>[table]' . "\n" . i18n::s('Rabbit') . "\t" . i18n::s('Turtle') . "\n" . i18n::s('Stories') . ' ' . i18n::s('Jean[nl]de la Fontaine') . "\n" . '[/table]</td></tr>' . Skin::table_suffix();
// [table=grid]...[/table]
$context['text'] .= '[title]' . i18n::s('Table') . ' [escape][table=grid]...[/table][/escape][/title]' . '<p>' . i18n::s('In this example cells are separated by the | character.') . '</p>' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][table=grid]' . "\n" . i18n::s('Rabbit|Turtle') . "\n" . i18n::s('Stories|Jean[nl]de la Fontaine') . "\n" . '[/table][/escape]</td>' . '<td>[table=grid]' . "\n" . i18n::s('Rabbit|Turtle') . "\n" . i18n::s('Stories|Jean[nl]de la Fontaine') . "\n" . '[/table]</td></tr>' . Skin::table_suffix();
// [table=tiny]...[/table]
$context['text'] .= '[title]' . i18n::s('Table') . ' [escape][table=tiny]...[/table][/escape][/title]' . '<p>Actually any style can be applied to the generated table.</p>' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][table=tiny]' . "\n" . i18n::s('Rabbit|Turtle') . "\n" . i18n::s('Stories|Jean[nl]de la Fontaine') . "\n" . '[/table][/escape]</td>' . '<td>[table=tiny]' . "\n" . i18n::s('Rabbit|Turtle') . "\n" . i18n::s('Stories|Jean[nl]de la Fontaine') . "\n" . '[/table]</td></tr>' . Skin::table_suffix();
// [table]...[body]...[/table]
$context['text'] .= '[title]' . i18n::s('Separate headers from the body') . ' [escape][table]...[body]...[/table][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][table=grid]' . "\n" . i18n::s('First Name|Last Name') . "\n" . '[body]' . "\n" . i18n::s('Rabbit|Turtle') . "\n" . i18n::s('Stories|Jean[nl]de la Fontaine') . "\n" . '[/table][/escape]</td>' . '<td>[table=grid]' . "\n" . i18n::s('First Name|Last Name') . "\n" . '[body]' . "\n" . i18n::s('Rabbit|Turtle') . "\n" . i18n::s('Stories|Jean[nl]de la Fontaine') . "\n" . '[/table]</td></tr>' . Skin::table_suffix();
// cells alignment
$context['text'] .= '[title]' . i18n::s('Explicit cells alignment') . '[/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][table=grid]' . "\n" . 'left=' . i18n::s('Full Name') . '| center=' . i18n::s('Birth Year') . '| right=' . i18n::s('Net income') . "\n" . '[body]' . "\n" . 'right=' . i18n::s('Speedy Rabbit') . '|center=1888|$11,230' . "\n" . 'center=' . i18n::s('Jean de la Fontaine') . '|center=1675|$234,567' . "\n" . '[/table][/escape]</td>' . '<td>[table=grid]' . "\n" . 'left=' . i18n::s('Full Name') . '| center=' . i18n::s('Birth Year') . '| right=' . i18n::s('Net income') . "\n" . '[body]' . "\n" . 'right=' . i18n::s('Speedy Rabbit') . '|center=1888|$11,230' . "\n" . 'center=' . i18n::s('Jean de la Fontaine') . '|center=1675|$234,567' . "\n" . '[/table]</td></tr>' . Skin::table_suffix();
// [table]...[csv]...[/csv]...[/table]
$context['text'] .= '[title]' . i18n::s('Comma-separated values') . ' [escape][table][csv]...[/csv][/table][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][table=grid]' . "\n" . '[csv]' . "\n" . i18n::s('Net income for the year,$2.310') . "\n" . i18n::s('Net income for last year,$2.100') . "\n" . i18n::s('Net income increase,10%') . "\n" . '[/csv]' . "\n" . '[/table][/escape]</td>' . '<td>[table=grid]' . "\n" . '[csv]' . "\n" . i18n::s('Net income for the year,$2.310') . "\n" . i18n::s('Net income for last year,$2.100') . "\n" . i18n::s('Net income increase,10%') . "\n" . '[/csv]' . "\n" . '[/table]</td></tr>' . Skin::table_suffix();
// [table]...[csv=;]...[/csv]...[/table]
$context['text'] .= '[title]' . i18n::s('Comma-separated values') . ' [escape][table][csv=;]...[/csv][/table][/escape][/title]' . '<p>' . i18n::s('Using a different separator between cells.') . '</p>' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][table=grid]' . "\n" . '[csv=;]' . "\n" . i18n::s('Net income for the year;$2.310') . "\n" . i18n::s('Net income for last year;$2.100') . "\n" . i18n::s('Net income increase;10%') . "\n" . '[/csv]' . "\n" . '[/table][/escape]</td>' . '<td>[table=grid]' . "\n" . '[csv=;]' . "\n" . i18n::s('Net income for the year;$2.310') . "\n" . i18n::s('Net income for last year;$2.100') . "\n" . i18n::s('Net income increase;10%') . "\n" . '[/csv]' . "\n" . '[/table]</td></tr>' . Skin::table_suffix();
// transform the text
$context['text'] = Codes::beautify($context['text']);
// general help on this page
$help = '<p>' . sprintf(i18n::s('Please note that actual rendering depends on the selected %s.'), Skin::build_link('skins/', i18n::s('skin'), 'shortcut')) . '</p>';
$context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help');
// render the skin
render_skin();
示例13: array
$cells[] = i18n::s('Your address');
$cells[] = 'left=' . Surfer::get_email_address();
$information .= Skin::table_row($cells, $lines++);
}
// the capability field - associate, member, or subscriber
$cells = array();
$cells[] = i18n::s('Your status');
if (Surfer::is_associate()) {
$cells[] = 'left=' . i18n::s('As an associate of this community, you may contribute freely to any part of this server.');
} elseif (Surfer::is_member()) {
$cells[] = 'left=' . i18n::s('As a member of this community, you may access freely most pages of this server.');
} else {
$cells[] = 'left=' . i18n::s('As a subscriber of this community, you may freely access most pages of this server.');
}
if (isset($cells[1])) {
$information .= Skin::table_row($cells, $lines++);
}
// end of the table
$information .= Skin::table_suffix();
// display in a separate panel
$panels[] = array('information', i18n::s('You'), 'information_panel', $information);
//
// assemble all tabs
//
$context['text'] .= Skin::build_tabs($panels);
// follow-up commands
$follow_up = i18n::s('Where do you want to go now?');
$menu = array();
if (isset($_REQUEST['login_forward'])) {
$menu[] = Skin::build_link($_REQUEST['login_forward'], i18n::s('Move forward'), 'button');
} elseif (isset($_SERVER['HTTP_REFERER']) && !preg_match('/users\\/login\\.php/', $_SERVER['HTTP_REFERER'])) {
示例14: sprintf
// the date of last modification
if (Surfer::is_associate()) {
$context['page_details'] .= '<p class="details">' . sprintf(i18n::s('Edited %s'), Skin::build_date(getlastmod())) . '</p>';
}
// page header
$context['text'] .= '<p>' . i18n::s('On this page we are introducing codes related to widgets and badges.') . '</p>';
// add a toc
$context['text'] .= "\n" . '[toc]' . "\n";
// [newsfeed]
$context['text'] .= '[title]' . i18n::s('Newsfeed') . ' [escape][newsfeed=<url>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][newsfeed=http://www.yacs.fr/feeds/rss.php][/escape]</td>' . '<td>[newsfeed=http://www.yacs.fr/feeds/rss.php]</td></tr>' . Skin::table_suffix();
// [newsfeed.embed]
$context['text'] .= '[title]' . i18n::s('Newsfeed') . ' [escape][newsfeed.embed=<url>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][newsfeed.embed=http://www.yacs.fr/feeds/rss.php][/escape]</td>' . '<td>[newsfeed.embed=http://www.yacs.fr/feeds/rss.php]</td></tr>' . Skin::table_suffix();
// [twitter]
$context['text'] .= '[title]' . i18n::s('Twitter profile') . ' [escape][twitter=<id>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][twitter=bernard357][/escape]</td>' . '<td>[twitter=bernard357]</td></tr>' . Skin::table_suffix();
// [tsearch]
$context['text'] .= '[title]' . i18n::s('Twitter search') . ' [escape][tsearch=<keyword>][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][tsearch=#yacs][/escape]</td>' . '<td>[tsearch=#yacs]</td></tr>' . Skin::table_suffix();
// [iframe]
$context['text'] .= '[title]' . i18n::s('External page') . ' [escape][iframe=<width>, <height>]<url>[/iframe][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][iframe=500, 320]http://www.cisco.com/[/iframe][/escape]</td>' . '<td>[iframe=500, 320]http://www.cisco.com/[/iframe]</td></tr>' . Skin::table_suffix();
// [cloud]
$context['text'] .= '[title]' . i18n::s('Cloud of tags') . ' [escape][cloud] [cloud=<40>][/escape][/title]' . '<p>' . i18n::s('Use the parameter to adjust the number of tags listed.') . '</p>' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][cloud][/escape]</td>' . '<td>[cloud]</td></tr>' . Skin::table_suffix();
// [calendar]
$context['text'] .= '[title]' . i18n::s('Events') . ' [escape][calendar][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][calendar][/escape]</td>' . '<td>[calendar]</td></tr>' . Skin::table_suffix();
// [location=latitude, longitude, label]
$context['text'] .= '[title]' . i18n::s('Direct location') . ' [escape][location=latitude, longitude, label][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][location=48.871264, 2.307558, Paris][/escape]</td>' . '<td>[location=48.871264, 2.307558, Paris]</td></tr>' . Skin::table_suffix();
// transform the text
$context['text'] = Codes::beautify($context['text']);
// general help on this page
$help = '<p>' . sprintf(i18n::s('Please note that actual rendering depends on the selected %s.'), Skin::build_link('skins/', i18n::s('skin'), 'shortcut')) . '</p>';
$context['components']['boxes'] = Skin::build_box(i18n::s('Help'), $help, 'boxes', 'help');
// render the skin
render_skin();
示例15: layout
/**
* list sections as topics in a forum
*
* @param resource the SQL result
* @return string the rendered text
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// output as a string
$text = '';
// build a list of sections
$family = '';
$first = TRUE;
while ($item = SQL::fetch($result)) {
// change the family
if ($item['family'] != $family) {
$family = $item['family'];
// close last table only if a section has been already listed
if (!$first) {
$text .= Skin::table_suffix();
}
// show the family
$text .= '<h2><span>' . $family . ' </span></h2>' . "\n" . Skin::table_prefix('yabb') . Skin::table_row(array(i18n::s('Board'), 'center=' . i18n::s('Topics'), i18n::s('Last post')), 'header');
} elseif ($first) {
$text .= Skin::table_prefix('yabb');
$text .= Skin::table_row(array(i18n::s('Board'), 'center=' . i18n::s('Topics'), i18n::s('Last post')), 'header');
}
// done with this case
$first = FALSE;
// reset everything
$prefix = $label = $suffix = $icon = '';
// signal restricted and private sections
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// indicate the id in the hovering popup
$hover = i18n::s('View the section');
if (Surfer::is_member()) {
$hover .= ' [section=' . $item['id'] . ']';
}
// the url to view this item
$url = Sections::get_permalink($item);
// use the title as a link to the page
$title =& Skin::build_link($url, Codes::beautify_title($item['title']), 'basic', $hover);
// also use a clickable thumbnail, if any
if ($item['thumbnail_url']) {
$prefix = Skin::build_link($url, '<img src="' . $item['thumbnail_url'] . '" alt="" title="' . encode_field($hover) . '" class="left_image" />', 'basic', $hover) . $prefix;
}
// flag sections 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 . ' ';
}
// board introduction
if ($item['introduction']) {
$suffix .= '<br style="clear: none;" />' . Codes::beautify_introduction($item['introduction']);
}
// more details
$details = '';
$more = array();
// board moderators
if ($moderators = Sections::list_editors_by_name($item, 0, 7, 'comma5')) {
$more[] = sprintf(i18n::ns('Moderator: %s', 'Moderators: %s', count($moderators)), $moderators);
}
// children boards
if ($children =& Sections::list_by_title_for_anchor('section:' . $item['id'], 0, COMPACT_LIST_SIZE, 'comma')) {
$more[] = sprintf(i18n::ns('Child board: %s', 'Child boards: %s', count($children)), Skin::build_list($children, 'comma'));
}
// as a compact list
if (count($more)) {
$details .= '<ul class="compact">';
foreach ($more as $list_item) {
$details .= '<li>' . $list_item . '</li>' . "\n";
}
$details .= '</ul>' . "\n";
}
// all details
if ($details) {
$details = BR . '<span class="details">' . $details . "</span>\n";
}
// count posts here, and in children sections
$anchors = Sections::get_branch_at_anchor('section:' . $item['id']);
if (!($count = Articles::count_for_anchor($anchors))) {
$count = 0;
}
// get last post
$last_post = '--';
$article =& Articles::get_newest_for_anchor($anchors, TRUE);
if ($article['id']) {
//.........这里部分代码省略.........