-
+
post_password ) ) echo esc_attr( $post->post_password );
+ $post = get_post();
+ if ( isset( $post->post_password ) )
+ echo esc_attr( $post->post_password );
}
/**
@@ -1336,13 +1484,14 @@ function the_post_password() {
* returned.
*
* @since 2.7.0
- * @param int $post_id The post id. If not supplied the global $post is used.
- * @return string The post title if set
+ *
+ * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
+ * @return string The post title if set.
*/
-function _draft_or_post_title( $post_id = 0 ) {
- $title = get_the_title($post_id);
- if ( empty($title) )
- $title = __('(no title)');
+function _draft_or_post_title( $post = 0 ) {
+ $title = get_the_title( $post );
+ if ( empty( $title ) )
+ $title = __( '(no title)' );
return $title;
}
@@ -1357,7 +1506,7 @@ function _draft_or_post_title( $post_id = 0 ) {
*
*/
function _admin_search_query() {
- echo isset($_REQUEST['s']) ? esc_attr( stripslashes( $_REQUEST['s'] ) ) : '';
+ echo isset($_REQUEST['s']) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : '';
}
/**
@@ -1375,6 +1524,7 @@ function iframe_header( $title = '', $limit_styles = false ) {
$current_screen = get_current_screen();
+ @header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
_wp_admin_html_begin();
?>
› —
@@ -1385,12 +1535,7 @@ wp_enqueue_style( 'colors' );
//',
- 'uid': 'ID; ?>',
- 'time':''
- },
- ajaxurl = '',
+var ajaxurl = '',
pagenow = 'id; ?>',
typenow = 'post_type; ?>',
adminpage = '',
@@ -1400,16 +1545,36 @@ var userSettings = {
//]]>
- class="wp-admin no-js iframe ">
+
+ class="wp-admin wp-core-ui no-js iframe ">
@@ -1460,7 +1634,16 @@ function _post_states($post) {
if ( is_sticky($post->ID) )
$post_states['sticky'] = __('Sticky');
- $post_states = apply_filters( 'display_post_states', $post_states );
+ /**
+ * Filter the default post display states used in the Posts list table.
+ *
+ * @since 2.8.0
+ *
+ * @param array $post_states An array of post display states. Values include 'Password protected',
+ * 'Private', 'Draft', 'Pending', and 'Sticky'.
+ * @param int $post The post ID.
+ */
+ $post_states = apply_filters( 'display_post_states', $post_states, $post );
if ( ! empty($post_states) ) {
$state_count = count($post_states);
@@ -1473,8 +1656,6 @@ function _post_states($post) {
}
}
- if ( get_post_format( $post->ID ) )
- echo ' -
' . get_post_format_string( get_post_format( $post->ID ) ) . '';
}
function _media_states( $post ) {
@@ -1493,6 +1674,14 @@ function _media_states( $post ) {
$media_states[] = __( 'Background Image' );
}
+ /**
+ * Filter the default media display states for items in the Media list table.
+ *
+ * @since 3.2.0
+ *
+ * @param array $media_states An array of media states. Default 'Header Image',
+ * 'Background Image'.
+ */
$media_states = apply_filters( 'display_media_states', $media_states );
if ( ! empty( $media_states ) ) {
@@ -1573,23 +1762,28 @@ function compression_test() {
}
/**
- * Echos a submit button, with provided text and appropriate class
+ * Echoes a submit button, with provided text and appropriate class(es).
*
* @since 3.1.0
*
- * @param string $text The text of the button (defaults to 'Save Changes')
- * @param string $type The type of button. One of: primary, secondary, delete
- * @param string $name The HTML name of the submit button. Defaults to "submit". If no id attribute
- * is given in $other_attributes below, $name will be used as the button's id.
- * @param bool $wrap True if the output button should be wrapped in a paragraph tag,
- * false otherwise. Defaults to true
- * @param array|string $other_attributes Other attributes that should be output with the button,
- * mapping attributes to their values, such as array( 'tabindex' => '1' ).
- * These attributes will be output as attribute="value", such as tabindex="1".
- * Defaults to no other attributes. Other attributes can also be provided as a
- * string such as 'tabindex="1"', though the array format is typically cleaner.
+ * @see get_submit_button()
+ *
+ * @param string $text The text of the button (defaults to 'Save Changes')
+ * @param string $type Optional. The type and CSS class(es) of the button. Core values
+ * include 'primary', 'secondary', 'delete'. Default 'primary'
+ * @param string $name The HTML name of the submit button. Defaults to "submit". If no
+ * id attribute is given in $other_attributes below, $name will be
+ * used as the button's id.
+ * @param bool $wrap True if the output button should be wrapped in a paragraph tag,
+ * false otherwise. Defaults to true
+ * @param array|string $other_attributes Other attributes that should be output with the button, mapping
+ * attributes to their values, such as setting tabindex to 1, etc.
+ * These key/value attribute pairs will be output as attribute="value",
+ * where attribute is the key. Other attributes can also be provided
+ * as a string such as 'tabindex="1"', though the array format is
+ * preferred. Default null.
*/
-function submit_button( $text = NULL, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = NULL ) {
+function submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null ) {
echo get_submit_button( $text, $type, $name, $wrap, $other_attributes );
}
@@ -1610,19 +1804,23 @@ function submit_button( $text = NULL, $type = 'primary', $name = 'submit', $wrap
* Defaults to no other attributes. Other attributes can also be provided as a
* string such as 'tabindex="1"', though the array format is typically cleaner.
*/
-function get_submit_button( $text = NULL, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = NULL ) {
- switch ( $type ) :
- case 'primary' :
- case 'secondary' :
- $class = 'button-' . $type;
- break;
- case 'delete' :
- $class = 'button-secondary delete';
- break;
- default :
- $class = $type; // Custom cases can just pass in the classes they want to be used
- endswitch;
- $text = ( NULL == $text ) ? __( 'Save Changes' ) : $text;
+function get_submit_button( $text = null, $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = null ) {
+ if ( ! is_array( $type ) )
+ $type = explode( ' ', $type );
+
+ $button_shorthand = array( 'primary', 'small', 'large' );
+ $classes = array( 'button' );
+ foreach ( $type as $t ) {
+ if ( 'secondary' === $t || 'button-secondary' === $t )
+ continue;
+ $classes[] = in_array( $t, $button_shorthand ) ? 'button-' . $t : $t;
+ }
+ $class = implode( ' ', array_unique( $classes ) );
+
+ if ( 'delete' === $type )
+ $class = 'button-secondary delete';
+
+ $text = $text ? $text : __( 'Save Changes' );
// Default the id attribute to $name unless an id was specifically provided in $other_attributes
$id = $name;
@@ -1651,13 +1849,26 @@ function get_submit_button( $text = NULL, $type = 'primary', $name = 'submit', $
}
function _wp_admin_html_begin() {
+ global $is_IE;
+
+ $admin_html_class = ( is_admin_bar_showing() ) ? 'wp-toolbar' : '';
+
+ if ( $is_IE )
+ @header('X-UA-Compatible: IE=edge');
+
+/**
+ * Fires inside the HTML tag in the admin header.
+ *
+ * @since 2.2.0
+ */
?>
- >
+
+ >
@@ -1673,8 +1884,8 @@ final class WP_Internal_Pointers {
* All pointers can be disabled using the following:
* remove_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts' ) );
*
- * Individual pointers (e.g. wp330_toolbar) can be disabled using the following:
- * remove_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_wp330_toolbar' ) );
+ * Individual pointers (e.g. wp390_widgets) can be disabled using the following:
+ * remove_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_wp390_widgets' ) );
*/
public static function enqueue_scripts( $hook_suffix ) {
/*
@@ -1683,39 +1894,43 @@ final class WP_Internal_Pointers {
*/
$registered_pointers = array(
- 'index.php' => 'wp330_toolbar',
- 'post-new.php' => 'wp330_media_uploader',
- 'post.php' => 'wp330_media_uploader',
- 'themes.php' => 'wp330_saving_widgets',
+ 'post-new.php' => 'wp350_media',
+ 'post.php' => array( 'wp350_media', 'wp360_revisions' ),
+ 'edit.php' => 'wp360_locks',
+ 'widgets.php' => 'wp390_widgets',
+ 'themes.php' => 'wp390_widgets',
);
// Check if screen related pointer is registered
if ( empty( $registered_pointers[ $hook_suffix ] ) )
return;
- $pointer = $registered_pointers[ $hook_suffix ];
+ $pointers = (array) $registered_pointers[ $hook_suffix ];
$caps_required = array(
- 'wp330_media_uploader' => array( 'upload_files' ),
- 'wp330_saving_widgets' => array( 'edit_theme_options', 'switch_themes' ),
+ 'wp350_media' => array( 'upload_files' ),
+ 'wp390_widgets' => array( 'edit_theme_options' ),
);
- if ( isset( $caps_required[ $pointer ] ) ) {
- foreach ( $caps_required[ $pointer ] as $cap ) {
- if ( ! current_user_can( $cap ) )
- return;
- }
- }
-
// Get dismissed pointers
$dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
- // Pointer has been dismissed
- if ( in_array( $pointer, $dismissed ) )
- return;
+ $got_pointers = false;
+ foreach ( array_diff( $pointers, $dismissed ) as $pointer ) {
+ if ( isset( $caps_required[ $pointer ] ) ) {
+ foreach ( $caps_required[ $pointer ] as $cap ) {
+ if ( ! current_user_can( $cap ) )
+ continue 2;
+ }
+ }
+
+ // Bind pointer print function
+ add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) );
+ $got_pointers = true;
+ }
- // Bind pointer print function
- add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) );
+ if ( ! $got_pointers )
+ return;
// Add pointers script and style to queue
wp_enqueue_style( 'wp-pointer' );
@@ -1729,7 +1944,7 @@ final class WP_Internal_Pointers {
*
* @param string $pointer_id The pointer ID.
* @param string $selector The HTML elements, on which the pointer should be attached.
- * @param array $args Arguments to be passed to the pointer JS (see wp-pointer.dev.js).
+ * @param array $args Arguments to be passed to the pointer JS (see wp-pointer.js).
*/
private static function print_js( $pointer_id, $selector, $args ) {
if ( empty( $pointer_id ) || empty( $selector ) || empty( $args ) || empty( $args['content'] ) )
@@ -1738,8 +1953,8 @@ final class WP_Internal_Pointers {
?>
' . esc_js( __( 'New Feature: Toolbar' ) ). '';
- $content .= '
' . esc_js( __( 'We’ve combined the admin bar and the old Dashboard header into one persistent toolbar. Hover over the toolbar items to see what’s new.' ) ) . '
';
+ public static function pointer_wp330_toolbar() {}
+ public static function pointer_wp330_media_uploader() {}
+ public static function pointer_wp330_saving_widgets() {}
+ public static function pointer_wp340_customize_current_theme_link() {}
+ public static function pointer_wp340_choose_image_from_library() {}
- if ( is_multisite() && is_super_admin() )
- $content .= '
' .esc_js( __( 'Network Admin is now located in the My Sites menu.' ) ) . '
';
+ public static function pointer_wp350_media() {
+ $content = '
' . __( 'New Media Manager' ) . '
';
+ $content .= '
' . __( 'Uploading files and creating image galleries has a whole new look. Check it out!' ) . '
';
- WP_Internal_Pointers::print_js( 'wp330_toolbar', '#wpadminbar', array(
+ self::print_js( 'wp350_media', '.insert-media', array(
'content' => $content,
- 'position' => array( 'edge' => 'top', 'align' => 'center' ),
+ 'position' => array( 'edge' => is_rtl() ? 'right' : 'left', 'align' => 'center' ),
) );
}
- /**
- * Print 'Updated Media Uploader' for 3.3.0.
- *
- * @since 3.3.0
- */
- public static function pointer_wp330_media_uploader() {
- $content = '
' . esc_js( __( 'Updated Media Uploader' ) ) . '
';
- $content .= '
' . esc_js( __( 'The single media icon now launches the uploader for all file types, and the new drag and drop interface makes uploading a breeze.' ) ) . '
';
+ public static function pointer_wp360_revisions() {
+ $content = '
' . __( 'Compare Revisions' ) . '
';
+ $content .= '
' . __( 'View, compare, and restore other versions of this content on the improved revisions screen.' ) . '
';
- WP_Internal_Pointers::print_js( 'wp330_media_uploader', '#content-add_media', array(
- 'content' => $content,
- 'position' => array( 'edge' => is_rtl() ? 'right' : 'left', 'align' => 'center' ),
+ self::print_js( 'wp360_revisions', '.misc-pub-section.misc-pub-revisions', array(
+ 'content' => $content,
+ 'position' => array( 'edge' => is_rtl() ? 'left' : 'right', 'align' => 'center' ),
) );
}
- /**
- * Print 'New Feature: Saving Widgets' for 3.3.0.
- *
- * @since 3.3.0
- */
- public static function pointer_wp330_saving_widgets() {
- $content = '
' . esc_js( __( 'New Feature: Saving Widgets' ) ) . '
';
- $content .= '
' . esc_js( __( 'If you change your mind and revert to your previous theme, we’ll put the widgets back the way you had them.' ) ) . '
';
+ public static function pointer_wp360_locks() {
+ if ( ! is_multi_author() ) {
+ return;
+ }
- WP_Internal_Pointers::print_js( 'wp330_saving_widgets', '#message2', array(
- 'content' => $content,
- 'position' => array( 'edge' => 'top', 'align' => is_rtl() ? 'right' : 'left' ),
+ $content = '
' . __( 'Edit Lock' ) . '
';
+ $content .= '
' . __( 'Someone else is editing this. No need to refresh; the lock will disappear when they’re done.' ) . '
';
+
+ self::print_js( 'wp360_locks', 'tr.wp-locked .locked-indicator', array(
+ 'content' => $content,
+ 'position' => array( 'edge' => 'left', 'align' => 'left' ),
+ ) );
+ }
+
+ public static function pointer_wp390_widgets() {
+ if ( ! current_theme_supports( 'widgets' ) ) {
+ return;
+ }
+
+ $content = '
' . __( 'New Feature: Live Widget Previews' ) . '
';
+ $content .= '
' . __( 'Add, edit, and play around with your widgets from the theme customizer.' ) . ' ' . __( 'Preview your changes in real-time and only save them when you’re ready.' ) . '
';
+
+ if ( 'themes' === get_current_screen()->id ) {
+ $selector = '.theme.active .customize';
+ $position = array( 'edge' => is_rtl() ? 'right' : 'left', 'align' => 'center' );
+ } else {
+ $selector = 'a[href="customize.php"]';
+ if ( is_rtl() ) {
+ $position = array( 'edge' => 'right', 'align' => 'center', 'my' => 'right-5px' );
+ } else {
+ $position = array( 'edge' => 'left', 'align' => 'center', 'my' => 'left-5px' );
+ }
+ }
+
+ self::print_js( 'wp390_widgets', $selector, array(
+ 'content' => $content,
+ 'position' => $position,
) );
}
@@ -1809,7 +2055,7 @@ final class WP_Internal_Pointers {
* @since 3.3.0
*/
public static function dismiss_pointers_for_new_users( $user_id ) {
- add_user_meta( $user_id, 'dismissed_wp_pointers', 'wp330_toolbar,wp330_media_uploader,wp330_saving_widgets' );
+ add_user_meta( $user_id, 'dismissed_wp_pointers', 'wp350_media,wp360_revisions,wp360_locks,wp390_widgets' );
}
}
@@ -1831,4 +2077,81 @@ function convert_to_screen( $hook_name ) {
}
return WP_Screen::get( $hook_name );
-}
\ No newline at end of file
+}
+
+/**
+ * Output the HTML for restoring the post data from DOM storage
+ *
+ * @since 3.6.0
+ * @access private
+ */
+function _local_storage_notice() {
+ ?>
+
+ 0,
+ 'type' => 'rating',
+ 'number' => 0,
+ );
+ $r = wp_parse_args( $args, $defaults );
+
+ // Non-english decimal places when the $rating is coming from a string
+ $rating = str_replace( ',', '.', $r['rating'] );
+
+ // Convert Percentage to star rating, 0..5 in .5 increments
+ if ( 'percent' == $r['type'] ) {
+ $rating = round( $rating / 10, 0 ) / 2;
+ }
+
+ // Calculate the number of each type of star needed
+ $full_stars = floor( $rating );
+ $half_stars = ceil( $rating - $full_stars );
+ $empty_stars = 5 - $full_stars - $half_stars;
+
+ if ( $r['number'] ) {
+ /* translators: 1: The rating, 2: The number of ratings */
+ $format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $r['number'] );
+ $title = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $r['number'] ) );
+ } else {
+ /* translators: 1: The rating */
+ $title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) );
+ }
+
+ echo '
';
+ echo '
' . $title . '';
+ echo str_repeat( '
', $full_stars );
+ echo str_repeat( '
', $half_stars );
+ echo str_repeat( '
', $empty_stars);
+ echo '
';
+}