Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r18254 r18023  
    2626    if ( $update )
    2727        $post_data['ID'] = (int) $post_data['post_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 
     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'] : '';
    3831    if ( isset($post_data['trackback_url']) )
    3932        $post_data['to_ping'] = $post_data['trackback_url'];
     
    1005998    $q['post_type'] = 'attachment';
    1006999    $post_type = get_post_type_object( 'attachment' );
    1007     $states = 'inherit';
     1000    $states = array( 'inherit' );
    10081001    if ( current_user_can( $post_type->cap->read_private_posts ) )
    1009         $states .= ',private';
     1002        $states[] = 'private';
    10101003
    10111004    $q['post_status'] = isset( $q['status'] ) && 'trash' == $q['status'] ? 'trash' : $states;
     
    10371030
    10381031/**
    1039  * Returns the list of classes to be used by a metabox
     1032 * {@internal Missing Short Description}}
    10401033 *
    10411034 * @uses get_user_option()
     
    10471040 */
    10481041function postbox_classes( $id, $page ) {
    1049     if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id ) {
    1050         $classes = array( '' );
    1051     } elseif ( $closed = get_user_option('closedpostboxes_'.$page ) ) {
     1042    if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id )
     1043        return '';
     1044
     1045    if ( $closed = get_user_option('closedpostboxes_'.$page ) ) {
    10521046        if ( !is_array( $closed ) ) {
    1053             $classes = array( '' );
    1054         } else {
    1055             $classes = in_array( $id, $closed ) ? array( 'closed' ) : array( '' );
    1056         }
     1047            return '';
     1048        }
     1049        return in_array( $id, $closed )? 'closed' : '';
    10571050    } else {
    1058         $classes = array( '' );
    1059     }
    1060 
    1061     $classes = apply_filters( "postbox_classes_{$page}_{$id}", $classes );
    1062     return implode( ' ', $classes );
     1051        return '';
     1052    }
    10631053}
    10641054
     
    11111101        $uri = strrev( stristr( strrev( $uri ), '/' ) );
    11121102        $uri = untrailingslashit($uri);
    1113         $uri = apply_filters( 'editable_slug', $uri );
    11141103        if ( !empty($uri) )
    11151104            $uri .= '/';
     
    14301419        $ext_plugins = '';
    14311420    } else {
    1432         $plugins = array( 'inlinepopups', 'spellchecker', 'tabfocus', 'paste', 'media', 'wordpress', 'wpfullscreen', 'wpeditimage', 'wpgallery', 'wplink', 'wpdialogs' );
     1421        $plugins = array( 'inlinepopups', 'spellchecker', 'paste', 'wordpress', 'fullscreen', 'wpeditimage', 'wpgallery', 'tabfocus', 'wplink', 'wpdialogs' );
    14331422
    14341423        /*
     
    15711560        'remove_linebreaks' => true,
    15721561        'gecko_spellcheck' => true,
    1573         'keep_styles' => false,
    15741562        'entities' => '38,amp,60,lt,62,gt',
    15751563        'accessibility_focus' => true,
     
    15801568        'paste_strip_class_attributes' => 'all',
    15811569        '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',
    15831570        'wpeditimage_disable_captions' => $no_captions,
    1584         'wp_fullscreen_content_css' => "$baseurl/plugins/wpfullscreen/css/wp-fullscreen.css",
    15851571        'plugins' => implode( ',', $plugins ),
    15861572    );
     
    16371623
    16381624    $compressed = $compress_scripts && $concatenate_scripts && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
    1639         && false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip');
     1625        && false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip');
    16401626
    16411627    /**
     
    16581644            $mce_options .= $k . ':' . $val . ', ';
    16591645            continue;
    1660         } elseif ( !empty($v) && is_string($v) && ( ('{' == $v{0} && '}' == $v{strlen($v) - 1}) || ('[' == $v{0} && ']' == $v{strlen($v) - 1}) || preg_match('/^\(?function ?\(/', $v) ) ) {
     1646        } elseif ( !empty($v) && is_string($v) && ( '{' == $v{0} || '[' == $v{0} ) ) {
    16611647            $mce_options .= $k . ':' . $v . ', ';
    16621648            continue;
     
    16661652    }
    16671653
    1668     $mce_options = rtrim( trim($mce_options), '\n\r,' );
    1669 
    1670     do_action('before_wp_tiny_mce', $initArray); ?>
     1654    $mce_options = rtrim( trim($mce_options), '\n\r,' ); ?>
    16711655
    16721656<script type="text/javascript">
     
    17091693<?php
    17101694
    1711 do_action('after_wp_tiny_mce', $initArray);
    1712 }
    1713 
    1714 // Load additional inline scripts based on active plugins.
    1715 function wp_preload_dialogs($init) {
    1716     $plugins = preg_split('/[ ,-]+/', $init['plugins']);
    1717 
    1718     if ( in_array( 'wpdialogs', $plugins, true ) ) {
    1719         wp_print_scripts('wpdialogs-popup');
     1695    // Load additional inline scripts based on active plugins.
     1696    if ( in_array( 'wpdialogs', $plugins ) ) {
     1697        wp_print_scripts( array( 'wpdialogs-popup' ) );
    17201698        wp_print_styles('wp-jquery-ui-dialog');
    17211699    }
    1722 
    1723     if ( in_array( 'wplink', $plugins, true ) ) {
     1700    if ( in_array( 'wplink', $plugins ) ) {
    17241701        require_once ABSPATH . 'wp-admin/includes/internal-linking.php';
    1725         ?><div style="display:none;"><?php wp_link_dialog(); ?></div><?php
     1702        add_action('tiny_mce_preload_dialogs', 'wp_link_dialog');
    17261703        wp_print_scripts('wplink');
    17271704        wp_print_styles('wplink');
    17281705    }
    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 
    1739 function 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 
    1750 function wp_print_editor_js() {
    1751     wp_print_scripts('editor');
    1752 }
    1753 
    1754 function 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>
     1706}
     1707function wp_tiny_mce_preload_dialogs() { ?>
     1708    <div id="preloaded-dialogs" style="display:none;">
     1709<?php   do_action('tiny_mce_preload_dialogs'); ?>
    18181710    </div>
    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 
     1711<?php }
Note: See TracChangeset for help on using the changeset viewer.