Make WordPress Core

Changeset 32617


Ignore:
Timestamp:
05/27/2015 04:25:17 PM (9 years ago)
Author:
wonderboymusic
Message:

Add missing doc blocks to post-template.php.
Correct some types for @param and @return.
is_page_template() can return the conditional instead of if/else true/false.

See #32444.

File:
1 edited

Legend:

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

    r32081 r32617  
    2323 * @since 2.1.0
    2424 *
    25  * @return int|bool The ID of the current item in the WordPress Loop. False if $post is not set.
     25 * @return int|false The ID of the current item in the WordPress Loop. False if $post is not set.
    2626 */
    2727function get_the_ID() {
     
    3636 *
    3737 * @param string $before Optional. Content to prepend to the title.
    38  * @param string $after Optional. Content to append to the title.
    39  * @param bool $echo Optional, default to true.Whether to display or return.
    40  * @return null|string Null on no title. String if $echo parameter is false.
    41  */
    42 function the_title($before = '', $after = '', $echo = true) {
     38 * @param string $after  Optional. Content to append to the title.
     39 * @param bool   $echo  Optional, default to true.Whether to display or return.
     40 * @return string|void String if $echo parameter is false.
     41 */
     42function the_title( $before = '', $after = '', $echo = true ) {
    4343    $title = get_the_title();
    4444
     
    7474 *     @type WP_Post $post   Current post object to retrieve the title for.
    7575 * }
    76  * @return string|null Null on failure or display. String when echo is false.
     76 * @return string|void String when echo is false.
    7777 */
    7878function the_title_attribute( $args = '' ) {
     
    238238 * @since 0.71
    239239 *
     240 * @global int   $page
     241 * @global int   $more
     242 * @global bool  $preview
     243 * @global array $pages
     244 * @global int   $multipage
     245 *
    240246 * @param string $more_link_text Optional. Content for when there is more text.
    241247 * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false.
     
    521527 *
    522528 * @since 2.8.0
     529 *
     530 * @global WP_Query $wp_query
     531 * @global wpdb     $wpdb
    523532 *
    524533 * @param string|array $class One or more classes to add to the class list.
     
    727736 * @since 2.7.0
    728737 *
    729  * @param int|WP_Post $post An optional post. Global $post used if not provided.
     738 * @param int|WP_Post|null $post An optional post. Global $post used if not provided.
    730739 * @return bool false if a password is not required or the correct password cookie is present, true otherwise.
    731740 */
     
    760769 *
    761770 * @since 1.2.0
     771 *
     772 * @global int $page
     773 * @global int $numpages
     774 * @global int $multipage
     775 * @global int $more
    762776 *
    763777 * @param string|array $args {
     
    783797 */
    784798function wp_link_pages( $args = '' ) {
     799    global $page, $numpages, $multipage, $more;
     800
    785801    $defaults = array(
    786802        'before'           => '<p>' . __( 'Pages:' ),
     
    806822     */
    807823    $r = apply_filters( 'wp_link_pages_args', $params );
    808 
    809     global $page, $numpages, $multipage, $more;
    810824
    811825    $output = '';
     
    878892 * @access private
    879893 *
     894 * @global WP_Rewrite $wp_rewrite
     895 *
    880896 * @param int $i Page number.
    881897 * @return string Link.
     
    922938 *
    923939 * @param string $key Meta data key name.
    924  * @return bool|string|array Array of values or single value, if only one element exists. False will be returned if key does not exist.
     940 * @return false|string|array Array of values or single value, if only one element exists. False will be returned if key does not exist.
    925941 */
    926942function post_custom( $key = '' ) {
     
    10481064 *
    10491065 * @see get_pages()
     1066 *
     1067 * @global WP_Query $wp_query
    10501068 *
    10511069 * @param array|string $args {
     
    10751093 *     @type Walker $walker       Walker instance to use for listing pages. Default empty (Walker_Page).
    10761094 * }
    1077  * @return string HTML list of pages.
     1095 * @return string|void HTML list of pages.
    10781096 */
    10791097function wp_list_pages( $args = '' ) {
     
    11731191 *                                        you'd like shown for the home link. 1|true defaults to 'Home'.
    11741192 * }
    1175  * @return string html menu
     1193 * @return string|void HTML menu
    11761194 */
    11771195function wp_page_menu( $args = array() ) {
     
    12501268 * @uses Walker_Page to create HTML list content.
    12511269 * @since 2.1.0
    1252  * @see Walker_Page::walk() for parameters and return description.
    1253  */
    1254 function walk_page_tree($pages, $depth, $current_page, $r) {
     1270 *
     1271 * @param array $pages
     1272 * @param int   $depth
     1273 * @param int   $current_page
     1274 * @param array $r
     1275 * @return string
     1276 */
     1277function walk_page_tree( $pages, $depth, $current_page, $r ) {
    12551278    if ( empty($r['walker']) )
    12561279        $walker = new Walker_Page;
     
    12731296 * @since 2.1.0
    12741297 * @see Walker_PageDropdown::walk() for parameters and return description.
     1298 *
     1299 * @return string
    12751300 */
    12761301function walk_page_dropdown_tree() {
     
    13111336     *
    13121337     * @param string $output Passed by reference. Used to append additional content.
    1313      * @param int $depth Depth of page. Used for padding.
    1314      * @param array $args
     1338     * @param int    $depth Depth of page. Used for padding.
     1339     * @param array  $args
    13151340     */
    13161341    public function start_lvl( &$output, $depth = 0, $args = array() ) {
     
    13241349     *
    13251350     * @param string $output Passed by reference. Used to append additional content.
    1326      * @param int $depth Depth of page. Used for padding.
    1327      * @param array $args
     1351     * @param int    $depth Depth of page. Used for padding.
     1352     * @param array  $args
    13281353     */
    13291354    public function end_lvl( &$output, $depth = 0, $args = array() ) {
     
    13361361     * @since 2.1.0
    13371362     *
    1338      * @param string $output Passed by reference. Used to append additional content.
    1339      * @param object $page Page data object.
    1340      * @param int $depth Depth of page. Used for padding.
    1341      * @param int $current_page Page ID.
    1342      * @param array $args
     1363     * @param string $output       Passed by reference. Used to append additional content.
     1364     * @param object $page         Page data object.
     1365     * @param int    $depth        Depth of page. Used for padding.
     1366     * @param int    $current_page Page ID.
     1367     * @param array  $args
    13431368     */
    13441369    public function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) {
     
    14201445     * @param string $output Passed by reference. Used to append additional content.
    14211446     * @param object $page Page data object. Not used.
    1422      * @param int $depth Depth of page. Not Used.
    1423      * @param array $args
     1447     * @param int    $depth Depth of page. Not Used.
     1448     * @param array  $args
    14241449     */
    14251450    public function end_el( &$output, $page, $depth = 0, $args = array() ) {
     
    14591484     * @param int    $depth  Depth of page in reference to parent pages. Used for padding.
    14601485     * @param array  $args   Uses 'selected' argument for selected page to set selected HTML attribute for option
    1461      *              element. Uses 'value_field' argument to fill "value" attribute. See {@see wp_dropdown_pages()}.
    1462      * @param int $id
     1486     *                       element. Uses 'value_field' argument to fill "value" attribute. See {@see wp_dropdown_pages()}.
     1487     * @param int    $id
    14631488     */
    14641489    public function start_el( &$output, $page, $depth = 0, $args = array(), $id = 0 ) {
     
    16811706    }
    16821707
    1683     if ( 'default' == $template && ! $page_template )
    1684         return true;
    1685 
    1686     return false;
     1708    return ( 'default' === $template && ! $page_template );
    16871709}
    16881710
     
    16931715 *
    16941716 * @param int $post_id Optional. The page ID to check. Defaults to the current post, when used in the loop.
    1695  * @return string|bool Page template filename. Returns an empty string when the default page template
     1717 * @return string|false Page template filename. Returns an empty string when the default page template
    16961718 *  is in use. Returns false if the post is not a page.
    16971719 */
     
    17121734 *
    17131735 * @param int|object $revision Revision ID or revision object.
    1714  * @param bool $link Optional, default is true. Link to revisions's page?
    1715  * @return string i18n formatted datetimestamp or localized 'Current Revision'.
     1736 * @param bool       $link    Optional, default is true. Link to revisions's page?
     1737 * @return string|false i18n formatted datetimestamp or localized 'Current Revision'.
    17161738 */
    17171739function wp_post_revision_title( $revision, $link = true ) {
     
    17471769 *
    17481770 * @param int|object $revision Revision ID or revision object.
    1749  * @param bool $link Optional, default is true. Link to revisions's page?
    1750  * @return string gravatar, user, i18n formatted datetimestamp or localized 'Current Revision'.
     1771 * @param bool       $link    Optional, default is true. Link to revisions's page?
     1772 * @return string|false gravatar, user, i18n formatted datetimestamp or localized 'Current Revision'.
    17511773 */
    17521774function wp_post_revision_title_expanded( $revision, $link = true ) {
     
    17971819 * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
    17981820 * @param string      $type    'all' (default), 'revision' or 'autosave'
    1799  * @return null
    18001821 */
    18011822function wp_list_post_revisions( $post_id = 0, $type = 'all' ) {
Note: See TracChangeset for help on using the changeset viewer.