本文整理汇总了PHP中Skin::table_prefix方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::table_prefix方法的具体用法?PHP Skin::table_prefix怎么用?PHP Skin::table_prefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skin
的用法示例。
在下文中一共展示了Skin::table_prefix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
} else {
$events .= '<p>' . i18n::s('No event has been logged') . "</p\\>";
}
// display in a separate panel
if (trim($events)) {
$panels[] = array('events', i18n::s('Events'), 'events_panel', $events);
}
//
// values updated in the background
//
$values = '';
$query = "SELECT * FROM " . SQL::table_name('values') . " ORDER BY id";
if (!($result = SQL::query($query))) {
$values .= Logger::error_pop() . BR . "\n";
} else {
$values .= Skin::table_prefix('yc-grid');
while ($row = SQL::fetch($result)) {
$values .= '<tr><td>' . $row['id'] . '</td><td>' . str_replace("\n", BR, $row['value']) . '</td><td>' . Surfer::from_GMT($row['edit_date']) . "</td></tr>\n";
}
$values .= "</table>\n";
}
// display in a separate panel
if (trim($values)) {
$panels[] = array('values', i18n::s('Values'), 'values_panel', $values);
}
//
// script profiles
//
$profiles = '';
include_once $context['path_to_root'] . 'agents/profiles.php';
if ($rows = Profiles::list_by_hits(0, 50)) {
示例2: 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
//.........这里部分代码省略.........
示例3: array
$delete_text = i18n::s('delete this file');
}
$menu[] = Skin::build_submit_button(sprintf(i18n::s('Yes, I want to %s'), $delete_text), NULL, NULL, 'confirmed', $class_submit);
if (!$render_overlaid) {
if (isset($item['id'])) {
$menu[] = Skin::build_link(Files::get_permalink($item), i18n::s('Cancel'), 'span');
}
} else {
$menu[] = '<span><a href="javascript:;" onclick="Yacs.closeModalBox();">' . i18n::s('Cancel') . '</a></span>';
}
// the submit button
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . "\n" . Skin::finalize_list($menu, 'menu_bar') . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n" . '<input type="hidden" name="confirm" value="yes" />' . "\n" . '</p></form>' . "\n";
// set the focus
Page::insert_script('$("#confirmed").focus();');
// use a table for the layout
$context['text'] .= Skin::table_prefix('form');
$lines = 1;
// the title
if ($item['title']) {
$cells = array(i18n::s('Title'), 'left=' . $item['title']);
$context['text'] .= Skin::table_row($cells, $lines++);
}
// the description
if ($item['description']) {
$cells = array(i18n::s('Description'), 'left=' . $item['description']);
$context['text'] .= Skin::table_row($cells, $lines++);
}
// display the source, if any
if ($item['source']) {
if (preg_match('/http:\\/\\/([^\\s]+)/', $item['source'], $matches)) {
$item['source'] = Skin::build_link($matches[0], $matches[0], 'external');
示例4: build
//.........这里部分代码省略.........
// column id
$labels[] = '.' . trim(preg_replace('/[^\\w]+/', '', ucfirst($field->name)));
// limit the number of columns put on screen
if (count($labels) >= 7) {
break;
}
}
// job done
$text = join(', ', $labels);
return $text;
// titles of columns for SIMILE Exhibit
// titles of columns for SIMILE Exhibit
case 'json-titles':
// get header labels
$labels = array();
$index = 0;
while ($field = SQL::fetch_field($rows)) {
$index++;
// first column is only a link
if ($index == 1 && $table['with_zoom'] == 'Y') {
continue;
}
// column header
$labels[] = trim(str_replace(',', '', ucfirst($field->name)));
}
$text = join(', ', $labels);
return $text;
// produce an HTML table
// produce an HTML table
default:
case 'inline':
case 'sortable':
// a table with a grid
$text .= Skin::table_prefix('grid');
// the title, with a menu to download the table into Excel
if ($variant == 'inline') {
$item_bar = array();
$item_bar += array(Tables::get_url($id) => $table['title']);
$item_bar += array(Tables::get_url($id, 'fetch_as_csv') => 'CSV (Excel)');
if (Surfer::is_associate()) {
$item_bar += array(Tables::get_url($id, 'edit') => i18n::s('edit'));
}
if (count($item_bar)) {
$text .= '<caption>' . Skin::build_list($item_bar, 'menu') . "</caption>\n";
}
}
// column headers are clickable links
$cells = array();
$index = 0;
while ($field = SQL::fetch_field($rows)) {
if ($index++ != 0 || $table['with_zoom'] != 'Y') {
$cells[] = ucfirst($field->name);
}
}
$text .= "\t\t" . Skin::table_row($cells, 'sortable');
// the table body
$count = 0;
$row_index = 0;
while ($row = SQL::fetch_row($rows)) {
$cells = array();
$link = '';
for ($index = 0; $index < count($row); $index++) {
if ($index == 0 && $table['with_zoom'] == 'Y') {
$link = $row[$index];
} elseif ($link) {
$cells[] = Skin::build_link($link, $row[$index]);
示例5: 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();
示例6: 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();
示例7: sprintf
// ++...++
$context['text'] .= '[title]' . i18n::s('Wiki insertion') . ' [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('This text ++has been inserted++.') . '[/escape]</td>' . '<td>' . i18n::s('This text ++has been inserted++.') . '</td></tr>' . Skin::table_suffix();
// [inserted]...[/inserted]
$context['text'] .= '[title]' . i18n::s('Inserted') . ' [escape][inserted]...[/inserted][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('This text [inserted]has been inserted[/inserted].') . '[/escape]</td>' . '<td>' . i18n::s('This text [inserted]has been inserted[/inserted].') . '</td></tr>' . Skin::table_suffix();
// --...--
$context['text'] .= '[title]' . i18n::s('Wiki deletion') . ' [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('This text --has been deleted--.') . '[/escape]</td>' . '<td>' . i18n::s('This text --has been deleted--.') . '</td></tr>' . Skin::table_suffix();
// [deleted]...[/deleted]
$context['text'] .= '[title]' . i18n::s('Deleted') . ' [escape][deleted]...[/deleted][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('This text [deleted]has been deleted[/deleted].') . '[/escape]</td>' . '<td>' . i18n::s('This text [deleted]has been deleted[/deleted].') . '</td></tr>' . Skin::table_suffix();
// [flag]...[/flag]
$context['text'] .= '[title]' . i18n::s('Flag') . ' [escape][flag]...[/flag][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape]' . i18n::s('[flag]important![/flag] Don\'t forget to give something to your cat today.') . '[/escape]</td>' . '<td>' . i18n::s('[flag]important![/flag] Don\'t forget to give something to your cat today.') . '</td></tr>' . Skin::table_suffix();
// [lang=xy]...[/lang]
$context['text'] .= '[title]' . i18n::s('Language') . ' [escape][lang=xy]...[/lang][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][lang=en]This is in English[/lang][lang=fr]Ceci est en français[/lang][/escape]</td>' . '<td>[lang=en]This is in English[/lang][lang=fr]Ceci est en français[/lang]</td></tr>' . Skin::table_suffix();
// [style=serif]...[/style]
$context['text'] .= '[title]' . i18n::s('Serif') . ' [escape][style=serif]...[/style][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][style=serif]' . i18n::s('This text is in Serif.') . '[/style][/escape]</td>' . '<td>[style=serif]' . i18n::s('This text is in Serif.') . '[/style]</td></tr>' . Skin::table_suffix();
// [style=sans-serif]...[/style]
$context['text'] .= '[title]' . i18n::s('Sans-Serif') . ' [escape][style=sans-serif]...[/style][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][style=sans-serif]' . i18n::s('This text is in Sans-Serif.') . '[/style][/escape]</td>' . '<td>[style=sans-serif]' . i18n::s('This text is in Sans-Serif.') . '[/style]</td></tr>' . Skin::table_suffix();
// [style=cursive]...[/style]
$context['text'] .= '[title]' . i18n::s('Cursive') . ' [escape][style=cursive]...[/style][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][style=cursive]' . i18n::s('This text is in Cursive.') . '[/style][/escape]</td>' . '<td>[style=cursive]' . i18n::s('This text is in Cursive.') . '[/style]</td></tr>' . Skin::table_suffix();
// [style=fantasy]...[/style]
$context['text'] .= '[title]' . i18n::s('Fantasy') . ' [escape][style=fantasy]...[/style][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][style=fantasy]' . i18n::s('This text is in Fantasy.') . '[/style][/escape]</td>' . '<td>[style=fantasy]' . i18n::s('This text is in Fantasy.') . '[/style]</td></tr>' . Skin::table_suffix();
// [style=comic]...[/style]
$context['text'] .= '[title]' . i18n::s('Comic') . ' [escape][style=comic]...[/style][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][style=comic]' . i18n::s('This text is in Comic.') . '[/style][/escape]</td>' . '<td>[style=comic]' . i18n::s('This text is in Comic.') . '[/style]</td></tr>' . Skin::table_suffix();
// [style]...[/style]
$context['text'] .= '[title]' . i18n::s('Use any style') . ' [escape][style=<style name>]...[/style][/escape][/title]' . Skin::table_prefix('wide') . Skin::table_row(array(i18n::s('Example'), i18n::s('Rendering')), 'header') . '<tr><td class="sample">[escape][style=my_style]' . i18n::s('But where will this rabbit be in some minutes? I don\'t know, but it depends also on the turtle speed...') . '[/style][/escape]</td>' . '<td>[style=my_style]' . i18n::s('But where will this rabbit be in some minutes? I don\'t know, but it depends also on the turtle speed...') . '[/style]</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: array
$fields[] = array($label, $input);
// color of inactive link
$label = i18n::s('Link color');
$input = '<input class="color {hash:true,required:false}" name="flexible_tabs_a_color" size="10" value="' . encode_field($context['flexible_tabs_a_color']) . '" maxlength="8" onchange="$(\'div#t_sample a.regular span\').each(function(){$(this).css({ \'color\': this.value})});" />';
$fields[] = array($label, $input);
Page::insert_script('$("#t_sample .regular span").each(function(){$(this).css({"color": "' . $context['flexible_tabs_a_color'] . '"});});');
// color of hovered link
$label = i18n::s('Hover color');
$input = '<input class="color {hash:true,required:false}" name="flexible_tabs_h_color" size="10" value="' . encode_field($context['flexible_tabs_h_color']) . '" maxlength="8" onchange="$(\'div#t_sample a.current span\').each(function(){$(this).css({ \'color\': this.value})});" />';
$fields[] = array($label, $input);
Page::insert_script('$("#t_sample .current span").each(function(){$(this).css({"color": "' . $context['flexible_tabs_h_color'] . '"});});');
// put the set of fields in the page
$text .= Skin::build_folded_box(i18n::s('Text'), Skin::build_form($fields));
$fields = array();
// tabs selection
$input = Skin::table_prefix('layout');
// use actual images for tabs background
if ($dir = Safe::opendir('skins/flexible/tabs')) {
// list files in the skin directory
$items = array();
while (($item = Safe::readdir($dir)) !== FALSE) {
if ($item[0] == '.' || is_dir('../skins/flexible/tabs/' . $item)) {
continue;
}
if (!preg_match('/(\\.gif|\\.jpeg|\\.jpg|\\.png)$/i', $item)) {
continue;
}
if (!($position = strpos($item, '-left'))) {
continue;
}
$name = substr($item, 0, $position);
示例9: layout
/**
* list articles as slashdot do
*
* @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;
}
// layout in a table
$text = Skin::table_prefix('wide');
// 'even' is used for title rows, 'odd' for detail rows
$class_title = 'odd';
$class_detail = 'even';
// build a list of sections
$family = '';
include_once $context['path_to_root'] . 'articles/article.php';
include_once $context['path_to_root'] . 'comments/comments.php';
include_once $context['path_to_root'] . 'links/links.php';
while ($item = SQL::fetch($result)) {
// change the family
if ($item['family'] != $family) {
$family = $item['family'];
// show the family
$text .= Skin::table_suffix() . '<h2><span>' . $family . ' </span></h2>' . "\n" . Skin::table_prefix('wide');
}
// document this section
$content = $prefix = $title = $suffix = $icon = '';
$menu = array();
// permalink
$url = Sections::get_permalink($item);
// get the anchor
$anchor = Anchors::get($item['anchor']);
// get the related overlay, if any
$overlay = Overlay::load($item, 'section:' . $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']);
}
// signal restricted and private sections
if ($item['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($item['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// this is another row of the output
$text .= '<tr class="' . $class_title . '"><th>' . $prefix . Skin::build_link($url, $title, 'basic', i18n::s('View the section')) . $suffix . '</th></tr>' . "\n";
// document most recent page here
$content = $prefix = $title = $suffix = $icon = '';
$menu = array();
// branches of this tree
$anchors = Sections::get_branch_at_anchor('section:' . $item['id']);
// get last post
$article =& Articles::get_newest_for_anchor($anchors, TRUE);
if ($article['id']) {
// permalink
$url = Articles::get_permalink($article);
// get the anchor
$anchor = Anchors::get($article['anchor']);
// get the related overlay, if any
$overlay = Overlay::load($item, 'section:' . $item['id']);
// use the title to label the link
if (is_object($overlay)) {
$title = Codes::beautify_title($overlay->get_text('title', $article));
} else {
$title = Codes::beautify_title($article['title']);
}
// signal restricted and private articles
if ($article['active'] == 'N') {
$prefix .= PRIVATE_FLAG;
} elseif ($article['active'] == 'R') {
$prefix .= RESTRICTED_FLAG;
}
// the icon to put aside
if ($article['thumbnail_url']) {
$icon = $article['thumbnail_url'];
}
// the icon to put aside
if (!$icon && is_callable(array($anchor, 'get_bullet_url'))) {
$icon = $anchor->get_bullet_url();
}
if ($icon) {
$icon = '<a href="' . $context['url_to_root'] . $url . '"><img src="' . $icon . '" class="right_image" alt="" title="' . encode_field(i18n::s('View the page')) . '" /></a>';
}
// the introductory text
if ($article['introduction']) {
$content .= Codes::beautify_introduction($article['introduction']);
} elseif (!is_object($overlay)) {
$handle = new Article();
$handle->load_by_content($article);
//.........这里部分代码省略.........
示例10: 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();
示例11: load_skin
// load localized strings
i18n::bind('smileys');
// load the skin
load_skin('smileys');
// the path to this page
$context['path_bar'] = array('help/' => i18n::s('Help index'));
// the title of the page
$context['page_title'] = i18n::s('Smileys');
// 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>';
}
// the splash message
$context['text'] .= '<p>' . i18n::s('Smileys are small graphical images that can be used to convey an emotion or feeling. If you have used email or Internet chat, you are likely familiar with the smilie concept.') . '</p>' . '<p>' . i18n::s('Let face it, sometimes words alone do not suffice. Adding a winking smilie, for instance, may help you clarify that you are joking.') . '</p>' . '<p>' . i18n::s('Use your smilies sparingly, though -- if overused, smilies can be downright annoying.') . '</p>' . '<p>' . i18n::s('Here is the list of codes that are automatically converted into images by this server.') . '</p>';
// use a table for the layout
$context['text'] .= Skin::table_prefix('grid');
$cells = array();
$cells[] = i18n::s('What to type');
$cells[] = i18n::s('Emotion');
$cells[] = i18n::s('Featured image');
$context['text'] .= Skin::table_row($cells, 'header');
$lines = 2;
// 8-) :cool:
$cells = array();
$cells[] = '[escape]8-) :cool:[/escape]';
$cells[] = i18n::s('sunglass dude');
$cells[] = '8-)';
$context['text'] .= Skin::table_row($cells, $lines++);
// :-) :smile:
$cells = array();
$cells[] = '[escape]:-) :smile:[/escape]';
示例12: layout
//.........这里部分代码省略.........
if ($anchor->is_owned()) {
Skin::define_img('COMMENTS_DELETE_IMG', 'comments/delete.gif');
$menu[] = Skin::build_link(Comments::get_url($item['id'], 'delete'), COMMENTS_DELETE_IMG . i18n::s('Delete'), 'basic');
}
// regular case
} else {
// additional commands for associates and poster and editor
if (Comments::allow_modification($anchor, $item)) {
Skin::define_img('COMMENTS_EDIT_IMG', 'comments/edit.gif');
$menu[] = Skin::build_link(Comments::get_url($item['id'], 'edit'), COMMENTS_EDIT_IMG . i18n::s('Edit'), 'basic');
Skin::define_img('COMMENTS_DELETE_IMG', 'comments/delete.gif');
$menu[] = Skin::build_link(Comments::get_url($item['id'], 'delete'), COMMENTS_DELETE_IMG . i18n::s('Delete'), 'basic');
}
}
// comment main text
$text = '';
// state clearly that this is an approval
if ($item['type'] == 'approval' && isset($poster['id'])) {
$text .= '<p>' . sprintf(i18n::s('%s has provided his approval'), Users::get_link($poster['full_name'], $poster['email'], $poster['id'])) . '</p>';
}
// display comment main text
$text .= $item['description'];
// display signature, but not for notifications
if ($item['type'] != 'notification') {
$text .= Users::get_signature($item['create_id']);
}
// format and display
$text = ucfirst(trim($text));
// float the menu on the right
if (count($menu)) {
$text = '<div style="text-align: right">' . Skin::finalize_list($menu, 'menu') . '</div>' . $text;
}
// comment has been modified
if ($item['create_name'] && $item['edit_name'] != $item['create_name']) {
$text .= '<p class="details">' . ucfirst(sprintf(i18n::s('edited by %s %s'), $item['edit_name'], Skin::build_date($item['edit_date']))) . '</p>';
}
// potential replies to this comment
if ($item['type'] != 'notification') {
// look for replies
if ($replies = Comments::list_next($item['id'], 'replies')) {
if (is_array($replies)) {
$replies = Skin::build_list($replies, 'compact');
}
$text .= '<div>' . $replies . '</div>';
}
// allow to reply to this comment
if (Comments::allow_creation($anchor)) {
// the form to edit a comment
$text .= '<form method="post" action="' . $context['url_to_root'] . Comments::get_url($item['id'], 'reply') . '" onsubmit="return validateDocumentPost(this)" enctype="multipart/form-data"><div style="margin-top: 1em;">';
// reference the anchor page
$text .= '<input type="hidden" name="anchor" value="' . $item['anchor'] . '" />';
// remember the id of the replied comment
$text .= '<input type="hidden" name="previous_id" value="' . $item['id'] . '" />';
// notify watchers
$text .= '<input type="hidden" name="notify_watchers" value="Y" />';
// ensure id uniqueness
static $fuse_id;
if (!isset($fuse_id)) {
$fuse_id = 1;
} else {
$fuse_id++;
}
// a textarea that grow on focus
Page::insert_script('var reply' . $fuse_id . '=1;');
$text .= '<textarea name="description" id="reply' . $fuse_id . '"' . ' rows="1" cols="50"' . ' onfocus="if(reply' . $fuse_id . '){$(\'div#submit' . $fuse_id . '\').slideDown(600);reply' . $fuse_id . '=0;}">' . '</textarea>' . "\n";
// fix number of rows in firefox
Page::insert_script('$(function(){' . '$("textarea#reply' . $fuse_id . '")' . '.each(function(){' . 'var lineHeight = parseFloat($(this).css("line-height"));' . 'var lines = $(this).attr("rows")*1 || $(this).prop("rows")*1;' . '$(this).css("height", lines*lineHeight);' . '})' . '.autogrow();' . '});' . "\n");
// the submit button
$text .= '<div class="menu_bar" style="display: none;" id="submit' . $fuse_id . '">' . Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's') . '</div>';
// end of the form
$text .= '</div></form>';
}
}
// the main part of the comment, with an id
$text = '<td class="comment ' . $item['type'] . '" id="comment_' . $item['id'] . '">' . $text . '</td>';
// this is another row of the output
$rows[] = '<td class="author ' . $item['type'] . '">' . $author . '</td>' . $text;
}
// end of processing
SQL::free($result);
// sanity check
if (!count($rows)) {
return '';
}
// return a table
$output = Skin::table_prefix('yabb');
$count = 1;
foreach ($rows as $row) {
if ($count % 2) {
$output .= '<tr class="odd">' . $row . '</tr>';
} else {
$output .= '<tr class="even">' . $row . '</tr>';
}
$count++;
}
$output .= '</table>';
// process yacs codes
$output = Codes::beautify($output);
return $output;
}
示例13: array
} else {
Safe::redirect($context['url_to_home'] . $context['url_to_root']);
}
}
// page title
$context['page_title'] = i18n::s('Welcome!');
//
// panels
//
$panels = array();
//
// main panel
//
$information = '';
// lay fields in a table
$information .= Skin::table_prefix('form');
$lines = 1;
// a link to the user profile
$cells = array();
$cells[] = i18n::s('Your profile');
$cells[] = 'left=' . Surfer::get_link();
$information .= Skin::table_row($cells, $lines++);
// the email field
if (Surfer::get_email_address()) {
$cells = 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();
示例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: 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;
}