Make WordPress Core


Ignore:
Timestamp:
06/07/2006 11:17:59 PM (19 years ago)
Author:
ryan
Message:

Reworg post/page/attachment functions. #2525

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/template-functions-general.php

    r3740 r3851  
    695695}
    696696
     697function wp_head() {
     698    do_action('wp_head');
     699}
     700
     701function wp_footer() {
     702    do_action('wp_footer');
     703}
     704
    697705function rsd_link() {
    698706    echo '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . get_bloginfo('wpurl') . "/xmlrpc.php?rsd\" />\n";
     
    704712        echo '<meta name="robots" content="noindex,nofollow" />' . "\n";
    705713}
     714
     715/**
     716 * Places a textarea according to the current user's preferences, filled with $content.
     717 * Also places a script block that enables tabbing between Title and Content.
     718 *
     719 * @param string Editor contents
     720 * @param string (optional) Previous form field's ID (for tabbing support)
     721 */
     722function the_editor($content, $id = 'content', $prev_id = 'title') {
     723    $rows = get_settings('default_post_edit_rows');
     724    if (($rows < 3) || ($rows > 100))
     725        $rows = 12;
     726
     727    $rows = "rows='$rows'";
     728
     729    the_quicktags();
     730
     731    if ( user_can_richedit() )
     732        add_filter('the_editor_content', 'wp_richedit_pre');
     733
     734    $the_editor = apply_filters('the_editor', "<div><textarea class='mceEditor' $rows cols='40' name='$id' tabindex='2' id='$id'>%s</textarea></div>\n");
     735    $the_editor_content = apply_filters('the_editor_content', $content);
     736
     737    printf($the_editor, $the_editor_content);
     738
     739    ?>
     740    <script type="text/javascript">
     741    //<!--
     742    edCanvas = document.getElementById('<?php echo $id; ?>');
     743    <?php if ( user_can_richedit() ) : ?>
     744    // This code is meant to allow tabbing from Title to Post (TinyMCE).
     745    if ( tinyMCE.isMSIE )
     746        document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e)
     747            {
     748                e = e ? e : window.event;
     749                if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
     750                    var i = tinyMCE.selectedInstance;
     751                    if(typeof i ==  'undefined')
     752                        return true;
     753                                    tinyMCE.execCommand("mceStartTyping");
     754                    this.blur();
     755                    i.contentWindow.focus();
     756                    e.returnValue = false;
     757                    return false;
     758                }
     759            }
     760    else
     761        document.getElementById('<?php echo $prev_id; ?>').onkeypress = function (e)
     762            {
     763                e = e ? e : window.event;
     764                if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
     765                    var i = tinyMCE.selectedInstance;
     766                    if(typeof i ==  'undefined')
     767                        return true;
     768                                    tinyMCE.execCommand("mceStartTyping");
     769                    this.blur();
     770                    i.contentWindow.focus();
     771                    e.returnValue = false;
     772                    return false;
     773                }
     774            }
     775    <?php endif; ?>
     776    //-->
     777    </script>
     778    <?php
     779}
     780
    706781?>
Note: See TracChangeset for help on using the changeset viewer.