WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/19/2016 11:20:32 PM (3 years ago)
Author:
DrewAPicture
Message:

Docs: Properly notate optional parameters as such in a variety of DocBlocks in wp-includes/link-template.php.

See #30406.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/link-template.php

    r37215 r37252  
    4040 * @global WP_Rewrite $wp_rewrite
    4141 *
    42  * @param string $string URL with or without a trailing slash.
    43  * @param string $type_of_url The type of URL being considered (e.g. single, category, etc) for use in the filter.
     42 * @param string $string      URL with or without a trailing slash.
     43 * @param string $type_of_url Optional. The type of URL being considered (e.g. single, category, etc)
     44 *                            for use in the filter. Default empty string.
    4445 * @return string The URL with the trailing slash appended or stripped.
    4546 */
     
    7273 * @since 0.71
    7374 *
    74  * @param string $mode Permalink mode can be either 'title', 'id', or default, which is 'id'.
     75 * @param string $mode Optional. Permalink mode. Accepts 'title' or 'id'. Default 'id'.
    7576 */
    7677function permalink_anchor( $mode = 'id' ) {
     
    243244 * @global WP_Rewrite $wp_rewrite
    244245 *
    245  * @param int $id         Optional. Post ID.
    246  * @param bool $leavename Optional, defaults to false. Whether to keep post name.
    247  * @param bool $sample    Optional, defaults to false. Is it a sample permalink.
     246 * @param int $id         Optional. Post ID. Default uses the global `$post`.
     247 * @param bool $leavename Optional, defaults to false. Whether to keep post name. Default false.
     248 * @param bool $sample    Optional, defaults to false. Is it a sample permalink. Default false.
    248249 * @return string|WP_Error The post permalink.
    249250 */
     
    301302 * @since 1.5.0
    302303 *
    303  * @param int|object $post      Optional. Post ID or object.
    304  * @param bool       $leavename Optional, defaults to false. Whether to keep page name.
    305  * @param bool       $sample    Optional, defaults to false. Is it a sample permalink.
     304 * @param int|WP_Post $post      Optional. Post ID or object. Default uses the global `$post`.
     305 * @param bool        $leavename Optional. Whether to keep the page name. Default false.
     306 * @param bool        $sample    Optional. Whether it should be treated as a sample permalink.
     307 *                               Default false.
    306308 * @return string The page permalink.
    307309 */
     
    336338 * @global WP_Rewrite $wp_rewrite
    337339 *
    338  * @param int|object $post      Optional. Post ID or object.
    339  * @param bool       $leavename Optional. Leave name.
    340  * @param bool       $sample    Optional. Sample permalink.
     340 * @param int|WP_Post $post      Optional. Post ID or object. Default uses the global `$post`.
     341 * @param bool        $leavename Optional. Whether to keep the page name. Default false.
     342 * @param bool        $sample    Optional. Whether it should be treated as a sample permalink.
     343 *                               Default false.
    341344 * @return string The page permalink.
    342345 */
     
    381384 * @global WP_Rewrite $wp_rewrite
    382385 *
    383  * @param int|object $post      Optional. Post ID or object.
    384  * @param bool       $leavename Optional. Leave name.
     386 * @param int|object $post      Optional. Post ID or object. Default uses the global `$post`.
     387 * @param bool       $leavename Optional. Whether to keep the page name. Default false.
    385388 * @return string The attachment permalink.
    386389 */
     
    440443 * @return string The permalink for the specified year archive.
    441444 */
    442 function get_year_link($year) {
     445function get_year_link( $year ) {
    443446    global $wp_rewrite;
    444447    if ( !$year )
     
    551554 *
    552555 * @param string $anchor The link's anchor text.
    553  * @param string $feed   Optional, defaults to default feed. Feed type.
     556 * @param string $feed   Optional. Feed type. Default empty.
    554557 */
    555558function the_feed_link( $anchor, $feed = '' ) {
     
    575578 * @global WP_Rewrite $wp_rewrite
    576579 *
    577  * @param string $feed Optional, defaults to default feed. Feed type.
     580 * @param string $feed Optional. Feed type. Default empty.
    578581 * @return string The feed permalink.
    579582 */
    580 function get_feed_link($feed = '') {
     583function get_feed_link( $feed = '' ) {
    581584    global $wp_rewrite;
    582585
     
    620623 * @since 2.2.0
    621624 *
    622  * @param int    $post_id Optional. Post ID.
    623  * @param string $feed    Optional. Feed type.
     625 * @param int    $post_id Optional. Post ID. Default is the ID of the global `$post`.
     626 * @param string $feed    Optional. Feed type. Default empty.
    624627 * @return string The permalink for the comments feed for the given post.
    625628 */
    626 function get_post_comments_feed_link($post_id = 0, $feed = '') {
     629function get_post_comments_feed_link( $post_id = 0, $feed = '' ) {
    627630    $post_id = absint( $post_id );
    628631
     
    683686 * @since 2.5.0
    684687 *
    685  * @param string $link_text Descriptive text.
    686  * @param int    $post_id   Optional post ID. Default to current post.
    687  * @param string $feed      Optional. Feed format.
     688 * @param string $link_text Optional. Descriptive link text. Default 'Comments Feed'.
     689 * @param int    $post_id   Optional. Post ID. Default is the ID of the global `$post`.
     690 * @param string $feed      Optional. Feed format. Default empty.
    688691 */
    689692function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) {
     
    714717 * @since 2.5.0
    715718 *
    716  * @param int    $author_id ID of an author.
    717  * @param string $feed      Optional. Feed type.
     719 * @param int    $author_id Author ID.
     720 * @param string $feed      Optional. Feed type. Default empty.
    718721 * @return string Link to the feed for the author specified by $author_id.
    719722 */
     
    758761 * @since 2.5.0
    759762 *
    760  * @param int    $cat_id ID of a category.
    761  * @param string $feed   Optional. Feed type.
     763 * @param int    $cat_id Category ID.
     764 * @param string $feed   Optional. Feed type. Default empty.
    762765 * @return string Link to the feed for the category specified by $cat_id.
    763766 */
     
    774777 * @since 3.0.0
    775778 *
    776  * @param int    $term_id  ID of a category.
    777  * @param string $taxonomy Optional. Taxonomy of $term_id
    778  * @param string $feed     Optional. Feed type.
     779 * @param int    $term_id  Term ID.
     780 * @param string $taxonomy Optional. Taxonomy of `$term_id`. Default 'category'.
     781 * @param string $feed     Optional. Feed type. Default empty.
    779782 * @return string|false Link to the feed for the term specified by $term_id and $taxonomy.
    780783 */
     
    854857 *
    855858 * @param int    $tag_id Tag ID.
    856  * @param string $feed   Optional. Feed type.
     859 * @param string $feed   Optional. Feed type. Default empty.
    857860 * @return string The feed permalink for the given tag.
    858861 */
     
    866869 * @since 2.7.0
    867870 *
    868  * @param int    $tag_id   Tag ID
    869  * @param string $taxonomy Taxonomy
     871 * @param int    $tag_id   Tag ID.
     872 * @param string $taxonomy Optional. Taxonomy slug. Default 'post_tag'.
    870873 * @return string The edit tag link URL for the given tag.
    871874 */
     
    886889 * @since 2.7.0
    887890 *
    888  * @param string $link   Optional. Anchor text.
    889  * @param string $before Optional. Display before edit link.
    890  * @param string $after  Optional. Display after edit link.
    891  * @param object $tag    Tag object.
     891 * @param string  $link   Optional. Anchor text. Default empty.
     892 * @param string  $before Optional. Display before edit link. Default empty.
     893 * @param string  $after  Optional. Display after edit link. Default empty.
     894 * @param WP_Term $tag    Optional. Term object. If null, the queried object will be inspected.
     895 *                        Default null.
    892896 */
    893897function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) {
     
    911915 *
    912916 * @param int    $term_id     Term ID.
    913  * @param string $taxonomy    Optional. Taxonomy. Defaults to the taxonomy of the term identified by `$term_id`.
    914  * @param string $object_type Optional. The object type. Used to highlight the proper post type menu on the linked page.
    915  *                            Defaults to the first object_type associated with the taxonomy.
     917 * @param string $taxonomy    Optional. Taxonomy. Defaults to the taxonomy of the term identified
     918 *                            by `$term_id`.
     919 * @param string $object_type Optional. The object type. Used to highlight the proper post type
     920 *                            menu on the linked page. Defaults to the first object_type associated
     921 *                            with the taxonomy.
    916922 * @return string|null The edit term link URL for the given term, or null on failure.
    917923 */
     
    10081014 * @global WP_Rewrite $wp_rewrite
    10091015 *
    1010  * @param string $query Optional. The query string to use. If empty the current query is used.
     1016 * @param string $query Optional. The query string to use. If empty the current query is used. Default empty.
    10111017 * @return string The search permalink.
    10121018 */
     
    10481054 * @global WP_Rewrite $wp_rewrite
    10491055 *
    1050  * @param string $search_query Optional. Search query.
    1051  * @param string $feed         Optional. Feed type.
     1056 * @param string $search_query Optional. Search query. Default empty.
     1057 * @param string $feed         Optional. Feed type. Default empty.
    10521058 * @return string The search results feed permalink.
    10531059 */
     
    10871093 * @global WP_Rewrite $wp_rewrite
    10881094 *
    1089  * @param string $search_query Optional. Search query.
    1090  * @param string $feed         Optional. Feed type.
     1095 * @param string $search_query Optional. Search query. Default empty.
     1096 * @param string $feed         Optional. Feed type. Default empty.
    10911097 * @return string The comments feed search results permalink.
    10921098 */
     
    11701176 *
    11711177 * @param string $post_type Post type
    1172  * @param string $feed      Optional. Feed type
     1178 * @param string $feed      Optional. Feed type. Default empty.
    11731179 * @return string|false The post type feed permalink.
    11741180 */
     
    12091215 * @since 4.4.0
    12101216 *
    1211  * @param int|WP_Post $post         Optional. Post ID or `WP_Post` object. Defaults to global post.
     1217 * @param int|WP_Post $post         Optional. Post ID or `WP_Post` object. Defaults to global `$post`.
    12121218 * @param array       $query_args   Optional. Array of additional query args to be appended to the link.
    1213  * @param string      $preview_link Optional. Base preview link to be used if it should differ from the post permalink.
     1219 *                                  Default empty array.
     1220 * @param string      $preview_link Optional. Base preview link to be used if it should differ from the
     1221 *                                  post permalink. Default empty.
    12141222 * @return string URL used for the post preview.
    12151223 */
     
    14031411 *
    14041412 * @since 1.0.0
    1405  * @since 4.6.0 The `$comment` and `$class` arguments were added.
    1406  *
    1407  * @param string         $text    Optional. Anchor text.
    1408  * @param string         $before  Optional. Display before edit link.
    1409  * @param string         $after   Optional. Display after edit link.
    1410  * @param int|WP_Comment $comment Optional. Comment ID or WP_Comment object.
    1411  * @param string         $class   Optional. Add custom class to link.
    1412  */
    1413 function edit_comment_link( $text = null, $before = '', $after = '', $comment = 0, $class = 'comment-edit-link' ) {
    1414     $comment = get_comment( $comment );
     1413 *
     1414 * @param string $text   Optional. Anchor text.
     1415 * @param string $before Optional. Display before edit link.
     1416 * @param string $after  Optional. Display after edit link.
     1417 */
     1418function edit_comment_link( $text = null, $before = '', $after = '' ) {
     1419    $comment = get_comment();
    14151420
    14161421    if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
     
    14221427    }
    14231428
    1424     $link = '<a class="' . esc_attr( $class ) . '" href="' . esc_url( get_edit_comment_link( $comment ) ) . '">' . $text . '</a>';
     1429    $link = '<a class="comment-edit-link" href="' . esc_url( get_edit_comment_link( $comment ) ) . '">' . $text . '</a>';
    14251430
    14261431    /**
Note: See TracChangeset for help on using the changeset viewer.