Make WordPress Core

Ticket #40780: 40780.patch

File 40780.patch, 4.8 KB (added by GunGeekATX, 9 years ago)
  • src/wp-includes/link-template.php

     
    247247 *
    248248 * @global WP_Rewrite $wp_rewrite
    249249 *
    250  * @param int $id         Optional. Post ID. Default uses the global `$post`.
    251  * @param bool $leavename Optional, defaults to false. Whether to keep post name. Default false.
    252  * @param bool $sample    Optional, defaults to false. Is it a sample permalink. Default false.
     250 * @param int|WP_Post $post      Optional. Post ID or post object. Default is the global `$post`.
     251 * @param bool        $leavename Optional, defaults to false. Whether to keep post name. Default false.
     252 * @param bool        $sample    Optional, defaults to false. Is it a sample permalink. Default false.
    253253 * @return string|WP_Error The post permalink.
    254254 */
    255 function get_post_permalink( $id = 0, $leavename = false, $sample = false ) {
     255function get_post_permalink( $post = 0, $leavename = false, $sample = false ) {
    256256        global $wp_rewrite;
    257257
    258         $post = get_post($id);
     258        $post = get_post( $post );
    259259
    260260        if ( is_wp_error( $post ) )
    261261                return $post;
     
    264264
    265265        $slug = $post->post_name;
    266266
    267         $draft_or_pending = get_post_status( $id ) && in_array( get_post_status( $id ), array( 'draft', 'pending', 'auto-draft', 'future' ) );
     267        $draft_or_pending = get_post_status( $post ) && in_array( get_post_status( $post ), array( 'draft', 'pending', 'auto-draft', 'future' ) );
    268268
    269269        $post_type = get_post_type_object($post->post_type);
    270270
    271271        if ( $post_type->hierarchical ) {
    272                 $slug = get_page_uri( $id );
     272                $slug = get_page_uri( $post );
    273273        }
    274274
    275275        if ( !empty($post_link) && ( !$draft_or_pending || $sample ) ) {
     
    12621262 *
    12631263 * @since 2.3.0
    12641264 *
    1265  * @param int    $id      Optional. Post ID. Default is the ID of the global `$post`.
    1266  * @param string $context Optional. How to output the '&' character. Default '&'.
     1265 * @param int|WP_Post $post    Optional. Post ID or post object. Default is the global `$post`.
     1266 * @param string      $context Optional. How to output the '&' character. Default '&'.
    12671267 * @return string|null The edit post link for the given post. null if the post type is invalid or does
    12681268 *                     not allow an editing UI.
    12691269 */
    1270 function get_edit_post_link( $id = 0, $context = 'display' ) {
    1271         if ( ! $post = get_post( $id ) )
     1270function get_edit_post_link( $post = 0, $context = 'display' ) {
     1271        if ( ! $post = get_post( $post ) )
    12721272                return;
    12731273
    12741274        if ( 'revision' === $post->post_type )
     
    13101310 * @since 1.0.0
    13111311 * @since 4.4.0 The `$class` argument was added.
    13121312 *
    1313  * @param string $text   Optional. Anchor text. If null, default is 'Edit This'. Default null.
    1314  * @param string $before Optional. Display before edit link. Default empty.
    1315  * @param string $after  Optional. Display after edit link. Default empty.
    1316  * @param int    $id     Optional. Post ID. Default is the ID of the global `$post`.
    1317  * @param string $class  Optional. Add custom class to link. Default 'post-edit-link'.
     1313 * @param string      $text   Optional. Anchor text. If null, default is 'Edit This'. Default null.
     1314 * @param string      $before Optional. Display before edit link. Default empty.
     1315 * @param string      $after  Optional. Display after edit link. Default empty.
     1316 * @param int|WP_Post $post   Optional. Post ID or post object. Default is the global `$post`.
     1317 * @param string      $class  Optional. Add custom class to link. Default 'post-edit-link'.
    13181318 */
    1319 function edit_post_link( $text = null, $before = '', $after = '', $id = 0, $class = 'post-edit-link' ) {
    1320         if ( ! $post = get_post( $id ) ) {
     1319function edit_post_link( $text = null, $before = '', $after = '', $post = 0, $class = 'post-edit-link' ) {
     1320        if ( ! $post = get_post( $post ) ) {
    13211321                return;
    13221322        }
    13231323
     
    13501350 *
    13511351 * @since 2.9.0
    13521352 *
    1353  * @param int    $id           Optional. Post ID. Default is the ID of the global `$post`.
    1354  * @param string $deprecated   Not used.
    1355  * @param bool   $force_delete Optional. Whether to bypass trash and force deletion. Default false.
     1353 * @param int|WP_Post $post         Optional. Post ID or post object. Default is the global `$post`.
     1354 * @param string      $deprecated   Not used.
     1355 * @param bool        $force_delete Optional. Whether to bypass trash and force deletion. Default false.
    13561356 * @return string|void The delete post link URL for the given post.
    13571357 */
    1358 function get_delete_post_link( $id = 0, $deprecated = '', $force_delete = false ) {
     1358function get_delete_post_link( $post = 0, $deprecated = '', $force_delete = false ) {
    13591359        if ( ! empty( $deprecated ) )
    13601360                _deprecated_argument( __FUNCTION__, '3.0.0' );
    13611361
    1362         if ( !$post = get_post( $id ) )
     1362        if ( !$post = get_post( $post ) )
    13631363                return;
    13641364
    13651365        $post_type_object = get_post_type_object( $post->post_type );