function test_wp_richedit_pre_charset_utf_8() { add_filter('pre_option_blog_charset', array($this, '_charset_utf_8')); $utf8 = 'Fran' . chr(195) . chr(167) . 'ais'; $this->assertEquals('<p>' . $utf8 . "</p>\n", wp_richedit_pre($utf8)); remove_filter('pre_option_blog_charset', array($this, '_charset_utf_8')); }
/** * Gets the content of a post, its excerpt as well as its title and returns it as an array * * @param string $content_type * @param string $excerpt_type * @param int $trid * @param string $lang * * @return array containing all the fields information */ public static function copy_from_original_fields($content_type, $excerpt_type, $trid, $lang) { global $wpdb; $post_id = $wpdb->get_var($wpdb->prepare("SELECT element_id FROM {$wpdb->prefix}icl_translations WHERE trid=%d AND language_code=%s", $trid, $lang)); $post = get_post($post_id); $fields_to_copy = array('content' => 'post_content', 'title' => 'post_title', 'excerpt' => 'post_excerpt'); $fields_contents = array(); if (!empty($post)) { foreach ($fields_to_copy as $editor_key => $editor_field) { //loops over the three fields to be inserted into the array if ($editor_key === 'content' || $editor_key === 'excerpt') { // if ($editor_key === 'content') { $editor_var = $content_type; //these variables are supplied by a javascript call in scripts.js icl_copy_from_original(lang, trid) } elseif ($editor_key === 'excerpt') { $editor_var = $excerpt_type; } if ($editor_var === 'rich') { $html_pre = wp_richedit_pre($post->{$editor_field}); } else { $html_pre = wp_htmledit_pre($post->{$editor_field}); } $fields_contents[$editor_key] = htmlspecialchars_decode($html_pre); } elseif ($editor_key === 'title') { $fields_contents[$editor_key] = strip_tags($post->{$editor_field}); } } $fields_contents['customfields'] = apply_filters('wpml_copy_from_original_custom_fields', self::copy_from_original_custom_fields($post)); } else { $fields_contents['error'] = __('Post not found', 'sitepress'); } do_action('icl_copy_from_original', $post_id); return $fields_contents; }
function html($field) { echo '<div class="acf_wysiwyg">'; ?> <div id="editor-toolbar" style="display:none;"> <div id="media-buttons"> Upload/Insert <a title="Add an Image" class="thickbox" id="add_image" href="media-upload.php?post_id=1802&type=image&TB_iframe=1&width=640&height=314"><img onclick="return false;" alt="Add an Image" src="http://localhost:8888/acf/wp-admin/images/media-button-image.gif?ver=20100531"></a><a title="Add Video" class="thickbox" id="add_video" href="media-upload.php?post_id=1802&type=video&TB_iframe=1&width=640&height=314"><img onclick="return false;" alt="Add Video" src="http://localhost:8888/acf/wp-admin/images/media-button-video.gif?ver=20100531"></a><a title="Add Audio" class="thickbox" id="add_audio" href="media-upload.php?post_id=1802&type=audio&TB_iframe=1&width=640&height=314"><img onclick="return false;" alt="Add Audio" src="http://localhost:8888/acf/wp-admin/images/media-button-music.gif?ver=20100531"></a><a title="Add Media" class="thickbox" id="add_media" href="media-upload.php?post_id=1802&TB_iframe=1&width=640&height=314"><img onclick="return false;" alt="Add Media" src="http://localhost:8888/acf/wp-admin/images/media-button-other.gif?ver=20100531"></a> </div> </div> <?php echo '<div id="editorcontainer"><textarea name="' . $field->input_name . '" >'; echo wp_richedit_pre($field->value); echo '</textarea></div></div>'; }
/** * 投稿画面にフィールドを表示 * * @param int $index インデックス番号 * @param mixed $value 保存されている値(check のときだけ配列) * @return string html */ public function get_field($index, $value) { $name = $this->get_field_name_in_editor($index); $disabled = $this->get_disable_attribute($index); if (function_exists('format_for_editor')) { $value = format_for_editor($value); } else { $value = wp_richedit_pre($value); } return sprintf('<div class="wp-editor-wrap"> <div class="wp-editor-tools hide-if-no-js"> <div class="wp-media-buttons">%s</div> </div> <div class="wp-editor-container"> <textarea name="%s" rows="8" class="widefat smart-cf-wp-editor" %s>%s</textarea> </div> </div>', $this->media_buttons(), esc_attr($name), disabled(true, $disabled, false), $value); }
function spyropress_widget_editor($item, $id, $value, $is_builder = false) { ob_start(); // collecting attributes $atts = array(); $atts['class'] = 'field builder-rich-text'; $atts['id'] = esc_attr($id); $atts['name'] = esc_attr($item['name']); $atts['rows'] = esc_attr($item['rows']); echo '<div ' . build_section_class('section-editor section-full', $item) . '>'; build_heading($item, true); build_description($item); echo '<div class="controls">'; printf('<textarea %s>%s</textarea>', spyropress_build_atts($atts), wp_richedit_pre($value)); echo '</div>'; echo '</div>'; $ui_content = ob_get_clean(); return $ui_content; }
} } if (isset($iclsettings)) { $this->save_settings($iclsettings); } } echo '1|'; break; case 'copy_from_original': $post_id = $wpdb->get_var($wpdb->prepare("SELECT element_id FROM {$wpdb->prefix}icl_translations WHERE trid=%d AND language_code=%s", $_POST['trid'], $_POST['lang'])); $post = get_post($post_id); $error = false; $json = array(); if (!empty($post)) { if ($_POST['editor_type'] == 'rich') { $json['body'] = htmlspecialchars_decode(wp_richedit_pre($post->post_content)); } else { $json['body'] = htmlspecialchars_decode(wp_htmledit_pre($post->post_content)); } } else { $json['error'] = __('Post not found', 'sitepress'); } do_action('icl_copy_from_original', $post_id); echo json_encode($json); break; case 'save_user_preferences': $user_preferences = $this->get_user_preferences(); $this->set_user_preferences(array_merge_recursive($user_preferences, $_POST['user_preferences'])); $this->save_user_preferences(); break; case 'wpml_cf_translation_preferences':
if ($rows < 3 || $rows > 100) { $rows = 12; } the_quicktags(); ?> <div><textarea <?php if (user_can_richedit()) { echo 'title="true" '; } ?> rows="<?php echo $rows; ?> " cols="40" name="content" tabindex="2" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?> </textarea></div> </fieldset> <script type="text/javascript"> <!-- edCanvas = document.getElementById('content'); <?php if (user_can_richedit()) { ?> // This code is meant to allow tabbing from Title to Post (TinyMCE). if ( tinyMCE.isMSIE ) document.getElementById('title').onkeydown = function (e) { e = e ? e : window.event;
/** * Actions to save, update, and delete forms/form fields * * * @since 1.0 */ public function save() { global $wpdb; if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'visual-form-builder' && isset($_REQUEST['action'])) { switch ($_REQUEST['action']) { case 'create_form': $form_id = absint($_REQUEST['form_id']); $form_key = sanitize_title($_REQUEST['form_title']); $form_title = esc_html($_REQUEST['form_title']); check_admin_referer('create_form-' . $form_id); $newdata = array('form_key' => $form_key, 'form_title' => $form_title); /* Set message to display */ $this->message = sprintf(__('<div id="message" class="updated"><p>The <strong>%s</strong> form has been created.</p></div>', 'visual-form-builder'), $form_title); /* Create the form */ $wpdb->insert($this->form_table_name, $newdata); /* Get form ID to add our first field */ $new_form_selected = $wpdb->insert_id; /* Setup the initial fieldset */ $initial_fieldset = array('form_id' => $wpdb->insert_id, 'field_key' => 'fieldset', 'field_type' => 'fieldset', 'field_name' => 'Fieldset', 'field_sequence' => 0); /* Add the first fieldset to get things started */ $wpdb->insert($this->field_table_name, $initial_fieldset); $verification_fieldset = array('form_id' => $new_form_selected, 'field_key' => 'verification', 'field_type' => 'verification', 'field_name' => 'Verification', 'field_description' => '(This is for preventing spam)', 'field_sequence' => 1); /* Insert the submit field */ $wpdb->insert($this->field_table_name, $verification_fieldset); $verify_fieldset_parent_id = $wpdb->insert_id; $secret = array('form_id' => $new_form_selected, 'field_key' => 'secret', 'field_type' => 'secret', 'field_name' => 'Please enter any two digits with no spaces (Example: 12)', 'field_size' => 'medium', 'field_required' => 'yes', 'field_parent' => $verify_fieldset_parent_id, 'field_sequence' => 2); /* Insert the submit field */ $wpdb->insert($this->field_table_name, $secret); /* Make the submit last in the sequence */ $submit = array('form_id' => $new_form_selected, 'field_key' => 'submit', 'field_type' => 'submit', 'field_name' => 'Submit', 'field_parent' => $verify_fieldset_parent_id, 'field_sequence' => 3); /* Insert the submit field */ $wpdb->insert($this->field_table_name, $submit); /* Redirect to keep the URL clean (use AJAX in the future?) */ wp_redirect('options-general.php?page=visual-form-builder&form=' . $new_form_selected); exit; break; case 'update_form': $form_id = absint($_REQUEST['form_id']); $form_key = sanitize_title($_REQUEST['form_title'], $form_id); $form_title = esc_html($_REQUEST['form_title']); $form_subject = esc_html($_REQUEST['form_email_subject']); $form_to = serialize(array_map('esc_html', $_REQUEST['form_email_to'])); $form_from = esc_html($_REQUEST['form_email_from']); $form_from_name = esc_html($_REQUEST['form_email_from_name']); $form_from_override = esc_html($_REQUEST['form_email_from_override']); $form_from_name_override = esc_html($_REQUEST['form_email_from_name_override']); $form_success_type = esc_html($_REQUEST['form_success_type']); $form_notification_setting = esc_html($_REQUEST['form_notification_setting']); $form_notification_email_name = esc_html($_REQUEST['form_notification_email_name']); $form_notification_email_from = esc_html($_REQUEST['form_notification_email_from']); $form_notification_email = esc_html($_REQUEST['form_notification_email']); $form_notification_subject = esc_html($_REQUEST['form_notification_subject']); $form_notification_message = wp_richedit_pre($_REQUEST['form_notification_message']); $form_notification_entry = esc_html($_REQUEST['form_notification_entry']); $form_label_alignment = esc_html($_REQUEST['form_label_alignment']); /* Add confirmation based on which type was selected */ switch ($form_success_type) { case 'text': $form_success_message = wp_richedit_pre($_REQUEST['form_success_message_text']); break; case 'page': $form_success_message = esc_html($_REQUEST['form_success_message_page']); break; case 'redirect': $form_success_message = esc_html($_REQUEST['form_success_message_redirect']); break; } check_admin_referer('update_form-' . $form_id); $newdata = array('form_key' => $form_key, 'form_title' => $form_title, 'form_email_subject' => $form_subject, 'form_email_to' => $form_to, 'form_email_from' => $form_from, 'form_email_from_name' => $form_from_name, 'form_email_from_override' => $form_from_override, 'form_email_from_name_override' => $form_from_name_override, 'form_success_type' => $form_success_type, 'form_success_message' => $form_success_message, 'form_notification_setting' => $form_notification_setting, 'form_notification_email_name' => $form_notification_email_name, 'form_notification_email_from' => $form_notification_email_from, 'form_notification_email' => $form_notification_email, 'form_notification_subject' => $form_notification_subject, 'form_notification_message' => $form_notification_message, 'form_notification_entry' => $form_notification_entry, 'form_label_alignment' => $form_label_alignment); $where = array('form_id' => $form_id); /* Update form details */ $wpdb->update($this->form_table_name, $newdata, $where); /* Initialize field sequence */ $field_sequence = 0; /* Loop through each field and update all at once */ if (!empty($_REQUEST['field_id'])) { foreach ($_REQUEST['field_id'] as $id) { $field_name = isset($_REQUEST['field_name-' . $id]) ? esc_html($_REQUEST['field_name-' . $id]) : ''; $field_key = sanitize_title($field_name, $id); $field_desc = isset($_REQUEST['field_description-' . $id]) ? esc_html($_REQUEST['field_description-' . $id]) : ''; $field_options = isset($_REQUEST['field_options-' . $id]) ? serialize(array_map('esc_html', $_REQUEST['field_options-' . $id])) : ''; $field_validation = isset($_REQUEST['field_validation-' . $id]) ? esc_html($_REQUEST['field_validation-' . $id]) : ''; $field_required = isset($_REQUEST['field_required-' . $id]) ? esc_html($_REQUEST['field_required-' . $id]) : ''; $field_size = isset($_REQUEST['field_size-' . $id]) ? esc_html($_REQUEST['field_size-' . $id]) : ''; $field_css = isset($_REQUEST['field_css-' . $id]) ? esc_html($_REQUEST['field_css-' . $id]) : ''; $field_layout = isset($_REQUEST['field_layout-' . $id]) ? esc_html($_REQUEST['field_layout-' . $id]) : ''; $field_default = isset($_REQUEST['field_default-' . $id]) ? esc_html($_REQUEST['field_default-' . $id]) : ''; $field_data = array('field_key' => $field_key, 'field_name' => $field_name, 'field_description' => $field_desc, 'field_options' => $field_options, 'field_validation' => $field_validation, 'field_required' => $field_required, 'field_size' => $field_size, 'field_css' => $field_css, 'field_layout' => $field_layout, 'field_sequence' => $field_sequence, 'field_default' => $field_default); $where = array('form_id' => $_REQUEST['form_id'], 'field_id' => $id); /* Update all fields */ $wpdb->update($this->field_table_name, $field_data, $where); $field_sequence++; } /* Check if a submit field type exists for backwards compatibility upgrades */ $is_verification = $wpdb->get_var("SELECT field_id FROM {$this->field_table_name} WHERE field_type = 'verification' AND form_id = {$form_id}"); $is_secret = $wpdb->get_var("SELECT field_id FROM {$this->field_table_name} WHERE field_type = 'secret' AND form_id = {$form_id}"); $is_submit = $wpdb->get_var("SELECT field_id FROM {$this->field_table_name} WHERE field_type = 'submit' AND form_id = {$form_id}"); /* Decrement sequence */ $field_sequence--; /* If this form doesn't have a verification field, add one */ if ($is_verification == NULL) { /* Adjust the sequence */ $verification_fieldset = array('form_id' => $form_id, 'field_key' => 'verification', 'field_type' => 'verification', 'field_name' => 'Verification', 'field_sequence' => $field_sequence); /* Insert the verification fieldset */ $wpdb->insert($this->field_table_name, $verification_fieldset); $verification_id = $wpdb->insert_id; } /* If the verification field was inserted, use that ID as a parent otherwise set no parent */ $verify_fieldset_parent_id = $verification_id !== false ? $verification_id : 0; /* If this form doesn't have a secret field, add one */ if ($is_secret == NULL) { /* Adjust the sequence */ $secret = array('form_id' => $form_id, 'field_key' => 'secret', 'field_type' => 'secret', 'field_name' => 'Please enter any two digits with no spaces (Example: 12)', 'field_size' => 'medium', 'field_required' => 'yes', 'field_parent' => $verify_fieldset_parent_id, 'field_sequence' => ++$field_sequence); /* Insert the submit field */ $wpdb->insert($this->field_table_name, $secret); } /* If this form doesn't have a submit field, add one */ if ($is_submit == NULL) { /* Make the submit last in the sequence */ $submit = array('form_id' => $form_id, 'field_key' => 'submit', 'field_type' => 'submit', 'field_name' => 'Submit', 'field_parent' => $verify_fieldset_parent_id, 'field_sequence' => ++$field_sequence); /* Insert the submit field */ $wpdb->insert($this->field_table_name, $submit); } else { /* Only update the Submit's parent ID if the Verification field is new */ $data = $is_verification == NULL ? array('field_parent' => $verify_fieldset_parent_id, 'field_sequence' => ++$field_sequence) : array('field_sequence' => $field_sequence); $where = array('form_id' => $form_id, 'field_id' => $is_submit); /* Update the submit field */ $wpdb->update($this->field_table_name, $data, $where); } } break; case 'delete_form': $id = absint($_REQUEST['form']); check_admin_referer('delete-form-' . $id); /* Delete form and all fields */ $wpdb->query($wpdb->prepare("DELETE FROM {$this->form_table_name} WHERE form_id = %d", $id)); $wpdb->query($wpdb->prepare("DELETE FROM {$this->field_table_name} WHERE form_id = %d", $id)); /* Redirect to keep the URL clean (use AJAX in the future?) */ wp_redirect(add_query_arg('action', 'deleted', 'options-general.php?page=visual-form-builder')); exit; break; case 'copy_form': $id = absint($_REQUEST['form']); check_admin_referer('copy-form-' . $id); /* Get all fields and data for the request form */ $fields_query = "SELECT * FROM {$this->field_table_name} WHERE form_id = {$id}"; $forms_query = "SELECT * FROM {$this->form_table_name} WHERE form_id = {$id}"; $emails = "SELECT form_email_from_override, form_notification_email FROM {$this->form_table_name} WHERE form_id = {$id}"; $fields = $wpdb->get_results($fields_query); $forms = $wpdb->get_results($forms_query); $override = $wpdb->get_var($emails); $notify = $wpdb->get_var($emails, 1); /* Copy this form and force the initial title to denote a copy */ foreach ($forms as $form) { $data = array('form_key' => sanitize_title($form->form_key . ' copy'), 'form_title' => $form->form_title . ' Copy', 'form_email_subject' => $form->form_email_subject, 'form_email_to' => $form->form_email_to, 'form_email_from' => $form->form_email_from, 'form_email_from_name' => $form->form_email_from_name, 'form_email_from_override' => $form->form_email_from_override, 'form_email_from_name_override' => $form->form_email_from_name_override, 'form_success_type' => $form->form_success_type, 'form_success_message' => $form->form_success_message, 'form_notification_setting' => $form->form_notification_setting, 'form_notification_email_name' => $form->form_notification_email_name, 'form_notification_email_from' => $form->form_notification_email_from, 'form_notification_email' => $form->form_notification_email, 'form_notification_subject' => $form->form_notification_subject, 'form_notification_message' => $form->form_notification_message, 'form_notification_entry' => $form->form_notification_entry, 'form_label_alignment' => $form->form_label_alignment); $wpdb->insert($this->form_table_name, $data); } /* Get form ID to add our first field */ $new_form_selected = $wpdb->insert_id; /* Copy each field and data */ foreach ($fields as $field) { $data = array('form_id' => $new_form_selected, 'field_key' => $field->field_key, 'field_type' => $field->field_type, 'field_name' => $field->field_name, 'field_description' => $field->field_description, 'field_options' => $field->field_options, 'field_sequence' => $field->field_sequence, 'field_validation' => $field->field_validation, 'field_required' => $field->field_required, 'field_size' => $field->field_size, 'field_css' => $field->field_css, 'field_layout' => $field->field_layout, 'field_parent' => $field->field_parent); $wpdb->insert($this->field_table_name, $data); /* If a parent field, save the old ID and the new ID to update new parent ID */ if (in_array($field->field_type, array('fieldset', 'section', 'verification'))) { $parents[$field->field_id] = $wpdb->insert_id; } if ($override == $field->field_id) { $wpdb->update($this->form_table_name, array('form_email_from_override' => $wpdb->insert_id), array('form_id' => $new_form_selected)); } if ($notify == $field->field_id) { $wpdb->update($this->form_table_name, array('form_notification_email' => $wpdb->insert_id), array('form_id' => $new_form_selected)); } } /* Loop through our parents and update them to their new IDs */ foreach ($parents as $k => $v) { $wpdb->update($this->field_table_name, array('field_parent' => $v), array('form_id' => $new_form_selected, 'field_parent' => $k)); } break; } } }
/** * Filter the field value to appear within the input as expected * @param string $value The field value * @param Attachments_field $field The field object * @return string The formatted value */ function format_value_for_input($value, $field = null) { return wp_richedit_pre($value); }
<div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div> </fieldset> <fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>"> <legend><?php _e('Post') ?></legend> <?php $rows = get_settings('default_post_edit_rows'); if (($rows < 3) || ($rows > 100)) { $rows = 12; } ?> <?php the_quicktags(); ?> </fieldset> <div><textarea <?php if ( user_can_richedit() ) echo 'title="true" '; ?>rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="2" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea></div> </fieldset> <script type="text/javascript"> // <![CDATA[ edCanvas = document.getElementById('content'); <?php if ( user_can_richedit() ) : ?> // This code is meant to allow tabbing from Title to Post (TinyMCE). if ( tinyMCE.isMSIE ) document.getElementById('title').onkeydown = function (e) { e = e ? e : window.event; if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { var i = tinyMCE.selectedInstance; if(typeof i == 'undefined') return true;
function create_field($field) { // vars $field['toolbar'] = isset($field['toolbar']) ? $field['toolbar'] : 'full'; $field['media_upload'] = isset($field['media_upload']) ? $field['media_upload'] : 'yes'; $id = 'wysiwyg-' . $field['name']; ?> <div id="wp-<?php echo $id; ?> -wrap" class="acf_wysiwyg wp-editor-wrap" data-toolbar="<?php echo $field['toolbar']; ?> "> <?php if ($field['media_upload'] == 'yes') { ?> <?php if (get_bloginfo('version') < "3.3") { ?> <div id="editor-toolbar"> <div id="media-buttons" class="hide-if-no-js"> <?php do_action('media_buttons'); ?> </div> </div> <?php } else { ?> <div id="wp-<?php echo $id; ?> -editor-tools" class="wp-editor-tools"> <?php /*<a onclick="switchEditors.switchto(this);" class="hide-if-no-js wp-switch-editor switch-html active" id="<?php echo $id; ?>-html">HTML</a> <a onclick="switchEditors.switchto(this);" class="hide-if-no-js wp-switch-editor switch-tmce" id="<?php echo $id; ?>-tmce">Visual</a>*/ ?> <div id="wp-<?php echo $id; ?> -media-buttons" class="hide-if-no-js wp-media-buttons"> <?php do_action('media_buttons'); ?> </div> </div> <?php } ?> <?php } ?> <div id="wp-<?php echo $id; ?> -editor-container" class="wp-editor-container"> <?php /*<div id="qt_<?php echo $id; ?>_toolbar" class="quicktags-toolbar"> <input type="button" value="b" title="" class="ed_button" accesskey="b" id="qt_<?php echo $id; ?>_strong"> <input type="button" value="i" title="" class="ed_button" accesskey="i" id="qt_<?php echo $id; ?>_em"> <input type="button" value="link" title="" class="ed_button" accesskey="a" id="qt_<?php echo $id; ?>_link"> <input type="button" value="b-quote" title="" class="ed_button" accesskey="q" id="qt_<?php echo $id; ?>_block"> <input type="button" value="del" title="" class="ed_button" accesskey="d" id="qt_<?php echo $id; ?>_del"> <input type="button" value="ins" title="" class="ed_button" accesskey="s" id="qt_<?php echo $id; ?>_ins"> <input type="button" value="img" title="" class="ed_button" accesskey="m" id="qt_<?php echo $id; ?>_img"> <input type="button" value="ul" title="" class="ed_button" accesskey="u" id="qt_<?php echo $id; ?>_ul"> <input type="button" value="ol" title="" class="ed_button" accesskey="o" id="qt_<?php echo $id; ?>_ol"> <input type="button" value="li" title="" class="ed_button" accesskey="l" id="qt_<?php echo $id; ?>_li"> <input type="button" value="code" title="" class="ed_button" accesskey="c" id="qt_<?php echo $id; ?>_code"> <input type="button" value="more" title="" class="ed_button" accesskey="t" id="qt_<?php echo $id; ?>_more"> <input type="button" value="lookup" title="Dictionary lookup" class="ed_button" id="qt_<?php echo $id; ?>_spell"> <input type="button" value="close tags" title="Close all open tags" class="ed_button" id="qt_<?php echo $id; ?>_close"> <input type="button" value="fullscreen" title="Toggle fullscreen mode" class="ed_button" accesskey="f" id="qt_<?php echo $id; ?>_fullscreen"> </div>*/ ?> <textarea id="<?php echo $id; ?> " class="wp-editor-area" name="<?php echo $field['name']; ?> " ><?php echo wp_richedit_pre($field['value']); ?> </textarea> </div> </div> <?php //wp_editor('', $id); ?> <?php }
function render() { $val = $this->get_value(); $id = 'wysiwyg-' . $this->get_name(); ?> <div id="wp-<?php echo $id; ?> -wrap" class="carbon-wysiwyg wp-editor-wrap tmce-active" data-toolbar="full"> <div id="wp-<?php echo $id; ?> -editor-tools" class="wp-editor-tools"> <div id="wp-<?php echo $id; ?> -media-buttons" class="hide-if-no-js wp-media-buttons"> <?php do_action('media_buttons'); ?> </div> </div> <div class="wp-editor-tabs"> <a class="wp-switch-editor switch-html">Text</a> <a class="wp-switch-editor switch-tmce">Visual</a> </div> <div id="wp-<?php echo $id; ?> -editor-container" class="wp-editor-container"> <textarea id="<?php echo $id; ?> " class="wp-editor-area" name="<?php echo $this->get_name(); ?> " <?php echo $this->required ? 'data-carbon-required="true"' : ''; ?> ><?php echo wp_richedit_pre($val); ?> </textarea> </div> </div> <?php }
<form action="press-this.php?action=post" method="post"> <?php wp_nonce_field('press-this') ?> <input type="hidden" name="post_type" id="post_type" value="text"/> <div id="posting"> <h2 id="title"><label for="post_title"><?php _e('Title') ?></label></h2> <div class="titlewrap"> <input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/> </div> <div id="extra_fields" style="display: none"></div> <div class="editor_area"> <h2 id="content_type"><label for="content"><?php _e('Post') ?></label></h2> <div class="editor-container"> <textarea name="content" id="content" style="width:100%;" class="mceEditor" rows="15"><?php if ($selection) { echo wp_richedit_pre($selection); } ?><a href="<?php echo $url ?>"><?php echo $title; ?></a>.</textarea> </div> </div> </div> <div id="categories"> <div class="submitbox" id="submitpost"> <div id="previewview"></div> <div class="inside"> <h2><?php _e('Categories') ?></h2> <div id="categories-all"> <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> <?php wp_category_checklist() ?> </ul> </div>
function form($instance) { global $wp_version; extract(wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'template' => '')), EXTR_SKIP); if (!empty($id) && intval($id) > 0) { $spot_post = get_post($id); } $spots = get_posts(array('numberposts' => -1, 'post_type' => SPOTS_POST_TYPE)); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', SPOTS_DOM); ?> <input class="widefat title-field" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo esc_attr($title); ?> " /> </label> </p> <?php // once a spot is chosen or created the widget is inexorably bound to that spot - simplifies the UI greatly. if (empty($id) || $id == 0) { ?> <p> <a class="button create-spot" href="#"><?php _e('Create a new spot', SPOTS_DOM); ?> </a> <span class="description"><?php _e('(You must enter a title first)', SPOTS_DOM); ?> </span> </p> <?php } else { ?> <input class="spot-id" type="hidden" name="<?php echo $this->get_field_name('id'); ?> " value="<?php echo esc_attr($id); ?> " /> <?php } if (count($spots) && (empty($id) || $id == 0)) { ?> <p> <label for="<?php echo $this->get_field_id('id'); ?> "><?php if (empty($id)) { _e('Or select an existing ', SPOTS_DOM); } _e('Spot:', SPOTS_DOM); ?> <select name="<?php echo $this->get_field_name('id'); ?> " id="<?php echo $this->get_field_id('id'); ?> " class="widefat spot-select"> <?php printf('<option value="">%s</option>', __('None', SPOTS_DOM)); foreach ($spots as $spot) { printf('<option value="%s"%s>%s</option>', esc_attr($spot->ID), selected($spot->ID, (int) $id, false), esc_html(!empty($spot->post_title) ? $spot->post_title : $spot->ID)); } ?> </select> </label> </p> <?php } if (isset($spot_post)) { ?> <div class="code-toggle hide-if-no-js"> <a href="#" class="button visual" data-id="<?php echo $this->get_field_id('content'); ?> " ><?php _e('Visual', SPOTS_DOM); ?> </a> <a href="#" class="button text" data-id="<?php echo $this->get_field_id('content'); ?> "><?php _e('Text', SPOTS_DOM); ?> </a> </div> <div class="editorcontainer wp-editor-wrap"> <textarea cols="40" rows="10" class="widefat mceme" id="<?php echo $this->get_field_id('content'); ?> " name="<?php echo $this->get_field_name('content'); ?> "> <?php if (version_compare($wp_version, '4.3', '>=')) { echo format_for_editor($spot_post->post_content); } else { echo wp_richedit_pre($spot_post->post_content); } ?> </textarea> </div> <?php if (version_compare($wp_version, '3.5', '<')) { ?> <div class="spot-featured-image"> <?php // show featured image if set if (current_theme_supports('post-thumbnails')) { echo $this->_wp_post_thumbnail_html(null, $spot_post->ID); } ?> </div> <?php } } $templates = icit_spots::$instance_spots->get_templates(); if ($templates) { ?> <p> <label for="<?php echo $this->get_field_id('template'); ?> "><?php _e('Template', SPOTS_DOM); ?> </label> <select class="widefat" name="<?php echo $this->get_field_name('template'); ?> " id="<?php echo $this->get_field_id('template'); ?> "> <option value=""><?php _e('Default Template', SPOTS_DOM); ?> </option> <?php foreach ($templates as $i => $name) { printf('<option value="%s" %s>%s</option>', esc_attr($name), selected($name, $template, false), esc_html(ucfirst($name))); } ?> </select> </p> <?php } ?> <p><a class="edit-spot-link"<?php echo intval($id) ? '' : ' style="display:none;"'; ?> target="_parent" href="./post.php?post=<?php echo $id; ?> &post_type=<?php echo SPOTS_POST_TYPE; ?> &action=edit"><?php _e('Go to the full editor for this spot', SPOTS_DOM); ?> </a></p> <?php }
function create_field($field) { global $wp_version; // vars $defaults = array('toolbar' => 'full', 'media_upload' => 'yes'); $field = array_merge($defaults, $field); $id = 'wysiwyg-' . $field['id']; ?> <div id="wp-<?php echo $id; ?> -wrap" class="acf_wysiwyg wp-editor-wrap" data-toolbar="<?php echo $field['toolbar']; ?> " data-upload="<?php echo $field['media_upload']; ?> "> <?php if ($field['media_upload'] == 'yes') { ?> <?php if (version_compare($wp_version, '3.3', '<')) { ?> <div id="editor-toolbar"> <div id="media-buttons" class="hide-if-no-js"> <?php do_action('media_buttons'); ?> </div> </div> <?php } else { ?> <div id="wp-<?php echo $id; ?> -editor-tools" class="wp-editor-tools"> <div id="wp-<?php echo $id; ?> -media-buttons" class="hide-if-no-js wp-media-buttons"> <?php do_action('media_buttons'); ?> </div> </div> <?php } ?> <?php } ?> <div id="wp-<?php echo $id; ?> -editor-container" class="wp-editor-container"> <textarea id="<?php echo $id; ?> " class="wp-editor-area" name="<?php echo $field['name']; ?> " ><?php echo wp_richedit_pre($field['value']); ?> </textarea> </div> </div> <?php }
function create_field($field) { // vars $field['toolbar'] = isset($field['toolbar']) ? $field['toolbar'] : 'full'; $field['media_upload'] = isset($field['media_upload']) ? $field['media_upload'] : 'yes'; $id = 'wysiwyg_' . uniqid(); ?> <div class="acf_wysiwyg" data-toolbar="<?php echo $field['toolbar']; ?> "> <?php if ($field['media_upload'] == 'yes') { ?> <div id="editor-toolbar" class="hide-if-no-js"> <div id="media-buttons" class="hide-if-no-js"> Upload/Insert <a title="Add an Image" class="thickbox" id="add_image" href="media-upload.php?post_id=1802&type=image&TB_iframe=1&width=640&height=314"> <img onclick="return false;" alt="Add an Image" src="<?php echo $this->parent->wpadminurl; ?> /images/media-button-image.gif?ver=20100531"> </a> <a title="Add Video" class="thickbox" id="add_video" href="media-upload.php?post_id=1802&type=video&TB_iframe=1&width=640&height=314"> <img onclick="return false;" alt="Add Video" src="<?php echo $this->parent->wpadminurl; ?> /images/media-button-video.gif?ver=20100531"> </a> <a title="Add Audio" class="thickbox" id="add_audio" href="media-upload.php?post_id=1802&type=audio&TB_iframe=1&width=640&height=314"> <img onclick="return false;" alt="Add Audio" src="<?php echo $this->parent->wpadminurl; ?> /images/media-button-music.gif?ver=20100531"> </a> <a title="Add Media" class="thickbox" id="add_media" href="media-upload.php?post_id=1802&TB_iframe=1&width=640&height=314"> <img onclick="return false;" alt="Add Media" src="<?php echo $this->parent->wpadminurl; ?> /images/media-button-other.gif?ver=20100531"> </a> </div> </div> <?php } ?> <div id="editorcontainer"> <textarea id="<?php echo $field['name']; ?> " name="<?php echo $field['name']; ?> " ><?php echo wp_richedit_pre($field['value']); ?> </textarea> </div> </div> <?php }
/** * Save the form * * @access public * @since 2.8.1 * @return void */ public function save_update_form() { global $wpdb; if (!isset($_REQUEST['action']) || !isset($_GET['page'])) { return; } if ('visual-form-builder' !== $_GET['page']) { return; } if ('update_form' !== $_REQUEST['action']) { return; } check_admin_referer('vfb_update_form'); $form_id = absint($_REQUEST['form_id']); $form_key = sanitize_title($_REQUEST['form_title'], $form_id); $form_title = $_REQUEST['form_title']; $form_subject = $_REQUEST['form_email_subject']; $form_to = serialize(array_map('sanitize_email', $_REQUEST['form_email_to'])); $form_from = sanitize_email($_REQUEST['form_email_from']); $form_from_name = $_REQUEST['form_email_from_name']; $form_from_override = isset($_REQUEST['form_email_from_override']) ? $_REQUEST['form_email_from_override'] : ''; $form_from_name_override = isset($_REQUEST['form_email_from_name_override']) ? $_REQUEST['form_email_from_name_override'] : ''; $form_success_type = $_REQUEST['form_success_type']; $form_notification_setting = isset($_REQUEST['form_notification_setting']) ? $_REQUEST['form_notification_setting'] : ''; $form_notification_email_name = isset($_REQUEST['form_notification_email_name']) ? $_REQUEST['form_notification_email_name'] : ''; $form_notification_email_from = isset($_REQUEST['form_notification_email_from']) ? sanitize_email($_REQUEST['form_notification_email_from']) : ''; $form_notification_email = isset($_REQUEST['form_notification_email']) ? $_REQUEST['form_notification_email'] : ''; $form_notification_subject = isset($_REQUEST['form_notification_subject']) ? $_REQUEST['form_notification_subject'] : ''; $form_notification_message = isset($_REQUEST['form_notification_message']) ? wp_richedit_pre($_REQUEST['form_notification_message']) : ''; $form_notification_entry = isset($_REQUEST['form_notification_entry']) ? $_REQUEST['form_notification_entry'] : ''; $form_label_alignment = $_REQUEST['form_label_alignment']; // Add confirmation based on which type was selected switch ($form_success_type) { case 'text': $form_success_message = wp_richedit_pre($_REQUEST['form_success_message_text']); break; case 'page': $form_success_message = $_REQUEST['form_success_message_page']; break; case 'redirect': $form_success_message = $_REQUEST['form_success_message_redirect']; break; } $newdata = array('form_key' => $form_key, 'form_title' => $form_title, 'form_email_subject' => $form_subject, 'form_email_to' => $form_to, 'form_email_from' => $form_from, 'form_email_from_name' => $form_from_name, 'form_email_from_override' => $form_from_override, 'form_email_from_name_override' => $form_from_name_override, 'form_success_type' => $form_success_type, 'form_success_message' => $form_success_message, 'form_notification_setting' => $form_notification_setting, 'form_notification_email_name' => $form_notification_email_name, 'form_notification_email_from' => $form_notification_email_from, 'form_notification_email' => $form_notification_email, 'form_notification_subject' => $form_notification_subject, 'form_notification_message' => $form_notification_message, 'form_notification_entry' => $form_notification_entry, 'form_label_alignment' => $form_label_alignment); $where = array('form_id' => $form_id); // Update form details $wpdb->update($this->form_table_name, $newdata, $where); $field_ids = array(); // Get max post vars, if available. Otherwise set to 1000 $max_post_vars = ini_get('max_input_vars') ? intval(ini_get('max_input_vars')) : 1000; // Set a message to be displayed if we've reached a limit if (count($_POST, COUNT_RECURSIVE) > $max_post_vars) { $this->post_max_vars = true; } foreach ($_REQUEST['field_id'] as $fields) { $field_ids[] = $fields; } // Initialize field sequence $field_sequence = 0; // Loop through each field and update foreach ($field_ids as $id) { $id = absint($id); $field_name = isset($_REQUEST['field_name-' . $id]) ? trim($_REQUEST['field_name-' . $id]) : ''; $field_key = sanitize_key(sanitize_title($field_name, $id)); $field_desc = isset($_REQUEST['field_description-' . $id]) ? trim($_REQUEST['field_description-' . $id]) : ''; $field_options = isset($_REQUEST['field_options-' . $id]) ? serialize(array_map('trim', $_REQUEST['field_options-' . $id])) : ''; $field_validation = isset($_REQUEST['field_validation-' . $id]) ? $_REQUEST['field_validation-' . $id] : ''; $field_required = isset($_REQUEST['field_required-' . $id]) ? $_REQUEST['field_required-' . $id] : ''; $field_size = isset($_REQUEST['field_size-' . $id]) ? $_REQUEST['field_size-' . $id] : ''; $field_css = isset($_REQUEST['field_css-' . $id]) ? $_REQUEST['field_css-' . $id] : ''; $field_layout = isset($_REQUEST['field_layout-' . $id]) ? $_REQUEST['field_layout-' . $id] : ''; $field_default = isset($_REQUEST['field_default-' . $id]) ? trim($_REQUEST['field_default-' . $id]) : ''; $field_data = array('field_key' => $field_key, 'field_name' => $field_name, 'field_description' => $field_desc, 'field_options' => $field_options, 'field_validation' => $field_validation, 'field_required' => $field_required, 'field_size' => $field_size, 'field_css' => $field_css, 'field_layout' => $field_layout, 'field_sequence' => $field_sequence, 'field_default' => $field_default); $where = array('form_id' => $form_id, 'field_id' => $id); // Update all fields $wpdb->update($this->field_table_name, $field_data, $where); $field_sequence++; } }
</a> <a id="edButtonPreview" class="active" onclick="switchEditors.go('content', 'tinymce');"><?php _e('Visual'); ?> </a> <div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('content')" /></div> </li> <?php } ?> </ul> <div id="quicktags"></div> <div class="editor-container"> <textarea name="content" id="content" style="width:100%;" class="theEditor" rows="15"><?php if ($selection) { echo wp_richedit_pre(htmlspecialchars_decode($selection)); } if ($url) { echo '<p>'; if ($selection) { _e('via '); } echo "<a href='{$url}'>{$title}</a>.</p>"; } ?> </textarea> </div> </div> </div> </div> </form>
function filter_excerpt_field_content_copy($elements) { if ($elements['post_type'] == 'product') { $elements['excerpt']['editor_type'] = 'editor'; } if ($_POST['excerpt_type'] == 'rich') { $elements['excerpt']['value'] = htmlspecialchars_decode(wp_richedit_pre($elements['excerpt']['value'])); } else { $elements['excerpt']['value'] = htmlspecialchars_decode(wp_htmledit_pre($elements['excerpt']['value'])); } return $elements; }
function create_field($field) { // vars $field['toolbar'] = isset($field['toolbar']) ? $field['toolbar'] : 'full'; $field['media_upload'] = isset($field['media_upload']) ? $field['media_upload'] : 'yes'; $id = 'wysiwyg-' . $field['name']; ?> <div id="wp-<?php echo $id; ?> -wrap" class="acf_wysiwyg wp-editor-wrap" data-toolbar="<?php echo $field['toolbar']; ?> "> <?php if ($field['media_upload'] == 'yes') { ?> <?php if (get_bloginfo('version') < "3.3") { ?> <div id="editor-toolbar"> <div id="media-buttons" class="hide-if-no-js"> <?php do_action('media_buttons'); ?> </div> </div> <?php } else { ?> <div id="wp-<?php echo $id; ?> -editor-tools" class="wp-editor-tools"> <div id="wp-<?php echo $id; ?> -media-buttons" class="hide-if-no-js wp-media-buttons"> <?php do_action('media_buttons'); ?> </div> </div> <?php } ?> <?php } ?> <div id="wp-<?php echo $id; ?> -editor-container" class="wp-editor-container"> <textarea id="<?php echo $id; ?> " class="wp-editor-area" name="<?php echo $field['name']; ?> " ><?php echo wp_richedit_pre($field['value']); ?> </textarea> </div> </div> <?php }
<div> <input type="text" id="newcomment_author_url" name="newcomment_author_url" size="35" value="<?php echo $comment->comment_author_url ?>" tabindex="3" id="URL" /> </div> </fieldset> <fieldset style="clear: both;"> <legend><?php _e('Comment') ?></legend> <?php the_quicktags(); ?> <?php $rows = get_settings('default_post_edit_rows'); if (($rows < 3) || ($rows > 100)) { $rows = 10; } ?> <div><textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content" style="width: 99%"><?php echo user_can_richedit() ? wp_richedit_pre($comment->comment_content) : $comment->comment_content; ?></textarea></div> </fieldset> <script type="text/javascript"> <!-- edCanvas = document.getElementById('content'); <?php if ( user_can_richedit() ) : ?> // This code is meant to allow tabbing from Author URL to Post (TinyMCE). if ( tinyMCE.isMSIE ) document.getElementById('newcomment_author_url').onkeydown = function (e) { e = e ? e : window.event; if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { var i = tinyMCE.selectedInstance; if(typeof i == 'undefined') return true;
} } ?> </select> <span class="spinner"></span> </p> </td> </tr> <tr <?php echo $display_class; ?> > <th>Body</th> <td> <?php $content = isset($notification['body']) ? htmlspecialchars_decode(wp_richedit_pre($notification['body'])) : '[' . __('system-message', 'wpem') . ']'; if (!empty($temp_id)) { $_REQUEST['temp_id'] = $temp_id; } wp_editor($content, 'notification_body', array('wpautop' => false, 'editor_height' => 400, 'dfw' => true, 'drag_drop_upload' => true, 'textarea_name' => 'notification[body]')); ?> </td> </tr> <tr> <td></td><td> <p class="submit"> <input type="submit" name="notification[save]" id="submit" class="button-primary" value="<?php esc_attr_e('Submit'); ?> " />
function create_field($field) { global $q_config, $wp_version; $languages = qtrans_getSortedLanguages(true); $values = qtrans_split($field['value'], $quicktags = true); $currentLanguage = $this->plugin->get_active_language(); echo '<div class="multi-language-field multi-language-field-wysiwyg">'; foreach ($languages as $language) { $class = $language === $currentLanguage ? 'wp-switch-editor current-language' : 'wp-switch-editor'; echo '<a class="' . $class . '" data-language="' . $language . '">' . $q_config['language_name'][$language] . '</a>'; } foreach ($languages as $language) { $value = $values[$language]; $id = 'wysiwyg-' . $field['id'] . '-' . uniqid(); $name = $field['name'] . "[{$language}]"; $class = $language === $currentLanguage ? 'acf_wysiwyg wp-editor-wrap current-language' : 'acf_wysiwyg wp-editor-wrap'; ?> <div id="wp-<?php echo $id; ?> -wrap" class="<?php echo $class; ?> " data-toolbar="<?php echo $field['toolbar']; ?> " data-upload="<?php echo $field['media_upload']; ?> " data-language="<?php echo $language; ?> "> <?php if (user_can_richedit() && $field['media_upload'] == 'yes') { ?> <?php if (version_compare($wp_version, '3.3', '<')) { ?> <div id="editor-toolbar"> <div id="media-buttons" class="hide-if-no-js"> <?php do_action('media_buttons'); ?> </div> </div> <?php } else { ?> <div id="wp-<?php echo $id; ?> -editor-tools" class="wp-editor-tools"> <div id="wp-<?php echo $id; ?> -media-buttons" class="hide-if-no-js wp-media-buttons"> <?php do_action('media_buttons'); ?> </div> </div> <?php } ?> <?php } ?> <div id="wp-<?php echo $id; ?> -editor-container" class="wp-editor-container"> <textarea id="<?php echo $id; ?> " class="qtx-wp-editor-area" name="<?php echo $name; ?> " ><?php if (user_can_richedit()) { echo wp_richedit_pre($field['value']); } else { echo wp_htmledit_pre($field['value']); } ?> </textarea> </div> </div> <?php } echo '</div>'; }
<?php while ($mb->have_fields_and_multi('panel')) { ?> <?php $mb->the_group_open(); ?> <label>Panel</label> <?php $mb->the_field('panel'); ?> <div class="customEditor"><textarea name="<?php $mb->the_name(); ?> "><?php echo wp_richedit_pre($mb->get_the_value()); ?> </textarea></div> <a href="#" class="dodelete button clear">- remove</a> <?php $mb->the_group_close(); ?> <?php } ?> <div class="clear"></div> </div> <a id="add-panel" href="#" class="docopy-panel button">Add +</a> <br/><br/>
function create_field($field) { global $wp_version; // vars $id = 'wysiwyg-' . $field['id'] . '-' . uniqid(); ?> <div id="wp-<?php echo $id; ?> -wrap" class="acf_wysiwyg wp-editor-wrap" data-toolbar="<?php echo $field['toolbar']; ?> " data-upload="<?php echo $field['media_upload']; ?> "> <?php if (user_can_richedit() && $field['media_upload'] == 'yes') { ?> <?php if (version_compare($wp_version, '3.3', '<')) { ?> <div id="editor-toolbar"> <div id="media-buttons" class="hide-if-no-js"> <?php do_action('media_buttons'); ?> </div> </div> <?php } else { ?> <div id="wp-<?php echo $id; ?> -editor-tools" class="wp-editor-tools"> <div id="wp-<?php echo $id; ?> -media-buttons" class="hide-if-no-js wp-media-buttons"> <?php do_action('media_buttons'); ?> </div> </div> <?php } ?> <?php } ?> <div id="wp-<?php echo $id; ?> -editor-container" class="wp-editor-container"> <textarea id="<?php echo $id; ?> " class="wp-editor-area" name="<?php echo $field['name']; ?> "><?php if (user_can_richedit()) { echo wp_richedit_pre($field['value']); } else { echo wp_htmledit_pre($field['value']); } ?> </textarea> </div> </div> <?php }
function format_value_for_input($value, $field = null) { if (version_compare(get_bloginfo('version'), '4.3', '>=')) { return format_for_editor($value); } else { return wp_richedit_pre($value); } }
function filter_excerpt_field_content_copy($elements) { if ($elements['post_type'] == 'product') { $elements['excerpt']['editor_type'] = 'editor'; } if (function_exists('format_for_editor')) { // WordPress 4.3 uses format_for_editor $elements['excerpt']['value'] = htmlspecialchars_decode(format_for_editor($elements['excerpt']['value'], $_POST['excerpt_type'])); } else { // Backwards compatible for WordPress < 4.3 if ($_POST['excerpt_type'] == 'rich') { $elements['excerpt']['value'] = htmlspecialchars_decode(wp_richedit_pre($elements['excerpt']['value'])); } else { $elements['excerpt']['value'] = htmlspecialchars_decode(wp_htmledit_pre($elements['excerpt']['value'])); } } return $elements; }
<?php if (!$is_compact) { echo VP_View::instance()->load('control/template_control_head', $head_info); } ?> <?php // prepare value for tinyMCE editor $value = html_entity_decode($value, ENT_COMPAT, 'UTF-8'); if (has_filter('the_editor_content')) { $value = apply_filters('the_editor_content', $value); } else { $value = wp_richedit_pre($value); } ?> <div class="customEditor"> <div class="wp-editor-tools"> <div class="custom_upload_buttons hide-if-no-js wp-media-buttons"><?php do_action('media_buttons'); ?> </div> </div> <textarea class="vp-input vp-js-wpeditor" id="<?php echo $name . '_ce'; ?> " data-vp-opt="<?php echo $opt; ?> " rows="10" cols="50" name="<?php echo $name;
</li> <?php if ( user_can_richedit() ) { ?> <li id="switcher"> <?php wp_print_scripts( 'quicktags' ); ?> <?php add_filter('the_editor_content', 'wp_richedit_pre'); ?> <a id="edButtonHTML" onclick="switchEditors.go('content', 'html');"><?php _e('HTML'); ?></a> <a id="edButtonPreview" class="active" onclick="switchEditors.go('content', 'tinymce');"><?php _e('Visual'); ?></a> <div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('content')" /></div> </li> <?php } ?> </ul> <div id="quicktags"></div> <div class="editor-container"> <textarea name="content" id="content" style="width:100%;" class="theEditor" rows="15"><?php if ( $selection ) echo wp_richedit_pre($selection); if ( $url ) { echo '<p>'; if ( $selection ) _e('via '); printf( "<a href='%s'>%s</a>.</p>", esc_url( $url ), esc_html( $title ) ); } ?></textarea> </div> </div> </div> </div> </form> <?php do_action('admin_print_footer_scripts'); ?> <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script> </body>
/** * Retrieve saved campaign data to populate fields. * * @since Astoundify Crowdfunding 1.7 * * @param $key The key of the current field. * @param $atts The shortcoe attribtues. * @return $data The correct form value for the field. */ private function saved_data($key, $campaign) { switch ($key) { case 'title': $data = $campaign->data->post_title; break; case 'length': $data = $campaign->days_remaining(); break; case 'description': $data = wp_richedit_pre($campaign->data->post_content); break; case 'excerpt': $data = apply_filters('get_the_excerpt', $campaign->data->post_excerpt); break; case 'updates': $data = wp_richedit_pre($campaign->updates()); break; case 'norewards': $data = $campaign->is_donations_only(); break; case 'rewards': $data = edd_get_variable_prices($campaign->ID); break; case 'physical': $data = $campaign->needs_shipping(); break; case 'goal': $data = edd_format_amount($campaign->goal(false)); break; case 'tos': $data = 1; break; case 'organization': $data = $campaign->__get('campaign_author'); break; default: $data = apply_filters('atcf_shortcode_submit_saved_data_' . $key, null, $key, $campaign); break; } if (!$data && method_exists($campaign, $key)) { $data = $campaign->{$key}(); } return $data; }