Code Duplication    Length = 25-26 lines in 3 locations

src/wp-includes/general-template.php 3 locations

@@ 2264-2288 (lines=25) @@
2261
 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post.
2262
 * @return false|string Date the current post was modified. False on failure.
2263
 */
2264
function get_the_modified_date( $d = '', $post = null ) {
2265
	$post = get_post( $post );
2266
2267
	if ( ! $post ) {
2268
		// For backward compatibility, failures go through the filter below.
2269
		$the_time = false;
2270
	} elseif ( empty( $d ) ) {
2271
		$the_time = get_post_modified_time( get_option( 'date_format' ), false, $post, true );
2272
	} else {
2273
		$the_time = get_post_modified_time( $d, false, $post, true );
2274
	}
2275
2276
	/**
2277
	 * Filters the date a post was last modified.
2278
	 *
2279
	 * @since 2.1.0
2280
	 * @since 4.6.0 Added the `$post` parameter.
2281
	 *
2282
	 * @param string  $the_time The formatted date.
2283
	 * @param string  $d        PHP date format. Defaults to value specified in
2284
	 *                          'date_format' option.
2285
	 * @param WP_Post $post     WP_Post object.
2286
	 */
2287
	return apply_filters( 'get_the_modified_date', $the_time, $d, $post );
2288
}
2289
2290
/**
2291
 * Display the time at which the post was written.
@@ 2321-2345 (lines=25) @@
2318
 * @param int|WP_Post $post WP_Post object or ID. Default is global $post object.
2319
 * @return string|int|false Formatted date string or Unix timestamp if `$id` is 'U' or 'G'. False on failure.
2320
 */
2321
function get_the_time( $d = '', $post = null ) {
2322
	$post = get_post($post);
2323
2324
	if ( ! $post ) {
2325
		return false;
2326
	}
2327
2328
	if ( '' == $d )
2329
		$the_time = get_post_time(get_option('time_format'), false, $post, true);
2330
	else
2331
		$the_time = get_post_time($d, false, $post, true);
2332
2333
	/**
2334
	 * Filters the time a post was written.
2335
	 *
2336
	 * @since 1.5.0
2337
	 *
2338
	 * @param string      $the_time The formatted time.
2339
	 * @param string      $d        Format to use for retrieving the time the post was written.
2340
	 *                              Accepts 'G', 'U', or php date format value specified
2341
	 *                              in 'time_format' option. Default empty.
2342
	 * @param int|WP_Post $post     WP_Post object or ID.
2343
	 */
2344
	return apply_filters( 'get_the_time', $the_time, $d, $post );
2345
}
2346
2347
/**
2348
 * Retrieve the time at which the post was written.
@@ 2419-2444 (lines=26) @@
2416
 * @param int|WP_Post $post  Optional. Post ID or WP_Post object. Default current post.
2417
 * @return false|string Formatted date string or Unix timestamp. False on failure.
2418
 */
2419
function get_the_modified_time( $d = '', $post = null ) {
2420
	$post = get_post( $post );
2421
2422
	if ( ! $post ) {
2423
		// For backward compatibility, failures go through the filter below.
2424
		$the_time = false;
2425
	} elseif ( empty( $d ) ) {
2426
		$the_time = get_post_modified_time( get_option( 'time_format' ), false, $post, true );
2427
	} else {
2428
		$the_time = get_post_modified_time( $d, false, $post, true );
2429
	}
2430
2431
	/**
2432
	 * Filters the localized time a post was last modified.
2433
	 *
2434
	 * @since 2.0.0
2435
	 * @since 4.6.0 Added the `$post` parameter.
2436
	 *
2437
	 * @param string $the_time The formatted time.
2438
	 * @param string $d        Format to use for retrieving the time the post was
2439
	 *                         written. Accepts 'G', 'U', or php date format. Defaults
2440
	 *                         to value specified in 'time_format' option.
2441
	 * @param WP_Post $post    WP_Post object.
2442
	 */
2443
	return apply_filters( 'get_the_modified_time', $the_time, $d, $post );
2444
}
2445
2446
/**
2447
 * Retrieve the time at which the post was last modified.