wp/wp-includes/general-template.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
    17  *
    17  *
    18  * @since 1.5.0
    18  * @since 1.5.0
    19  * @since 5.5.0 A return value was added.
    19  * @since 5.5.0 A return value was added.
    20  * @since 5.5.0 The `$args` parameter was added.
    20  * @since 5.5.0 The `$args` parameter was added.
    21  *
    21  *
    22  * @param string $name The name of the specialized header.
    22  * @param string|null $name The name of the specialized header. Default null.
    23  * @param array  $args Optional. Additional arguments passed to the header template.
    23  * @param array       $args Optional. Additional arguments passed to the header template.
    24  *                     Default empty array.
    24  *                          Default empty array.
    25  * @return void|false Void on success, false if the template does not exist.
    25  * @return void|false Void on success, false if the template does not exist.
    26  */
    26  */
    27 function get_header( $name = null, $args = array() ) {
    27 function get_header( $name = null, $args = array() ) {
    28 	/**
    28 	/**
    29 	 * Fires before the header template file is loaded.
    29 	 * Fires before the header template file is loaded.
    61  *
    61  *
    62  * @since 1.5.0
    62  * @since 1.5.0
    63  * @since 5.5.0 A return value was added.
    63  * @since 5.5.0 A return value was added.
    64  * @since 5.5.0 The `$args` parameter was added.
    64  * @since 5.5.0 The `$args` parameter was added.
    65  *
    65  *
    66  * @param string $name The name of the specialized footer.
    66  * @param string|null $name The name of the specialized footer. Default null.
    67  * @param array  $args Optional. Additional arguments passed to the footer template.
    67  * @param array       $args Optional. Additional arguments passed to the footer template.
    68  *                     Default empty array.
    68  *                          Default empty array.
    69  * @return void|false Void on success, false if the template does not exist.
    69  * @return void|false Void on success, false if the template does not exist.
    70  */
    70  */
    71 function get_footer( $name = null, $args = array() ) {
    71 function get_footer( $name = null, $args = array() ) {
    72 	/**
    72 	/**
    73 	 * Fires before the footer template file is loaded.
    73 	 * Fires before the footer template file is loaded.
   105  *
   105  *
   106  * @since 1.5.0
   106  * @since 1.5.0
   107  * @since 5.5.0 A return value was added.
   107  * @since 5.5.0 A return value was added.
   108  * @since 5.5.0 The `$args` parameter was added.
   108  * @since 5.5.0 The `$args` parameter was added.
   109  *
   109  *
   110  * @param string $name The name of the specialized sidebar.
   110  * @param string|null $name The name of the specialized sidebar. Default null.
   111  * @param array  $args Optional. Additional arguments passed to the sidebar template.
   111  * @param array       $args Optional. Additional arguments passed to the sidebar template.
   112  *                     Default empty array.
   112  *                          Default empty array.
   113  * @return void|false Void on success, false if the template does not exist.
   113  * @return void|false Void on success, false if the template does not exist.
   114  */
   114  */
   115 function get_sidebar( $name = null, $args = array() ) {
   115 function get_sidebar( $name = null, $args = array() ) {
   116 	/**
   116 	/**
   117 	 * Fires before the sidebar template file is loaded.
   117 	 * Fires before the sidebar template file is loaded.
   157  * @since 3.0.0
   157  * @since 3.0.0
   158  * @since 5.5.0 A return value was added.
   158  * @since 5.5.0 A return value was added.
   159  * @since 5.5.0 The `$args` parameter was added.
   159  * @since 5.5.0 The `$args` parameter was added.
   160  *
   160  *
   161  * @param string      $slug The slug name for the generic template.
   161  * @param string      $slug The slug name for the generic template.
   162  * @param string|null $name Optional. The name of the specialized template.
   162  * @param string|null $name Optional. The name of the specialized template. Default null.
   163  * @param array       $args Optional. Additional arguments passed to the template.
   163  * @param array       $args Optional. Additional arguments passed to the template.
   164  *                          Default empty array.
   164  *                          Default empty array.
   165  * @return void|false Void on success, false if the template does not exist.
   165  * @return void|false Void on success, false if the template does not exist.
   166  */
   166  */
   167 function get_template_part( $slug, $name = null, $args = array() ) {
   167 function get_template_part( $slug, $name = null, $args = array() ) {
   173 	 *
   173 	 *
   174 	 * @since 3.0.0
   174 	 * @since 3.0.0
   175 	 * @since 5.5.0 The `$args` parameter was added.
   175 	 * @since 5.5.0 The `$args` parameter was added.
   176 	 *
   176 	 *
   177 	 * @param string      $slug The slug name for the generic template.
   177 	 * @param string      $slug The slug name for the generic template.
   178 	 * @param string|null $name The name of the specialized template or null if
   178 	 * @param string|null $name The name of the specialized template
   179 	 *                          there is none.
   179 	 *                          or null if there is none.
   180 	 * @param array       $args Additional arguments passed to the template.
   180 	 * @param array       $args Additional arguments passed to the template.
   181 	 */
   181 	 */
   182 	do_action( "get_template_part_{$slug}", $slug, $name, $args );
   182 	do_action( "get_template_part_{$slug}", $slug, $name, $args );
   183 
   183 
   184 	$templates = array();
   184 	$templates = array();
   194 	 *
   194 	 *
   195 	 * @since 5.2.0
   195 	 * @since 5.2.0
   196 	 * @since 5.5.0 The `$args` parameter was added.
   196 	 * @since 5.5.0 The `$args` parameter was added.
   197 	 *
   197 	 *
   198 	 * @param string   $slug      The slug name for the generic template.
   198 	 * @param string   $slug      The slug name for the generic template.
   199 	 * @param string   $name      The name of the specialized template or an empty
   199 	 * @param string   $name      The name of the specialized template
   200 	 *                            string if there is none.
   200 	 *                            or an empty string if there is none.
   201 	 * @param string[] $templates Array of template files to search for, in order.
   201 	 * @param string[] $templates Array of template files to search for, in order.
   202 	 * @param array    $args      Additional arguments passed to the template.
   202 	 * @param array    $args      Additional arguments passed to the template.
   203 	 */
   203 	 */
   204 	do_action( 'get_template_part', $slug, $name, $templates, $args );
   204 	do_action( 'get_template_part', $slug, $name, $templates, $args );
   205 
   205 
  1116 				$html = sprintf(
  1116 				$html = sprintf(
  1117 					'<span class="custom-logo-link">%1$s</span>',
  1117 					'<span class="custom-logo-link">%1$s</span>',
  1118 					$image
  1118 					$image
  1119 				);
  1119 				);
  1120 			} else {
  1120 			} else {
  1121 				$aria_current = is_front_page() && ! is_paged() ? ' aria-current="page"' : '';
  1121 				$aria_current = ! is_paged() && ( is_front_page() || is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) ? ' aria-current="page"' : '';
  1122 
  1122 
  1123 				$html = sprintf(
  1123 				$html = sprintf(
  1124 					'<a href="%1$s" class="custom-logo-link" rel="home"%2$s>%3$s</a>',
  1124 					'<a href="%1$s" class="custom-logo-link" rel="home"%2$s>%3$s</a>',
  1125 					esc_url( home_url( '/' ) ),
  1125 					esc_url( home_url( '/' ) ),
  1126 					$aria_current,
  1126 					$aria_current,
  1297 }
  1297 }
  1298 
  1298 
  1299 /**
  1299 /**
  1300  * Displays title tag with content.
  1300  * Displays title tag with content.
  1301  *
  1301  *
  1302  * @ignore
       
  1303  * @since 4.1.0
  1302  * @since 4.1.0
  1304  * @since 4.4.0 Improved title output replaced `wp_title()`.
  1303  * @since 4.4.0 Improved title output replaced `wp_title()`.
  1305  * @access private
  1304  * @access private
  1306  */
  1305  */
  1307 function _wp_render_title_tag() {
  1306 function _wp_render_title_tag() {
  1915  * @param string $url      URL to archive.
  1914  * @param string $url      URL to archive.
  1916  * @param string $text     Archive text description.
  1915  * @param string $text     Archive text description.
  1917  * @param string $format   Optional. Can be 'link', 'option', 'html', or custom. Default 'html'.
  1916  * @param string $format   Optional. Can be 'link', 'option', 'html', or custom. Default 'html'.
  1918  * @param string $before   Optional. Content to prepend to the description. Default empty.
  1917  * @param string $before   Optional. Content to prepend to the description. Default empty.
  1919  * @param string $after    Optional. Content to append to the description. Default empty.
  1918  * @param string $after    Optional. Content to append to the description. Default empty.
  1920  * @param bool   $selected Optional. Set to true if the current page is the selected archive page.
  1919  * @param bool   $selected Optional. Set to true if the current page is the selected archive page. Default false.
  1921  * @return string HTML link content for archive.
  1920  * @return string HTML link content for archive.
  1922  */
  1921  */
  1923 function get_archives_link( $url, $text, $format = 'html', $before = '', $after = '', $selected = false ) {
  1922 function get_archives_link( $url, $text, $format = 'html', $before = '', $after = '', $selected = false ) {
  1924 	$text         = wptexturize( $text );
  1923 	$text         = wptexturize( $text );
  1925 	$url          = esc_url( $url );
  1924 	$url          = esc_url( $url );
  2153 		}
  2152 		}
  2154 		$arc_w_last = '';
  2153 		$arc_w_last = '';
  2155 		if ( $results ) {
  2154 		if ( $results ) {
  2156 			$after = $parsed_args['after'];
  2155 			$after = $parsed_args['after'];
  2157 			foreach ( (array) $results as $result ) {
  2156 			foreach ( (array) $results as $result ) {
  2158 				if ( $result->week != $arc_w_last ) {
  2157 				if ( $result->week !== $arc_w_last ) {
  2159 					$arc_year       = $result->yr;
  2158 					$arc_year       = $result->yr;
  2160 					$arc_w_last     = $result->week;
  2159 					$arc_w_last     = $result->week;
  2161 					$arc_week       = get_weekstartend( $result->yyyymmdd, get_option( 'start_of_week' ) );
  2160 					$arc_week       = get_weekstartend( $result->yyyymmdd, get_option( 'start_of_week' ) );
  2162 					$arc_week_start = date_i18n( get_option( 'date_format' ), $arc_week['start'] );
  2161 					$arc_week_start = date_i18n( get_option( 'date_format' ), $arc_week['start'] );
  2163 					$arc_week_end   = date_i18n( get_option( 'date_format' ), $arc_week['end'] );
  2162 					$arc_week_end   = date_i18n( get_option( 'date_format' ), $arc_week['end'] );
  2232  *
  2231  *
  2233  * The calendar is cached, which will be retrieved, if it exists. If there are
  2232  * The calendar is cached, which will be retrieved, if it exists. If there are
  2234  * no posts for the month, then it will not be displayed.
  2233  * no posts for the month, then it will not be displayed.
  2235  *
  2234  *
  2236  * @since 1.0.0
  2235  * @since 1.0.0
       
  2236  * @since 6.8.0 Added the `$args` parameter, with backward compatibility
       
  2237  *              for the replaced `$initial` and `$display` parameters.
  2237  *
  2238  *
  2238  * @global wpdb      $wpdb      WordPress database abstraction object.
  2239  * @global wpdb      $wpdb      WordPress database abstraction object.
  2239  * @global int       $m
  2240  * @global int       $m
  2240  * @global int       $monthnum
  2241  * @global int       $monthnum
  2241  * @global int       $year
  2242  * @global int       $year
  2242  * @global WP_Locale $wp_locale WordPress date and time locale object.
  2243  * @global WP_Locale $wp_locale WordPress date and time locale object.
  2243  * @global array     $posts
  2244  * @global array     $posts
  2244  *
  2245  *
  2245  * @param bool $initial Optional. Whether to use initial calendar names. Default true.
  2246  * @param array $args {
  2246  * @param bool $display Optional. Whether to display the calendar output. Default true.
  2247  *     Optional. Arguments for the `get_calendar` function.
       
  2248  *
       
  2249  *     @type bool   $initial   Whether to use initial calendar names. Default true.
       
  2250  *     @type bool   $display   Whether to display the calendar output. Default true.
       
  2251  *     @type string $post_type Optional. Post type. Default 'post'.
       
  2252  * }
  2247  * @return void|string Void if `$display` argument is true, calendar HTML if `$display` is false.
  2253  * @return void|string Void if `$display` argument is true, calendar HTML if `$display` is false.
  2248  */
  2254  */
  2249 function get_calendar( $initial = true, $display = true ) {
  2255 function get_calendar( $args = array() ) {
  2250 	global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
  2256 	global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
  2251 
  2257 
  2252 	$key   = md5( $m . $monthnum . $year );
  2258 	$defaults = array(
       
  2259 		'initial'   => true,
       
  2260 		'display'   => true,
       
  2261 		'post_type' => 'post',
       
  2262 	);
       
  2263 
       
  2264 	$original_args = func_get_args();
       
  2265 	$args          = array();
       
  2266 
       
  2267 	if ( ! empty( $original_args ) ) {
       
  2268 		if ( ! is_array( $original_args[0] ) ) {
       
  2269 			if ( isset( $original_args[0] ) && is_bool( $original_args[0] ) ) {
       
  2270 				$defaults['initial'] = $original_args[0];
       
  2271 			}
       
  2272 			if ( isset( $original_args[1] ) && is_bool( $original_args[1] ) ) {
       
  2273 				$defaults['display'] = $original_args[1];
       
  2274 			}
       
  2275 		} else {
       
  2276 			$args = $original_args[0];
       
  2277 		}
       
  2278 	}
       
  2279 
       
  2280 	/**
       
  2281 	 * Filter the `get_calendar` function arguments before they are used.
       
  2282 	 *
       
  2283 	 * @since 6.8.0
       
  2284 	 *
       
  2285 	 * @param array $args {
       
  2286 	 *     Optional. Arguments for the `get_calendar` function.
       
  2287 	 *
       
  2288 	 *     @type bool   $initial   Whether to use initial calendar names. Default true.
       
  2289 	 *     @type bool   $display   Whether to display the calendar output. Default true.
       
  2290 	 *     @type string $post_type Optional. Post type. Default 'post'.
       
  2291 	 * }
       
  2292 	 * @return array The arguments for the `get_calendar` function.
       
  2293 	 */
       
  2294 	$args = apply_filters( 'get_calendar_args', wp_parse_args( $args, $defaults ) );
       
  2295 
       
  2296 	if ( ! post_type_exists( $args['post_type'] ) ) {
       
  2297 		$args['post_type'] = 'post';
       
  2298 	}
       
  2299 
       
  2300 	$w = 0;
       
  2301 	if ( isset( $_GET['w'] ) ) {
       
  2302 		$w = (int) $_GET['w'];
       
  2303 	}
       
  2304 
       
  2305 	/*
       
  2306 	 * Normalize the cache key.
       
  2307 	 *
       
  2308 	 * The following ensures the same cache key is used for the same parameter
       
  2309 	 * and parameter equivalents. This prevents `post_type > post, initial > true`
       
  2310 	 * from generating a different key from the same values in the reverse order.
       
  2311 	 *
       
  2312 	 * `display` is excluded from the cache key as the cache contains the same
       
  2313 	 * HTML regardless of this function's need to echo or return the output.
       
  2314 	 *
       
  2315 	 * The global values contain data generated by the URL query string variables.
       
  2316 	 */
       
  2317 	$cache_args = $args;
       
  2318 	unset( $cache_args['display'] );
       
  2319 
       
  2320 	$cache_args['globals'] = array(
       
  2321 		'm'        => $m,
       
  2322 		'monthnum' => $monthnum,
       
  2323 		'year'     => $year,
       
  2324 		'week'     => $w,
       
  2325 	);
       
  2326 
       
  2327 	wp_recursive_ksort( $cache_args );
       
  2328 	$key   = md5( serialize( $cache_args ) );
  2253 	$cache = wp_cache_get( 'get_calendar', 'calendar' );
  2329 	$cache = wp_cache_get( 'get_calendar', 'calendar' );
  2254 
  2330 
  2255 	if ( $cache && is_array( $cache ) && isset( $cache[ $key ] ) ) {
  2331 	if ( $cache && is_array( $cache ) && isset( $cache[ $key ] ) ) {
  2256 		/** This filter is documented in wp-includes/general-template.php */
  2332 		/** This filter is documented in wp-includes/general-template.php */
  2257 		$output = apply_filters( 'get_calendar', $cache[ $key ] );
  2333 		$output = apply_filters( 'get_calendar', $cache[ $key ], $args );
  2258 
  2334 
  2259 		if ( $display ) {
  2335 		if ( $args['display'] ) {
  2260 			echo $output;
  2336 			echo $output;
  2261 			return;
  2337 			return;
  2262 		}
  2338 		}
  2263 
  2339 
  2264 		return $output;
  2340 		return $output;
  2266 
  2342 
  2267 	if ( ! is_array( $cache ) ) {
  2343 	if ( ! is_array( $cache ) ) {
  2268 		$cache = array();
  2344 		$cache = array();
  2269 	}
  2345 	}
  2270 
  2346 
       
  2347 	$post_type = $args['post_type'];
       
  2348 
  2271 	// Quick check. If we have no posts at all, abort!
  2349 	// Quick check. If we have no posts at all, abort!
  2272 	if ( ! $posts ) {
  2350 	if ( ! $posts ) {
  2273 		$gotsome = $wpdb->get_var( "SELECT 1 as test FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1" );
  2351 		$gotsome = $wpdb->get_var(
       
  2352 			$wpdb->prepare(
       
  2353 				"SELECT 1 as test
       
  2354 				FROM $wpdb->posts
       
  2355 				WHERE post_type = %s
       
  2356 				AND post_status = 'publish'
       
  2357 				LIMIT 1",
       
  2358 				$post_type
       
  2359 			)
       
  2360 		);
       
  2361 
  2274 		if ( ! $gotsome ) {
  2362 		if ( ! $gotsome ) {
  2275 			$cache[ $key ] = '';
  2363 			$cache[ $key ] = '';
  2276 			wp_cache_set( 'get_calendar', $cache, 'calendar' );
  2364 			wp_cache_set( 'get_calendar', $cache, 'calendar' );
  2277 			return;
  2365 			return;
  2278 		}
  2366 		}
  2279 	}
  2367 	}
  2280 
  2368 
  2281 	if ( isset( $_GET['w'] ) ) {
       
  2282 		$w = (int) $_GET['w'];
       
  2283 	}
       
  2284 	// week_begins = 0 stands for Sunday.
  2369 	// week_begins = 0 stands for Sunday.
  2285 	$week_begins = (int) get_option( 'start_of_week' );
  2370 	$week_begins = (int) get_option( 'start_of_week' );
  2286 
  2371 
  2287 	// Let's figure out when we are.
  2372 	// Let's figure out when we are.
  2288 	if ( ! empty( $monthnum ) && ! empty( $year ) ) {
  2373 	if ( ! empty( $monthnum ) && ! empty( $year ) ) {
  2289 		$thismonth = zeroise( (int) $monthnum, 2 );
  2374 		$thismonth = (int) $monthnum;
  2290 		$thisyear  = (int) $year;
  2375 		$thisyear  = (int) $year;
  2291 	} elseif ( ! empty( $w ) ) {
  2376 	} elseif ( ! empty( $w ) ) {
  2292 		// We need to get the month from MySQL.
  2377 		// We need to get the month from MySQL.
  2293 		$thisyear = (int) substr( $m, 0, 4 );
  2378 		$thisyear = (int) substr( $m, 0, 4 );
  2294 		// It seems MySQL's weeks disagree with PHP's.
  2379 		// It seems MySQL's weeks disagree with PHP's.
  2295 		$d         = ( ( $w - 1 ) * 7 ) + 6;
  2380 		$d         = ( ( $w - 1 ) * 7 ) + 6;
  2296 		$thismonth = $wpdb->get_var( "SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')" );
  2381 		$thismonth = (int) $wpdb->get_var(
       
  2382 			$wpdb->prepare(
       
  2383 				"SELECT DATE_FORMAT((DATE_ADD('%d0101', INTERVAL %d DAY) ), '%%m')",
       
  2384 				$thisyear,
       
  2385 				$d
       
  2386 			)
       
  2387 		);
  2297 	} elseif ( ! empty( $m ) ) {
  2388 	} elseif ( ! empty( $m ) ) {
  2298 		$thisyear = (int) substr( $m, 0, 4 );
  2389 		$thisyear = (int) substr( $m, 0, 4 );
  2299 		if ( strlen( $m ) < 6 ) {
  2390 		if ( strlen( $m ) < 6 ) {
  2300 			$thismonth = '01';
  2391 			$thismonth = 1;
  2301 		} else {
  2392 		} else {
  2302 			$thismonth = zeroise( (int) substr( $m, 4, 2 ), 2 );
  2393 			$thismonth = (int) substr( $m, 4, 2 );
  2303 		}
  2394 		}
  2304 	} else {
  2395 	} else {
  2305 		$thisyear  = current_time( 'Y' );
  2396 		$thisyear  = (int) current_time( 'Y' );
  2306 		$thismonth = current_time( 'm' );
  2397 		$thismonth = (int) current_time( 'm' );
  2307 	}
  2398 	}
  2308 
  2399 
  2309 	$unixmonth = mktime( 0, 0, 0, $thismonth, 1, $thisyear );
  2400 	$unixmonth = mktime( 0, 0, 0, $thismonth, 1, $thisyear );
  2310 	$last_day  = gmdate( 't', $unixmonth );
  2401 	$last_day  = gmdate( 't', $unixmonth );
  2311 
  2402 
  2312 	// Get the next and previous month and year with at least one post.
  2403 	// Get the next and previous month and year with at least one post.
  2313 	$previous = $wpdb->get_row(
  2404 	$previous = $wpdb->get_row(
  2314 		"SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
  2405 		$wpdb->prepare(
  2315 		FROM $wpdb->posts
  2406 			"SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
  2316 		WHERE post_date < '$thisyear-$thismonth-01'
  2407 			FROM $wpdb->posts
  2317 		AND post_type = 'post' AND post_status = 'publish'
  2408 			WHERE post_date < '%d-%d-01'
  2318 		ORDER BY post_date DESC
  2409 			AND post_type = %s AND post_status = 'publish'
  2319 		LIMIT 1"
  2410 			ORDER BY post_date DESC
       
  2411 			LIMIT 1",
       
  2412 			$thisyear,
       
  2413 			zeroise( $thismonth, 2 ),
       
  2414 			$post_type
       
  2415 		)
  2320 	);
  2416 	);
  2321 	$next     = $wpdb->get_row(
  2417 
  2322 		"SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
  2418 	$next = $wpdb->get_row(
  2323 		FROM $wpdb->posts
  2419 		$wpdb->prepare(
  2324 		WHERE post_date > '$thisyear-$thismonth-{$last_day} 23:59:59'
  2420 			"SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
  2325 		AND post_type = 'post' AND post_status = 'publish'
  2421 			FROM $wpdb->posts
  2326 		ORDER BY post_date ASC
  2422 			WHERE post_date > '%d-%d-%d 23:59:59'
  2327 		LIMIT 1"
  2423 			AND post_type = %s AND post_status = 'publish'
       
  2424 			ORDER BY post_date ASC
       
  2425 			LIMIT 1",
       
  2426 			$thisyear,
       
  2427 			zeroise( $thismonth, 2 ),
       
  2428 			$last_day,
       
  2429 			$post_type
       
  2430 		)
  2328 	);
  2431 	);
  2329 
  2432 
  2330 	/* translators: Calendar caption: 1: Month name, 2: 4-digit year. */
  2433 	/* translators: Calendar caption: 1: Month name, 2: 4-digit year. */
  2331 	$calendar_caption = _x( '%1$s %2$s', 'calendar caption' );
  2434 	$calendar_caption = _x( '%1$s %2$s', 'calendar caption' );
  2332 	$calendar_output  = '<table id="wp-calendar" class="wp-calendar-table">
  2435 	$calendar_output  = '<table id="wp-calendar" class="wp-calendar-table">
  2343 	for ( $wdcount = 0; $wdcount <= 6; $wdcount++ ) {
  2446 	for ( $wdcount = 0; $wdcount <= 6; $wdcount++ ) {
  2344 		$myweek[] = $wp_locale->get_weekday( ( $wdcount + $week_begins ) % 7 );
  2447 		$myweek[] = $wp_locale->get_weekday( ( $wdcount + $week_begins ) % 7 );
  2345 	}
  2448 	}
  2346 
  2449 
  2347 	foreach ( $myweek as $wd ) {
  2450 	foreach ( $myweek as $wd ) {
  2348 		$day_name         = $initial ? $wp_locale->get_weekday_initial( $wd ) : $wp_locale->get_weekday_abbrev( $wd );
  2451 		$day_name         = $args['initial'] ? $wp_locale->get_weekday_initial( $wd ) : $wp_locale->get_weekday_abbrev( $wd );
  2349 		$wd               = esc_attr( $wd );
  2452 		$wd               = esc_attr( $wd );
  2350 		$calendar_output .= "\n\t\t<th scope=\"col\" title=\"$wd\">$day_name</th>";
  2453 		$calendar_output .= "\n\t\t<th scope=\"col\" aria-label=\"$wd\">$day_name</th>";
  2351 	}
  2454 	}
  2352 
  2455 
  2353 	$calendar_output .= '
  2456 	$calendar_output .= '
  2354 	</tr>
  2457 	</tr>
  2355 	</thead>
  2458 	</thead>
  2358 
  2461 
  2359 	$daywithpost = array();
  2462 	$daywithpost = array();
  2360 
  2463 
  2361 	// Get days with posts.
  2464 	// Get days with posts.
  2362 	$dayswithposts = $wpdb->get_results(
  2465 	$dayswithposts = $wpdb->get_results(
  2363 		"SELECT DISTINCT DAYOFMONTH(post_date)
  2466 		$wpdb->prepare(
  2364 		FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00'
  2467 			"SELECT DISTINCT DAYOFMONTH(post_date)
  2365 		AND post_type = 'post' AND post_status = 'publish'
  2468 			FROM $wpdb->posts WHERE post_date >= '%d-%d-01 00:00:00'
  2366 		AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'",
  2469 			AND post_type = %s AND post_status = 'publish'
       
  2470 			AND post_date <= '%d-%d-%d 23:59:59'",
       
  2471 			$thisyear,
       
  2472 			zeroise( $thismonth, 2 ),
       
  2473 			$post_type,
       
  2474 			$thisyear,
       
  2475 			zeroise( $thismonth, 2 ),
       
  2476 			$last_day
       
  2477 		),
  2367 		ARRAY_N
  2478 		ARRAY_N
  2368 	);
  2479 	);
  2369 
  2480 
  2370 	if ( $dayswithposts ) {
  2481 	if ( $dayswithposts ) {
  2371 		foreach ( (array) $dayswithposts as $daywith ) {
  2482 		foreach ( (array) $dayswithposts as $daywith ) {
  2372 			$daywithpost[] = (int) $daywith[0];
  2483 			$daywithpost[] = (int) $daywith[0];
  2373 		}
  2484 		}
  2374 	}
  2485 	}
  2375 
  2486 
  2376 	// See how much we should pad in the beginning.
  2487 	// See how much we should pad in the beginning.
  2377 	$pad = calendar_week_mod( gmdate( 'w', $unixmonth ) - $week_begins );
  2488 	$pad = calendar_week_mod( (int) gmdate( 'w', $unixmonth ) - $week_begins );
  2378 	if ( 0 != $pad ) {
  2489 	if ( $pad > 0 ) {
  2379 		$calendar_output .= "\n\t\t" . '<td colspan="' . esc_attr( $pad ) . '" class="pad">&nbsp;</td>';
  2490 		$calendar_output .= "\n\t\t" . '<td colspan="' . esc_attr( $pad ) . '" class="pad">&nbsp;</td>';
  2380 	}
  2491 	}
  2381 
  2492 
  2382 	$newrow      = false;
  2493 	$newrow      = false;
  2383 	$daysinmonth = (int) gmdate( 't', $unixmonth );
  2494 	$daysinmonth = (int) gmdate( 't', $unixmonth );
  2384 
  2495 
  2385 	for ( $day = 1; $day <= $daysinmonth; ++$day ) {
  2496 	for ( $day = 1; $day <= $daysinmonth; ++$day ) {
  2386 		if ( isset( $newrow ) && $newrow ) {
  2497 		if ( isset( $newrow ) && $newrow ) {
  2387 			$calendar_output .= "\n\t</tr>\n\t<tr>\n\t\t";
  2498 			$calendar_output .= "\n\t</tr>\n\t<tr>\n\t\t";
  2388 		}
  2499 		}
       
  2500 
  2389 		$newrow = false;
  2501 		$newrow = false;
  2390 
  2502 
  2391 		if ( current_time( 'j' ) == $day &&
  2503 		if ( (int) current_time( 'j' ) === $day
  2392 			current_time( 'm' ) == $thismonth &&
  2504 			&& (int) current_time( 'm' ) === $thismonth
  2393 			current_time( 'Y' ) == $thisyear ) {
  2505 			&& (int) current_time( 'Y' ) === $thisyear
       
  2506 		) {
  2394 			$calendar_output .= '<td id="today">';
  2507 			$calendar_output .= '<td id="today">';
  2395 		} else {
  2508 		} else {
  2396 			$calendar_output .= '<td>';
  2509 			$calendar_output .= '<td>';
  2397 		}
  2510 		}
  2398 
  2511 
  2411 			$calendar_output .= $day;
  2524 			$calendar_output .= $day;
  2412 		}
  2525 		}
  2413 
  2526 
  2414 		$calendar_output .= '</td>';
  2527 		$calendar_output .= '</td>';
  2415 
  2528 
  2416 		if ( 6 == calendar_week_mod( gmdate( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ) ) {
  2529 		if ( 6 === (int) calendar_week_mod( (int) gmdate( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ) ) {
  2417 			$newrow = true;
  2530 			$newrow = true;
  2418 		}
  2531 		}
  2419 	}
  2532 	}
  2420 
  2533 
  2421 	$pad = 7 - calendar_week_mod( gmdate( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins );
  2534 	$pad = 7 - calendar_week_mod( (int) gmdate( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins );
  2422 	if ( 0 != $pad && 7 != $pad ) {
  2535 	if ( 0 < $pad && $pad < 7 ) {
  2423 		$calendar_output .= "\n\t\t" . '<td class="pad" colspan="' . esc_attr( $pad ) . '">&nbsp;</td>';
  2536 		$calendar_output .= "\n\t\t" . '<td class="pad" colspan="' . esc_attr( $pad ) . '">&nbsp;</td>';
  2424 	}
  2537 	}
  2425 
  2538 
  2426 	$calendar_output .= "\n\t</tr>\n\t</tbody>";
  2539 	$calendar_output .= "\n\t</tr>\n\t</tbody>";
  2427 
  2540 
  2428 	$calendar_output .= "\n\t</table>";
  2541 	$calendar_output .= "\n\t</table>";
  2429 
  2542 
  2430 	$calendar_output .= '<nav aria-label="' . __( 'Previous and next months' ) . '" class="wp-calendar-nav">';
  2543 	$calendar_output .= '<nav aria-label="' . __( 'Previous and next months' ) . '" class="wp-calendar-nav">';
  2431 
  2544 
  2432 	if ( $previous ) {
  2545 	if ( $previous ) {
  2433 		$calendar_output .= "\n\t\t" . '<span class="wp-calendar-nav-prev"><a href="' . get_month_link( $previous->year, $previous->month ) . '">&laquo; ' .
  2546 		$calendar_output .= "\n\t\t" . sprintf(
  2434 			$wp_locale->get_month_abbrev( $wp_locale->get_month( $previous->month ) ) .
  2547 			'<span class="wp-calendar-nav-prev"><a href="%1$s">&laquo; %2$s</a></span>',
  2435 		'</a></span>';
  2548 			get_month_link( $previous->year, $previous->month ),
       
  2549 			$wp_locale->get_month_abbrev( $wp_locale->get_month( $previous->month ) )
       
  2550 		);
  2436 	} else {
  2551 	} else {
  2437 		$calendar_output .= "\n\t\t" . '<span class="wp-calendar-nav-prev">&nbsp;</span>';
  2552 		$calendar_output .= "\n\t\t" . '<span class="wp-calendar-nav-prev">&nbsp;</span>';
  2438 	}
  2553 	}
  2439 
  2554 
  2440 	$calendar_output .= "\n\t\t" . '<span class="pad">&nbsp;</span>';
  2555 	$calendar_output .= "\n\t\t" . '<span class="pad">&nbsp;</span>';
  2441 
  2556 
  2442 	if ( $next ) {
  2557 	if ( $next ) {
  2443 		$calendar_output .= "\n\t\t" . '<span class="wp-calendar-nav-next"><a href="' . get_month_link( $next->year, $next->month ) . '">' .
  2558 		$calendar_output .= "\n\t\t" . sprintf(
  2444 			$wp_locale->get_month_abbrev( $wp_locale->get_month( $next->month ) ) .
  2559 			'<span class="wp-calendar-nav-next"><a href="%1$s">%2$s &raquo;</a></span>',
  2445 		' &raquo;</a></span>';
  2560 			get_month_link( $next->year, $next->month ),
       
  2561 			$wp_locale->get_month_abbrev( $wp_locale->get_month( $next->month ) )
       
  2562 		);
  2446 	} else {
  2563 	} else {
  2447 		$calendar_output .= "\n\t\t" . '<span class="wp-calendar-nav-next">&nbsp;</span>';
  2564 		$calendar_output .= "\n\t\t" . '<span class="wp-calendar-nav-next">&nbsp;</span>';
  2448 	}
  2565 	}
  2449 
  2566 
  2450 	$calendar_output .= '
  2567 	$calendar_output .= '
  2451 	</nav>';
  2568 	</nav>';
  2452 
  2569 
  2453 	$cache[ $key ] = $calendar_output;
  2570 	$cache[ $key ] = $calendar_output;
  2454 	wp_cache_set( 'get_calendar', $cache, 'calendar' );
  2571 	wp_cache_set( 'get_calendar', $cache, 'calendar' );
  2455 
  2572 
  2456 	if ( $display ) {
  2573 	/**
  2457 		/**
  2574 	 * Filters the HTML calendar output.
  2458 		 * Filters the HTML calendar output.
  2575 	 *
  2459 		 *
  2576 	 * @since 3.0.0
  2460 		 * @since 3.0.0
  2577 	 * @since 6.8.0 Added the `$args` parameter.
  2461 		 *
  2578 	 *
  2462 		 * @param string $calendar_output HTML output of the calendar.
  2579 	 * @param string $calendar_output HTML output of the calendar.
  2463 		 */
  2580 	 * @param array  $args {
  2464 		echo apply_filters( 'get_calendar', $calendar_output );
  2581 	 *     Optional. Array of display arguments.
       
  2582 	 *
       
  2583 	 *     @type bool   $initial   Whether to use initial calendar names. Default true.
       
  2584 	 *     @type bool   $display   Whether to display the calendar output. Default true.
       
  2585 	 *     @type string $post_type Optional. Post type. Default 'post'.
       
  2586 	 * }
       
  2587 	 */
       
  2588 	$calendar_output = apply_filters( 'get_calendar', $calendar_output, $args );
       
  2589 
       
  2590 	if ( $args['display'] ) {
       
  2591 		echo $calendar_output;
  2465 		return;
  2592 		return;
  2466 	}
  2593 	}
  2467 	/** This filter is documented in wp-includes/general-template.php */
  2594 
  2468 	return apply_filters( 'get_calendar', $calendar_output );
  2595 	return $calendar_output;
  2469 }
  2596 }
  2470 
  2597 
  2471 /**
  2598 /**
  2472  * Purges the cached results of get_calendar.
  2599  * Purges the cached results of get_calendar.
  2473  *
  2600  *
  2516 function the_date_xml() {
  2643 function the_date_xml() {
  2517 	echo mysql2date( 'Y-m-d', get_post()->post_date, false );
  2644 	echo mysql2date( 'Y-m-d', get_post()->post_date, false );
  2518 }
  2645 }
  2519 
  2646 
  2520 /**
  2647 /**
  2521  * Displays or retrieves the date the current post was written (once per date)
  2648  * Displays or retrieves the date of the post (once per date).
  2522  *
  2649  *
  2523  * Will only output the date if the current post's date is different from the
  2650  * Will only output the date if the current post's date is different from the
  2524  * previous one output.
  2651  * previous one output.
  2525  *
  2652  *
  2526  * i.e. Only one date listing will show per day worth of posts shown in the loop, even if the
  2653  * i.e. Only one date listing will show per day worth of posts shown in the loop, even if the
  2527  * function is called several times for each post.
  2654  * function is called several times for each post.
  2528  *
  2655  *
  2529  * HTML output can be filtered with 'the_date'.
  2656  * HTML output can be filtered with {@see 'the_date'}.
  2530  * Date string output can be filtered with 'get_the_date'.
  2657  * Date string output can be filtered with {@see 'get_the_date'}.
  2531  *
  2658  *
  2532  * @since 0.71
  2659  * @since 0.71
  2533  *
  2660  *
  2534  * @global string $currentday  The day of the current post in the loop.
  2661  * @global string $currentday  The day of the current post in the loop.
  2535  * @global string $previousday The day of the previous post in the loop.
  2662  * @global string $previousday The day of the previous post in the loop.
  2549 		$the_date    = $before . get_the_date( $format ) . $after;
  2676 		$the_date    = $before . get_the_date( $format ) . $after;
  2550 		$previousday = $currentday;
  2677 		$previousday = $currentday;
  2551 	}
  2678 	}
  2552 
  2679 
  2553 	/**
  2680 	/**
  2554 	 * Filters the date a post was published for display.
  2681 	 * Filters the date of the post, for display.
  2555 	 *
  2682 	 *
  2556 	 * @since 0.71
  2683 	 * @since 0.71
  2557 	 *
  2684 	 *
  2558 	 * @param string $the_date The formatted date string.
  2685 	 * @param string $the_date The formatted date string.
  2559 	 * @param string $format   PHP date format.
  2686 	 * @param string $format   PHP date format.
  2568 		return $the_date;
  2695 		return $the_date;
  2569 	}
  2696 	}
  2570 }
  2697 }
  2571 
  2698 
  2572 /**
  2699 /**
  2573  * Retrieves the date on which the post was written.
  2700  * Retrieves the date of the post.
  2574  *
  2701  *
  2575  * Unlike the_date() this function will always return the date.
  2702  * Unlike the_date() this function will always return the date.
  2576  * Modify output with the {@see 'get_the_date'} filter.
  2703  * Modify output with the {@see 'get_the_date'} filter.
  2577  *
  2704  *
  2578  * @since 3.0.0
  2705  * @since 3.0.0
  2591 	$_format = ! empty( $format ) ? $format : get_option( 'date_format' );
  2718 	$_format = ! empty( $format ) ? $format : get_option( 'date_format' );
  2592 
  2719 
  2593 	$the_date = get_post_time( $_format, false, $post, true );
  2720 	$the_date = get_post_time( $_format, false, $post, true );
  2594 
  2721 
  2595 	/**
  2722 	/**
  2596 	 * Filters the date a post was published.
  2723 	 * Filters the date of the post.
  2597 	 *
  2724 	 *
  2598 	 * @since 3.0.0
  2725 	 * @since 3.0.0
  2599 	 *
  2726 	 *
  2600 	 * @param string|int  $the_date Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
  2727 	 * @param string|int $the_date Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
  2601 	 * @param string      $format   PHP date format.
  2728 	 * @param string     $format   PHP date format.
  2602 	 * @param WP_Post     $post     The post object.
  2729 	 * @param WP_Post    $post     The post object.
  2603 	 */
  2730 	 */
  2604 	return apply_filters( 'get_the_date', $the_date, $format, $post );
  2731 	return apply_filters( 'get_the_date', $the_date, $format, $post );
  2605 }
  2732 }
  2606 
  2733 
  2607 /**
  2734 /**
  2617  */
  2744  */
  2618 function the_modified_date( $format = '', $before = '', $after = '', $display = true ) {
  2745 function the_modified_date( $format = '', $before = '', $after = '', $display = true ) {
  2619 	$the_modified_date = $before . get_the_modified_date( $format ) . $after;
  2746 	$the_modified_date = $before . get_the_modified_date( $format ) . $after;
  2620 
  2747 
  2621 	/**
  2748 	/**
  2622 	 * Filters the date a post was last modified for display.
  2749 	 * Filters the date a post was last modified, for display.
  2623 	 *
  2750 	 *
  2624 	 * @since 2.1.0
  2751 	 * @since 2.1.0
  2625 	 *
  2752 	 *
  2626 	 * @param string|false $the_modified_date The last modified date or false if no post is found.
  2753 	 * @param string $the_modified_date The last modified date.
  2627 	 * @param string       $format            PHP date format.
  2754 	 * @param string $format            PHP date format.
  2628 	 * @param string       $before            HTML output before the date.
  2755 	 * @param string $before            HTML output before the date.
  2629 	 * @param string       $after             HTML output after the date.
  2756 	 * @param string $after             HTML output after the date.
  2630 	 */
  2757 	 */
  2631 	$the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $format, $before, $after );
  2758 	$the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $format, $before, $after );
  2632 
  2759 
  2633 	if ( $display ) {
  2760 	if ( $display ) {
  2634 		echo $the_modified_date;
  2761 		echo $the_modified_date;
  2671 	 */
  2798 	 */
  2672 	return apply_filters( 'get_the_modified_date', $the_time, $format, $post );
  2799 	return apply_filters( 'get_the_modified_date', $the_time, $format, $post );
  2673 }
  2800 }
  2674 
  2801 
  2675 /**
  2802 /**
  2676  * Displays the time at which the post was written.
  2803  * Displays the time of the post.
  2677  *
  2804  *
  2678  * @since 0.71
  2805  * @since 0.71
  2679  *
  2806  *
  2680  * @param string $format Optional. Format to use for retrieving the time the post
  2807  * @param string $format Optional. Format to use for retrieving the time the post
  2681  *                       was written. Accepts 'G', 'U', or PHP date format.
  2808  *                       was written. Accepts 'G', 'U', or PHP date format.
  2682  *                       Defaults to the 'time_format' option.
  2809  *                       Defaults to the 'time_format' option.
  2683  */
  2810  */
  2684 function the_time( $format = '' ) {
  2811 function the_time( $format = '' ) {
  2685 	/**
  2812 	/**
  2686 	 * Filters the time a post was written for display.
  2813 	 * Filters the time of the post, for display.
  2687 	 *
  2814 	 *
  2688 	 * @since 0.71
  2815 	 * @since 0.71
  2689 	 *
  2816 	 *
  2690 	 * @param string $get_the_time The formatted time.
  2817 	 * @param string $get_the_time The formatted time.
  2691 	 * @param string $format       Format to use for retrieving the time the post
  2818 	 * @param string $format       Format to use for retrieving the time the post
  2693 	 */
  2820 	 */
  2694 	echo apply_filters( 'the_time', get_the_time( $format ), $format );
  2821 	echo apply_filters( 'the_time', get_the_time( $format ), $format );
  2695 }
  2822 }
  2696 
  2823 
  2697 /**
  2824 /**
  2698  * Retrieves the time at which the post was written.
  2825  * Retrieves the time of the post.
  2699  *
  2826  *
  2700  * @since 1.5.0
  2827  * @since 1.5.0
  2701  *
  2828  *
  2702  * @param string      $format Optional. Format to use for retrieving the time the post
  2829  * @param string      $format Optional. Format to use for retrieving the time the post
  2703  *                            was written. Accepts 'G', 'U', or PHP date format.
  2830  *                            was written. Accepts 'G', 'U', or PHP date format.
  2716 	$_format = ! empty( $format ) ? $format : get_option( 'time_format' );
  2843 	$_format = ! empty( $format ) ? $format : get_option( 'time_format' );
  2717 
  2844 
  2718 	$the_time = get_post_time( $_format, false, $post, true );
  2845 	$the_time = get_post_time( $_format, false, $post, true );
  2719 
  2846 
  2720 	/**
  2847 	/**
  2721 	 * Filters the time a post was written.
  2848 	 * Filters the time of the post.
  2722 	 *
  2849 	 *
  2723 	 * @since 1.5.0
  2850 	 * @since 1.5.0
  2724 	 *
  2851 	 *
  2725 	 * @param string|int  $the_time Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
  2852 	 * @param string|int $the_time Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
  2726 	 * @param string      $format   Format to use for retrieving the time the post
  2853 	 * @param string     $format   Format to use for retrieving the time the post
  2727 	 *                              was written. Accepts 'G', 'U', or PHP date format.
  2854 	 *                             was written. Accepts 'G', 'U', or PHP date format.
  2728 	 * @param WP_Post     $post     Post object.
  2855 	 * @param WP_Post    $post     Post object.
  2729 	 */
  2856 	 */
  2730 	return apply_filters( 'get_the_time', $the_time, $format, $post );
  2857 	return apply_filters( 'get_the_time', $the_time, $format, $post );
  2731 }
  2858 }
  2732 
  2859 
  2733 /**
  2860 /**
  2734  * Retrieves the time at which the post was written.
  2861  * Retrieves the localized time of the post.
  2735  *
  2862  *
  2736  * @since 2.0.0
  2863  * @since 2.0.0
  2737  *
  2864  *
  2738  * @param string      $format    Optional. Format to use for retrieving the time the post
  2865  * @param string      $format    Optional. Format to use for retrieving the time the post
  2739  *                               was written. Accepts 'G', 'U', or PHP date format. Default 'U'.
  2866  *                               was written. Accepts 'G', 'U', or PHP date format. Default 'U'.
  2773 
  2900 
  2774 		$time = $datetime->format( $format );
  2901 		$time = $datetime->format( $format );
  2775 	}
  2902 	}
  2776 
  2903 
  2777 	/**
  2904 	/**
  2778 	 * Filters the localized time a post was written.
  2905 	 * Filters the localized time of the post.
  2779 	 *
  2906 	 *
  2780 	 * @since 2.6.0
  2907 	 * @since 2.6.0
  2781 	 *
  2908 	 *
  2782 	 * @param string|int $time   Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
  2909 	 * @param string|int $time   Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
  2783 	 * @param string     $format Format to use for retrieving the time the post was written.
  2910 	 * @param string     $format Format to use for retrieving the date of the post.
  2784 	 *                           Accepts 'G', 'U', or PHP date format.
  2911 	 *                           Accepts 'G', 'U', or PHP date format.
  2785 	 * @param bool       $gmt    Whether to retrieve the GMT time.
  2912 	 * @param bool       $gmt    Whether to retrieve the GMT time.
  2786 	 */
  2913 	 */
  2787 	return apply_filters( 'get_post_time', $time, $format, $gmt );
  2914 	return apply_filters( 'get_post_time', $time, $format, $gmt );
  2788 }
  2915 }
  2975 	 */
  3102 	 */
  2976 	return apply_filters( 'get_post_modified_time', $time, $format, $gmt );
  3103 	return apply_filters( 'get_post_modified_time', $time, $format, $gmt );
  2977 }
  3104 }
  2978 
  3105 
  2979 /**
  3106 /**
  2980  * Displays the weekday on which the post was written.
  3107  * Displays the localized weekday for the post.
  2981  *
  3108  *
  2982  * @since 0.71
  3109  * @since 0.71
  2983  *
  3110  *
  2984  * @global WP_Locale $wp_locale WordPress date and time locale object.
  3111  * @global WP_Locale $wp_locale WordPress date and time locale object.
  2985  */
  3112  */
  2993 	}
  3120 	}
  2994 
  3121 
  2995 	$the_weekday = $wp_locale->get_weekday( get_post_time( 'w', false, $post ) );
  3122 	$the_weekday = $wp_locale->get_weekday( get_post_time( 'w', false, $post ) );
  2996 
  3123 
  2997 	/**
  3124 	/**
  2998 	 * Filters the weekday on which the post was written, for display.
  3125 	 * Filters the localized weekday of the post, for display.
  2999 	 *
  3126 	 *
  3000 	 * @since 0.71
  3127 	 * @since 0.71
  3001 	 *
  3128 	 *
  3002 	 * @param string $the_weekday
  3129 	 * @param string $the_weekday
  3003 	 */
  3130 	 */
  3004 	echo apply_filters( 'the_weekday', $the_weekday );
  3131 	echo apply_filters( 'the_weekday', $the_weekday );
  3005 }
  3132 }
  3006 
  3133 
  3007 /**
  3134 /**
  3008  * Displays the weekday on which the post was written.
  3135  * Displays the localized weekday for the post.
  3009  *
  3136  *
  3010  * Will only output the weekday if the current post's weekday is different from
  3137  * Will only output the weekday if the current post's weekday is different from
  3011  * the previous one output.
  3138  * the previous one output.
  3012  *
  3139  *
  3013  * @since 0.71
  3140  * @since 0.71
  3036 		$the_weekday_date .= $after;
  3163 		$the_weekday_date .= $after;
  3037 		$previousweekday   = $currentday;
  3164 		$previousweekday   = $currentday;
  3038 	}
  3165 	}
  3039 
  3166 
  3040 	/**
  3167 	/**
  3041 	 * Filters the localized date on which the post was written, for display.
  3168 	 * Filters the localized weekday of the post, for display.
  3042 	 *
  3169 	 *
  3043 	 * @since 0.71
  3170 	 * @since 0.71
  3044 	 *
  3171 	 *
  3045 	 * @param string $the_weekday_date The weekday on which the post was written.
  3172 	 * @param string $the_weekday_date The weekday on which the post was written.
  3046 	 * @param string $before           The HTML to output before the date.
  3173 	 * @param string $before           The HTML to output before the date.
  3117 		/* translators: 1: Site title, 2: Separator (raquo). */
  3244 		/* translators: 1: Site title, 2: Separator (raquo). */
  3118 		'comstitle' => __( '%1$s %2$s Comments Feed' ),
  3245 		'comstitle' => __( '%1$s %2$s Comments Feed' ),
  3119 	);
  3246 	);
  3120 
  3247 
  3121 	$args = wp_parse_args( $args, $defaults );
  3248 	$args = wp_parse_args( $args, $defaults );
       
  3249 
       
  3250 	/**
       
  3251 	 * Filters the feed links arguments.
       
  3252 	 *
       
  3253 	 * @since 6.7.0
       
  3254 	 *
       
  3255 	 * @param array $args An array of feed links arguments.
       
  3256 	 */
       
  3257 	$args = apply_filters( 'feed_links_args', $args );
  3122 
  3258 
  3123 	/**
  3259 	/**
  3124 	 * Filters whether to display the posts feed link.
  3260 	 * Filters whether to display the posts feed link.
  3125 	 *
  3261 	 *
  3126 	 * @since 4.4.0
  3262 	 * @since 4.4.0
  3179 		/* translators: 1: Site name, 2: Separator (raquo), 3: Post type name. */
  3315 		/* translators: 1: Site name, 2: Separator (raquo), 3: Post type name. */
  3180 		'posttypetitle' => __( '%1$s %2$s %3$s Feed' ),
  3316 		'posttypetitle' => __( '%1$s %2$s %3$s Feed' ),
  3181 	);
  3317 	);
  3182 
  3318 
  3183 	$args = wp_parse_args( $args, $defaults );
  3319 	$args = wp_parse_args( $args, $defaults );
       
  3320 
       
  3321 	/**
       
  3322 	 * Filters the extra feed links arguments.
       
  3323 	 *
       
  3324 	 * @since 6.7.0
       
  3325 	 *
       
  3326 	 * @param array $args An array of extra feed links arguments.
       
  3327 	 */
       
  3328 	$args = apply_filters( 'feed_links_extra_args', $args );
  3184 
  3329 
  3185 	if ( is_singular() ) {
  3330 	if ( is_singular() ) {
  3186 		$id   = 0;
  3331 		$id   = 0;
  3187 		$post = get_post( $id );
  3332 		$post = get_post( $id );
  3188 
  3333 
  3773 
  3918 
  3774 /**
  3919 /**
  3775  * Finds out which editor should be displayed by default.
  3920  * Finds out which editor should be displayed by default.
  3776  *
  3921  *
  3777  * Works out which of the editors to display as the current editor for a
  3922  * Works out which of the editors to display as the current editor for a
  3778  * user. The 'html' setting is for the "Text" editor tab.
  3923  * user. The 'html' setting is for the "Code" editor tab.
  3779  *
  3924  *
  3780  * @since 2.5.0
  3925  * @since 2.5.0
  3781  *
  3926  *
  3782  * @return string Either 'tinymce', 'html', or 'test'
  3927  * @return string Either 'tinymce', 'html', or 'test'
  3783  */
  3928  */
  4332  *
  4477  *
  4333  * @since 2.1.0
  4478  * @since 2.1.0
  4334  */
  4479  */
  4335 function the_search_query() {
  4480 function the_search_query() {
  4336 	/**
  4481 	/**
  4337 	 * Filters the contents of the search query variable for display.
  4482 	 * Filters the contents of the search query variable, for display.
  4338 	 *
  4483 	 *
  4339 	 * @since 2.3.0
  4484 	 * @since 2.3.0
  4340 	 *
  4485 	 *
  4341 	 * @param mixed $search Contents of the search query variable.
  4486 	 * @param mixed $search Contents of the search query variable.
  4342 	 */
  4487 	 */
  4560 	$r          = '';
  4705 	$r          = '';
  4561 	$page_links = array();
  4706 	$page_links = array();
  4562 	$dots       = false;
  4707 	$dots       = false;
  4563 
  4708 
  4564 	if ( $args['prev_next'] && $current && 1 < $current ) :
  4709 	if ( $args['prev_next'] && $current && 1 < $current ) :
  4565 		$link = str_replace( '%_%', 2 == $current ? '' : $args['format'], $args['base'] );
  4710 		$link = str_replace( '%_%', 2 === $current ? '' : $args['format'], $args['base'] );
  4566 		$link = str_replace( '%#%', $current - 1, $link );
  4711 		$link = str_replace( '%#%', $current - 1, $link );
  4567 		if ( $add_args ) {
  4712 		if ( $add_args ) {
  4568 			$link = add_query_arg( $add_args, $link );
  4713 			$link = add_query_arg( $add_args, $link );
  4569 		}
  4714 		}
  4570 		$link .= $args['add_fragment'];
  4715 		$link .= $args['add_fragment'];
  4582 			$args['prev_text']
  4727 			$args['prev_text']
  4583 		);
  4728 		);
  4584 	endif;
  4729 	endif;
  4585 
  4730 
  4586 	for ( $n = 1; $n <= $total; $n++ ) :
  4731 	for ( $n = 1; $n <= $total; $n++ ) :
  4587 		if ( $n == $current ) :
  4732 		if ( $n === $current ) :
  4588 			$page_links[] = sprintf(
  4733 			$page_links[] = sprintf(
  4589 				'<span aria-current="%s" class="page-numbers current">%s</span>',
  4734 				'<span aria-current="%s" class="page-numbers current">%s</span>',
  4590 				esc_attr( $args['aria_current'] ),
  4735 				esc_attr( $args['aria_current'] ),
  4591 				$args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
  4736 				$args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
  4592 			);
  4737 			);
  4593 
  4738 
  4594 			$dots = true;
  4739 			$dots = true;
  4595 		else :
  4740 		else :
  4596 			if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) :
  4741 			if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) :
  4597 				$link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] );
  4742 				$link = str_replace( '%_%', 1 === $n ? '' : $args['format'], $args['base'] );
  4598 				$link = str_replace( '%#%', $n, $link );
  4743 				$link = str_replace( '%#%', $n, $link );
  4599 				if ( $add_args ) {
  4744 				if ( $add_args ) {
  4600 					$link = add_query_arg( $add_args, $link );
  4745 					$link = add_query_arg( $add_args, $link );
  4601 				}
  4746 				}
  4602 				$link .= $args['add_fragment'];
  4747 				$link .= $args['add_fragment'];
  4743 
  4888 
  4744 	wp_admin_css_color(
  4889 	wp_admin_css_color(
  4745 		'modern',
  4890 		'modern',
  4746 		_x( 'Modern', 'admin color scheme' ),
  4891 		_x( 'Modern', 'admin color scheme' ),
  4747 		admin_url( "css/colors/modern/colors$suffix.css" ),
  4892 		admin_url( "css/colors/modern/colors$suffix.css" ),
  4748 		array( '#1e1e1e', '#3858e9', '#33f078' ),
  4893 		array( '#1e1e1e', '#3858e9', '#7b90ff' ),
  4749 		array(
  4894 		array(
  4750 			'base'    => '#f3f1f1',
  4895 			'base'    => '#f3f1f1',
  4751 			'focus'   => '#fff',
  4896 			'focus'   => '#fff',
  4752 			'current' => '#fff',
  4897 			'current' => '#fff',
  4753 		)
  4898 		)
  4965  *
  5110  *
  4966  * @param string $type The type of generator to output - (html|xhtml|atom|rss2|rdf|comment|export).
  5111  * @param string $type The type of generator to output - (html|xhtml|atom|rss2|rdf|comment|export).
  4967  */
  5112  */
  4968 function the_generator( $type ) {
  5113 function the_generator( $type ) {
  4969 	/**
  5114 	/**
  4970 	 * Filters the output of the XHTML generator tag for display.
  5115 	 * Filters the output of the XHTML generator tag, for display.
  4971 	 *
  5116 	 *
  4972 	 * @since 2.5.0
  5117 	 * @since 2.5.0
  4973 	 *
  5118 	 *
  4974 	 * @param string $generator_type The generator output.
  5119 	 * @param string $generator_type The generator output.
  4975 	 * @param string $type           The type of generator to output. Accepts 'html',
  5120 	 * @param string $type           The type of generator to output. Accepts 'html',