Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu...
File: post-template.php
$args['before'] = "<ul>{$n}";
[1500] Fix | Delete
$args['after'] = '</ul>';
[1501] Fix | Delete
}
[1502] Fix | Delete
[1503] Fix | Delete
$menu = $args['before'] . $menu . $args['after'];
[1504] Fix | Delete
}
[1505] Fix | Delete
[1506] Fix | Delete
$attrs = '';
[1507] Fix | Delete
if ( ! empty( $args['menu_id'] ) ) {
[1508] Fix | Delete
$attrs .= ' id="' . esc_attr( $args['menu_id'] ) . '"';
[1509] Fix | Delete
}
[1510] Fix | Delete
[1511] Fix | Delete
if ( ! empty( $args['menu_class'] ) ) {
[1512] Fix | Delete
$attrs .= ' class="' . esc_attr( $args['menu_class'] ) . '"';
[1513] Fix | Delete
}
[1514] Fix | Delete
[1515] Fix | Delete
$menu = "<{$container}{$attrs}>" . $menu . "</{$container}>{$n}";
[1516] Fix | Delete
[1517] Fix | Delete
/**
[1518] Fix | Delete
* Filters the HTML output of a page-based menu.
[1519] Fix | Delete
*
[1520] Fix | Delete
* @since 2.7.0
[1521] Fix | Delete
*
[1522] Fix | Delete
* @see wp_page_menu()
[1523] Fix | Delete
*
[1524] Fix | Delete
* @param string $menu The HTML output.
[1525] Fix | Delete
* @param array $args An array of arguments. See wp_page_menu()
[1526] Fix | Delete
* for information on accepted arguments.
[1527] Fix | Delete
*/
[1528] Fix | Delete
$menu = apply_filters( 'wp_page_menu', $menu, $args );
[1529] Fix | Delete
[1530] Fix | Delete
if ( $args['echo'] ) {
[1531] Fix | Delete
echo $menu;
[1532] Fix | Delete
} else {
[1533] Fix | Delete
return $menu;
[1534] Fix | Delete
}
[1535] Fix | Delete
}
[1536] Fix | Delete
[1537] Fix | Delete
//
[1538] Fix | Delete
// Page helpers.
[1539] Fix | Delete
//
[1540] Fix | Delete
[1541] Fix | Delete
/**
[1542] Fix | Delete
* Retrieves HTML list content for page list.
[1543] Fix | Delete
*
[1544] Fix | Delete
* @uses Walker_Page to create HTML list content.
[1545] Fix | Delete
* @since 2.1.0
[1546] Fix | Delete
*
[1547] Fix | Delete
* @param array $pages
[1548] Fix | Delete
* @param int $depth
[1549] Fix | Delete
* @param int $current_page
[1550] Fix | Delete
* @param array $args
[1551] Fix | Delete
* @return string
[1552] Fix | Delete
*/
[1553] Fix | Delete
function walk_page_tree( $pages, $depth, $current_page, $args ) {
[1554] Fix | Delete
if ( empty( $args['walker'] ) ) {
[1555] Fix | Delete
$walker = new Walker_Page();
[1556] Fix | Delete
} else {
[1557] Fix | Delete
/**
[1558] Fix | Delete
* @var Walker $walker
[1559] Fix | Delete
*/
[1560] Fix | Delete
$walker = $args['walker'];
[1561] Fix | Delete
}
[1562] Fix | Delete
[1563] Fix | Delete
foreach ( (array) $pages as $page ) {
[1564] Fix | Delete
if ( $page->post_parent ) {
[1565] Fix | Delete
$args['pages_with_children'][ $page->post_parent ] = true;
[1566] Fix | Delete
}
[1567] Fix | Delete
}
[1568] Fix | Delete
[1569] Fix | Delete
return $walker->walk( $pages, $depth, $args, $current_page );
[1570] Fix | Delete
}
[1571] Fix | Delete
[1572] Fix | Delete
/**
[1573] Fix | Delete
* Retrieves HTML dropdown (select) content for page list.
[1574] Fix | Delete
*
[1575] Fix | Delete
* @since 2.1.0
[1576] Fix | Delete
* @since 5.3.0 Formalized the existing `...$args` parameter by adding it
[1577] Fix | Delete
* to the function signature.
[1578] Fix | Delete
*
[1579] Fix | Delete
* @uses Walker_PageDropdown to create HTML dropdown content.
[1580] Fix | Delete
* @see Walker_PageDropdown::walk() for parameters and return description.
[1581] Fix | Delete
*
[1582] Fix | Delete
* @param mixed ...$args Elements array, maximum hierarchical depth and optional additional arguments.
[1583] Fix | Delete
* @return string
[1584] Fix | Delete
*/
[1585] Fix | Delete
function walk_page_dropdown_tree( ...$args ) {
[1586] Fix | Delete
if ( empty( $args[2]['walker'] ) ) { // The user's options are the third parameter.
[1587] Fix | Delete
$walker = new Walker_PageDropdown();
[1588] Fix | Delete
} else {
[1589] Fix | Delete
/**
[1590] Fix | Delete
* @var Walker $walker
[1591] Fix | Delete
*/
[1592] Fix | Delete
$walker = $args[2]['walker'];
[1593] Fix | Delete
}
[1594] Fix | Delete
[1595] Fix | Delete
return $walker->walk( ...$args );
[1596] Fix | Delete
}
[1597] Fix | Delete
[1598] Fix | Delete
//
[1599] Fix | Delete
// Attachments.
[1600] Fix | Delete
//
[1601] Fix | Delete
[1602] Fix | Delete
/**
[1603] Fix | Delete
* Displays an attachment page link using an image or icon.
[1604] Fix | Delete
*
[1605] Fix | Delete
* @since 2.0.0
[1606] Fix | Delete
*
[1607] Fix | Delete
* @param int|WP_Post $post Optional. Post ID or post object.
[1608] Fix | Delete
* @param bool $fullsize Optional. Whether to use full size. Default false.
[1609] Fix | Delete
* @param bool $deprecated Deprecated. Not used.
[1610] Fix | Delete
* @param bool $permalink Optional. Whether to include permalink. Default false.
[1611] Fix | Delete
*/
[1612] Fix | Delete
function the_attachment_link( $post = 0, $fullsize = false, $deprecated = false, $permalink = false ) {
[1613] Fix | Delete
if ( ! empty( $deprecated ) ) {
[1614] Fix | Delete
_deprecated_argument( __FUNCTION__, '2.5.0' );
[1615] Fix | Delete
}
[1616] Fix | Delete
[1617] Fix | Delete
if ( $fullsize ) {
[1618] Fix | Delete
echo wp_get_attachment_link( $post, 'full', $permalink );
[1619] Fix | Delete
} else {
[1620] Fix | Delete
echo wp_get_attachment_link( $post, 'thumbnail', $permalink );
[1621] Fix | Delete
}
[1622] Fix | Delete
}
[1623] Fix | Delete
[1624] Fix | Delete
/**
[1625] Fix | Delete
* Retrieves an attachment page link using an image or icon, if possible.
[1626] Fix | Delete
*
[1627] Fix | Delete
* @since 2.5.0
[1628] Fix | Delete
* @since 4.4.0 The `$post` parameter can now accept either a post ID or `WP_Post` object.
[1629] Fix | Delete
*
[1630] Fix | Delete
* @param int|WP_Post $post Optional. Post ID or post object.
[1631] Fix | Delete
* @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array
[1632] Fix | Delete
* of width and height values in pixels (in that order). Default 'thumbnail'.
[1633] Fix | Delete
* @param bool $permalink Optional. Whether to add permalink to image. Default false.
[1634] Fix | Delete
* @param bool $icon Optional. Whether the attachment is an icon. Default false.
[1635] Fix | Delete
* @param string|false $text Optional. Link text to use. Activated by passing a string, false otherwise.
[1636] Fix | Delete
* Default false.
[1637] Fix | Delete
* @param array|string $attr Optional. Array or string of attributes. Default empty.
[1638] Fix | Delete
* @return string HTML content.
[1639] Fix | Delete
*/
[1640] Fix | Delete
function wp_get_attachment_link( $post = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) {
[1641] Fix | Delete
$_post = get_post( $post );
[1642] Fix | Delete
[1643] Fix | Delete
if ( empty( $_post ) || ( 'attachment' !== $_post->post_type ) || ! wp_get_attachment_url( $_post->ID ) ) {
[1644] Fix | Delete
return __( 'Missing Attachment' );
[1645] Fix | Delete
}
[1646] Fix | Delete
[1647] Fix | Delete
$url = wp_get_attachment_url( $_post->ID );
[1648] Fix | Delete
[1649] Fix | Delete
if ( $permalink ) {
[1650] Fix | Delete
$url = get_attachment_link( $_post->ID );
[1651] Fix | Delete
}
[1652] Fix | Delete
[1653] Fix | Delete
if ( $text ) {
[1654] Fix | Delete
$link_text = $text;
[1655] Fix | Delete
} elseif ( $size && 'none' !== $size ) {
[1656] Fix | Delete
$link_text = wp_get_attachment_image( $_post->ID, $size, $icon, $attr );
[1657] Fix | Delete
} else {
[1658] Fix | Delete
$link_text = '';
[1659] Fix | Delete
}
[1660] Fix | Delete
[1661] Fix | Delete
if ( '' === trim( $link_text ) ) {
[1662] Fix | Delete
$link_text = $_post->post_title;
[1663] Fix | Delete
}
[1664] Fix | Delete
[1665] Fix | Delete
if ( '' === trim( $link_text ) ) {
[1666] Fix | Delete
$link_text = esc_html( pathinfo( get_attached_file( $_post->ID ), PATHINFO_FILENAME ) );
[1667] Fix | Delete
}
[1668] Fix | Delete
[1669] Fix | Delete
/**
[1670] Fix | Delete
* Filters the list of attachment link attributes.
[1671] Fix | Delete
*
[1672] Fix | Delete
* @since 6.2.0
[1673] Fix | Delete
*
[1674] Fix | Delete
* @param array $attributes An array of attributes for the link markup,
[1675] Fix | Delete
* keyed on the attribute name.
[1676] Fix | Delete
* @param int $id Post ID.
[1677] Fix | Delete
*/
[1678] Fix | Delete
$attributes = apply_filters( 'wp_get_attachment_link_attributes', array( 'href' => $url ), $_post->ID );
[1679] Fix | Delete
[1680] Fix | Delete
$link_attributes = '';
[1681] Fix | Delete
foreach ( $attributes as $name => $value ) {
[1682] Fix | Delete
$value = 'href' === $name ? esc_url( $value ) : esc_attr( $value );
[1683] Fix | Delete
$link_attributes .= ' ' . esc_attr( $name ) . "='" . $value . "'";
[1684] Fix | Delete
}
[1685] Fix | Delete
[1686] Fix | Delete
$link_html = "<a$link_attributes>$link_text</a>";
[1687] Fix | Delete
[1688] Fix | Delete
/**
[1689] Fix | Delete
* Filters a retrieved attachment page link.
[1690] Fix | Delete
*
[1691] Fix | Delete
* @since 2.7.0
[1692] Fix | Delete
* @since 5.1.0 Added the `$attr` parameter.
[1693] Fix | Delete
*
[1694] Fix | Delete
* @param string $link_html The page link HTML output.
[1695] Fix | Delete
* @param int|WP_Post $post Post ID or object. Can be 0 for the current global post.
[1696] Fix | Delete
* @param string|int[] $size Requested image size. Can be any registered image size name, or
[1697] Fix | Delete
* an array of width and height values in pixels (in that order).
[1698] Fix | Delete
* @param bool $permalink Whether to add permalink to image. Default false.
[1699] Fix | Delete
* @param bool $icon Whether to include an icon.
[1700] Fix | Delete
* @param string|false $text If string, will be link text.
[1701] Fix | Delete
* @param array|string $attr Array or string of attributes.
[1702] Fix | Delete
*/
[1703] Fix | Delete
return apply_filters( 'wp_get_attachment_link', $link_html, $post, $size, $permalink, $icon, $text, $attr );
[1704] Fix | Delete
}
[1705] Fix | Delete
[1706] Fix | Delete
/**
[1707] Fix | Delete
* Wraps attachment in paragraph tag before content.
[1708] Fix | Delete
*
[1709] Fix | Delete
* @since 2.0.0
[1710] Fix | Delete
*
[1711] Fix | Delete
* @param string $content
[1712] Fix | Delete
* @return string
[1713] Fix | Delete
*/
[1714] Fix | Delete
function prepend_attachment( $content ) {
[1715] Fix | Delete
$post = get_post();
[1716] Fix | Delete
[1717] Fix | Delete
if ( empty( $post->post_type ) || 'attachment' !== $post->post_type ) {
[1718] Fix | Delete
return $content;
[1719] Fix | Delete
}
[1720] Fix | Delete
[1721] Fix | Delete
if ( wp_attachment_is( 'video', $post ) ) {
[1722] Fix | Delete
$meta = wp_get_attachment_metadata( get_the_ID() );
[1723] Fix | Delete
$atts = array( 'src' => wp_get_attachment_url() );
[1724] Fix | Delete
if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) {
[1725] Fix | Delete
$atts['width'] = (int) $meta['width'];
[1726] Fix | Delete
$atts['height'] = (int) $meta['height'];
[1727] Fix | Delete
}
[1728] Fix | Delete
if ( has_post_thumbnail() ) {
[1729] Fix | Delete
$atts['poster'] = wp_get_attachment_url( get_post_thumbnail_id() );
[1730] Fix | Delete
}
[1731] Fix | Delete
$p = wp_video_shortcode( $atts );
[1732] Fix | Delete
} elseif ( wp_attachment_is( 'audio', $post ) ) {
[1733] Fix | Delete
$p = wp_audio_shortcode( array( 'src' => wp_get_attachment_url() ) );
[1734] Fix | Delete
} else {
[1735] Fix | Delete
$p = '<p class="attachment">';
[1736] Fix | Delete
// Show the medium sized image representation of the attachment if available, and link to the raw file.
[1737] Fix | Delete
$p .= wp_get_attachment_link( 0, 'medium', false );
[1738] Fix | Delete
$p .= '</p>';
[1739] Fix | Delete
}
[1740] Fix | Delete
[1741] Fix | Delete
/**
[1742] Fix | Delete
* Filters the attachment markup to be prepended to the post content.
[1743] Fix | Delete
*
[1744] Fix | Delete
* @since 2.0.0
[1745] Fix | Delete
*
[1746] Fix | Delete
* @see prepend_attachment()
[1747] Fix | Delete
*
[1748] Fix | Delete
* @param string $p The attachment HTML output.
[1749] Fix | Delete
*/
[1750] Fix | Delete
$p = apply_filters( 'prepend_attachment', $p );
[1751] Fix | Delete
[1752] Fix | Delete
return "$p\n$content";
[1753] Fix | Delete
}
[1754] Fix | Delete
[1755] Fix | Delete
//
[1756] Fix | Delete
// Misc.
[1757] Fix | Delete
//
[1758] Fix | Delete
[1759] Fix | Delete
/**
[1760] Fix | Delete
* Retrieves protected post password form content.
[1761] Fix | Delete
*
[1762] Fix | Delete
* @since 1.0.0
[1763] Fix | Delete
*
[1764] Fix | Delete
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
[1765] Fix | Delete
* @return string HTML content for password form for password protected post.
[1766] Fix | Delete
*/
[1767] Fix | Delete
function get_the_password_form( $post = 0 ) {
[1768] Fix | Delete
$post = get_post( $post );
[1769] Fix | Delete
$label = 'pwbox-' . ( empty( $post->ID ) ? rand() : $post->ID );
[1770] Fix | Delete
$output = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" class="post-password-form" method="post">
[1771] Fix | Delete
<p>' . __( 'This content is password protected. To view it please enter your password below:' ) . '</p>
[1772] Fix | Delete
<p><label for="' . $label . '">' . __( 'Password:' ) . ' <input name="post_password" id="' . $label . '" type="password" spellcheck="false" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr_x( 'Enter', 'post password form' ) . '" /></p></form>
[1773] Fix | Delete
';
[1774] Fix | Delete
[1775] Fix | Delete
/**
[1776] Fix | Delete
* Filters the HTML output for the protected post password form.
[1777] Fix | Delete
*
[1778] Fix | Delete
* If modifying the password field, please note that the core database schema
[1779] Fix | Delete
* limits the password field to 20 characters regardless of the value of the
[1780] Fix | Delete
* size attribute in the form input.
[1781] Fix | Delete
*
[1782] Fix | Delete
* @since 2.7.0
[1783] Fix | Delete
* @since 5.8.0 Added the `$post` parameter.
[1784] Fix | Delete
*
[1785] Fix | Delete
* @param string $output The password form HTML output.
[1786] Fix | Delete
* @param WP_Post $post Post object.
[1787] Fix | Delete
*/
[1788] Fix | Delete
return apply_filters( 'the_password_form', $output, $post );
[1789] Fix | Delete
}
[1790] Fix | Delete
[1791] Fix | Delete
/**
[1792] Fix | Delete
* Determines whether the current post uses a page template.
[1793] Fix | Delete
*
[1794] Fix | Delete
* This template tag allows you to determine if you are in a page template.
[1795] Fix | Delete
* You can optionally provide a template filename or array of template filenames
[1796] Fix | Delete
* and then the check will be specific to that template.
[1797] Fix | Delete
*
[1798] Fix | Delete
* For more information on this and similar theme functions, check out
[1799] Fix | Delete
* the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
[1800] Fix | Delete
* Conditional Tags} article in the Theme Developer Handbook.
[1801] Fix | Delete
*
[1802] Fix | Delete
* @since 2.5.0
[1803] Fix | Delete
* @since 4.2.0 The `$template` parameter was changed to also accept an array of page templates.
[1804] Fix | Delete
* @since 4.7.0 Now works with any post type, not just pages.
[1805] Fix | Delete
*
[1806] Fix | Delete
* @param string|string[] $template The specific template filename or array of templates to match.
[1807] Fix | Delete
* @return bool True on success, false on failure.
[1808] Fix | Delete
*/
[1809] Fix | Delete
function is_page_template( $template = '' ) {
[1810] Fix | Delete
if ( ! is_singular() ) {
[1811] Fix | Delete
return false;
[1812] Fix | Delete
}
[1813] Fix | Delete
[1814] Fix | Delete
$page_template = get_page_template_slug( get_queried_object_id() );
[1815] Fix | Delete
[1816] Fix | Delete
if ( empty( $template ) ) {
[1817] Fix | Delete
return (bool) $page_template;
[1818] Fix | Delete
}
[1819] Fix | Delete
[1820] Fix | Delete
if ( $template === $page_template ) {
[1821] Fix | Delete
return true;
[1822] Fix | Delete
}
[1823] Fix | Delete
[1824] Fix | Delete
if ( is_array( $template ) ) {
[1825] Fix | Delete
if ( ( in_array( 'default', $template, true ) && ! $page_template )
[1826] Fix | Delete
|| in_array( $page_template, $template, true )
[1827] Fix | Delete
) {
[1828] Fix | Delete
return true;
[1829] Fix | Delete
}
[1830] Fix | Delete
}
[1831] Fix | Delete
[1832] Fix | Delete
return ( 'default' === $template && ! $page_template );
[1833] Fix | Delete
}
[1834] Fix | Delete
[1835] Fix | Delete
/**
[1836] Fix | Delete
* Gets the specific template filename for a given post.
[1837] Fix | Delete
*
[1838] Fix | Delete
* @since 3.4.0
[1839] Fix | Delete
* @since 4.7.0 Now works with any post type, not just pages.
[1840] Fix | Delete
*
[1841] Fix | Delete
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
[1842] Fix | Delete
* @return string|false Page template filename. Returns an empty string when the default page template
[1843] Fix | Delete
* is in use. Returns false if the post does not exist.
[1844] Fix | Delete
*/
[1845] Fix | Delete
function get_page_template_slug( $post = null ) {
[1846] Fix | Delete
$post = get_post( $post );
[1847] Fix | Delete
[1848] Fix | Delete
if ( ! $post ) {
[1849] Fix | Delete
return false;
[1850] Fix | Delete
}
[1851] Fix | Delete
[1852] Fix | Delete
$template = get_post_meta( $post->ID, '_wp_page_template', true );
[1853] Fix | Delete
[1854] Fix | Delete
if ( ! $template || 'default' === $template ) {
[1855] Fix | Delete
return '';
[1856] Fix | Delete
}
[1857] Fix | Delete
[1858] Fix | Delete
return $template;
[1859] Fix | Delete
}
[1860] Fix | Delete
[1861] Fix | Delete
/**
[1862] Fix | Delete
* Retrieves formatted date timestamp of a revision (linked to that revisions's page).
[1863] Fix | Delete
*
[1864] Fix | Delete
* @since 2.6.0
[1865] Fix | Delete
*
[1866] Fix | Delete
* @param int|WP_Post $revision Revision ID or revision object.
[1867] Fix | Delete
* @param bool $link Optional. Whether to link to revision's page. Default true.
[1868] Fix | Delete
* @return string|false i18n formatted datetimestamp or localized 'Current Revision'.
[1869] Fix | Delete
*/
[1870] Fix | Delete
function wp_post_revision_title( $revision, $link = true ) {
[1871] Fix | Delete
$revision = get_post( $revision );
[1872] Fix | Delete
[1873] Fix | Delete
if ( ! $revision ) {
[1874] Fix | Delete
return $revision;
[1875] Fix | Delete
}
[1876] Fix | Delete
[1877] Fix | Delete
if ( ! in_array( $revision->post_type, array( 'post', 'page', 'revision' ), true ) ) {
[1878] Fix | Delete
return false;
[1879] Fix | Delete
}
[1880] Fix | Delete
[1881] Fix | Delete
/* translators: Revision date format, see https://www.php.net/manual/datetime.format.php */
[1882] Fix | Delete
$datef = _x( 'F j, Y @ H:i:s', 'revision date format' );
[1883] Fix | Delete
/* translators: %s: Revision date. */
[1884] Fix | Delete
$autosavef = __( '%s [Autosave]' );
[1885] Fix | Delete
/* translators: %s: Revision date. */
[1886] Fix | Delete
$currentf = __( '%s [Current Revision]' );
[1887] Fix | Delete
[1888] Fix | Delete
$date = date_i18n( $datef, strtotime( $revision->post_modified ) );
[1889] Fix | Delete
$edit_link = get_edit_post_link( $revision->ID );
[1890] Fix | Delete
if ( $link && current_user_can( 'edit_post', $revision->ID ) && $edit_link ) {
[1891] Fix | Delete
$date = "<a href='$edit_link'>$date</a>";
[1892] Fix | Delete
}
[1893] Fix | Delete
[1894] Fix | Delete
if ( ! wp_is_post_revision( $revision ) ) {
[1895] Fix | Delete
$date = sprintf( $currentf, $date );
[1896] Fix | Delete
} elseif ( wp_is_post_autosave( $revision ) ) {
[1897] Fix | Delete
$date = sprintf( $autosavef, $date );
[1898] Fix | Delete
}
[1899] Fix | Delete
[1900] Fix | Delete
return $date;
[1901] Fix | Delete
}
[1902] Fix | Delete
[1903] Fix | Delete
/**
[1904] Fix | Delete
* Retrieves formatted date timestamp of a revision (linked to that revisions's page).
[1905] Fix | Delete
*
[1906] Fix | Delete
* @since 3.6.0
[1907] Fix | Delete
*
[1908] Fix | Delete
* @param int|WP_Post $revision Revision ID or revision object.
[1909] Fix | Delete
* @param bool $link Optional. Whether to link to revision's page. Default true.
[1910] Fix | Delete
* @return string|false gravatar, user, i18n formatted datetimestamp or localized 'Current Revision'.
[1911] Fix | Delete
*/
[1912] Fix | Delete
function wp_post_revision_title_expanded( $revision, $link = true ) {
[1913] Fix | Delete
$revision = get_post( $revision );
[1914] Fix | Delete
[1915] Fix | Delete
if ( ! $revision ) {
[1916] Fix | Delete
return $revision;
[1917] Fix | Delete
}
[1918] Fix | Delete
[1919] Fix | Delete
if ( ! in_array( $revision->post_type, array( 'post', 'page', 'revision' ), true ) ) {
[1920] Fix | Delete
return false;
[1921] Fix | Delete
}
[1922] Fix | Delete
[1923] Fix | Delete
$author = get_the_author_meta( 'display_name', $revision->post_author );
[1924] Fix | Delete
/* translators: Revision date format, see https://www.php.net/manual/datetime.format.php */
[1925] Fix | Delete
$datef = _x( 'F j, Y @ H:i:s', 'revision date format' );
[1926] Fix | Delete
[1927] Fix | Delete
$gravatar = get_avatar( $revision->post_author, 24 );
[1928] Fix | Delete
[1929] Fix | Delete
$date = date_i18n( $datef, strtotime( $revision->post_modified ) );
[1930] Fix | Delete
$edit_link = get_edit_post_link( $revision->ID );
[1931] Fix | Delete
if ( $link && current_user_can( 'edit_post', $revision->ID ) && $edit_link ) {
[1932] Fix | Delete
$date = "<a href='$edit_link'>$date</a>";
[1933] Fix | Delete
}
[1934] Fix | Delete
[1935] Fix | Delete
$revision_date_author = sprintf(
[1936] Fix | Delete
/* translators: Post revision title. 1: Author avatar, 2: Author name, 3: Time ago, 4: Date. */
[1937] Fix | Delete
__( '%1$s %2$s, %3$s ago (%4$s)' ),
[1938] Fix | Delete
$gravatar,
[1939] Fix | Delete
$author,
[1940] Fix | Delete
human_time_diff( strtotime( $revision->post_modified_gmt ) ),
[1941] Fix | Delete
$date
[1942] Fix | Delete
);
[1943] Fix | Delete
[1944] Fix | Delete
/* translators: %s: Revision date with author avatar. */
[1945] Fix | Delete
$autosavef = __( '%s [Autosave]' );
[1946] Fix | Delete
/* translators: %s: Revision date with author avatar. */
[1947] Fix | Delete
$currentf = __( '%s [Current Revision]' );
[1948] Fix | Delete
[1949] Fix | Delete
if ( ! wp_is_post_revision( $revision ) ) {
[1950] Fix | Delete
$revision_date_author = sprintf( $currentf, $revision_date_author );
[1951] Fix | Delete
} elseif ( wp_is_post_autosave( $revision ) ) {
[1952] Fix | Delete
$revision_date_author = sprintf( $autosavef, $revision_date_author );
[1953] Fix | Delete
}
[1954] Fix | Delete
[1955] Fix | Delete
/**
[1956] Fix | Delete
* Filters the formatted author and date for a revision.
[1957] Fix | Delete
*
[1958] Fix | Delete
* @since 4.4.0
[1959] Fix | Delete
*
[1960] Fix | Delete
* @param string $revision_date_author The formatted string.
[1961] Fix | Delete
* @param WP_Post $revision The revision object.
[1962] Fix | Delete
* @param bool $link Whether to link to the revisions page, as passed into
[1963] Fix | Delete
* wp_post_revision_title_expanded().
[1964] Fix | Delete
*/
[1965] Fix | Delete
return apply_filters( 'wp_post_revision_title_expanded', $revision_date_author, $revision, $link );
[1966] Fix | Delete
}
[1967] Fix | Delete
[1968] Fix | Delete
/**
[1969] Fix | Delete
* Displays a list of a post's revisions.
[1970] Fix | Delete
*
[1971] Fix | Delete
* Can output either a UL with edit links or a TABLE with diff interface, and
[1972] Fix | Delete
* restore action links.
[1973] Fix | Delete
*
[1974] Fix | Delete
* @since 2.6.0
[1975] Fix | Delete
*
[1976] Fix | Delete
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
[1977] Fix | Delete
* @param string $type 'all' (default), 'revision' or 'autosave'
[1978] Fix | Delete
*/
[1979] Fix | Delete
function wp_list_post_revisions( $post = 0, $type = 'all' ) {
[1980] Fix | Delete
$post = get_post( $post );
[1981] Fix | Delete
[1982] Fix | Delete
if ( ! $post ) {
[1983] Fix | Delete
return;
[1984] Fix | Delete
}
[1985] Fix | Delete
[1986] Fix | Delete
// $args array with (parent, format, right, left, type) deprecated since 3.6.
[1987] Fix | Delete
if ( is_array( $type ) ) {
[1988] Fix | Delete
$type = ! empty( $type['type'] ) ? $type['type'] : $type;
[1989] Fix | Delete
_deprecated_argument( __FUNCTION__, '3.6.0' );
[1990] Fix | Delete
}
[1991] Fix | Delete
[1992] Fix | Delete
$revisions = wp_get_post_revisions( $post->ID );
[1993] Fix | Delete
[1994] Fix | Delete
if ( ! $revisions ) {
[1995] Fix | Delete
return;
[1996] Fix | Delete
}
[1997] Fix | Delete
[1998] Fix | Delete
$rows = '';
[1999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function