diff -r 34716fd837a4 -r be944660c56a wp/wp-admin/edit-form-advanced.php --- a/wp/wp-admin/edit-form-advanced.php Tue Dec 15 15:52:01 2020 +0100 +++ b/wp/wp-admin/edit-form-advanced.php Wed Sep 21 18:19:35 2022 +0200 @@ -44,22 +44,24 @@ $_wp_editor_expand = false; $_content_editor_dfw = false; -/** - * Filters 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 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, $post_type ) ) { - - wp_enqueue_script( 'editor-expand' ); - $_content_editor_dfw = true; - $_wp_editor_expand = ( 'on' === get_user_setting( 'editor_expand', 'on' ) ); +if ( post_type_supports( $post_type, 'editor' ) + && ! wp_is_mobile() + && ! ( $is_IE && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) ) +) { + /** + * Filters 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 string $post_type Post type. + */ + if ( apply_filters( 'wp_editor_expand', true, $post_type ) ) { + wp_enqueue_script( 'editor-expand' ); + $_content_editor_dfw = true; + $_wp_editor_expand = ( 'on' === get_user_setting( 'editor_expand', 'on' ) ); + } } if ( wp_is_mobile() ) { @@ -76,7 +78,7 @@ $user_ID = isset( $user_ID ) ? (int) $user_ID : 0; $action = isset( $action ) ? $action : ''; -if ( (int) get_option( 'page_for_posts' ) === $post_ID && empty( $post->post_content ) ) { +if ( (int) get_option( 'page_for_posts' ) === $post->ID && empty( $post->post_content ) ) { add_action( 'edit_form_after_title', '_wp_posts_page_notice' ); remove_post_type_support( $post_type, 'editor' ); } @@ -92,7 +94,7 @@ if ( $thumbnail_support ) { add_thickbox(); - wp_enqueue_media( array( 'post' => $post_ID ) ); + wp_enqueue_media( array( 'post' => $post->ID ) ); } // Add the local autosave notice HTML. @@ -101,7 +103,7 @@ /* * @todo Document the $messages array(s). */ -$permalink = get_permalink( $post_ID ); +$permalink = get_permalink( $post->ID ); if ( ! $permalink ) { $permalink = ''; } @@ -169,9 +171,9 @@ $scheduled_date = sprintf( /* translators: Publish box date string. 1: Date, 2: Time. */ __( '%1$s at %2$s' ), - /* translators: Publish box date format, see https://www.php.net/date */ + /* translators: Publish box date format, see https://www.php.net/manual/datetime.format.php */ date_i18n( _x( 'M j, Y', 'publish box date format' ), strtotime( $post->post_date ) ), - /* translators: Publish box time format, see https://www.php.net/date */ + /* translators: Publish box time format, see https://www.php.net/manual/datetime.format.php */ date_i18n( _x( 'H:i', 'publish box time format' ), strtotime( $post->post_date ) ) ); @@ -235,12 +237,12 @@ $autosave = false; $form_extra .= ""; } else { - $autosave = wp_get_post_autosave( $post_ID ); + $autosave = wp_get_post_autosave( $post->ID ); } $form_action = 'editpost'; -$nonce_action = 'update-post_' . $post_ID; -$form_extra .= ""; +$nonce_action = 'update-post_' . $post->ID; +$form_extra .= ""; // Detect if there exists an autosave newer than the post and if that autosave is different than the post. if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) { @@ -619,7 +621,7 @@ post_status ) { echo ''; - $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) ); + $last_user = get_userdata( get_post_meta( $post->ID, '_edit_last', true ) ); if ( $last_user ) { /* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time. */ printf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) );