From 0eff79af37728d731cb87ee77d48d86441c43394 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 17 Jul 2022 01:38:08 +0000 Subject: [PATCH] Coding Standards: Use a single input array on Permalink Settings screen. This reduces the amount of code to edit in case of any changes to the default permalink structures. Follow-up to [53706], [53710]. See #55647, #55498. Built from https://develop.svn.wordpress.org/trunk@53713 git-svn-id: http://core.svn.wordpress.org/trunk@53272 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/options-permalink.php | 38 ++++++++++++++-------------------- wp-includes/version.php | 2 +- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/wp-admin/options-permalink.php b/wp-admin/options-permalink.php index e3c5a058fd..604c75f3fb 100644 --- a/wp-admin/options-permalink.php +++ b/wp-admin/options-permalink.php @@ -238,49 +238,43 @@ if ( is_multisite() && ! is_subdomain_install() && is_main_site() $tag_base = preg_replace( '|^/?blog|', '', $tag_base ); } -$default_structures = array( - 0 => '', - 1 => $index_php_prefix . '/%year%/%monthnum%/%day%/%postname%/', - 2 => $index_php_prefix . '/%year%/%monthnum%/%postname%/', - 3 => $index_php_prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%', - 4 => $index_php_prefix . '/%postname%/', -); - $url_base = home_url( $blog_prefix . $index_php_prefix ); -$default_structure_inputs = array( - 0 => array( +$default_structures = array( + array( 'id' => 'plain', 'label' => __( 'Plain' ), + 'value' => '', 'example' => home_url( '/?p=123' ), - 'value' => $default_structures[0], ), - 1 => array( + array( 'id' => 'day-name', 'label' => __( 'Day and name' ), + 'value' => $index_php_prefix . '/%year%/%monthnum%/%day%/%postname%/', 'example' => $url_base . '/' . gmdate( 'Y/m/d' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/', - 'value' => $default_structures[1], ), - 2 => array( + array( 'id' => 'month-name', 'label' => __( 'Month and name' ), + 'value' => $index_php_prefix . '/%year%/%monthnum%/%postname%/', 'example' => $url_base . '/' . gmdate( 'Y/m' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/', - 'value' => $default_structures[2], ), - 3 => array( - 'id' => 'day-numeric', + array( + 'id' => 'numeric', 'label' => __( 'Numeric' ), + 'value' => $index_php_prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%', 'example' => $url_base . '/' . _x( 'archives', 'sample permalink base' ) . '/123', - 'value' => $default_structures[3], ), - 4 => array( + array( 'id' => 'post-name', 'label' => __( 'Post name' ), + 'value' => $index_php_prefix . '/%postname%/', 'example' => $url_base . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/', - 'value' => $default_structures[4], ), ); +$default_structure_values = wp_list_pluck( $default_structures, 'value' ); + $available_tags = array( /* translators: %s: Permalink structure tag. */ 'year' => __( '%s (The year of the post, four digits, for example 2004.)' ), @@ -336,7 +330,7 @@ printf(
- +
+ />
diff --git a/wp-includes/version.php b/wp-includes/version.php index d3d1b74d83..3e14e800f8 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-alpha-53712'; +$wp_version = '6.1-alpha-53713'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.