rebase on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:23:21 -04:00
parent d37566ffb6
commit d096058d7d
4789 changed files with 254611 additions and 307223 deletions

View File

@@ -158,10 +158,10 @@ function get_sidebar( $name = null, $args = array() ) {
* @since 5.5.0 A return value was added.
* @since 5.5.0 The `$args` parameter was added.
*
* @param string $slug The slug name for the generic template.
* @param string $name The name of the specialized template.
* @param array $args Optional. Additional arguments passed to the template.
* Default empty array.
* @param string $slug The slug name for the generic template.
* @param string|null $name Optional. The name of the specialized template.
* @param array $args Optional. Additional arguments passed to the template.
* Default empty array.
* @return void|false Void on success, false if the template does not exist.
*/
function get_template_part( $slug, $name = null, $args = array() ) {
@@ -175,7 +175,8 @@ function get_template_part( $slug, $name = null, $args = array() ) {
* @since 5.5.0 The `$args` parameter was added.
*
* @param string $slug The slug name for the generic template.
* @param string|null $name The name of the specialized template.
* @param string|null $name The name of the specialized template or null if
* there is none.
* @param array $args Additional arguments passed to the template.
*/
do_action( "get_template_part_{$slug}", $slug, $name, $args );
@@ -195,7 +196,8 @@ function get_template_part( $slug, $name = null, $args = array() ) {
* @since 5.5.0 The `$args` parameter was added.
*
* @param string $slug The slug name for the generic template.
* @param string $name The name of the specialized template.
* @param string $name The name of the specialized template or an empty
* string if there is none.
* @param string[] $templates Array of template files to search for, in order.
* @param array $args Additional arguments passed to the template.
*/
@@ -652,7 +654,7 @@ function wp_lostpassword_url( $redirect = '' ) {
}
if ( is_multisite() ) {
$blog_details = get_blog_details();
$blog_details = get_site();
$wp_login_path = $blog_details->path . 'wp-login.php';
} else {
$wp_login_path = 'wp-login.php';
@@ -905,9 +907,11 @@ function get_bloginfo( $show = '', $filter = 'raw' ) {
}
$url = true;
if ( strpos( $show, 'url' ) === false &&
strpos( $show, 'directory' ) === false &&
strpos( $show, 'home' ) === false ) {
if ( ! str_contains( $show, 'url' )
&& ! str_contains( $show, 'directory' )
&& ! str_contains( $show, 'home' )
) {
$url = false;
}
@@ -956,7 +960,7 @@ function get_site_icon_url( $size = 512, $url = '', $blog_id = 0 ) {
$switched_blog = true;
}
$site_icon_id = get_option( 'site_icon' );
$site_icon_id = (int) get_option( 'site_icon' );
if ( $site_icon_id ) {
if ( $size >= 512 ) {
@@ -2054,10 +2058,10 @@ function wp_get_archives( $args = '' ) {
$query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date $order $limit";
$key = md5( $query );
$key = "wp_get_archives:$key:$last_changed";
$results = wp_cache_get( $key, 'posts' );
$results = wp_cache_get( $key, 'post-queries' );
if ( ! $results ) {
$results = $wpdb->get_results( $query );
wp_cache_set( $key, $results, 'posts' );
wp_cache_set( $key, $results, 'post-queries' );
}
if ( $results ) {
$after = $parsed_args['after'];
@@ -2079,10 +2083,10 @@ function wp_get_archives( $args = '' ) {
$query = "SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date $order $limit";
$key = md5( $query );
$key = "wp_get_archives:$key:$last_changed";
$results = wp_cache_get( $key, 'posts' );
$results = wp_cache_get( $key, 'post-queries' );
if ( ! $results ) {
$results = $wpdb->get_results( $query );
wp_cache_set( $key, $results, 'posts' );
wp_cache_set( $key, $results, 'post-queries' );
}
if ( $results ) {
$after = $parsed_args['after'];
@@ -2103,10 +2107,10 @@ function wp_get_archives( $args = '' ) {
$query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date $order $limit";
$key = md5( $query );
$key = "wp_get_archives:$key:$last_changed";
$results = wp_cache_get( $key, 'posts' );
$results = wp_cache_get( $key, 'post-queries' );
if ( ! $results ) {
$results = $wpdb->get_results( $query );
wp_cache_set( $key, $results, 'posts' );
wp_cache_set( $key, $results, 'post-queries' );
}
if ( $results ) {
$after = $parsed_args['after'];
@@ -2129,10 +2133,10 @@ function wp_get_archives( $args = '' ) {
$query = "SELECT DISTINCT $week AS `week`, YEAR( `post_date` ) AS `yr`, DATE_FORMAT( `post_date`, '%Y-%m-%d' ) AS `yyyymmdd`, count( `ID` ) AS `posts` FROM `$wpdb->posts` $join $where GROUP BY $week, YEAR( `post_date` ) ORDER BY `post_date` $order $limit";
$key = md5( $query );
$key = "wp_get_archives:$key:$last_changed";
$results = wp_cache_get( $key, 'posts' );
$results = wp_cache_get( $key, 'post-queries' );
if ( ! $results ) {
$results = $wpdb->get_results( $query );
wp_cache_set( $key, $results, 'posts' );
wp_cache_set( $key, $results, 'post-queries' );
}
$arc_w_last = '';
if ( $results ) {
@@ -2168,10 +2172,10 @@ function wp_get_archives( $args = '' ) {
$query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit";
$key = md5( $query );
$key = "wp_get_archives:$key:$last_changed";
$results = wp_cache_get( $key, 'posts' );
$results = wp_cache_get( $key, 'post-queries' );
if ( ! $results ) {
$results = $wpdb->get_results( $query );
wp_cache_set( $key, $results, 'posts' );
wp_cache_set( $key, $results, 'post-queries' );
}
if ( $results ) {
foreach ( (array) $results as $result ) {
@@ -2298,16 +2302,16 @@ function get_calendar( $initial = true, $display = true ) {
FROM $wpdb->posts
WHERE post_date < '$thisyear-$thismonth-01'
AND post_type = 'post' AND post_status = 'publish'
ORDER BY post_date DESC
LIMIT 1"
ORDER BY post_date DESC
LIMIT 1"
);
$next = $wpdb->get_row(
"SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
FROM $wpdb->posts
WHERE post_date > '$thisyear-$thismonth-{$last_day} 23:59:59'
AND post_type = 'post' AND post_status = 'publish'
ORDER BY post_date ASC
LIMIT 1"
ORDER BY post_date ASC
LIMIT 1"
);
/* translators: Calendar caption: 1: Month name, 2: 4-digit year. */
@@ -3094,11 +3098,11 @@ function feed_links( $args = array() ) {
}
$defaults = array(
/* translators: Separator between blog name and feed type in feed links. */
/* translators: Separator between site name and feed type in feed links. */
'separator' => _x( '&raquo;', 'feed link' ),
/* translators: 1: Blog title, 2: Separator (raquo). */
/* translators: 1: Site title, 2: Separator (raquo). */
'feedtitle' => __( '%1$s %2$s Feed' ),
/* translators: 1: Blog title, 2: Separator (raquo). */
/* translators: 1: Site title, 2: Separator (raquo). */
'comstitle' => __( '%1$s %2$s Comments Feed' ),
);
@@ -3146,21 +3150,21 @@ function feed_links( $args = array() ) {
*/
function feed_links_extra( $args = array() ) {
$defaults = array(
/* translators: Separator between blog name and feed type in feed links. */
/* translators: Separator between site name and feed type in feed links. */
'separator' => _x( '&raquo;', 'feed link' ),
/* translators: 1: Blog name, 2: Separator (raquo), 3: Post title. */
/* translators: 1: Site name, 2: Separator (raquo), 3: Post title. */
'singletitle' => __( '%1$s %2$s %3$s Comments Feed' ),
/* translators: 1: Blog name, 2: Separator (raquo), 3: Category name. */
/* translators: 1: Site name, 2: Separator (raquo), 3: Category name. */
'cattitle' => __( '%1$s %2$s %3$s Category Feed' ),
/* translators: 1: Blog name, 2: Separator (raquo), 3: Tag name. */
/* translators: 1: Site name, 2: Separator (raquo), 3: Tag name. */
'tagtitle' => __( '%1$s %2$s %3$s Tag Feed' ),
/* translators: 1: Blog name, 2: Separator (raquo), 3: Term name, 4: Taxonomy singular name. */
/* translators: 1: Site name, 2: Separator (raquo), 3: Term name, 4: Taxonomy singular name. */
'taxtitle' => __( '%1$s %2$s %3$s %4$s Feed' ),
/* translators: 1: Blog name, 2: Separator (raquo), 3: Author name. */
/* translators: 1: Site name, 2: Separator (raquo), 3: Author name. */
'authortitle' => __( '%1$s %2$s Posts by %3$s Feed' ),
/* translators: 1: Blog name, 2: Separator (raquo), 3: Search query. */
/* translators: 1: Site name, 2: Separator (raquo), 3: Search query. */
'searchtitle' => __( '%1$s %2$s Search Results for &#8220;%3$s&#8221; Feed' ),
/* translators: 1: Blog name, 2: Separator (raquo), 3: Post type name. */
/* translators: 1: Site name, 2: Separator (raquo), 3: Post type name. */
'posttypetitle' => __( '%1$s %2$s %3$s Feed' ),
);
@@ -3372,19 +3376,6 @@ function rsd_link() {
);
}
/**
* Displays the link to the Windows Live Writer manifest file.
*
* @link https://msdn.microsoft.com/en-us/library/bb463265.aspx
* @since 2.3.1
*/
function wlwmanifest_link() {
printf(
'<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="%s" />' . "\n",
includes_url( 'wlwmanifest.xml' )
);
}
/**
* Displays a referrer `strict-origin-when-cross-origin` meta tag.
*
@@ -3749,7 +3740,7 @@ function user_can_richedit() {
if ( $is_safari ) {
$wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && (int) $match[1] >= 534 );
} elseif ( $is_IE ) {
$wp_rich_edit = ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Trident/7.0;' ) !== false );
$wp_rich_edit = str_contains( $_SERVER['HTTP_USER_AGENT'], 'Trident/7.0;' );
} elseif ( $is_gecko || $is_chrome || $is_edge || ( $is_opera && ! wp_is_mobile() ) ) {
$wp_rich_edit = true;
}
@@ -4032,7 +4023,7 @@ function wp_get_code_editor_settings( $args ) {
if ( 'application/x-patch' === $type || 'text/x-patch' === $type ) {
$type = 'text/x-diff';
}
} elseif ( isset( $args['file'] ) && false !== strpos( basename( $args['file'] ), '.' ) ) {
} elseif ( isset( $args['file'] ) && str_contains( basename( $args['file'] ), '.' ) ) {
$extension = strtolower( pathinfo( $args['file'], PATHINFO_EXTENSION ) );
foreach ( wp_get_mime_types() as $exts => $mime ) {
if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) {
@@ -4168,7 +4159,7 @@ function wp_get_code_editor_settings( $args ) {
'matchBrackets' => true,
)
);
} elseif ( false !== strpos( $type, 'json' ) ) {
} elseif ( str_contains( $type, 'json' ) ) {
$settings['codemirror'] = array_merge(
$settings['codemirror'],
array(
@@ -4185,7 +4176,7 @@ function wp_get_code_editor_settings( $args ) {
} else {
$settings['codemirror']['mode']['json'] = true;
}
} elseif ( false !== strpos( $type, 'jsx' ) ) {
} elseif ( str_contains( $type, 'jsx' ) ) {
$settings['codemirror'] = array_merge(
$settings['codemirror'],
array(
@@ -4231,7 +4222,7 @@ function wp_get_code_editor_settings( $args ) {
'matchBrackets' => true,
)
);
} elseif ( false !== strpos( $type, 'xml' ) ) {
} elseif ( str_contains( $type, 'xml' ) ) {
$settings['codemirror'] = array_merge(
$settings['codemirror'],
array(
@@ -4873,7 +4864,7 @@ function wp_admin_css_uri( $file = 'wp-admin' ) {
*/
function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
// For backward compatibility.
$handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file;
$handle = str_starts_with( $file, 'css/' ) ? substr( $file, 4 ) : $file;
if ( wp_styles()->query( $handle ) ) {
if ( $force_echo || did_action( 'wp_print_styles' ) ) {