本文整理汇总了PHP中_WP_Editors::editor_js方法的典型用法代码示例。如果您正苦于以下问题:PHP _WP_Editors::editor_js方法的具体用法?PHP _WP_Editors::editor_js怎么用?PHP _WP_Editors::editor_js使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_WP_Editors
的用法示例。
在下文中一共展示了_WP_Editors::editor_js方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bbconnect_get_post_to_edit
//.........这里部分代码省略.........
$post_type = false;
$post_type = $_POST['data'];
if (false == $post_type) {
echo '';
die;
}
}
$post = get_default_post_to_edit($post_type, true);
$post_author = $_POST['uid'];
$action = $_POST['actung'];
}
// SET THE NONCE
if ('user' == $type) {
bbconnect_user_actions_nonce_field();
} else {
bbconnect_post_actions_nonce_field();
}
$post_fields = array(array('meta' => array('source' => 'wpr', 'meta_key' => 'post_title', 'name' => __('Title', 'bbconnect'), 'help' => '', 'options' => array('field_type' => 'text', 'req' => true, 'public' => false, 'choices' => false))), array('meta' => array('source' => 'wpr', 'meta_key' => 'post_date', 'name' => __('Date', 'bbconnect'), 'help' => '', 'options' => array('field_type' => 'date', 'req' => true, 'public' => false, 'choices' => false))));
if ('user' == $type) {
if (!empty($parent_term)) {
// Editing existing note
$post_fields[] = array('post_val' => $parent_term->slug, 'meta' => array('source' => 'tax', 'meta_key' => 'bb_note_type_parent', 'name' => __('Type', 'bbconnect'), 'help' => '', 'options' => array('field_type' => 'select', 'req' => true, 'public' => true, 'choices' => array($parent_term->slug => $parent_term->name))));
$post_fields[] = array('post_val' => $child_term->slug, 'meta' => array('source' => 'tax', 'meta_key' => 'bb_note_type', 'name' => __('', 'bbconnect'), 'help' => '', 'options' => array('field_type' => 'select', 'req' => false, 'public' => true, 'choices' => array($child_term->slug => $child_term->name))));
} else {
// New note
$parent_term = get_term_by('slug', $_POST['data'], 'bb_note_type');
$terms = get_terms('bb_note_type', array('hide_empty' => false, 'parent' => $parent_term->term_id));
$choices = array();
foreach ($terms as $term) {
$choices[$term->slug] = $term->name;
}
$post_fields[] = array('meta' => array('source' => 'tax', 'meta_key' => 'bb_note_type', 'name' => __('Type', 'bbconnect'), 'help' => '', 'options' => array('field_type' => 'select', 'req' => true, 'public' => false, 'choices' => $choices)));
$post_fields[] = array('meta' => array('source' => 'tax', 'meta_key' => 'bb_note_type_parent', 'name' => __('', 'bbconnect'), 'help' => '', 'options' => array('field_type' => 'hidden', 'req' => false, 'public' => false, 'choices' => $parent_term->slug)));
}
}
foreach ($post_fields as $field) {
$meta_key = $field['meta']['meta_key'];
$field['type'] = 'post';
$field['action'] = $action;
$field['id'] = $post->ID;
$field['swap_name'] = $meta_key;
if (isset($post->{$meta_key})) {
$field['post_val'] = $post->{$meta_key};
}
echo '<p><ul style="display: block; float: none;">';
bbconnect_get_field($field);
echo '</ul></p>';
}
if ('bulk-edit' == $action) {
echo '<ul><li class="meta-item"><span class="bbconnect-label">';
echo '<a class="rui off" title="' . $cid . 'bulk-edit">Enable Text</a>';
echo '</span><span class="bbconnect-field">';
}
echo '<div style="width: 90%;padding: .3em;margin: .2em 0;"> </div>';
//echo '<p>'. __( 'Title', 'bbconnect' ) .'<br /><input type="text" name="post_title" class="regular-text" value="'.$post->post_title.'" /></p>';
//echo '<p>'. __( 'Date', 'bbconnect' ) .'<br /><input type="text" class="bbconnect-date" name="post_date" class="regular-text" value="'.$post->post_date.'" /></p>';
if (preg_match('/Firefox/i', $_SERVER['HTTP_USER_AGENT'])) {
wp_editor(stripslashes($post->post_content), $cid, array('tinymce' => false, 'textarea_name' => 'post_content', 'teeny' => true, 'quicktags' => true));
} else {
wp_editor(stripslashes($post->post_content), $cid, array('tinymce' => true, 'textarea_name' => 'post_content', 'teeny' => false, 'quicktags' => true));
}
if ('bulk-edit' == $action) {
echo '</span></li></ul>';
}
// SET THE META
if ('user' == $type) {
bbconnect_user_actions_meta_fields(array('post_id' => $post->ID, 'fields' => bbconnect_get_user_actions_meta(), 'action' => $action, 'post_val' => $post_val));
} else {
bbconnect_post_actions_meta_fields(array('post_id' => $post->ID, 'fields' => bbconnect_get_post_actions_meta(), 'action' => $action, 'post_val' => $post_val));
}
?>
<input type="hidden" name="post_ID" value="<?php
echo $post->ID;
?>
" />
<input type="hidden" name="post_status" value="publish" />
<input type="hidden" name="post_author" value="<?php
echo $post_author;
?>
" />
<input type="hidden" name="post_type" value="<?php
echo $post_type;
?>
" />
<?php
$inline_button = apply_filters('bbconnect_inline_do_action_button', array('<input type="submit" class="bbconnect-actions-save button-primary ' . $type . '" name="save" value="' . __('Save', 'bbconnect') . '" />'), $post_type, $type, $action);
echo '<div class="tright">';
echo implode(' ', $inline_button);
echo '</div>';
} else {
echo 'error';
}
if ('3.9' <= get_bloginfo('version')) {
_WP_Editors::enqueue_scripts();
//print_footer_scripts();
_WP_Editors::editor_js();
echo '<script src="' . admin_url('js/editor.js') . '" />';
}
die;
}
示例2:
}
?>
<?php
}
?>
</td>
<?php
}
?>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<?php
if (!$woocommerce_wpml->settings['first_editor_call']) {
//load editor js
if (class_exists('_WP_Editors')) {
_WP_Editors::editor_js();
}
$woocommerce_wpml->settings['first_editor_call'] = true;
$woocommerce_wpml->update_settings();
}
?>
</td>
</tr>
示例3: hrm_tinymce
function hrm_tinymce($element)
{
if (!isset($element['content']) || !isset($element['editor_id'])) {
return;
}
if (empty($element['editor_id'])) {
return;
}
ob_start();
$settings = isset($element['settings']) && is_array($element['settings']) ? $element['settings'] : array();
$id = isset($element['id']) ? esc_attr($element['id']) : '';
$desc = isset($element['desc']) ? esc_attr($element['desc']) : '';
$wrap_class = isset($element['wrap_class']) ? $element['wrap_class'] : '';
$wrap_tag = isset($element['wrap_tag']) ? $element['wrap_tag'] : 'div';
$extra = isset($element['extra']) ? $element['extra'] : array();
$required = isset($extra['data-hrm_required']) && $extra['data-hrm_required'] === true ? '*' : '';
$label = isset($element['label']) ? esc_attr($element['label']) : '';
echo $this->multiple_field_inside_this_wrap($element);
printf('<%1$s class="hrm-form-field %2$s">', $wrap_tag, $wrap_class);
printf('<%1$s class="hrm-form-field %2$s">', $wrap_tag, $wrap_class);
printf('<label for="%1s">%2s<em>%3s</em></label>', $id, $label, $required);
wp_editor($element['content'], $element['editor_id'], $settings);
printf('<span class="hrm-clear"></span><span class="description">%s</span>', $desc);
printf('</%s>', $wrap_tag);
echo $this->multiple_field_inside_this_wrap_close($element);
_WP_Editors::editor_js();
return ob_get_clean();
}
示例4: wp_editors
function wp_editors()
{
if (function_exists('wp_editor')) {
$init_str = '';
ob_start();
_WP_Editors::editor_js();
$js = ob_get_contents();
ob_end_clean();
$js = explode('tinyMCEPreInit = {', $js);
if (count($js) > 0) {
$js[1] = explode('};', $js[1]);
if (count($js[1]) > 0) {
if (preg_match('/mceInit\\s*:(.*?),\\s*qtInit/is', $js[1][0], $matches)) {
$init_str = $matches[1];
$js[1][0] = preg_replace('/mceInit\\s*:(.*?),\\s*qtInit/is', 'qtInit', $js[1][0]);
}
}
$js[1] = implode('};', $js[1]);
}
if ($init_str != '') {
echo '
<script type="text/javascript">
var OP_tinyMCE = ' . $init_str . ';
</script>';
}
$js = implode('tinyMCEPreInit = {', $js);
echo $js;
}
}
示例5: add_form_item
//.........这里部分代码省略.........
$id = $this->generate_field_id($id);
$item_inline_style = $inline_style ? 'style="' . $inline_style . '"' : '';
$output = '';
if (is_array($this->options['hidden_items']) && in_array($item_id, $this->options['hidden_items'])) {
return;
}
switch ($type) {
case 'submit':
// $output .= '<input ' . $item_inline_style . ' class="' . $class . ' '.$this->options['class']['submit'].'" id="' . $id . '" name="' . $name . '" type="'.$type.'" value="' . esc_html( $value ) . '" >';
$type .= ' ' . $class;
$item_inline_style .= ' id=' . $id;
$output .= get_submit_button($value, $type, $name, false, $item_inline_style);
break;
case 'reset':
$output .= '<input ' . $item_inline_style . ' class="' . $class . ' ' . $this->options['class']['submit'] . '" id="' . $id . '" name="' . $name . '" type="reset" value="' . esc_html($value) . '" >';
break;
case 'text':
$ui_text = new UI_Text(array('id' => $id, 'name' => $name, 'value' => $value, 'placeholder' => $placeholder, 'class' => $class));
$output .= $ui_text->render();
break;
case 'textarea':
$ui_textarea = new UI_Textarea(array('id' => $id, 'name' => $name, 'value' => $value, 'placeholder' => $placeholder, 'class' => $class));
$output .= $ui_textarea->render();
break;
case 'select':
$ui_select = new UI_Select(array('id' => $id, 'name' => $name, 'multiple' => $multiple, 'value' => $value, 'options' => $options, 'class' => $class));
$output .= $ui_select->render();
break;
case 'checkbox':
$ui_checkbox = new UI_Checkbox(array('id' => $id, 'name' => $name, 'value' => $value, 'options' => $options, 'class' => $class));
$output .= $ui_checkbox->render();
break;
case 'radio':
$ui_radio = new UI_Radio(array('id' => $id, 'name' => $name, 'value' => $value, 'options' => $options, 'class' => $class));
$output .= $ui_radio->render();
break;
case 'switcher':
$ui_switcher = new UI_Switcher(array('id' => $id, 'name' => $name, 'value' => $value, 'toggle' => $toggle, 'class' => $class));
$output .= $ui_switcher->render();
break;
case 'stepper':
$ui_stepper = new UI_Stepper(array('id' => $id, 'name' => $name, 'value' => $value, 'max_value' => $max_value, 'min_value' => $min_value, 'step_value' => $step_value, 'class' => $class));
$output .= $ui_stepper->render();
break;
case 'slider':
$ui_slider = new UI_Slider(array('id' => $id, 'name' => $name, 'value' => $value, 'max_value' => $max_value, 'min_value' => $min_value, 'step_value' => $step_value, 'class' => $class));
$output .= $ui_slider->render();
break;
case 'rangeslider':
$ui_range_slider = new UI_Range_Slider(array('id' => $id, 'name' => $name, 'value' => $value, 'max_value' => $max_value, 'min_value' => $min_value, 'step_value' => $step_value, 'class' => $class));
$output .= $ui_range_slider->render();
break;
case 'colorpicker':
$ui_colorpicker = new UI_Colorpicker(array('id' => $id, 'name' => $name, 'value' => $value, 'class' => $class));
$output .= $ui_colorpicker->render();
break;
case 'media':
$ui_media = new UI_Media(array('id' => $id, 'name' => $name, 'value' => $value, 'multi_upload' => $multi_upload, 'library_type' => $library_type, 'class' => $class));
$output .= $ui_media->render();
break;
case 'background':
$ui_background = new UI_Background(array('id' => $id, 'name' => $name, 'value' => $value, 'multi_upload' => $multi_upload, 'library_type' => $library_type, 'class' => $class));
$output .= $ui_background->render();
break;
case 'typography':
$ui_typography = new UI_Typography(array('id' => $id, 'name' => $name, 'value' => $value, 'class' => $class));
$output .= $ui_typography->render();
break;
case 'ace-editor':
$ui_ace_editor = new UI_Ace_Editor(array('id' => $id, 'name' => $name, 'value' => $value, 'class' => $class));
$output .= $ui_ace_editor->render();
break;
case 'repeater':
$ui_repeater = new UI_Repeater(array('id' => $id, 'name' => $name, 'value' => $value, 'class' => $class));
$output .= $ui_repeater->render();
break;
case 'static_area_editor':
$ui_statics = new UI_Static_Area_Editor(array('id' => $id, 'name' => $name, 'value' => $value, 'options' => $options, 'class' => $class));
$output .= $ui_statics->render();
break;
case 'layouteditor':
$ui_layout_editor = new UI_Layout_Editor(array('id' => $id, 'name' => $name, 'value' => $value, 'class' => $class));
$output .= $ui_layout_editor->render();
break;
case 'editor':
//$wrap = false;
ob_start();
$settings = array('textarea_name' => $name, 'media_buttons' => 1, 'teeny' => 0, 'textarea_rows' => 10, 'tinymce' => array('setup' => 'function(ed) {
ed.onChange.add(function(ed) {
tinyMCE.triggerSave();
});
}'));
wp_editor($value, $id, $settings);
$output .= ob_get_clean();
_WP_Editors::editor_js();
_WP_Editors::enqueue_scripts();
break;
}
return $this->wrap_item($output, $id, 'cherry-section cherry-' . $type . ' ' . $this->options['class']['section'], $title, $label, $description, $hint);
}
示例6: enqueue_controls_css
function enqueue_controls_css()
{
include_once ReduxFramework::$_dir . 'core/enqueue.php';
$enqueue = new reduxCoreEnqueue($this->parent);
$enqueue->get_warnings_and_errors_array();
$enqueue->init();
wp_enqueue_style('redux-extension-advanced-customizer', $this->_extension_url . 'extension_advanced_customizer.css');
wp_enqueue_script('redux-extension-advanced-customizer', $this->_extension_url . 'extension_advanced_customizer.js', array('jquery'), ReduxFramework_extension_advanced_customizer::$version . '4', true);
require_once ABSPATH . '/wp-includes/class-wp-editor.php';
_WP_Editors::enqueue_scripts();
_WP_Editors::editor_js();
}
示例7: _action_print_wp_editor
/**
* @internal
**/
public function _action_print_wp_editor()
{
if (!class_exists('_WP_Editors')) {
require ABSPATH . WPINC . '/class-wp-editor.php';
$id = 'fw-wp-editor-option-type';
$set = _WP_Editors::parse_settings($id, array('teeny' => true, 'media_buttons' => true, 'tinymce' => true, 'editor_css' => true, 'quicktags' => true));
_WP_Editors::editor_settings($id, $set);
_WP_Editors::enqueue_scripts();
_WP_Editors::editor_js();
}
}
示例8: rad_query_listener
/**
* Query Maker Engine
*/
function rad_query_listener()
{
global $post, $super_options, $helper, $ioa_meta_data;
$type = $_REQUEST["type"];
if ($type == "rad-live-save") {
if (!isset($_POST['data'])) {
return 0;
}
$post_ID = $_POST['id'];
$the_post = array('ID' => $post_ID, 'post_content' => $_POST['data']);
// Update the post into the database
wp_update_post($the_post);
$ioa_options = get_post_meta($post_ID, 'ioa_options', true);
$ioa_options['ioa_template_mode'] = 'rad-builder';
update_post_meta($post_ID, 'ioa_options', $ioa_options);
update_post_meta($post_ID, '_style_keys', $_POST['styles']);
update_post_meta($post_ID, 'rad_version', RAD_Version);
echo 1;
} elseif ($type == 'rad-live-preview') {
global $radunits, $helper;
$widget = array();
$widget['data'] = $_POST['data'];
$widget['id'] = $_POST['id'];
$widget['type'] = $_POST['key'];
$widget['layout'] = 'full';
$widget['data']['id'] = $_POST['id'];
$widget['data']['type'] = $_POST['key'];
if (isset($widget['data']['inputs'])) {
$widget['data'] = $widget['data']['inputs'];
}
$widget['data'] = $helper->getAssocMap($widget['data'], 'value');
$ioa_meta_data['widget'] = $widget;
$ioa_meta_data['widget_classes'] = ' w_layout_element ';
$ioa_meta_data['widget_classes'] .= ' w_full ';
$ioa_meta_data['rad_type'] = $widget['type'];
get_template_part("templates/rad/" . $radunits[str_replace('-', '_', $widget['type'])]->data['template']);
} elseif ($type == "rad-builder-data") {
global $radunits, $post, $ioa_portfolio_slug;
$settings = array();
foreach ($radunits as $key => $widget) {
if ($widget->getCommonKey() != "") {
$settings[$widget->getCommonKey()] = $widget->mapSettingsOverlay();
} else {
$settings[$key] = $widget->mapSettingsOverlay();
}
}
array_unique($settings);
foreach ($settings as $key => $setting) {
echo $setting;
}
} elseif ($type == "rad_wp_editor") {
$settings = array('wpautop' => true, 'media_buttons' => true, 'textarea_name' => 'rad_wp_editor', 'textarea_rows' => 15, 'textarea_columns' => 4, 'tinymce' => array('theme_advanced_buttons1' => 'bold,italic,underline,blockquote,|,bullist ,numlist , link,unlink, ioabutton', 'theme_advanced_buttons2' => '', 'theme_advanced_buttons3' => '', 'theme_advanced_buttons4' => '', 'content_css' => get_stylesheet_directory_uri() . '/sprites/stylesheets/custom-editor-style.css'), 'tabindex' => '', 'editor_class' => " rad-editor", 'teeny' => false, 'dfw' => false, 'quicktags' => true);
wp_editor('', 'rad_wp_editor', $settings);
if (!class_exists('_WP_Editors')) {
require ABSPATH . WPINC . '/class-wp-editor.php';
}
_WP_Editors::editor_js();
} elseif ($type == "RAD") {
$data = array();
if (isset($_POST['data'])) {
$data = $_POST['data'];
}
echo update_post_meta($_POST['id'], 'rad_data', $data);
} elseif ($type == "RAD-Template-Export") {
$tdata = array();
if (isset($_POST['data'])) {
$tdata = $_POST['data'];
}
$title = 'Page_Template';
if (isset($_POST['title'])) {
$title = str_replace(' ', '_', $_POST['title']);
}
echo set_transient('TEMP_RAD_TEMPLATE', $tdata, 60 * 60);
echo set_transient('TEMP_RAD_TEMPLATE_TITLE', $title, 60 * 60);
} elseif ($type == "RAD-Template") {
$data = array();
if (get_option('RAD_TEMPLATES')) {
$data = get_option('RAD_TEMPLATES');
}
$tdata = array();
if (isset($_POST['data'])) {
$tdata = $_POST['data'];
}
$title = $_POST['title'];
$id = 'RT' . uniqid();
$data[$id] = array('post_id' => $_POST['id'], 'data' => $tdata, 'title' => $title);
update_option('RAD_TEMPLATES', $data);
} elseif ($type == "RAD-Template-Section") {
$data = array();
if (get_option('RAD_TEMPLATES_SECTION')) {
$data = get_option('RAD_TEMPLATES_SECTION');
}
$tdata = array();
if (isset($_POST['data'])) {
$tdata = $_POST['data'];
}
$title = $_POST['title'];
//.........这里部分代码省略.........
示例9: admin_print_footer_scripts
function admin_print_footer_scripts()
{
if (!$this->is_valid($this->current_source)) {
return false;
}
if (!class_exists('_WP_Editors')) {
require ABSPATH . WPINC . '/class-wp-editor.php';
}
/**
* TODO: Make this not so hacky :)
*
* To get things setup so we can actually have TinyMCE loaded for use in the
* individual slide source editors, we need to get TinyMCE loaded on the page first.
* Unfortunately TinyMCE is not a registered script for WordPress yet, so its
* not as easy as using wp_enqueue_script() to get it in there. TinyMCE is however
* hard coded for output with the wp_editor() script. All we need to do is run it
* once to get it scheduled for loading and the _WP_Editors class takes care of
* the rest to get it loaded when we actually call the _WP_Editors::editor_js()
*/
ob_start();
wp_editor("", $this->namespace, apply_filters("{$this->namespace}_wp_editor_settings", $this->wp_editor_settings));
ob_end_clean();
_WP_Editors::editor_js();
}
示例10: test_init_options
/**
* This feature is deprecated, but we still try to support it.
*/
public function test_init_options()
{
$value = rand_str();
$value_2 = rand_str();
$css_url = 'http://example.org/' . rand_str() . '.css';
$css_url_2 = 'http://example.org/' . rand_str() . '.css';
$fm = new Fieldmanager_RichTextArea(array('name' => 'test_richtextarea', 'init_options' => array('fm_test' => $value, 'content_css' => $css_url)));
ob_start();
$fm->add_meta_box('Test RichTextArea', 'post')->render_meta_box($this->post, array());
ob_end_clean();
ob_start();
_WP_Editors::editor_js();
$js = ob_get_clean();
$this->assertContains('fm_test:"' . $value . '"', $js);
$this->assertContains($css_url, $js);
// Now test that `editor_settings` and `stylesheet` take precedence
$fm = new Fieldmanager_RichTextArea(array('name' => 'test_richtextarea', 'init_options' => array('fm_test' => $value, 'content_css' => $css_url), 'stylesheet' => $css_url_2, 'editor_settings' => array('tinymce' => array('fm_test' => $value_2))));
ob_start();
$fm->add_meta_box('Test RichTextArea', 'post')->render_meta_box($this->post, array());
ob_end_clean();
ob_start();
_WP_Editors::editor_js();
$js = ob_get_clean();
$this->assertNotContains('fm_test:"' . $value . '"', $js);
$this->assertNotContains($css_url, $js);
$this->assertContains('fm_test:"' . $value_2 . '"', $js);
$this->assertContains($css_url_2, $js);
}