当前位置: 首页>>代码示例>>PHP>>正文


PHP wp_default_editor函数代码示例

本文整理汇总了PHP中wp_default_editor函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_default_editor函数的具体用法?PHP wp_default_editor怎么用?PHP wp_default_editor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wp_default_editor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: substr

    ?>
		<h3 class="handle"><?php 
    echo $mb->get_the_value() ? substr(strip_tags(html_entity_decode($mb->get_the_value())), 0, 30) : 'Textarea Content';
    ?>
</h3>
		
		<div class="group-inside">
		
			<p class="warning update-warning"><?php 
    _e('Sort order has been changed.  Remember to save the post to save these changes.');
    ?>
</p>
	
			<?php 
    // 'html' is used for the "Text" editor tab.
    if ('html' === wp_default_editor()) {
        add_filter('the_editor_content', 'wp_htmledit_pre');
        $switch_class = 'html-active';
    } else {
        add_filter('the_editor_content', 'wp_richedit_pre');
        $switch_class = 'tmce-active';
    }
    ?>

			<div class="customEditor wp-core-ui wp-editor-wrap <?php 
    echo 'tmce-active';
    //echo $switch_class;
    ?>
">
				
				<div class="wp-editor-tools hide-if-no-js">
开发者ID:logiscg89,项目名称:WP-Alchemy-Holy-Grail-Theme,代码行数:31,代码来源:repeating-textarea.php

示例2: motopressCEAddCEBtn


//.........这里部分代码省略.........
                                    if (!pluginAutoSaved){
                                        sessionStorage.setItem('motopressPluginAutoOpen', true);
                                        sessionStorage.setItem('motopressPluginAutoSaved', true);
                                        window.onbeforeunload = null;
                                        $(window).off( 'beforeunload.edit-post' );
                                        jQuery('form#post').submit();
                                        return false;
                                    }
                                }
                            <?php 
            }
            ?>
                            sessionStorage.setItem('motopressPluginAutoSaved', false);

                            if (typeof CE === 'undefined') {
                                var head = $('head')[0];
                                var stealVerScript = $('<script />', {
                                    text: 'var steal = { production: "mp/ce/production.js" + motopress.pluginVersionParam };'
                                })[0];
                                head.appendChild(stealVerScript);
                                var script = $('<script />', {
                                    src: '<?php 
            echo $motopressCESettings["plugin_root_url"];
            ?>
' + '/' + '<?php 
            echo $motopressCESettings["plugin_name"];
            ?>
' + '/steal/steal.production.js?mp/ce'
                                })[0];
                                head.appendChild(script);
                            }
                        });

                        function mpceOnEditorInit() {
                            motopressCEButton.removeAttr('disabled');
                            if (pluginAutoOpen) {
                                sessionStorage.setItem('motopressPluginAutoOpen', false);
                                motopressCEButton.click();
                            }
                        }

                        var editorState = "<?php 
            echo wp_default_editor();
            ?>
";
                        var pluginAutoOpen = sessionStorage.getItem('motopressPluginAutoOpen');
                        var paramPluginAutoOpen = ('<?php 
            if (isset($_GET['motopress-ce-auto-open']) && $_GET['motopress-ce-auto-open']) {
                echo $_GET['motopress-ce-auto-open'];
            }
            ?>
' === 'true') ? true : false; //fix different site (WordPress Address) and home (Site Address) url for sessionStorage
                        pluginAutoOpen = ((pluginAutoOpen && pluginAutoOpen === 'true') || paramPluginAutoOpen) ? true : false;
                        if (pluginAutoOpen) preloader.show();

                        if (typeof tinyMCE !== 'undefined' && editorState === 'tinymce') {
                            if (tinyMCE.majorVersion === '4') {
                                tinyMCE.on('AddEditor', function(args){
                                    if(args.editor.id === 'content'){
                                        args.editor.on('init', function(ed){
                                            mpceOnEditorInit();
                                        });
                                    }
                                });
                            } else {
                                tinyMCE.onAddEditor.add(function(mce, ed) {
                                    if (ed.editorId === 'content') {
                                        ed.onInit.add(function(ed) {
                                            mpceOnEditorInit();
                                        });
                                    }
                                });
                            }
                        } else {
                            mpceOnEditorInit();
                        }
                    <?php 
        } else {
            add_action('admin_notices', 'motopressCEIsjQueryVerNotice');
        }
        // endif jquery version check
    } else {
        add_action('admin_notices', 'motopressCEIsMBStringEnabledNotice');
    }
    ?>
            }
        });
    </script>
    <?php 
    $isHideNativeEditor = apply_filters('mpce_hide_native_editor', false);
    if ($isHideNativeEditor) {
        ?>
    <style type="text/css">
        #postdivrich{
            display: none;
        }
    </style>
    <?php 
    }
}
开发者ID:vova95,项目名称:motoWidget,代码行数:101,代码来源:contentEditor.php

