+<script type="text/javascript">
+//<![CDATA[
+addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
+function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_remove();}
+var userSettings = {
+ 'url': '<?php echo SITECOOKIEPATH; ?>',
+ 'uid': '<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>',
+ 'time':'<?php echo time() ?>'
+ },
+ ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>',
+ pagenow = '<?php echo $current_screen->id; ?>',
+ typenow = '<?php echo $current_screen->post_type; ?>',
+ adminpage = '<?php echo $admin_body_class; ?>',
+ thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
+ decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
+ isRtl = <?php echo (int) is_rtl(); ?>;
+//]]>
+</script>
+<?php
+do_action('admin_enqueue_scripts', $hook_suffix);
+do_action("admin_print_styles-$hook_suffix");
+do_action('admin_print_styles');
+do_action("admin_print_scripts-$hook_suffix");
+do_action('admin_print_scripts');
+do_action("admin_head-$hook_suffix");
+do_action('admin_head');
+?>
+</head>
+<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-admin no-js iframe <?php echo apply_filters( 'admin_body_class', '' ) . ' ' . $admin_body_class; ?>">
+<script type="text/javascript">
+//<![CDATA[
+(function(){
+var c = document.body.className;
+c = c.replace(/no-js/, 'js');
+document.body.className = c;
+})();
+//]]>
+</script>
+<?php
+}
+
+/**
+ * Generic Iframe footer for use with Thickbox
+ *
+ * @since 2.7.0
+ *
+ */
+function iframe_footer() {
+ //We're going to hide any footer output on iframe pages, but run the hooks anyway since they output Javascript or other needed content. ?>
+ <div class="hidden">
+<?php
+ do_action('admin_footer', '');
+ do_action('admin_print_footer_scripts'); ?>
+ </div>
+<script type="text/javascript">if(typeof wpOnload=="function")wpOnload();</script>
+</body>
+</html>
+<?php
+}
+
+function _post_states($post) {
+ $post_states = array();
+ if ( isset( $_REQUEST['post_status'] ) )
+ $post_status = $_REQUEST['post_status'];
+ else
+ $post_status = '';
+
+ if ( !empty($post->post_password) )
+ $post_states['protected'] = __('Password protected');
+ if ( 'private' == $post->post_status && 'private' != $post_status )
+ $post_states['private'] = __('Private');
+ if ( 'draft' == $post->post_status && 'draft' != $post_status )
+ $post_states['draft'] = __('Draft');
+ if ( 'pending' == $post->post_status && 'pending' != $post_status )
+ /* translators: post state */
+ $post_states['pending'] = _x('Pending', 'post state');
+ if ( is_sticky($post->ID) )
+ $post_states['sticky'] = __('Sticky');
+
+ $post_states = apply_filters( 'display_post_states', $post_states );
+
+ if ( ! empty($post_states) ) {
+ $state_count = count($post_states);
+ $i = 0;
+ echo ' - ';
+ foreach ( $post_states as $state ) {
+ ++$i;
+ ( $i == $state_count ) ? $sep = '' : $sep = ', ';
+ echo "<span class='post-state'>$state$sep</span>";
+ }
+ }
+
+ if ( get_post_format( $post->ID ) )
+ echo ' - <span class="post-state-format">' . get_post_format_string( get_post_format( $post->ID ) ) . '</span>';
+}
+
+function _media_states( $post ) {
+ $media_states = array();
+ $stylesheet = get_option('stylesheet');
+
+ if ( current_theme_supports( 'custom-header') ) {
+ $meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true );
+ if ( ! empty( $meta_header ) && $meta_header == $stylesheet )
+ $media_states[] = __( 'Header Image' );
+ }
+
+ if ( current_theme_supports( 'custom-background') ) {
+ $meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true );
+ if ( ! empty( $meta_background ) && $meta_background == $stylesheet )
+ $media_states[] = __( 'Background Image' );
+ }
+
+ $media_states = apply_filters( 'display_media_states', $media_states );
+
+ if ( ! empty( $media_states ) ) {
+ $state_count = count( $media_states );
+ $i = 0;
+ echo ' - ';
+ foreach ( $media_states as $state ) {
+ ++$i;
+ ( $i == $state_count ) ? $sep = '' : $sep = ', ';
+ echo "<span class='post-state'>$state$sep</span>";
+ }
+ }
+}
+
+/**
+ * Test support for compressing JavaScript from PHP
+ *
+ * Outputs JavaScript that tests if compression from PHP works as expected
+ * and sets an option with the result. Has no effect when the current user
+ * is not an administrator. To run the test again the option 'can_compress_scripts'
+ * has to be deleted.
+ *
+ * @since 2.8.0
+ */
+function compression_test() {
+?>
+ <script type="text/javascript">
+ /* <![CDATA[ */
+ var testCompression = {
+ get : function(test) {
+ var x;
+ if ( window.XMLHttpRequest ) {
+ x = new XMLHttpRequest();
+ } else {
+ try{x=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{x=new ActiveXObject('Microsoft.XMLHTTP');}catch(e){};}
+ }
+
+ if (x) {
+ x.onreadystatechange = function() {
+ var r, h;
+ if ( x.readyState == 4 ) {
+ r = x.responseText.substr(0, 18);
+ h = x.getResponseHeader('Content-Encoding');
+ testCompression.check(r, h, test);
+ }
+ }
+
+ x.open('GET', ajaxurl + '?action=wp-compression-test&test='+test+'&'+(new Date()).getTime(), true);
+ x.send('');
+ }
+ },
+
+ check : function(r, h, test) {
+ if ( ! r && ! test )
+ this.get(1);
+
+ if ( 1 == test ) {
+ if ( h && ( h.match(/deflate/i) || h.match(/gzip/i) ) )
+ this.get('no');
+ else
+ this.get(2);
+
+ return;
+ }
+
+ if ( 2 == test ) {
+ if ( '"wpCompressionTest' == r )
+ this.get('yes');
+ else
+ this.get('no');
+ }
+ }
+ };
+ testCompression.check();
+ /* ]]> */
+ </script>
+<?php
+}
+
+/**
+ * Echos a submit button, with provided text and appropriate class
+ *
+ * @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.
+ */
+function submit_button( $text = NULL, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = NULL ) {
+ echo get_submit_button( $text, $type, $name, $wrap, $other_attributes );
+}
+
+/**
+ * Returns a submit button, with provided text and appropriate class
+ *
+ * @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.
+ */
+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;
+
+ // Default the id attribute to $name unless an id was specifically provided in $other_attributes
+ $id = $name;
+ if ( is_array( $other_attributes ) && isset( $other_attributes['id'] ) ) {
+ $id = $other_attributes['id'];
+ unset( $other_attributes['id'] );
+ }
+
+ $attributes = '';
+ if ( is_array( $other_attributes ) ) {
+ foreach ( $other_attributes as $attribute => $value ) {
+ $attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important
+ }
+ } else if ( !empty( $other_attributes ) ) { // Attributes provided as a string
+ $attributes = $other_attributes;
+ }
+
+ $button = '<input type="submit" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class );
+ $button .= '" value="' . esc_attr( $text ) . '" ' . $attributes . ' />';
+
+ if ( $wrap ) {
+ $button = '<p class="submit">' . $button . '</p>';
+ }
+
+ return $button;
+}
+
+function _wp_admin_html_begin() {
+?>
+<!DOCTYPE html>
+<!--[if IE 8]>
+<html xmlns="http://www.w3.org/1999/xhtml" class="ie8" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
+<![endif]-->
+<!--[if !(IE 8) ]><!-->
+<html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
+<!--<![endif]-->
+<head>
+<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
+<?php
+}
+
+final class WP_Internal_Pointers {
+ /**
+ * Initializes the new feature pointers.
+ *
+ * @since 3.3.0
+ *
+ * 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' ) );
+ */
+ public static function enqueue_scripts( $hook_suffix ) {
+ /*
+ * Register feature pointers
+ * Format: array( hook_suffix => pointer_id )
+ */
+
+ $registered_pointers = array(
+ 'index.php' => 'wp330_toolbar',
+ 'post-new.php' => 'wp330_media_uploader',
+ 'post.php' => 'wp330_media_uploader',
+ 'themes.php' => 'wp330_saving_widgets',
+ );
+
+ // Check if screen related pointer is registered
+ if ( empty( $registered_pointers[ $hook_suffix ] ) )
+ return;
+
+ $pointer = $registered_pointers[ $hook_suffix ];
+
+ $caps_required = array(
+ 'wp330_media_uploader' => array( 'upload_files' ),
+ 'wp330_saving_widgets' => array( 'edit_theme_options', 'switch_themes' ),
+ );
+
+ 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;
+
+ // Bind pointer print function
+ add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) );
+
+ // Add pointers script and style to queue
+ wp_enqueue_style( 'wp-pointer' );
+ wp_enqueue_script( 'wp-pointer' );
+ }
+
+ /**
+ * Print the pointer javascript data.
+ *
+ * @since 3.3.0
+ *
+ * @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).
+ */
+ private static function print_js( $pointer_id, $selector, $args ) {
+ if ( empty( $pointer_id ) || empty( $selector ) || empty( $args ) || empty( $args['content'] ) )
+ return;
+
+ ?>
+ <script type="text/javascript">
+ //<![CDATA[
+ jQuery(document).ready( function($) {
+ var options = <?php echo json_encode( $args ); ?>;
+
+ if ( ! options )
+ return;
+
+ options = $.extend( options, {
+ close: function() {
+ $.post( ajaxurl, {
+ pointer: '<?php echo $pointer_id; ?>',
+ action: 'dismiss-wp-pointer'
+ });
+ }
+ });
+
+ $('<?php echo $selector; ?>').pointer( options ).pointer('open');
+ });
+ //]]>
+ </script>
+ <?php
+ }
+
+ public static function pointer_wp330_toolbar() {
+ $content = '<h3>' . __( 'New Feature: Toolbar' ) . '</h3>';
+ $content .= '<p>' . __( '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.' ) . '</p>';
+
+ if ( is_multisite() && is_super_admin() )
+ $content .= '<p>' . __( 'Network Admin is now located in the My Sites menu.' ) . '</p>';
+
+ WP_Internal_Pointers::print_js( 'wp330_toolbar', '#wpadminbar', array(
+ 'content' => $content,
+ 'position' => array( 'edge' => 'top', 'align' => 'center' ),
+ ) );
+ }
+
+ /**
+ * Print 'Updated Media Uploader' for 3.3.0.
+ *
+ * @since 3.3.0
+ */
+ public static function pointer_wp330_media_uploader() {
+ $content = '<h3>' . __( 'Updated Media Uploader' ) . '</h3>';
+ $content .= '<p>' . __( 'The single media icon now launches the uploader for all file types, and the new drag and drop interface makes uploading a breeze.' ) . '</p>';
+
+ WP_Internal_Pointers::print_js( 'wp330_media_uploader', '#content-add_media', array(
+ 'content' => $content,
+ 'position' => array( 'edge' => is_rtl() ? 'right' : 'left', 'align' => 'center' ),
+ ) );
+ }
+
+ /**
+ * Print 'New Feature: Saving Widgets' for 3.3.0.
+ *
+ * @since 3.3.0
+ */
+ public static function pointer_wp330_saving_widgets() {
+ $content = '<h3>' . __( 'New Feature: Saving Widgets' ) . '</h3>';
+ $content .= '<p>' . __( 'If you change your mind and revert to your previous theme, we’ll put the widgets back the way you had them.' ). '</p>';
+
+ WP_Internal_Pointers::print_js( 'wp330_saving_widgets', '#message2', array(
+ 'content' => $content,
+ 'position' => array( 'edge' => 'top', 'align' => is_rtl() ? 'right' : 'left' ),
+ ) );
+ }
+
+ /**
+ * Prevents new users from seeing existing 'new feature' 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_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts' ) );
+add_action( 'user_register', array( 'WP_Internal_Pointers', 'dismiss_pointers_for_new_users' ) );
+
+/**
+ * Convert a screen string to a screen object
+ *
+ * @since 3.0.0
+ *
+ * @param string $hook_name The hook name (also known as the hook suffix) used to determine the screen.
+ * @return WP_Screen Screen object.
+ */
+function convert_to_screen( $hook_name ) {
+ if ( ! class_exists( 'WP_Screen' ) ) {
+ _doing_it_wrong( 'convert_to_screen(), add_meta_box()', __( "Likely direct inclusion of wp-admin/includes/template.php in order to use add_meta_box(). This is very wrong. Hook the add_meta_box() call into the add_meta_boxes action instead." ), '3.3' );
+ return (object) array( 'id' => '_invalid', 'base' => '_are_belong_to_us' );
+ }
+
+ return WP_Screen::get( $hook_name );
+}
\ No newline at end of file