Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/post.php

    r18370 r18386  
    2626    if ( $update )
    2727        $post_data['ID'] = (int) $post_data['post_ID'];
    28     $post_data['post_content'] = isset($post_data['content']) ? $post_data['content'] : '';
    29     $post_data['post_excerpt'] = isset($post_data['excerpt']) ? $post_data['excerpt'] : '';
    30     $post_data['post_parent'] = isset($post_data['parent_id'])? $post_data['parent_id'] : '';
     28
     29    if ( isset( $post_data['content'] ) )
     30        $post_data['post_content'] = $post_data['content'];
     31
     32    if ( isset( $post_data['excerpt'] ) )
     33        $post_data['post_excerpt'] = $post_data['excerpt'];
     34
     35    if ( isset( $post_data['parent_id'] ) )
     36        $post_data['post_parent'] = (int) $post_data['parent_id'];
     37
    3138    if ( isset($post_data['trackback_url']) )
    3239        $post_data['to_ping'] = $post_data['trackback_url'];
     
    10491056
    10501057/**
    1051  * {@internal Missing Short Description}}
     1058 * Returns the list of classes to be used by a metabox
    10521059 *
    10531060 * @uses get_user_option()
     
    10591066 */
    10601067function postbox_classes( $id, $page ) {
    1061     if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id )
    1062         return '';
    1063 
    1064     if ( $closed = get_user_option('closedpostboxes_'.$page ) ) {
     1068    if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id ) {
     1069        $classes = array( '' );
     1070    } elseif ( $closed = get_user_option('closedpostboxes_'.$page ) ) {
    10651071        if ( !is_array( $closed ) ) {
    1066             return '';
    1067         }
    1068         return in_array( $id, $closed )? 'closed' : '';
     1072            $classes = array( '' );
     1073        } else {
     1074            $classes = in_array( $id, $closed ) ? array( 'closed' ) : array( '' );
     1075        }
    10691076    } else {
    1070         return '';
    1071     }
     1077        $classes = array( '' );
     1078    }
     1079
     1080    $classes = apply_filters( "postbox_classes_{$page}_{$id}", $classes );
     1081    return implode( ' ', $classes );
    10721082}
    10731083
     
    11201130        $uri = strrev( stristr( strrev( $uri ), '/' ) );
    11211131        $uri = untrailingslashit($uri);
     1132        $uri = apply_filters( 'editable_slug', $uri );
    11221133        if ( !empty($uri) )
    11231134            $uri .= '/';
     
    14381449        $ext_plugins = '';
    14391450    } else {
    1440         $plugins = array( 'inlinepopups', 'spellchecker', 'paste', 'wordpress', 'fullscreen', 'wpeditimage', 'wpgallery', 'tabfocus', 'wplink', 'wpdialogs' );
     1451        $plugins = array( 'inlinepopups', 'spellchecker', 'tabfocus', 'paste', 'media', 'wordpress', 'wpfullscreen', 'wpeditimage', 'wpgallery', 'wplink', 'wpdialogs' );
    14411452
    14421453        /*
     
    15791590        'remove_linebreaks' => true,
    15801591        'gecko_spellcheck' => true,
     1592        'keep_styles' => false,
    15811593        'entities' => '38,amp,60,lt,62,gt',
    15821594        'accessibility_focus' => true,
     
    15871599        'paste_strip_class_attributes' => 'all',
    15881600        'paste_text_use_dialog' => true,
     1601        'extended_valid_elements' => 'article[*],aside[*],audio[*],canvas[*],command[*],datalist[*],details[*],embed[*],figcaption[*],figure[*],footer[*],header[*],hgroup[*],keygen[*],mark[*],meter[*],nav[*],output[*],progress[*],section[*],source[*],summary,time[*],video[*],wbr',
    15891602        'wpeditimage_disable_captions' => $no_captions,
     1603        'wp_fullscreen_content_css' => "$baseurl/plugins/wpfullscreen/css/wp-fullscreen.css",
    15901604        'plugins' => implode( ',', $plugins ),
    15911605    );
     
    16421656
    16431657    $compressed = $compress_scripts && $concatenate_scripts && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
    1644         && false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip');
     1658        && false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip');
    16451659
    16461660    /**
     
    16631677            $mce_options .= $k . ':' . $val . ', ';
    16641678            continue;
    1665         } elseif ( !empty($v) && is_string($v) && ( '{' == $v{0} || '[' == $v{0} ) ) {
     1679        } elseif ( !empty($v) && is_string($v) && ( ('{' == $v{0} && '}' == $v{strlen($v) - 1}) || ('[' == $v{0} && ']' == $v{strlen($v) - 1}) || preg_match('/^\(?function ?\(/', $v) ) ) {
    16661680            $mce_options .= $k . ':' . $v . ', ';
    16671681            continue;
     
    16711685    }
    16721686
    1673     $mce_options = rtrim( trim($mce_options), '\n\r,' ); ?>
     1687    $mce_options = rtrim( trim($mce_options), '\n\r,' );
     1688
     1689    do_action('before_wp_tiny_mce', $initArray); ?>
    16741690
    16751691<script type="text/javascript">
     
    17121728<?php
    17131729
    1714     // Load additional inline scripts based on active plugins.
    1715     if ( in_array( 'wpdialogs', $plugins ) ) {
    1716         wp_print_scripts( array( 'wpdialogs-popup' ) );
     1730do_action('after_wp_tiny_mce', $initArray);
     1731}
     1732
     1733// Load additional inline scripts based on active plugins.
     1734function wp_preload_dialogs($init) {
     1735    $plugins = preg_split('/[ ,-]+/', $init['plugins']);
     1736
     1737    if ( in_array( 'wpdialogs', $plugins, true ) ) {
     1738        wp_print_scripts('wpdialogs-popup');
    17171739        wp_print_styles('wp-jquery-ui-dialog');
    17181740    }
    1719     if ( in_array( 'wplink', $plugins ) ) {
     1741
     1742    if ( in_array( 'wplink', $plugins, true ) ) {
    17201743        require_once ABSPATH . 'wp-admin/includes/internal-linking.php';
    1721         add_action('tiny_mce_preload_dialogs', 'wp_link_dialog');
     1744        ?><div style="display:none;"><?php wp_link_dialog(); ?></div><?php
    17221745        wp_print_scripts('wplink');
    17231746        wp_print_styles('wplink');
    17241747    }
    1725 }
    1726 function wp_tiny_mce_preload_dialogs() { ?>
    1727     <div id="preloaded-dialogs" style="display:none;">
    1728 <?php   do_action('tiny_mce_preload_dialogs'); ?>
     1748
     1749    // Distraction Free Writing mode
     1750    if ( in_array( 'wpfullscreen', $plugins, true ) ) {
     1751        wp_fullscreen_html();
     1752        wp_print_scripts('wp-fullscreen');
     1753    }
     1754
     1755    wp_print_scripts('word-count');
     1756}
     1757
     1758function wp_quicktags() {
     1759    global $tinymce_version;
     1760
     1761    wp_preload_dialogs( array( 'plugins' => 'wpdialogs,wplink,wpfullscreen' ) );
     1762
     1763    if ( !user_can_richedit() ) {
     1764        wp_enqueue_style( 'tinymce-buttons', includes_url('js/tinymce/themes/advanced/skins/wp_theme/ui.css'), array(), $tinymce_version );
     1765        wp_print_styles('tinymce-buttons');
     1766    }
     1767}
     1768
     1769function wp_print_editor_js() {
     1770    wp_print_scripts('editor');
     1771}
     1772
     1773function wp_fullscreen_html() {
     1774    global $content_width, $post;
     1775
     1776    $width = isset($content_width) && 800 > $content_width ? $content_width : 800;
     1777    $width = $width + 10; // compensate for the padding
     1778    $dfw_width = get_user_setting( 'dfw_width', $width );
     1779    $save = isset($post->post_status) && $post->post_status == 'publish' ? __('Update') : __('Save');
     1780?>
     1781<div id="wp-fullscreen-body">
     1782<div id="fullscreen-topbar">
     1783    <div id="wp-fullscreen-toolbar">
     1784        <div id="wp-fullscreen-close"><a href="#" onclick="fullscreen.off();return false;"><?php _e('Exit fullscreen'); ?></a></div>
     1785        <div id="wp-fullscreen-central-toolbar" style="width:<?php echo $width; ?>px;">
     1786
     1787        <div id="wp-fullscreen-mode-bar"><div id="wp-fullscreen-modes">
     1788            <a href="#" onclick="fullscreen.switchmode('tinymce');return false;"><?php _e('Visual'); ?></a>
     1789            <a href="#" onclick="fullscreen.switchmode('html');return false;"><?php _e('HTML'); ?></a>
     1790        </div></div>
     1791
     1792        <div id="wp-fullscreen-button-bar"><div id="wp-fullscreen-buttons" class="wp_themeSkin">
     1793<?php
     1794
     1795    $media_link_type = 'image';
     1796    if ( is_multisite() && ( ( ! $mu_media_buttons = get_site_option( 'mu_media_buttons' ) ) || empty( $mu_media_buttons['image'] ) ) )
     1797        $media_link_type = 'media';
     1798
     1799    $buttons = array(
     1800        // format: title, onclick, show in both editors
     1801        'bold' => array( 'title' => __('Bold (Ctrl + B)'), 'onclick' => 'fullscreen.b();', 'both' => false ),
     1802        'italic' => array( 'title' => __('Italic (Ctrl + I)'), 'onclick' => 'fullscreen.i();', 'both' => false ),
     1803        '0' => 'separator',
     1804        'bullist' => array( 'title' => __('Unordered list (Alt + Shift + U)'), 'onclick' => 'fullscreen.ul();', 'both' => false ),
     1805        'numlist' => array( 'title' => __('Ordered list (Alt + Shift + O)'), 'onclick' => 'fullscreen.ol();', 'both' => false ),
     1806        '1' => 'separator',
     1807        'blockquote' => array( 'title' => __('Blockquote (Alt+Shift+Q)'), 'onclick' => 'fullscreen.blockquote();', 'both' => false ),
     1808        'image' => array( 'title' => __('Insert/edit image (Alt + Shift + M)'), 'onclick' => "jQuery('#add_{$media_link_type}').click();", 'both' => true ),
     1809        '2' => 'separator',
     1810        'link' => array( 'title' => __('Insert/edit link (Alt + Shift + A)'), 'onclick' => 'fullscreen.link();', 'both' => true ),
     1811        'unlink' => array( 'title' => __('Unlink (Alt + Shift + S)'), 'onclick' => 'fullscreen.unlink();', 'both' => false ),
     1812        '3' => 'separator',
     1813        'help' => array( 'title' => __('Help (Alt + Shift + H)'), 'onclick' => 'fullscreen.help();', 'both' => false )
     1814    );
     1815
     1816    $buttons = apply_filters( 'wp_fullscreen_buttons', $buttons );
     1817
     1818    foreach ( $buttons as $button => $args ) {
     1819        if ( 'separator' == $args ) { ?>
     1820            <div><span aria-orientation="vertical" role="separator" class="mceSeparator"></span></div>
     1821<?php       continue;
     1822        } ?>
     1823
     1824        <div<?php if ( $args['both'] ) { ?> class="wp-fullscreen-both"<?php } ?>>
     1825        <a title="<?php echo $args['title']; ?>" onclick="<?php echo $args['onclick']; ?>return false;" class="mceButton mceButtonEnabled mce_<?php echo $button; ?>" href="#" id="wp_fs_<?php echo $button; ?>" role="button" aria-pressed="false">
     1826        <span class="mceIcon mce_<?php echo $button; ?>"></span>
     1827        </a>
     1828        </div>
     1829<?php
     1830    } ?>
     1831
     1832        </div></div>
     1833
     1834        <div id="wp-fullscreen-save">
     1835            <span><?php if ( $post->post_status == 'publish' ) _e('Updated.'); else _e('Saved.'); ?></span>
     1836            <img src="images/wpspin_light.gif" alt="" />
     1837            <input type="button" class="button-primary" value="<?php echo $save; ?>" onclick="fullscreen.save();" />
     1838        </div>
     1839
     1840        </div>
    17291841    </div>
    1730 <?php }
     1842</div>
     1843
     1844<div id="wp-fullscreen-wrap" style="width:<?php echo $dfw_width; ?>px;">
     1845    <label id="wp-fullscreen-title-prompt-text" for="wp-fullscreen-title"><?php echo apply_filters( 'enter_title_here', __( 'Enter title here' ), $post ); ?></label>
     1846    <input type="text" id="wp-fullscreen-title" value="" autocomplete="off" />
     1847
     1848    <div id="wp-fullscreen-container">
     1849        <textarea id="wp_mce_fullscreen"></textarea>
     1850    </div>
     1851
     1852    <div id="wp-fullscreen-status">
     1853        <div id="wp-fullscreen-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></div>
     1854        <div id="wp-fullscreen-tagline"><?php _e('Just write.'); ?></div>
     1855    </div>
     1856</div>
     1857</div>
     1858
     1859<div class="fullscreen-overlay" id="fullscreen-overlay"></div>
     1860<div class="fullscreen-overlay fullscreen-fader fade-600" id="fullscreen-fader"></div>
     1861<?php
     1862}
     1863
     1864
Note: See TracChangeset for help on using the changeset viewer.