示例3: editor

 /**
  * Outputs the HTML for a single instance of the editor.
  *
  * @static
  * @param string $content The initial content of the editor.
  * @param string $editor_id ID for the textarea and TinyMCE and Quicktags instances (can contain only ASCII letters and numbers).
  * @param array $settings See the _parse_settings() method for description.
  */
 public static function editor($content, $editor_id, $settings = array())
 {
     $set = self::parse_settings($editor_id, $settings);
     $editor_class = ' class="' . trim(esc_attr($set['editor_class']) . ' wp-editor-area') . '"';
     $tabindex = $set['tabindex'] ? ' tabindex="' . (int) $set['tabindex'] . '"' : '';
     $default_editor = 'html';
     $buttons = $autocomplete = '';
     $editor_id_attr = esc_attr($editor_id);
     if ($set['drag_drop_upload']) {
         self::$drag_drop_upload = true;
     }
     if (!empty($set['editor_height'])) {
         $height = ' style="height: ' . (int) $set['editor_height'] . 'px"';
     } else {
         $height = ' rows="' . (int) $set['textarea_rows'] . '"';
     }
     if (!current_user_can('upload_files')) {
         $set['media_buttons'] = false;
     }
     if (self::$this_tinymce) {
         $autocomplete = ' autocomplete="off"';
         if (self::$this_quicktags) {
             $default_editor = $set['default_editor'] ? $set['default_editor'] : wp_default_editor();
             // 'html' is used for the "Text" editor tab.
             if ('html' !== $default_editor) {
                 $default_editor = 'tinymce';
             }
             $buttons .= '<button type="button" id="' . $editor_id_attr . '-tmce" class="wp-switch-editor switch-tmce"' . ' data-wp-editor-id="' . $editor_id_attr . '">' . __('Visual') . "</button>\n";
             $buttons .= '<button type="button" id="' . $editor_id_attr . '-html" class="wp-switch-editor switch-html"' . ' data-wp-editor-id="' . $editor_id_attr . '">' . _x('Text', 'Name for the Text editor tab (formerly HTML)') . "</button>\n";
         } else {
             $default_editor = 'tinymce';
         }
     }
     $switch_class = 'html' === $default_editor ? 'html-active' : 'tmce-active';
     $wrap_class = 'wp-core-ui wp-editor-wrap ' . $switch_class;
     if ($set['_content_editor_dfw']) {
         $wrap_class .= ' has-dfw';
     }
     echo '<div id="wp-' . $editor_id_attr . '-wrap" class="' . $wrap_class . '">';
     if (self::$editor_buttons_css) {
         wp_print_styles('editor-buttons');
         self::$editor_buttons_css = false;
     }
     if (!empty($set['editor_css'])) {
         echo $set['editor_css'] . "\n";
     }
     if (!empty($buttons) || $set['media_buttons']) {
         echo '<div id="wp-' . $editor_id_attr . '-editor-tools" class="wp-editor-tools hide-if-no-js">';
         if ($set['media_buttons']) {
             self::$has_medialib = true;
             if (!function_exists('media_buttons')) {
                 include ABSPATH . 'wp-admin/includes/media.php';
             }
             echo '<div id="wp-' . $editor_id_attr . '-media-buttons" class="wp-media-buttons">';
             /**
              * Fires after the default media button(s) are displayed.
              *
              * @since 2.5.0
              *
              * @param string $editor_id Unique editor identifier, e.g. 'content'.
              */
             do_action('media_buttons', $editor_id);
             echo "</div>\n";
         }
         echo '<div class="wp-editor-tabs">' . $buttons . "</div>\n";
         echo "</div>\n";
     }
     $quicktags_toolbar = '';
     if (self::$this_quicktags) {
         if ('content' === $editor_id && !empty($GLOBALS['current_screen']) && $GLOBALS['current_screen']->base === 'post') {
             $toolbar_id = 'ed_toolbar';
         } else {
             $toolbar_id = 'qt_' . $editor_id_attr . '_toolbar';
         }
         $quicktags_toolbar = '<div id="' . $toolbar_id . '" class="quicktags-toolbar"></div>';
     }
     /**
      * Filters the HTML markup output that displays the editor.
      *
      * @since 2.1.0
      *
      * @param string $output Editor's HTML markup.
      */
     $the_editor = apply_filters('the_editor', '<div id="wp-' . $editor_id_attr . '-editor-container" class="wp-editor-container">' . $quicktags_toolbar . '<textarea' . $editor_class . $height . $tabindex . $autocomplete . ' cols="40" name="' . esc_attr($set['textarea_name']) . '" ' . 'id="' . $editor_id_attr . '">%s</textarea></div>');
     // Prepare the content for the Visual or Text editor, only when TinyMCE is used (back-compat).
     if (self::$this_tinymce) {
         add_filter('the_editor_content', 'format_for_editor', 10, 2);
     }
     /**
      * Filters the default editor content.
      *
      * @since 2.1.0
//.........这里部分代码省略.........
开发者ID:BoldGrid,项目名称:WordPress,代码行数:101,代码来源:class-wp-editor.php

示例4: editor

 function editor($content, $editor_id, $settings = array(), $media_buttons = true)
 {
     if (function_exists('wp_editor')) {
         $settings['media_buttons'] = $media_buttons;
         wp_editor($content, $editor_id, $settings);
         return;
     }
     $this->editor_ids[] = $editor_id;
     $set = wp_parse_args($settings, array('wpautop' => true, 'wp_buttons_css' => PODS_URL . '/ui/wp-editor/editor-buttons.css', 'editor_class' => 'wp-editor-area', 'upload_link_title' => 'Upload and insert images or other media', 'media_buttons_context' => '', 'textarea_rows' => get_option('default_post_edit_rows', 10)));
     if (!$set['wpautop']) {
         $set['apply_source_formatting'] = true;
     }
     $rows = (int) $set['textarea_rows'];
     $can_richedit = user_can_richedit();
     $id = $editor_id;
     $default_editor = is_admin() ? wp_default_editor() : 'tinymce';
     $default_editor = 'tinymce';
     // default editor not working yet in code, so it's turned off for now
     $toolbar = '';
     if (!current_user_can('upload_files')) {
         $media_buttons = false;
     }
     $this->media_buttons = $media_buttons;
     echo '<div id="wp-' . $id . '-wrap" class="wp-editor-wrap">';
     if (!is_admin() && !empty($set['wp_buttons_css'])) {
         echo '<style type="text/css" scoped="scoped"> @import url("' . $set['wp_buttons_css'] . '"); ' . "</style>\n";
     }
     if ($can_richedit || $media_buttons) {
         $toolbar .= '<div id="wp-' . $id . '-editor-tools" class="wp-editor-tools">';
         if ($can_richedit) {
             $html_class = $tmce_class = '';
             if ('html' == $default_editor) {
                 add_filter('the_editor_content', 'wp_htmledit_pre');
                 $html_class = 'active ';
             } else {
                 add_filter('the_editor_content', 'wp_richedit_pre');
                 $tmce_class = 'active ';
             }
             $toolbar .= '<a id="' . $id . '-html" class="' . $html_class . 'hide-if-no-js wp-switch-editor" onclick="wpEditor.s(this);return false;">' . __('HTML') . "</a>\n";
             $toolbar .= '<a id="' . $id . '-tmce" class="' . $tmce_class . 'hide-if-no-js wp-switch-editor" onclick="wpEditor.s(this);return false;">' . __('Visual') . "</a>\n";
         }
         if ($media_buttons) {
             global $post_ID;
             $href = add_query_arg(array('post_id' => (int) $post_ID, 'TB_iframe' => true), admin_url('media-upload.php'));
             $title = $set['upload_link_title'];
             $button = "<a href='" . esc_url($href) . "' id='{$id}-add_media' class='thickbox' title='{$title}'><img src='" . esc_url(admin_url('images/media-button-image.gif')) . "' alt='{$title}' onclick='return false;' /></a>";
             $toolbar .= '<div id="wp-' . $id . '-media-buttons" class="hide-if-no-js wp-media-buttons">';
             $toolbar .= $set['media_buttons_context'] . apply_filters('wp_upload_buttons', $button, $id);
             $toolbar .= "</div>\n";
         }
         $toolbar .= "</div>\n";
     }
     $the_editor = apply_filters('the_editor', '<div id="wp-' . $id . '-editor-container" class="wp-editor-container"><textarea class="' . $set['editor_class'] . '" rows="' . $rows . '" cols="40" name="' . $id . '" id="' . $id . '">%s</textarea></div>');
     $the_editor_content = apply_filters('the_editor_content', $content);
     echo apply_filters('the_editor_toolbar', $toolbar);
     printf($the_editor, $the_editor_content);
     echo "\n</div>\n\n";
     if (is_admin()) {
         add_action('admin_print_footer_scripts', array($this, 'editor_js'), 50);
     } else {
         add_action('wp_print_footer_scripts', array($this, 'editor_js'));
     }
     unset($set['wp_buttons_css'], $set['editor_class'], $set['upload_link_title'], $set['media_buttons_context'], $set['textarea_rows']);
     $this->settings[$editor_id] = $set;
 }
开发者ID:natduffy,项目名称:gicinema,代码行数:65,代码来源:wp-editor.php

示例5: render_field

        function render_field($field)
        {
            // global
            global $wp_version;
            // enqueue
            acf_enqueue_uploader();
            // vars
            $id = uniqid('acf-editor-');
            $default_editor = 'html';
            $show_tabs = true;
            $button = '';
            // get height
            $height = acf_get_user_setting('wysiwyg_height', 300);
            $height = max($height, 300);
            // minimum height is 300
            // detect mode
            if (!user_can_richedit()) {
                $show_tabs = false;
            } elseif ($field['tabs'] == 'visual') {
                // case: visual tab only
                $default_editor = 'tinymce';
                $show_tabs = false;
            } elseif ($field['tabs'] == 'text') {
                // case: text tab only
                $show_tabs = false;
            } elseif (wp_default_editor() == 'tinymce') {
                // case: both tabs
                $default_editor = 'tinymce';
            }
            // must be logged in tp upload
            if (!current_user_can('upload_files')) {
                $field['media_upload'] = 0;
            }
            // mode
            $switch_class = $default_editor === 'html' ? 'html-active' : 'tmce-active';
            // filter value for editor
            remove_filter('acf_the_editor_content', 'format_for_editor', 10, 2);
            remove_filter('acf_the_editor_content', 'wp_htmledit_pre', 10, 1);
            remove_filter('acf_the_editor_content', 'wp_richedit_pre', 10, 1);
            // WP 4.3
            if (version_compare($wp_version, '4.3', '>=')) {
                add_filter('acf_the_editor_content', 'format_for_editor', 10, 2);
                $button = 'data-wp-editor-id="' . $id . '"';
                // WP < 4.3
            } else {
                $function = $default_editor === 'html' ? 'wp_htmledit_pre' : 'wp_richedit_pre';
                add_filter('acf_the_editor_content', $function, 10, 1);
                $button = 'onclick="switchEditors.switchto(this);"';
            }
            // filter
            $field['value'] = apply_filters('acf_the_editor_content', $field['value'], $default_editor);
            ?>
		<div id="wp-<?php 
            echo $id;
            ?>
-wrap" class="acf-editor-wrap wp-core-ui wp-editor-wrap <?php 
            echo $switch_class;
            ?>
" data-toolbar="<?php 
            echo $field['toolbar'];
            ?>
" data-upload="<?php 
            echo $field['media_upload'];
            ?>
">
			<div id="wp-<?php 
            echo $id;
            ?>
-editor-tools" class="wp-editor-tools hide-if-no-js">
				<?php 
            if ($field['media_upload']) {
                ?>
				<div id="wp-<?php 
                echo $id;
                ?>
-media-buttons" class="wp-media-buttons">
					<?php 
                do_action('media_buttons', $id);
                ?>
				</div>
				<?php 
            }
            ?>
				<?php 
            if (user_can_richedit() && $show_tabs) {
                ?>
					<div class="wp-editor-tabs">
						<button id="<?php 
                echo $id;
                ?>
-tmce" class="wp-switch-editor switch-tmce" <?php 
                echo $button;
                ?>
 type="button"><?php 
                echo __('Visual', 'acf');
                ?>
</button>
						<button id="<?php 
                echo $id;
                ?>
//.........这里部分代码省略.........
开发者ID:coreymargulis,项目名称:karenmargulis,代码行数:101,代码来源:wysiwyg.php

示例6: render_field

        function render_field($field)
        {
            // enqueue
            acf_enqueue_uploader();
            // vars
            $id = $field['id'] . '-' . uniqid();
            $mode = 'html';
            $show_tabs = true;
            // get height
            $height = acf_get_user_setting('wysiwyg_height', 300);
            $height = max($height, 300);
            // minimum height is 300
            // detect mode
            if ($field['tabs'] == 'visual') {
                // case: visual tab only
                $mode = 'tmce';
                $show_tabs = false;
            } elseif ($field['tabs'] == 'text') {
                // case: text tab only
                $show_tabs = false;
            } elseif (wp_default_editor() == 'tinymce') {
                // case: both tabs
                $mode = 'tmce';
            }
            // mode
            $switch_class = $mode . '-active';
            // filter value for editor
            remove_all_filters('acf_the_editor_content');
            if ($mode == 'tmce') {
                add_filter('acf_the_editor_content', 'wp_richedit_pre');
            } else {
                add_filter('acf_the_editor_content', 'wp_htmledit_pre');
            }
            $field['value'] = apply_filters('acf_the_editor_content', $field['value']);
            ?>
		<div id="wp-<?php 
            echo $id;
            ?>
-wrap" class="acf-wysiwyg-wrap wp-core-ui wp-editor-wrap <?php 
            echo $switch_class;
            ?>
" data-toolbar="<?php 
            echo $field['toolbar'];
            ?>
" data-upload="<?php 
            echo $field['media_upload'];
            ?>
">
			<div id="wp-<?php 
            echo $id;
            ?>
-editor-tools" class="wp-editor-tools hide-if-no-js">
				<?php 
            if ($field['media_upload']) {
                ?>
				<div id="wp-<?php 
                echo $id;
                ?>
-media-buttons" class="wp-media-buttons">
					<?php 
                do_action('media_buttons');
                ?>
				</div>
				<?php 
            }
            ?>
				<?php 
            if (user_can_richedit() && $show_tabs) {
                ?>
					<div class="wp-editor-tabs">
						<a id="<?php 
                echo $id;
                ?>
-html" class="wp-switch-editor switch-html" onclick="switchEditors.switchto(this);"><?php 
                echo _x('Text', 'Name for the Text editor tab (formerly HTML)');
                ?>
</a>
						<a id="<?php 
                echo $id;
                ?>
-tmce" class="wp-switch-editor switch-tmce" onclick="switchEditors.switchto(this);"><?php 
                echo __('Visual');
                ?>
</a>
					</div>
				<?php 
            }
            ?>
			</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 $field['name'];
            ?>
" <?php 
//.........这里部分代码省略.........
开发者ID:mariussunde,项目名称:Sn-hetta-Designmanual-WP-Theme,代码行数:101,代码来源:wysiwyg.php

示例7: the_editor

function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2) {
	$rows = get_option('default_post_edit_rows');
	if (($rows < 3) || ($rows > 100))
		$rows = 12;

	$rows = "rows='$rows'";	?>
	<div id="editor-toolbar">
	<?php if ( user_can_richedit() ) {
		$wp_default_editor = wp_default_editor(); ?>
		<div class="zerosize"><input accesskey="e" type="button" onclick="switchEditors.go('<?php echo $id; ?>')" /></div>
		<?php if ( 'tinymce' == $wp_default_editor ) {
			add_filter('the_editor_content', 'wp_richedit_pre'); ?>
			<a id="edButtonHTML" onclick="switchEditors.go('<?php echo $id; ?>');"><?php _e('HTML'); ?></a>
			<a id="edButtonPreview" class="active"><?php _e('Visual'); ?></a>
		<?php } elseif ( 'html' == $wp_default_editor ) {
			add_filter('the_editor_content', 'wp_htmledit_pre'); ?>
			<a id="edButtonHTML" class="active"><?php _e('HTML'); ?></a>
			<a id="edButtonPreview" onclick="switchEditors.go('<?php echo $id; ?>');"><?php _e('Visual'); ?></a>
		<?php }
	}

	if ( $media_buttons ) { ?>
		<div id="media-buttons" class="hide-if-no-js">
		<?php do_action( 'media_buttons' ); ?>
		</div>
	<?php } ?>
	</div>

	<div id="quicktags">
	<?php wp_print_scripts( 'quicktags' ); ?>
	<script type="text/javascript">edToolbar()</script>
	</div>

    <?php if ( 'html' != $wp_default_editor ) : ?>
    <script type="text/javascript">
    // <![CDATA[
        if ( typeof tinyMCE != "undefined" )
            document.getElementById("quicktags").style.display="none";
    // ]]>
    </script>
    <?php endif; // 'html' != $wp_default_editor

	$the_editor = apply_filters('the_editor', "<div id='editorcontainer'><textarea class='' $rows cols='40' name='$id' tabindex='$tab_index' id='$id'>%s</textarea></div>\n");
	$the_editor_content = apply_filters('the_editor_content', $content);

	printf($the_editor, $the_editor_content);

	?>
    <script type="text/javascript">
    // <![CDATA[
    edCanvas = document.getElementById('<?php echo $id; ?>');
    <?php if ( $prev_id && user_can_richedit() ) : ?>
    // If tinyMCE is defined.
    if ( typeof tinyMCE != 'undefined' ) {
    // This code is meant to allow tabbing from Title to Post (TinyMCE).
        document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e) {
            e = e || window.event;
            if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
                if ( tinyMCE.activeEditor ) {
                    if ( (jQuery("#post_ID").val() < 1) && (jQuery("#title").val().length > 0) ) { autosave(); }
                    e = null;
                    if ( tinyMCE.activeEditor.isHidden() ) return true;
                    tinyMCE.activeEditor.focus();
                    return false;
                }
                return true;
            }
        }
    }
    <?php endif; ?>
    // ]]>
    </script>
    <?php
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:74,代码来源:general-template.php

示例8: extend_tiny_mce

 public static function extend_tiny_mce($init)
 {
     if (wp_default_editor() == 'tinymce') {
         $init['setup'] = 'rich_scroll';
     }
     return $init;
 }
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:7,代码来源:options_functions.php

示例9: devfmt_initEditor

function devfmt_initEditor($AEditor)
{
    if ('tinymce' == wp_default_editor()) {
        $AEditor .= "<script language='JavaScript'><!--\n jQuery(document).ready(function(){ if(typeof(switchEditors) != \"undefined\"){ jQuery('textarea#content')[0].value = switchEditors.wpautop(jQuery('textarea#content')[0].value); } }); //-->\n</script>";
    }
    return $AEditor;
}
开发者ID:RA2WP,项目名称:RA2WP,代码行数:7,代码来源:devinterface.php

示例10: filterEditor

 /**
  * Filters the WordPress editor widget, adding special reSt handling.
  *
  * WordPress uses a filter to allow plugins to change the HTML of the 
  * editor widget. This is currently the only way to add another editor
  * interface, since we cannot influence the editor's HTML until the
  * "the_editor" filter is run. A reSt-specific toolbar is added to
  * the HTML (regardless of the "active" editor interface) as well as
  * an additional textarea, which is used to track the reSt source used
  * to render a Post/Page's HTML.
  *
  * When this filter is called, it is guaranteed that WordPress has already
  * installed it's own default "the_editor_content" filters. We remove
  * these here, so our own "the_editor_content" filter will be passed the
  * original Post/Page HTML.
  *
  * @param string $editor The HTML for the rendered editor widget.
  *
  * @return string
  *
  * @todo Store and retrieve reSt source for each post.
  */
 public static function filterEditor($editor)
 {
     global $post;
     if (wp_default_editor() === 'rest') {
         /**
          * Strip the class from the editor to prevent auto-TinyMCE
          */
         $editor = str_replace("class='theEditor'", '', $editor);
         /**
          * Disable the content transformations added by the other editors.
          *
          * <note>
          * This must be done as late as possible (after "the_editor" filter is
          * called) so the filters won't register themselves after we've
          * removed them.
          * </note>
          */
         remove_filter('the_editor_content', 'wp_htmledit_pre');
         remove_filter('the_editor_content', 'wp_richedit_pre');
         /**
          * Add the reSt editor content filter.
          */
         add_filter('the_editor_content', array(__CLASS__, 'filterEditorContent'));
     }
     /**
      * Create a reSt-specific toolbar.
      */
     $prefix = '<div id="rest-toolbar"></div>';
     /**
      * Either output a warning or the textarea for reSt source.
      */
     if (!get_option('rst2html_path')) {
         /**
          * Display a warning if rst2html.py is not set up.
          */
         $contents = '<p>No HTML convertor found! Please edit your <a href="';
         $contents .= admin_url('options-general.php?page=rest-plugin-settings');
         $contents .= '">' . self::$display_name . ' Settings</a>.</p>';
     } else {
         /**
          * Get the current reSt source for this Page/Post.
          */
         $rest_src = '';
         if ($post->ID) {
             $rest_src = get_post_meta($post->ID, 'rest_src', true);
         }
         /**
          * Escape printf chars.
          */
         $rest_src = str_replace('%', '%%', $rest_src);
         /**
          * Create a textarea to hold the reSt source.
          */
         $contents = sprintf('<textarea cols=40 rows=10>%s</textarea>', htmlentities($rest_src));
     }
     /**
      * Wrap the textarea or error message in a div.
      */
     $suffix = '<div id="rest-container">' . $contents . '</div>';
     /**
      * Always add the prefix and suffix to the editor we're given.
      */
     $editor = $prefix . $editor . $suffix;
     /**
      * Continue processing by other filters.
      */
     return $editor;
 }
开发者ID:xdissent,项目名称:wordprest,代码行数:90,代码来源:rest.php

示例11: after_wp_tiny_mce

        /**
         * Denote the default editor for the user.
         *
         * Note that it would usually be ideal to expose this via a JS variable using wp_localize_script; however, it is
         * being printed here in order to guarantee that nothing changes this value before it would otherwise be printed.
         * The "after_wp_tiny_mce" action appears to be the most reliable place to print this variable.
         *
         * @since  1.0.0.
         *
         * @param  array    $settings   TinyMCE settings.
         * @return void
         */
        public function after_wp_tiny_mce($settings)
        {
            ?>
		<script type="text/javascript">
			var ttfmakeMCE = '<?php 
            echo esc_js(wp_default_editor());
            ?>
';
		</script>
	<?php 
        }
开发者ID:natejacobson,项目名称:WSUWP-spine-parent-theme,代码行数:23,代码来源:base.php

示例12: action_the_editor_content

 /**
  * prepare html data for editor
  */
 function action_the_editor_content($content)
 {
     // if rich editing is on => wordpress adds autop which destroys our code
     // so we need to be there prior than WP.
     // See wp-includes/general-template.php [1500+] for more info
     // and "wp_htmledit_pre" vs. "wp_richedit_pre"
     // the filter functions added are:
     // a) wp_richedit_pre (wp-includes/formatting.php [1627]) = when tinymce is ACTIVE
     // b) wp_htmledit_pre (wp-includes/formatting.php [1649]) = when tinymce is INACTIVE
     if (wp_default_editor() != 'html') {
         $content = preg_replace('#<\\?php([\\s\\S]*?)\\?>#ie', '\'<img src="\' . PHP_EXECUTION_BASE_URL . \'/assets/trans.gif" class="mceWpPHP mceItemNoResize" title="php" alt="\' . base64_encode(stripslashes(\'\\0\')) . \'" />\'', $content);
     }
     return $content;
 }
开发者ID:barnaclebarnes,项目名称:open-data,代码行数:17,代码来源:class.php_execution.php

示例13: template_tinymce_css

        /**
         * Extend TinyMCE config with a setup function.
         * See http://www.tinymce.com/wiki.php/API3:event.tinymce.Editor.onInit
         *
         * @since 0.1.0
         *
         * @param array $init
         * @return array
         */
        public static function template_tinymce_css($init)
        {
            global $typenow;
            if ($typenow == 'wpem-temps' || $_REQUEST['page'] == 'wpem_mail') {
                if (isset($_REQUEST['temp_id'])) {
                    $post_id = absint($_REQUEST['temp_id']);
                } elseif (isset($_POST['schedule']['template']) && !empty($_POST['schedule']['template'])) {
                    $post_id = absint($_POST['schedule']['template']);
                } else {
                    global $post_id;
                }
                $css = get_post_meta($post_id, 'wpem_css-box-field', true);
                ?>
                <script type="text/javascript">
                                                                                                                                                
                    function addTempCSS( ed ) {
                        ed.onInit.add( function() {
                            tinyMCE.activeEditor.dom.addStyle(<?php 
                echo json_encode($css);
                ?>
);
                        } );
                    };
                </script>

                <?php 
                if (wp_default_editor() == 'tinymce') {
                    $init['setup'] = 'addTempCSS';
                }
            }
            return $init;
        }
开发者ID:etondeengole,项目名称:Store_Application,代码行数:41,代码来源:wpem-template-class.php

示例14: tc_user_defined_tinymce_css

        /**
         * Extend TinyMCE config with a setup function.
         * See http://www.tinymce.com/wiki.php/API3:event.tinymce.Editor.onInit
         * http://wordpress.stackexchange.com/questions/120831/how-to-add-custom-css-theme-option-to-tinymce
         * @package Customizr
         * @since Customizr 3.2.11
         *
         */
        function tc_user_defined_tinymce_css($init)
        {
            if (!apply_filters('tc_add_custom_fonts_to_editor', true)) {
                return $init;
            }
            $_css = TC_resources::$instance->tc_write_fonts_inline_css('', 'mce-content-body');
            ?>

          <script type="text/javascript">
            function add_user_defined_CSS( ed ) {
              //http://www.tinymce.com/wiki.php/Tutorial:Migration_guide_from_3.x
                ed.on('init', function() {
                    tinyMCE.activeEditor.dom.addStyle(<?php 
            echo json_encode($_css);
            ?>
);
                } );
            };
          </script>

          <?php 
            if (wp_default_editor() == 'tinymce') {
                $init['setup'] = 'add_user_defined_CSS';
            }
            return $init;
        }
开发者ID:eq0rip,项目名称:Hamroreview.com,代码行数:34,代码来源:class-fire-admin_init.php

示例15: _admin_print_footer_scripts

    /**
     * @access private
     * @since 2.0
     * @return void
     */
    function _admin_print_footer_scripts()
    {
        if (wp_script_is('editor', 'done') && apply_filters("{$this->slug('hook')}-print-editor-fix", true)) {
            $this->_comment_tag(true);
            ?>
<script type="text/javascript">
/* <![CDATA[ */
jQuery(function($) {
	var $div = $('<div/>');	
	$('body').bind('beforeWpautop', function(e, o) {
		o.data = o.data.replace(/<\?php.*?\?>/gim, function(str) {
			return $div.text(str).html();
		});
	}).bind('beforePreWpautop', function(e, o) {
		o.data = o.data.replace(/<!--\?php/gi, '&lt;?php').replace(/\?-->/g, '?&gt;').replace(/&lt;\?php.*?\?&gt;/gim, function(str) {
			return $div.html(str).text();
		});
	});
<?php 
            if (user_can_richedit() && wp_default_editor() != 'html') {
                //are we using the visual editor?
                //the following fixes an issue were the visual editor doesnt display php
                ?>
	
	if (switchEditors.mode == '') {
		switchEditors.go('content');
		switchEditors.go('content');
	}
<?php 
            }
            ?>
});
/* ]]> */
</script>
<?php 
            $this->_comment_tag(false);
        }
        if (wp_script_is('admin-widgets', 'done') && apply_filters("{$this->slug('hook')}-print-widget-fix", true)) {
            $this->_comment_tag(true);
            ?>
<script type="text/javascript">
/* <![CDATA[ */
(function($) {
	if (wpWidgets) {
		var appendTitle = wpWidgets.appendTitle;
		wpWidgets.appendTitle = function(widget) {
			if ($('input.id_base[value="text"]', widget).length > 0) {
				var title = $('input[id*="-title"]', widget).val();
				
				if (title) {
					title = title.replace(/</g, '&lt;').replace(/>/g, '&gt;');
					$('.widget-top .widget-title .in-widget-title', widget).html(': ' + title);
				}
			} else
				appendTitle(widget);
		};
	}
})(jQuery);
/* ]]> */
</script>
<?php 
            $this->_comment_tag(false);
        }
    }
开发者ID:DarussalamTech,项目名称:aims_prj,代码行数:69,代码来源:wp-exec-php.php


注:本文中的wp_default_editor函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。