本文整理汇总了PHP中Sections::get_options方法的典型用法代码示例。如果您正苦于以下问题:PHP Sections::get_options方法的具体用法?PHP Sections::get_options怎么用?PHP Sections::get_options使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sections
的用法示例。
在下文中一共展示了Sections::get_options方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
// break an assignment, and also purge the watch list
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'reset' && isset($_REQUEST['member'])) {
Members::free($_REQUEST['anchor'], $_REQUEST['member']);
if (preg_match('/^user:/', $_REQUEST['anchor'])) {
Members::free($_REQUEST['member'], $_REQUEST['anchor']);
}
}
// insert anchor prefix
if (is_object($anchor)) {
$context['text'] .= $anchor->get_prefix();
}
// the current list of linked sections
$sections =& Members::list_sections_by_title_for_anchor($anchor->get_reference(), 0, SECTIONS_LIST_SIZE, 'raw');
// the form to link additional sections
if (!is_array($sections) || count($sections) < SECTIONS_LIST_SIZE) {
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '"><p>' . i18n::s('To assign a section, look in the content tree below and assign one section at a time') . BR . '<select name="member">' . Sections::get_options(NULL, $sections) . '</select>' . ' ' . Skin::build_submit_button(' >> ') . '<input type="hidden" name="anchor" value="' . encode_field($anchor->get_reference()) . '">' . '<input type="hidden" name="action" value="set">' . '</p></form>' . "\n";
}
// splash
$context['text'] .= '<p style="margin-top: 2em;">' . sprintf(i18n::s('This is the list of sections assigned to %s'), $anchor->get_title()) . '</p>';
// layout assigned sections
if ($sections) {
// browse the list
foreach ($sections as $id => $section) {
// get the related overlay, if any
$overlay = Overlay::load($section, 'section:' . $id);
// get parent anchor
$parent = Anchors::get($section['anchor']);
// the url to view this item
$url = Sections::get_permalink($section);
// use the title to label the link
if (is_object($overlay)) {
示例2: validateDocumentPost
// the form to submit a new search
$context['text'] .= '<form method="get" action="' . $context['script_url'] . '" onsubmit="return validateDocumentPost(this)" id="main_form"><div>';
$fields = array();
// a field to type keywords
$label = i18n::s('You are searching for');
$input = '<input type="text" name="search" size="45" value="' . encode_field($search) . '" maxlength="255" />' . Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's');
$hint = i18n::s('Type one or several words.');
$fields[] = array($label, $input, $hint);
// limit the search to one section
$label = i18n::s('Search in');
if ($section_id) {
$current = 'section:' . $section_id;
} else {
$current = 'none';
}
$input = '<select name="anchor">' . '<option value="">' . i18n::s('-- All sections') . "</option>\n" . Sections::get_options($current, 'no_subsections') . '</select>';
$hint = i18n::s('Look in all or only one section.');
$fields[] = array($label, $input, $hint);
// build the form
$context['text'] .= Skin::build_form($fields);
$fields = array();
// the form to submit a new search
$context['text'] .= '</div></form>';
// the script used for form handling at the browser
Page::insert_script(' func' . 'tion validateDocumentPost(container) {' . "\n" . ' if(!container.search.value) {' . "\n" . ' alert("' . i18n::s('Please type something to search for.') . '");' . "\n" . ' Yacs.stopWorking();' . "\n" . ' return false;' . "\n" . ' }' . "\n" . ' return true;' . "\n" . ' }' . "\n" . "\n" . '$("#search").focus();' . "\n");
// various panels
$panels = array();
// all results, as array($score, $summary)
$result = array();
// number of results per page
$bucket = 20;
示例3: urlencode
Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'articles/edit.php?variant=' . urlencode(strip_tags($_REQUEST['type'])));
}
// create a wiki
} elseif ($action == 'wiki') {
// page title
$context['page_title'] = i18n::s('Add a wiki');
// get section parameters
if (!isset($_REQUEST['title']) || !$_REQUEST['title']) {
// splash
$context['text'] .= '<p>' . i18n::s('With YACS, each wiki is an independant section, with options to limit the number of contributors or readers. Each post in a wiki may feature images, photos, files, comments, trackbacks and related links.') . '</p>' . '<p>' . i18n::s('You can either create one general-purpose wiki, or run this script several time and create a set of more specialised wikis.') . '</p>';
// a form to get section parameters
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '" onsubmit="return validateDocumentPost(this)" id="main_form"><div>' . "\n" . '<input type="hidden" name="action" value="wiki" />';
$fields = array();
// the anchor
$label = i18n::s('Wiki anchor');
$input = '<select name="anchor"><option value="">' . i18n::s('-- Root level') . "</option>\n" . Sections::get_options('none', NULL) . '</select>';
$hint = i18n::s('Please carefully select a parent section, if any');
$fields[] = array($label, $input, $hint);
// the title
$label = i18n::s('Wiki Title');
$input = '<textarea id="title" name="title" rows="1" cols="50" accesskey="t">' . encode_field(i18n::c('Our wiki')) . '</textarea>';
$hint = i18n::s('Please provide a meaningful title.');
$fields[] = array($label, $input, $hint);
// the introduction
$label = i18n::s('Introduction');
$input = '<textarea name="introduction" rows="5" cols="50" accesskey="i">' . encode_field(i18n::c('Our collaborative place')) . '</textarea>';
$hint = i18n::s('Appears at site map, near section title');
$fields[] = array($label, $input, $hint);
// the description
$label = i18n::s('Description');
$input = '<textarea name="description" rows="4" cols="50">' . encode_field(i18n::c('A description of what information is developed at this wiki.')) . '</textarea>';
示例4: elseif
$menu[] = Skin::build_submit_button(i18n::s('Move'));
$menu[] = Skin::build_link(Sections::get_url($item['id'], 'manage'), 'Cancel', 'span');
$context['text'] .= Skin::finalize_list($menu, 'assistant_bar');
$context['text'] .= '</form>';
// nothing to do
} else {
Logger::error(i18n::s('No page has been selected.'));
}
// move selected pages
} elseif ($action == 'move_sections') {
// sections
if (isset($_REQUEST['selected_sections'])) {
// actually a form
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . "\n" . '<input type="hidden" name="action" value="move_confirmed" />' . "\n" . '<input type="hidden" name="id" value="' . $item['id'] . '" />' . "\n";
// target section
$context['text'] .= '<p>' . i18n::s('Move following pages to') . BR . '<select name=move_to>' . Sections::get_options('section:' . $item['id']) . '</select></p>';
// selected pages
$context['text'] .= $selected_sections;
// follow-up commands
$menu = array();
$menu[] = Skin::build_submit_button(i18n::s('Move'));
$menu[] = Skin::build_link(Sections::get_url($item['id'], 'manage'), 'Cancel', 'span');
$context['text'] .= Skin::finalize_list($menu, 'assistant_bar');
$context['text'] .= '</form>';
// nothing to do
} else {
Logger::error(i18n::s('No page has been selected.'));
}
// actual move
} elseif ($action == 'move_confirmed') {
// nothing to do
示例5: validateDocumentPost
// display the form
if ($with_form) {
// the form to edit a link
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '" onsubmit="return validateDocumentPost(this)" id="main_form"><div>';
// the category, for direct uploads
if (!$anchor) {
// a splash message for new users
$context['text'] .= Skin::build_block(i18n::s('This script will add this page to one of the sections listed below. If you would like to add a link to an existing page, browse the target page instead and use the adequate command from the menu.'), 'caution') . "\n";
$label = i18n::s('Section');
$input = '<select name="anchor">' . Sections::get_options(NULL, 'bookmarks') . '</select>';
$hint = i18n::s('Please carefully select a section for your link');
$fields[] = array($label, $input, $hint);
// allow for section change
} elseif ($item['id'] && preg_match('/section:/', $current = $anchor->get_reference())) {
$label = i18n::s('Section');
$input = '<select name="anchor">' . Sections::get_options($current, NULL) . '</select>';
$hint = i18n::s('Please carefully select a section for your link');
$fields[] = array($label, $input, $hint);
// else preserve the previous anchor
} elseif (is_object($anchor)) {
$context['text'] .= '<input type="hidden" name="anchor" value="' . $anchor->get_reference() . '" />';
}
// additional fields for anonymous surfers
if (!isset($item['id']) && !Surfer::is_logged()) {
// splash
if (isset($item['id'])) {
if (is_object($anchor)) {
$login_url = $context['url_to_root'] . 'users/login.php?url=' . urlencode('links/edit.php?id=' . $item['id'] . '&anchor=' . $anchor->get_reference());
} else {
$login_url = $context['url_to_root'] . 'users/login.php?url=' . urlencode('links/edit.php?id=' . $item['id']);
}
示例6: array
// in a side box at the front page
$fields['rank'] = 40000;
// at the end of the list
$fields['title'] = i18n::c('External News');
$fields['description'] = i18n::s('Received from feeding servers');
if ($fields['id'] = Sections::post($fields, FALSE)) {
$anchor = 'section:' . $fields['id'];
}
$fields = array();
}
$item['anchor'] = $anchor;
}
if ($item['anchor']) {
$to_select = $item['anchor'];
}
$input .= BR . sprintf(i18n::s('and store data in section %s'), '<select name="anchor">' . Sections::get_options($to_select) . '</select>');
$fields[] = array($label, $input);
// do we have to ping this server?
$label = i18n::s('Ping');
$input = '<input type="radio" name="submit_ping" value="N"';
if (!isset($item['submit_ping']) || $item['submit_ping'] == 'N') {
$input .= ' checked="checked"';
}
$input .= '/> ' . i18n::s('Do not advertise our changes to this remote server') . BR . '<input type="radio" name="submit_ping" value="Y"';
if (isset($item['submit_ping']) && $item['submit_ping'] == 'Y') {
$input .= ' checked="checked"';
}
if (!isset($item['ping_url']) || !$item['ping_url']) {
$item['ping_url'] = 'http://' . (isset($item['host_name']) ? $item['host_name'] : '__server__') . '/services/ping.php';
}
$input .= '/> ' . sprintf(i18n::s('On publication, submit XML-RPC call of <code>weblogUpdates.ping</code> at %s'), '<input type="text" name="ping_url" size="50" value="' . encode_field($item['ping_url']) . '" />');