]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/edit-form-advanced.php
WordPress 4.1.2-scripts
[autoinstalls/wordpress.git] / wp-admin / edit-form-advanced.php
index ebda7a3f69d2b4f0741f1ce48a7972beeddf99ed..a9222ce6fc22b5b0342e6d894c407eb7fb807e9d 100644 (file)
@@ -11,20 +11,23 @@ if ( !defined('ABSPATH') )
        die('-1');
 
 wp_enqueue_script('post');
-$_wp_editor_expand = false;
+$_wp_editor_expand = $_content_editor_dfw = false;
 
 /**
  * Filter whether to enable the 'expand' functionality in the post editor.
  *
  * @since 4.0.0
+ * @since 4.1.0 Added the `$post_type` parameter.
  *
- * @param bool $expand Whether to enable the 'expand' functionality. Default true.
+ * @param bool   $expand    Whether to enable the 'expand' functionality. Default true.
+ * @param string $post_type Post type.
  */
 if ( post_type_supports( $post_type, 'editor' ) && ! wp_is_mobile() &&
         ! ( $is_IE && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) ) &&
-        apply_filters( 'wp_editor_expand', true ) ) {
+        apply_filters( 'wp_editor_expand', true, $post_type ) ) {
 
        wp_enqueue_script('editor-expand');
+       $_content_editor_dfw = true;
        $_wp_editor_expand = ( get_user_setting( 'editor_expand', 'on' ) === 'on' );
 }
 
@@ -241,7 +244,7 @@ do_action( 'add_meta_boxes', $post_type, $post );
 /**
  * Fires after all built-in meta boxes have been added, contextually for the given post type.
  *
- * The dynamic portion of the hook, $post_type, refers to the post type of the post.
+ * The dynamic portion of the hook, `$post_type`, refers to the post type of the post.
  *
  * @since 3.0.0
  *
@@ -278,7 +281,11 @@ if ( 'post' == $post_type ) {
        ) );
 
        $title_and_editor  = '<p>' . __('<strong>Title</strong> - Enter a title for your post. After you enter a title, you&#8217;ll see the permalink below, which you can edit.') . '</p>';
-       $title_and_editor .= '<p>' . __('<strong>Post editor</strong> - Enter the text for your post. There are two modes of editing: Visual and Text. Choose the mode by clicking on the appropriate tab. Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. The Text mode allows you to enter HTML along with your post text. Line breaks will be converted to paragraphs automatically. You can insert media files by clicking the icons above the post editor and following the directions. You can go to the distraction-free writing screen via the Fullscreen icon in Visual mode (second to last in the top row) or the Fullscreen button in Text mode (last in the row). Once there, you can make buttons visible by hovering over the top area. Exit Fullscreen back to the regular post editor.') . '</p>';
+       $title_and_editor .= '<p>' . __( '<strong>Post editor</strong> - Enter the text for your post. There are two modes of editing: Visual and Text. Choose the mode by clicking on the appropriate tab.' ) . '</p>';
+       $title_and_editor .= '<p>' . __( 'Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. ') . '</p>';
+       $title_and_editor .= '<p>' . __( 'The Text mode allows you to enter HTML along with your post text. Line breaks will be converted to paragraphs automatically.' ) . '</p>';
+       $title_and_editor .= '<p>' . __( 'You can insert media files by clicking the icons above the post editor and following the directions. You can align or edit images using the inline formatting toolbar available in Visual mode.' ) . '</p>';
+       $title_and_editor .= '<p>' . __( 'You can enable distraction-free writing mode using the icon to the right. This feature is not available for old browsers or devices with small screens, and requires that the full-height editor be enabled in Screen Options.' ) . '</p>';
        $title_and_editor .= '<p>' . __( 'Keyboard users: When you&#8217;re working in the visual editor, you can use <kbd>Alt + F10</kbd> to access the toolbar.' ) . '</p>';
 
        get_current_screen()->add_help_tab( array(
@@ -388,7 +395,7 @@ if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create
        echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="add-new-h2">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
 ?></h2>
 <?php if ( $notice ) : ?>
-<div id="notice" class="error"><p id="has-newer-autosave"><?php echo $notice ?></p></div>
+<div id="notice" class="notice notice-warning"><p id="has-newer-autosave"><?php echo $notice ?></p></div>
 <?php endif; ?>
 <?php if ( $message ) : ?>
 <div id="message" class="updated"><p><?php echo $message; ?></p></div>
@@ -398,16 +405,16 @@ if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create
        <span class="hide-if-no-sessionstorage"><?php _e( 'We&#8217;re backing up this post in your browser, just in case.' ); ?></span>
        </p>
 </div>
-<?php
+<form name="post" action="post.php" method="post" id="post"<?php
 /**
- * Fires inside the post editor <form> tag.
+ * Fires inside the post editor form tag.
  *
  * @since 3.0.0
  *
  * @param WP_Post $post Post object.
  */
-?>
-<form name="post" action="post.php" method="post" id="post"<?php do_action( 'post_edit_form_tag', $post ); ?>>
+do_action( 'post_edit_form_tag', $post );
+?>>
 <?php wp_nonce_field($nonce_action); ?>
 <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" />
 <input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr( $form_action ) ?>" />
@@ -457,10 +464,21 @@ do_action( 'edit_form_top', $post ); ?>
         * @param string  $text Placeholder text. Default 'Enter title here'.
         * @param WP_Post $post Post object.
         */
+       $title_placeholder = apply_filters( 'enter_title_here', __( 'Enter title here' ), $post );
        ?>
-       <label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo apply_filters( 'enter_title_here', __( 'Enter title here' ), $post ); ?></label>
-       <input type="text" name="post_title" size="30" value="<?php echo esc_attr( htmlspecialchars( $post->post_title ) ); ?>" id="title" autocomplete="off" />
+       <label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo $title_placeholder; ?></label>
+       <input type="text" name="post_title" size="30" value="<?php echo esc_attr( htmlspecialchars( $post->post_title ) ); ?>" id="title" spellcheck="true" autocomplete="off" />
 </div>
+<?php
+/**
+ * Fires before the permalink field in the edit form.
+ *
+ * @since 4.1.0
+ *
+ * @param WP_Post $post Post object.
+ */
+do_action( 'edit_form_before_permalink', $post );
+?>
 <div class="inside">
 <?php
 $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : '';
@@ -502,9 +520,9 @@ if ( post_type_supports($post_type, 'editor') ) {
 <div id="postdivrich" class="postarea<?php if ( $_wp_editor_expand ) { echo ' wp-editor-expand'; } ?>">
 
 <?php wp_editor( $post->post_content, 'content', array(
-       'dfw' => true,
+       '_content_editor_dfw' => $_content_editor_dfw,
        'drag_drop_upload' => true,
-       'tabfocus_elements' => 'insert-media-button,save-post',
+       'tabfocus_elements' => 'content-html,save-post',
        'editor_height' => 300,
        'tinymce' => array(
                'resize' => false,
@@ -629,7 +647,7 @@ if ( post_type_supports( $post_type, 'comments' ) )
        wp_comment_reply();
 ?>
 
-<?php if ( post_type_supports( $post_type, 'title' ) && '' === $post->post_title ) : ?>
+<?php if ( ! wp_is_mobile() && post_type_supports( $post_type, 'title' ) && '' === $post->post_title ) : ?>
 <script type="text/javascript">
 try{document.post.title.focus();}catch(e){}
 </script>