Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r18023 r18254  
    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'];
     
    9981005    $q['post_type'] = 'attachment';
    9991006    $post_type = get_post_type_object( 'attachment' );
    1000     $states = array( 'inherit' );
     1007    $states = 'inherit';
    10011008    if ( current_user_can( $post_type->cap->read_private_posts ) )
    1002         $states[] = 'private';
     1009        $states .= ',private';
    10031010
    10041011    $q['post_status'] = isset( $q['status'] ) && 'trash' == $q['status'] ? 'trash' : $states;
     
    10301037
    10311038/**
    1032  * {@internal Missing Short Description}}
     1039 * Returns the list of classes to be used by a metabox
    10331040 *
    10341041 * @uses get_user_option()
     
    10401047 */
    10411048function postbox_classes( $id, $page ) {
    1042     if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id )
    1043         return '';
    1044 
    1045     if ( $closed = get_user_option('closedpostboxes_'.$page ) ) {
     1049    if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id ) {
     1050        $classes = array( '' );
     1051    } elseif ( $closed = get_user_option('closedpostboxes_'.$page ) ) {
    10461052        if ( !is_array( $closed ) ) {
    1047             return '';
    1048         }
    1049         return in_array( $id, $closed )? 'closed' : '';
     1053            $classes = array( '' );
     1054        } else {
     1055            $classes = in_array( $id, $closed ) ? array( 'closed' ) : array( '' );
     1056        }
    10501057    } else {
    1051         return '';
    1052     }
     1058        $classes = array( '' );
     1059    }
     1060
     1061    $classes = apply_filters( "postbox_classes_{$page}_{$id}", $classes );
     1062    return implode( ' ', $classes );
    10531063}
    10541064
     
    11011111        $uri = strrev( stristr( strrev( $uri ), '/' ) );
    11021112        $uri = untrailingslashit($uri);
     1113        $uri = apply_filters( 'editable_slug', $uri );
    11031114        if ( !empty($uri) )
    11041115            $uri .= '/';
     
    14191430        $ext_plugins = '';
    14201431    } else {
    1421         $plugins = array( 'inlinepopups', 'spellchecker', 'paste', 'wordpress', 'fullscreen', 'wpeditimage', 'wpgallery', 'tabfocus', 'wplink', 'wpdialogs' );
     1432        $plugins = array( 'inlinepopups', 'spellchecker', 'tabfocus', 'paste', 'media', 'wordpress', 'wpfullscreen', 'wpeditimage', 'wpgallery', 'wplink', 'wpdialogs' );
    14221433
    14231434        /*
     
    15601571        'remove_linebreaks' => true,
    15611572        'gecko_spellcheck' => true,
     1573        'keep_styles' => false,
    15621574        'entities' => '38,amp,60,lt,62,gt',
    15631575        'accessibility_focus' => true,
     
    15681580        'paste_strip_class_attributes' => 'all',
    15691581        'paste_text_use_dialog' => true,
     1582        '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',
    15701583        'wpeditimage_disable_captions' => $no_captions,
     1584        'wp_fullscreen_content_css' => "$baseurl/plugins/wpfullscreen/css/wp-fullscreen.css",
    15711585        'plugins' => implode( ',', $plugins ),
    15721586    );
     
    16231637
    16241638    $compressed = $compress_scripts && $concatenate_scripts && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
    1625         && false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip');
     1639        && false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip');
    16261640
    16271641    /**
     
    16441658            $mce_options .= $k . ':' . $val . ', ';
    16451659            continue;
    1646         } elseif ( !empty($v) && is_string($v) && ( '{' == $v{0} || '[' == $v{0} ) ) {
     1660        } elseif ( !empty($v) && is_string($v) && ( ('{' == $v{0} && '}' == $v{strlen($v) - 1}) || ('[' == $v{0} && ']' == $v{strlen($v) - 1}) || preg_match('/^\(?function ?\(/', $v) ) ) {
    16471661            $mce_options .= $k . ':' . $v . ', ';
    16481662            continue;
     
    16521666    }
    16531667
    1654     $mce_options = rtrim( trim($mce_options), '\n\r,' ); ?>
     1668    $mce_options = rtrim( trim($mce_options), '\n\r,' );
     1669
     1670    do_action('before_wp_tiny_mce', $initArray); ?>
    16551671
    16561672<script type="text/javascript">
     
    16931709<?php
    16941710
    1695     // Load additional inline scripts based on active plugins.
    1696     if ( in_array( 'wpdialogs', $plugins ) ) {
    1697         wp_print_scripts( array( 'wpdialogs-popup' ) );
     1711do_action('after_wp_tiny_mce', $initArray);
     1712}
     1713
     1714// Load additional inline scripts based on active plugins.
     1715function wp_preload_dialogs($init) {
     1716    $plugins = preg_split('/[ ,-]+/', $init['plugins']);
     1717
     1718    if ( in_array( 'wpdialogs', $plugins, true ) ) {
     1719        wp_print_scripts('wpdialogs-popup');
    16981720        wp_print_styles('wp-jquery-ui-dialog');
    16991721    }
    1700     if ( in_array( 'wplink', $plugins ) ) {
     1722
     1723    if ( in_array( 'wplink', $plugins, true ) ) {
    17011724        require_once ABSPATH . 'wp-admin/includes/internal-linking.php';
    1702         add_action('tiny_mce_preload_dialogs', 'wp_link_dialog');
     1725        ?><div style="display:none;"><?php wp_link_dialog(); ?></div><?php
    17031726        wp_print_scripts('wplink');
    17041727        wp_print_styles('wplink');
    17051728    }
    1706 }
    1707 function wp_tiny_mce_preload_dialogs() { ?>
    1708     <div id="preloaded-dialogs" style="display:none;">
    1709 <?php   do_action('tiny_mce_preload_dialogs'); ?>
     1729
     1730    // Distraction Free Writing mode
     1731    if ( in_array( 'wpfullscreen', $plugins, true ) ) {
     1732        wp_fullscreen_html();
     1733        wp_print_scripts('wp-fullscreen');
     1734    }
     1735
     1736    wp_print_scripts('word-count');
     1737}
     1738
     1739function wp_quicktags() {
     1740    global $tinymce_version;
     1741
     1742    wp_preload_dialogs( array( 'plugins' => 'wpdialogs,wplink,wpfullscreen' ) );
     1743
     1744    if ( !user_can_richedit() ) {
     1745        wp_enqueue_style( 'tinymce-buttons', includes_url('js/tinymce/themes/advanced/skins/wp_theme/ui.css'), array(), $tinymce_version );
     1746        wp_print_styles('tinymce-buttons');
     1747    }
     1748}
     1749
     1750function wp_print_editor_js() {
     1751    wp_print_scripts('editor');
     1752}
     1753
     1754function wp_fullscreen_html() {
     1755    global $content_width, $post;
     1756
     1757    $width = isset($content_width) && 800 > $content_width ? $content_width : 800;
     1758    $width = $width + 10; // compensate for the padding
     1759    $dfw_width = get_user_setting( 'dfw_width', $width );
     1760    $save = $post->post_status == 'publish' ? __('Update') : __('Save');
     1761?>
     1762<div id="wp-fullscreen-body">
     1763<div id="fullscreen-topbar">
     1764    <div id="wp-fullscreen-toolbar">
     1765        <div id="wp-fullscreen-close"><a href="#" onclick="fullscreen.off();return false;"><?php _e('Exit fullscreen'); ?></a></div>
     1766        <div id="wp-fullscreen-central-toolbar" style="width:<?php echo $width; ?>px;">
     1767
     1768        <div id="wp-fullscreen-mode-bar"><div id="wp-fullscreen-modes">
     1769            <a href="#" onclick="fullscreen.switchmode('tinymce');return false;"><?php _e('Visual'); ?></a>
     1770            <a href="#" onclick="fullscreen.switchmode('html');return false;"><?php _e('HTML'); ?></a>
     1771        </div></div>
     1772
     1773        <div id="wp-fullscreen-button-bar"><div id="wp-fullscreen-buttons" class="wp_themeSkin">
     1774<?php
     1775
     1776    $buttons = array(
     1777        // format: title, onclick, show in both editors
     1778        'bold' => array( 'title' => __('Bold (Ctrl + B)'), 'onclick' => 'fullscreen.b();', 'both' => false ),
     1779        'italic' => array( 'title' => __('Italic (Ctrl + I)'), 'onclick' => 'fullscreen.i();', 'both' => false ),
     1780        '0' => 'separator',
     1781        'bullist' => array( 'title' => __('Unordered list (Alt + Shift + U)'), 'onclick' => 'fullscreen.ul();', 'both' => false ),
     1782        'numlist' => array( 'title' => __('Ordered list (Alt + Shift + O)'), 'onclick' => 'fullscreen.ol();', 'both' => false ),
     1783        '1' => 'separator',
     1784        'blockquote' => array( 'title' => __('Blockquote (Alt+Shift+Q)'), 'onclick' => 'fullscreen.blockquote();', 'both' => false ),
     1785        'image' => array( 'title' => __('Insert/edit image (Alt + Shift + M)'), 'onclick' => "jQuery('#add_image').click();", 'both' => true ),
     1786        '2' => 'separator',
     1787        'link' => array( 'title' => __('Insert/edit link (Alt + Shift + A)'), 'onclick' => 'fullscreen.link();', 'both' => true ),
     1788        'unlink' => array( 'title' => __('Unlink (Alt + Shift + S)'), 'onclick' => 'fullscreen.unlink();', 'both' => false ),
     1789        '3' => 'separator',
     1790        'help' => array( 'title' => __('Help (Alt + Shift + H)'), 'onclick' => 'fullscreen.help();', 'both' => false )
     1791    );
     1792
     1793    $buttons = apply_filters( 'wp_fullscreen_buttons', $buttons );
     1794
     1795    foreach ( $buttons as $button => $args ) {
     1796        if ( 'separator' == $args ) { ?>
     1797            <div><span aria-orientation="vertical" role="separator" class="mceSeparator"></span></div>
     1798<?php       continue;
     1799        } ?>
     1800
     1801        <div<?php if ( $args['both'] ) { ?> class="wp-fullscreen-both"<?php } ?>>
     1802        <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">
     1803        <span class="mceIcon mce_<?php echo $button; ?>"></span>
     1804        </a>
     1805        </div>
     1806<?php
     1807    } ?>
     1808
     1809        </div></div>
     1810
     1811        <div id="wp-fullscreen-save">
     1812            <span><?php if ( $post->post_status == 'publish' ) _e('Updated.'); else _e('Saved.'); ?></span>
     1813            <img src="images/wpspin_light.gif" alt="" />
     1814            <input type="button" class="button-primary" value="<?php echo $save; ?>" onclick="fullscreen.save();" />
     1815        </div>
     1816
     1817        </div>
    17101818    </div>
    1711 <?php }
     1819</div>
     1820
     1821<div id="wp-fullscreen-wrap" style="width:<?php echo $dfw_width; ?>px;">
     1822    <label id="wp-fullscreen-title-prompt-text" for="wp-fullscreen-title"><?php echo apply_filters( 'enter_title_here', __( 'Enter title here' ), $post ); ?></label>
     1823    <input type="text" id="wp-fullscreen-title" value="" autocomplete="off" />
     1824
     1825    <div id="wp-fullscreen-container">
     1826        <textarea id="wp_mce_fullscreen"></textarea>
     1827    </div>
     1828
     1829    <div id="wp-fullscreen-status">
     1830        <div id="wp-fullscreen-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></div>
     1831        <div id="wp-fullscreen-tagline"><?php _e('Just write.'); ?></div>
     1832    </div>
     1833</div>
     1834</div>
     1835
     1836<div class="fullscreen-overlay" id="fullscreen-overlay"></div>
     1837<div class="fullscreen-overlay fullscreen-fader fade-600" id="fullscreen-fader"></div>
     1838<?php
     1839}
     1840
     1841
Note: See TracChangeset for help on using the changeset viewer.