本文整理汇总了PHP中Surfer::get_editor方法的典型用法代码示例。如果您正苦于以下问题:PHP Surfer::get_editor方法的具体用法?PHP Surfer::get_editor怎么用?PHP Surfer::get_editor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Surfer
的用法示例。
在下文中一共展示了Surfer::get_editor方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateDocumentPost
if ($context['letter_suffix']) {
$context['letter_body'] .= '<div>' . $context['letter_suffix'] . '</div>';
}
// the form to edit a letter
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '" onsubmit="return validateDocumentPost(this)" id="main_form"><div>' . '<input type="hidden" name="action" value="send" />';
// the letter title
$label = i18n::s('Title');
if (!isset($context['letter_title']) || !$context['letter_title']) {
$context['letter_title'] = $context['site_name'];
}
$input = '<input type="text" name="letter_title" size="50" value="' . encode_field(strip_tags($context['letter_title'])) . '" />';
$hint = i18n::s('Used as message subject line');
$fields[] = array($label, $input, $hint);
// letter content
$label = i18n::s('Content');
$input = Surfer::get_editor('letter_body', $context['letter_body']);
$fields[] = array($label, $input, $hint);
// letter recipients
$label = i18n::s('Recipients');
$input = '<input type="radio" name="letter_recipients" size="40" value="all" checked="checked" /> ' . i18n::s('All subscribers of the community') . BR . "\n";
$input .= '<input type="radio" name="letter_recipients" size="40" value="members" /> ' . i18n::s('Members only') . BR . "\n";
$input .= '<input type="radio" name="letter_recipients" size="40" value="associates" /> ' . i18n::s('Associates only') . BR . "\n";
$input .= '<input type="radio" name="letter_recipients" size="40" value="custom" /> ' . i18n::s('Specific addresses:') . ' <input type="text" name="mail_to" onfocus="document.main_form.letter_recipients[3].checked=\'checked\'" size="40" />' . BR . "\n";
$hint = i18n::s('The recipients that will receive the letter');
$fields[] = array($label, $input, $hint);
// build the form
$context['text'] .= Skin::build_form($fields);
// the submit button
$context['text'] .= '<p>' . Skin::build_submit_button(i18n::s('Send'), i18n::s('Press [s] to submit data'), 's') . '</p>' . "\n";
// end of the form
$context['text'] .= '</div></form>';
示例2: sprintf
$title = $item['title'];
}
$title = sprintf(i18n::c('Invitation: %s'), $title);
$input = '<input type="text" name="subject" size="50" maxlength="255" value="' . encode_field($title) . '" />';
$fields[] = array($label, $input);
// default message content
$content = '';
if (is_callable(array($overlay, 'get_invite_default_message'))) {
$content = $overlay->get_invite_default_message();
}
if (!$content) {
$content = '<p>' . i18n::c('I would like to invite you to the following page.') . '</p>' . '<p><a href="' . Sections::get_permalink($item) . '">' . $item['title'] . '</a></p>' . '<p>' . i18n::c('Please let me thank you for your involvement.') . '</p>' . '<p>' . Surfer::get_name() . '</p>';
}
// the message
$label = i18n::s('Message content');
$input = Surfer::get_editor('message', $content);
$fields[] = array($label, $input);
// build the form
$context['text'] .= Skin::build_form($fields);
//
// bottom commands
//
$menu = array();
// the submit button
$menu[] = Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's');
// cancel button
if (isset($item['id'])) {
$menu[] = Skin::build_link(Sections::get_permalink($item), i18n::s('Cancel'), 'span');
}
// insert the menu in the page
$context['text'] .= Skin::finalize_list($menu, 'assistant_bar');
示例3: array_merge
// include overlay fields, if any
if (is_object($overlay)) {
$fields = array_merge($fields, $overlay->get_fields($item));
}
// on page creation
if (!isset($item['id'])) {
// no description on initial submit
$text .= '<input type="hidden" name="description" value="" />';
// but a field to capture a comment
$label = i18n::s('Introduction');
// use the editor if possible
$value = '';
if (isset($_SESSION['pasted_text'])) {
$value = $_SESSION['pasted_text'];
}
$input = Surfer::get_editor('first_comment', $value);
$fields[] = array($label, $input);
// allow for an initial upload, if allowed
if (Surfer::may_upload()) {
// attachment label
$label = i18n::s('Add a file');
// an upload entry
$input = '<input type="hidden" name="file_type" value="upload" />' . '<input type="file" name="upload" size="30" onchange="if(/\\.zip$/i.test($(this).val())){$(\'#upload_option\').slideDown();}else{$(\'#upload_option\').slideUp();}" />' . ' (< ' . $context['file_maximum_size'] . i18n::s('bytes') . ')' . '<div id="upload_option" style="display: none;" >' . '<input type="checkbox" name="explode_files" checked="checked" /> ' . i18n::s('Extract files from the archive') . '</div>';
$fields[] = array($label, $input);
}
}
// associates will have it on options tab
if (Surfer::is_associate()) {
} elseif ($cur_article->is_owned()) {
$label = i18n::s('Access');
$input = Skin::build_active_set_input($item);
示例4: validateDocumentPost
Logger::error(i18n::s('No recipient has been found.'));
// display the form
} else {
// the form to send a message
$context['text'] .= '<form method="post" action="' . $context['script_url'] . '" onsubmit="return validateDocumentPost(this)" id="main_form"><div>';
// build a nice list of recipients
$label = i18n::s('Message recipients');
$input = Skin::build_box(i18n::s('Select recipients'), $recipients, 'folded');
$fields[] = array($label, $input);
// the subject
$label = i18n::s('Message title');
$input = '<input type="text" name="subject" id="subject" size="70" value="' . encode_field($item['title']) . '" />';
$fields[] = array($label, $input);
// the message
$label = i18n::s('Message content');
$input = Surfer::get_editor('message', '<p>' . $item['title'] . BR . Categories::get_permalink($item) . '</p>');
$fields[] = array($label, $input);
// build the form
$context['text'] .= Skin::build_form($fields);
//
// bottom commands
//
$menu = array();
// the submit button
$menu[] = Skin::build_submit_button(i18n::s('Send'), i18n::s('Press [s] to submit data'), 's');
// cancel button
if (isset($item['id'])) {
$menu[] = Skin::build_link(Categories::get_permalink($item), i18n::s('Cancel'), 'span');
}
// insert the menu in the page
$context['text'] .= Skin::finalize_list($menu, 'assistant_bar');
示例5: array
$fields[] = array($label, $input);
// include overlay fields, if any
if (is_object($overlay)) {
$fields = array_merge($fields, $overlay->get_fields($item));
}
// history of changes
if (!is_object($overlay) || ($label = $overlay->get_label('description')) === null) {
$label = i18n::s('History');
}
if (!is_object($overlay) || ($hint = $overlay->get_label('description_hint')) === null) {
$hint = i18n::s('What is new in this file?');
}
if ($hint) {
$hint .= BR;
}
$input = '<span class="details">' . $hint . '</span>' . Surfer::get_editor('version', '', TRUE, 5, FALSE);
if (isset($item['description'])) {
$input .= Skin::build_box(i18n::s('More information'), Skin::build_block($item['description'], 'description'), 'folded');
}
$fields[] = array($label, $input);
// build the form
$text .= Skin::build_form($fields);
$fields = array();
// display in a separate panel
if ($text) {
$panels[] = array('information', i18n::s('Information'), 'information_panel', $text);
}
//
// resources tab
//
$text = '';
示例6: array
/**
* add some tabs
*
* Manage the event in a separate panel
*
* Accepted action codes:
* - 'edit' - embedded into the main form page
*
* @see overlays/overlay.php
*
* @param string the on-going action
* @param array the hosting record
* @return an array of array('tab_id', 'tab_label', 'panel_id', 'panel_content') or NULL
*/
function &get_tabs($variant = 'view', $host = NULL)
{
global $context, $local;
// returned tabs
$tabs = array();
$now = strftime('%Y-%m-%d %H:%M:%S', time() + (Surfer::get_gmt_offset() - intval($context['gmt_offset'])) * 3600);
// trackings
//
$manage = '';
$fields = array();
// manage the event
if ($variant == 'edit') {
// event preparation
$manage .= Skin::build_block(i18n::s('Event preparation'), 'header2');
// induction message
$label = i18n::s('Induction message');
if (!isset($this->attributes['induction_message'])) {
$this->attributes['induction_message'] = $this->get_induction_default_message();
}
$input = Surfer::get_editor('induction_message', $this->attributes['induction_message']);
$hint = i18n::s('Displayed until the beginning of the event.');
$fields[] = array($label, $input, $hint);
// other event details
$fields = array_merge($fields, $this->get_event_fields());
// should we manage enrolment?
if ($this->with_enrolment()) {
// enrolment
$label = i18n::s('Enrolment');
// none
if (!isset($this->attributes['enrolment'])) {
$this->attributes['enrolment'] = 'none';
}
$input = '<input type="radio" name="enrolment" value="none"';
if (!isset($this->attributes['enrolment']) || $this->attributes['enrolment'] == 'none') {
$input .= ' checked="checked"';
}
$input .= '/> ' . i18n::s('Any page visitor can participate') . BR;
// apply-and-validate
$input .= '<input type="radio" name="enrolment" value="validate"';
if (!isset($this->attributes['enrolment']) || $this->attributes['enrolment'] == 'validate') {
$input .= ' checked="checked"';
}
$input .= '/> ' . i18n::s('Accept applications, to be confirmed by page owner') . BR;
// manual registration
$input .= '<input type="radio" name="enrolment" value="manual"';
if (isset($this->attributes['enrolment']) && $this->attributes['enrolment'] == 'manual') {
$input .= ' checked="checked"';
}
$input .= '/> ' . i18n::s('Registration is managed by page owner') . BR;
// expand the form
$fields[] = array($label, $input);
}
$manage .= Skin::build_form($fields);
$fields = array();
// meeting initiation
$manage .= Skin::build_block(i18n::s('During the event'), 'header2');
// lobby message
$label = i18n::s('Lobby message');
if (!isset($this->attributes['lobby_message'])) {
$this->attributes['lobby_message'] = $this->get_lobby_default_message();
}
$input = '<textarea name="lobby_message" rows="2" cols="50">' . encode_field($this->attributes['lobby_message']) . '</textarea>';
$hint = i18n::s('Displayed one hour ahead the beginning of the event.');
$fields[] = array($label, $input, $hint);
// welcome message
$label = i18n::s('Welcome message');
if (!isset($this->attributes['welcome_message'])) {
$this->attributes['welcome_message'] = '';
}
$input = Surfer::get_editor('welcome_message', $this->attributes['welcome_message']);
$hint = i18n::s('Displayed only during the event.');
$fields[] = array($label, $input, $hint);
// assemble the form
$manage .= Skin::build_form($fields);
$fields = array();
// event follow-up
$manage .= Skin::build_block(i18n::s('After the event'), 'header2');
// splash message
$label = i18n::s('Follow-up message');
if (!isset($this->attributes['follow_up_message'])) {
$this->attributes['follow_up_message'] = $this->get_follow_up_default_message();
}
$input = Surfer::get_editor('follow_up_message', $this->attributes['follow_up_message']);
$hint = i18n::s('Congratulate participants, and drive people to complementary information or action.');
$fields[] = array($label, $input, $hint);
$manage .= Skin::build_form($fields);
//.........这里部分代码省略.........
示例7: get_form
/**
* build a small form to post a comment
*
* @param string reference to the anchor to attach the comment
* @param string the place to come back when complete
* @return string the HTML tags to put in the page
*/
public static function get_form($reference, $follow_up = 'comments', $placeholder = null, $file_attachement = true)
{
global $context, $render_overlaid;
// default placeholder
if (!$placeholder) {
$placeholder = i18n::s('Reply');
}
// the form to post a comment
$text = '<form method="post" action="' . $context['url_to_root'] . 'comments/edit.php" enctype="multipart/form-data" class="comment_form"><div style="margin: 1em 0;">';
// use the right editor, maybe wysiwyg
$text .= Surfer::get_editor('description', '', TRUE, 3, FALSE, $placeholder);
// bottom commands
$menu = array();
// option to add a file
$anchor = Anchors::get($reference);
if ($file_attachement && $anchor->allows('creation', 'file')) {
include_once $context['path_to_root'] . 'files/files.php';
// input field to appear on demand
$text .= '<p id="comment_upload" class="details" style="display: none;">' . '<input type="file" name="upload" id="upload" size="30" onchange="if(/\\.zip$/i.test($(this).val())){$(\'#upload_option\').slideDown();}else{$(\'#upload_option\').slideUp();}" />' . ' (< ' . $context['file_maximum_size'] . i18n::s('bytes') . ')' . '<input type="hidden" name="file_type" value="upload" /></p>' . '<div id="upload_option" style="display: none;" >' . '<input type="checkbox" name="explode_files" checked="checked" /> ' . i18n::s('Extract files from the archive') . '</div>';
// the command to add a file
Skin::define_img('FILES_UPLOAD_IMG', 'files/upload.gif');
$menu[] = '<a href="#" onclick="$(\'#comment_upload\').slideDown(600);$(this).slideUp(); return false;"><span>' . FILES_UPLOAD_IMG . i18n::s('Add a file') . '</span></a>';
}
// the submit button
$class_submit = $render_overlaid && $follow_up !== 'json' ? 'submit-overlaid' : 'button';
$menu[] = Skin::build_submit_button(i18n::s('Send'), i18n::s('Press [s] to submit data'), 's', null, $class_submit);
// case of a ajax submission
if ($follow_up === 'json') {
// insert js only once
static $ajax_comment_form = false;
if (!$ajax_comment_form) {
Page::insert_script('Yacs.initAjaxComments();');
$ajax_comment_form = true;
}
}
// finalize the form
$text .= '<input type="hidden" name="anchor" value="' . $reference . '" />' . '<input type="hidden" name="follow_up" value="' . $follow_up . '" />' . '<input type="hidden" name="notify_watchers" value="Y" />' . Skin::finalize_list($menu, 'menu_bar') . '</div></form>';
// done
return $text;
}
示例8: array_merge
// include overlay fields, if any
if (is_object($overlay)) {
$fields = array_merge($fields, $overlay->get_fields($item));
}
// the description label
if (!is_object($overlay) || !($label = $overlay->get_label('description', isset($item['id']) ? 'edit' : 'new'))) {
$label = i18n::s('Description');
}
// use the editor if possible
$value = '';
if (isset($item['description']) && $item['description']) {
$value = $item['description'];
} elseif (isset($_SESSION['pasted_text'])) {
$value = $_SESSION['pasted_text'];
}
$input = Surfer::get_editor('description', $value);
if (!is_object($overlay) || !($hint = $overlay->get_label('description_hint', isset($item['id']) ? 'edit' : 'new'))) {
$hint = '';
}
$fields[] = array($label, $input, $hint);
// allow for an initial upload, if allowed
if (!isset($item['id']) && Surfer::may_upload() && $cur_article->allows('creation', 'file')) {
// attachment label
$label = i18n::s('Add a file');
// an upload entry
$input = '<input type="hidden" name="file_type" value="upload" />' . '<input type="file" name="upload" size="30" onchange="if(/\\.zip$/i.test($(this).val())){$(\'#upload_option\').slideDown();}else{$(\'#upload_option\').slideUp();}" />' . ' (< ' . $context['file_maximum_size'] . i18n::s('bytes') . ')' . '<div id="upload_option" style="display: none;" >' . '<input type="checkbox" name="explode_files" checked="checked" /> ' . i18n::s('Extract files from the archive') . '</div>';
$fields[] = array($label, $input);
}
// associates will have it on options tab
if (Surfer::is_associate()) {
} elseif ($cur_article->is_owned()) {
示例9: encode_field
$hint .= i18n::s('Image to be displayed in the panel aside the page.');
$command = i18n::s('Add an image');
}
$value = '';
if (isset($item['icon_url']) && $item['icon_url']) {
$value = $item['icon_url'];
}
$input .= '<input type="text" name="icon_url" size="55" value="' . encode_field($value) . '" maxlength="255" />';
if (Surfer::may_upload()) {
$input .= ' <span class="details">' . Skin::build_link('images/edit.php?anchor=' . urlencode('section:' . $item['id']) . '&action=icon', $command, 'button') . '</span>';
}
$fields[] = array($label, $input, $hint);
}
// extra information
$label = i18n::s('Extra');
$input = Surfer::get_editor('extra', isset($item['extra']) ? $item['extra'] : '');
$hint = i18n::s('Text to be inserted in the panel aside the page. Use [box.extra=title]content[/box] or plain HTML.');
$fields[] = array($label, $input, $hint);
// news can be either a static or an animated list
$label = i18n::s('News');
if (!isset($item['index_news_count']) || $item['index_news_count'] < 1 || $item['index_news_count'] > 7) {
$item['index_news_count'] = 5;
}
$input = '<input type="radio" name="index_news" value="static"';
if (!isset($item['index_news']) || !preg_match('/(rotate|scroll|none)/', $item['index_news'])) {
$input .= ' checked="checked"';
}
$input .= '/> ' . sprintf(i18n::s('List up to %s news aside.'), '<input type="text" name="index_news_count" value="' . encode_field($item['index_news_count']) . '" size="2" />');
$input .= BR . '<input type="radio" name="index_news" value="scroll"';
if (isset($item['index_news']) && $item['index_news'] == 'scroll') {
$input .= ' checked="checked"';
示例10: elseif
} elseif ($action == 'thumbnail') {
$hint = i18n::s('Select a thumbnail picture for this page.');
} elseif (is_object($anchor)) {
$hint = i18n::s('Select a .png, .gif or .jpeg image, or a .zip file containing several images.');
}
}
$fields[] = array($label, $input, $hint);
// not just a bare upload
if ($action != 'avatar' && $action != 'icon' && $action != 'thumbnail') {
// the title
$label = i18n::s('Title');
$input = '<input type="text" name="title" size="50" value="' . encode_field(isset($item['title']) ? $item['title'] : '') . '" maxlength="255" accesskey="t" />';
$fields[] = array($label, $input);
// the description
$label = '';
$input = Skin::build_box(i18n::s('Description'), Surfer::get_editor('description', isset($item['description']) ? $item['description'] : ''), 'folded');
$fields[] = array($label, $input);
// the source
$label = i18n::s('Source');
$input = '<input type="text" name="source" size="45" value="' . encode_field(isset($item['source']) ? $item['source'] : '') . '" maxlength="255" accesskey="u" />';
$hint = i18n::s('If you have got this file from outside sources, please reference these sources here');
$fields[] = array($label, $input, $hint);
}
// we are now entering the advanced options section
$context['text'] .= Skin::build_form($fields);
$fields = array();
// create a thumbnail on direct upload
if (!isset($item['id']) && !$anchor) {
$context['text'] .= '<input type="hidden" name="action" value="set_as_both" />';
} else {
if ($action == 'avatar') {
示例11: sprintf
if (!isset($item['id']) && isset($_REQUEST['type']) && $_REQUEST['type'] == 'approval' && Surfer::get_id() && Comments::count_approvals_for_anchor($anchor->get_reference(), Surfer::get_id())) {
$input .= '<p class="details">' . i18n::s('It is not your first approval for this page.') . '</p>';
}
// change page title too
$context['page_title'] = sprintf(i18n::s('%s: %s'), i18n::s('Approval'), $anchor->get_title());
// else select a regular type
} else {
$input = Comments::get_radio_buttons('type', $type);
$hint = i18n::s('Please carefully select a type adequate for your comment.');
}
$fields[] = array($label, $input, $hint);
}
// the description
$label = i18n::s('Your contribution');
// use the editor if possible
$input = Surfer::get_editor('description', isset($item['description']) ? $item['description'] : '', TRUE, 3, FALSE);
$fields[] = array($label, $input);
// add a file on first post, and if allowed
if (Surfer::may_upload() && (!isset($item['id']) || $action == 'quote' || $action == 'reply')) {
// attachment label
$label = i18n::s('Add a file');
// an upload entry
$input = '<input type="hidden" name="file_type" value="upload" />' . '<input type="file" name="upload" id="upload" size="30" onchange="if(/\\.zip$/i.test($(this).val())){$(\'#upload_option\').slideDown();}else{$(\'#upload_option\').slideUp();}" />' . ' (< ' . $context['file_maximum_size'] . i18n::s('bytes') . ')' . '<div id="upload_option" style="display: none;" >' . '<input type="checkbox" name="explode_files" checked="checked" /> ' . i18n::s('Extract files from the archive') . '</div>';
$fields[] = array($label, $input);
}
// build the form
$context['text'] .= Skin::build_form($fields);
// bottom commands
$menu = array();
$menu[] = Skin::build_submit_button(i18n::s('Submit'), i18n::s('Press [s] to submit data'), 's', 'submit_button');
if (!$render_overlaid) {