+ $hidden = $locked ? '' : ' hidden';
+
+ ?>
+ <div id="post-lock-dialog" class="notification-dialog-wrap<?php echo $hidden; ?>">
+ <div class="notification-dialog-background"></div>
+ <div class="notification-dialog">
+ <?php
+
+ if ( $locked ) {
+ $query_args = array();
+ if ( get_post_type_object( $post->post_type )->public ) {
+ if ( 'publish' == $post->post_status || $user->ID != $post->post_author ) {
+ // Latest content is in autosave
+ $nonce = wp_create_nonce( 'post_preview_' . $post->ID );
+ $query_args['preview_id'] = $post->ID;
+ $query_args['preview_nonce'] = $nonce;
+ }
+ }
+
+ $preview_link = get_preview_post_link( $post->ID, $query_args );
+
+ /**
+ * Filters whether to allow the post lock to be overridden.
+ *
+ * Returning a falsey value to the filter will disable the ability
+ * to override the post lock.
+ *
+ * @since 3.6.0
+ *
+ * @param bool $override Whether to allow overriding post locks. Default true.
+ * @param WP_Post $post Post object.
+ * @param WP_User $user User object.
+ */
+ $override = apply_filters( 'override_post_lock', true, $post, $user );
+ $tab_last = $override ? '' : ' wp-tab-last';
+
+ ?>
+ <div class="post-locked-message">
+ <div class="post-locked-avatar"><?php echo get_avatar( $user->ID, 64 ); ?></div>
+ <p class="currently-editing wp-tab-first" tabindex="0">
+ <?php
+ _e( 'This content is currently locked.' );
+ if ( $override )
+ printf( ' ' . __( 'If you take over, %s will be blocked from continuing to edit.' ), esc_html( $user->display_name ) );
+ ?>
+ </p>
+ <?php
+ /**
+ * Fires inside the post locked dialog before the buttons are displayed.
+ *
+ * @since 3.6.0
+ *
+ * @param WP_Post $post Post object.
+ */
+ do_action( 'post_locked_dialog', $post );
+ ?>
+ <p>
+ <a class="button" href="<?php echo esc_url( $sendback ); ?>"><?php echo $sendback_text; ?></a>
+ <?php if ( $preview_link ) { ?>
+ <a class="button<?php echo $tab_last; ?>" href="<?php echo esc_url( $preview_link ); ?>"><?php _e('Preview'); ?></a>
+ <?php
+ }
+
+ // Allow plugins to prevent some users overriding the post lock
+ if ( $override ) {
+ ?>
+ <a class="button button-primary wp-tab-last" href="<?php echo esc_url( add_query_arg( 'get-post-lock', '1', wp_nonce_url( get_edit_post_link( $post->ID, 'url' ), 'lock-post_' . $post->ID ) ) ); ?>"><?php _e('Take over'); ?></a>
+ <?php
+ }
+
+ ?>
+ </p>
+ </div>
+ <?php
+ } else {
+ ?>
+ <div class="post-taken-over">
+ <div class="post-locked-avatar"></div>
+ <p class="wp-tab-first" tabindex="0">
+ <span class="currently-editing"></span><br />
+ <span class="locked-saving hidden"><img src="<?php echo esc_url( admin_url( 'images/spinner-2x.gif' ) ); ?>" width="16" height="16" alt="" /> <?php _e( 'Saving revision…' ); ?></span>
+ <span class="locked-saved hidden"><?php _e('Your latest changes were saved as a revision.'); ?></span>
+ </p>
+ <?php
+ /**
+ * Fires inside the dialog displayed when a user has lost the post lock.
+ *
+ * @since 3.6.0
+ *
+ * @param WP_Post $post Post object.
+ */
+ do_action( 'post_lock_lost_dialog', $post );
+ ?>
+ <p><a class="button button-primary wp-tab-last" href="<?php echo esc_url( $sendback ); ?>"><?php echo $sendback_text; ?></a></p>
+ </div>
+ <?php
+ }
+
+ ?>
+ </div>
+ </div>
+ <?php