Make WordPress Core

Changeset 27341


Ignore:
Timestamp:
03/01/2014 09:30:55 AM (10 years ago)
Author:
DrewAPicture
Message:

Inline documentation for hooks in wp-includes/rewrite.php.

Props mboynes for the initial patch.
Fixes #26095.

File:
1 edited

Legend:

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

    r27327 r27341  
    290290    global $wp_rewrite;
    291291
    292     $url = apply_filters('url_to_postid', $url);
     292    /**
     293     * Filter the URL to derive the post ID from.
     294     *
     295     * @since 2.2.0
     296     *
     297     * @param string $url The URL to derive the post ID from.
     298     */
     299    $url = apply_filters( 'url_to_postid', $url );
    293300
    294301    // First, check to see if there is a 'p=N' or 'page_id=N' to match against
     
    15601567        $registration_pages['.*wp-register.php$'] = $this->index . '?register=true'; // Deprecated
    15611568
    1562         // Post
     1569        // Post rewrite rules.
    15631570        $post_rewrite = $this->generate_rewrite_rules( $this->permalink_structure, EP_PERMALINK );
    1564         $post_rewrite = apply_filters('post_rewrite_rules', $post_rewrite);
    1565 
    1566         // Date
     1571
     1572        /**
     1573         * Filter rewrite rules used for "post" archives.
     1574         *
     1575         * @since 1.5.0
     1576         *
     1577         * @param array $post_rewrite The rewrite rules for posts.
     1578         */
     1579        $post_rewrite = apply_filters( 'post_rewrite_rules', $post_rewrite );
     1580
     1581        // Date rewrite rules.
    15671582        $date_rewrite = $this->generate_rewrite_rules($this->get_date_permastruct(), EP_DATE);
    1568         $date_rewrite = apply_filters('date_rewrite_rules', $date_rewrite);
    1569 
    1570         // Root
     1583
     1584        /**
     1585         * Filter rewrite rules used for date archives.
     1586         *
     1587         * Likely date archives would include /yyyy/, /yyyy/mm/, and /yyyy/mm/dd/.
     1588         *
     1589         * @since 1.5.0
     1590         *
     1591         * @param array $date_rewrite The rewrite rules for date archives.
     1592         */
     1593        $date_rewrite = apply_filters( 'date_rewrite_rules', $date_rewrite );
     1594
     1595        // Root-level rewrite rules.
    15711596        $root_rewrite = $this->generate_rewrite_rules($this->root . '/', EP_ROOT);
    1572         $root_rewrite = apply_filters('root_rewrite_rules', $root_rewrite);
    1573 
    1574         // Comments
     1597
     1598        /**
     1599         * Filter rewrite rules used for root-level archives.
     1600         *
     1601         * Likely root-level archives would include pagination rules for the homepage
     1602         * as well as site-wide post feeds (e.g. /feed/, and /feed/atom/).
     1603         *
     1604         * @since 1.5.0
     1605         *
     1606         * @param array $root_rewrite The root-level rewrite rules.
     1607         */
     1608        $root_rewrite = apply_filters( 'root_rewrite_rules', $root_rewrite );
     1609
     1610        // Comments rewrite rules.
    15751611        $comments_rewrite = $this->generate_rewrite_rules($this->root . $this->comments_base, EP_COMMENTS, false, true, true, false);
    1576         $comments_rewrite = apply_filters('comments_rewrite_rules', $comments_rewrite);
    1577 
    1578         // Search
     1612
     1613        /**
     1614         * Filter rewrite rules used for comment feed archives.
     1615         *
     1616         * Likely comments feed archives include /comments/feed/, and /comments/feed/atom/.
     1617         *
     1618         * @since 1.5.0
     1619         *
     1620         * @param array $comments_rewrite The rewrite rules for the site-wide comments feeds.
     1621         */
     1622        $comments_rewrite = apply_filters( 'comments_rewrite_rules', $comments_rewrite );
     1623
     1624        // Search rewrite rules.
    15791625        $search_structure = $this->get_search_permastruct();
    15801626        $search_rewrite = $this->generate_rewrite_rules($search_structure, EP_SEARCH);
    1581         $search_rewrite = apply_filters('search_rewrite_rules', $search_rewrite);
    1582 
    1583         // Authors
     1627
     1628        /**
     1629         * Filter rewrite rules used for search archives.
     1630         *
     1631         * Likely search-related archives include /search/search+query/ as well as
     1632         * pagination and feed paths for a search.
     1633         *
     1634         * @since 1.5.0
     1635         *
     1636         * @param array $search_rewrite The rewrite rules for search queries.
     1637         */
     1638        $search_rewrite = apply_filters( 'search_rewrite_rules', $search_rewrite );
     1639
     1640        // Author rewrite rules.
    15841641        $author_rewrite = $this->generate_rewrite_rules($this->get_author_permastruct(), EP_AUTHORS);
    1585         $author_rewrite = apply_filters('author_rewrite_rules', $author_rewrite);
    1586 
    1587         // Pages
     1642
     1643        /**
     1644         * Filter rewrite rules used for author archives.
     1645         *
     1646         * Likely author archives would inlcude /author/author-name/, as well as
     1647         * pagination and feed paths for author archives.
     1648         *
     1649         * @since 1.5.0
     1650         *
     1651         * @param array $author_rewrite The rewrite rules for author archives.
     1652         */
     1653        $author_rewrite = apply_filters( 'author_rewrite_rules', $author_rewrite );
     1654
     1655        // Pages rewrite rules.
    15881656        $page_rewrite = $this->page_rewrite_rules();
    1589         $page_rewrite = apply_filters('page_rewrite_rules', $page_rewrite);
    1590 
    1591         // Extra permastructs
     1657
     1658        /**
     1659         * Filter rewrite rules used for "page" post type archives.
     1660         *
     1661         * @since 1.5.0
     1662         *
     1663         * @param array $page_rewrite The rewrite rules for the "page" post type.
     1664         */
     1665        $page_rewrite = apply_filters( 'page_rewrite_rules', $page_rewrite );
     1666
     1667        // Extra permastructs.
    15921668        foreach ( $this->extra_permastructs as $permastructname => $struct ) {
    15931669            if ( is_array( $struct ) ) {
     
    16001676            }
    16011677
    1602             $rules = apply_filters($permastructname . '_rewrite_rules', $rules);
    1603             if ( 'post_tag' == $permastructname )
    1604                 $rules = apply_filters('tag_rewrite_rules', $rules);
     1678            /**
     1679             * Filter rewrite rules used for individual permastructs.
     1680             *
     1681             * The dynamic portion of the hook name, $permastructname, refers
     1682             * to the name of the registered permastruct, e.g. 'post_tag' (tags),
     1683             * 'category' (categories), etc.
     1684             *
     1685             * @since 3.1.0
     1686             *
     1687             * @param array $rules The rewrite rules generated for the current permastruct.
     1688             */
     1689            $rules = apply_filters( $permastructname . '_rewrite_rules', $rules );
     1690            if ( 'post_tag' == $permastructname ) {
     1691
     1692                /**
     1693                 * Filter rewrite rules used specifically for Tags.
     1694                 *
     1695                 * @since 2.3.0
     1696                 * @deprecated 3.1.0 Use 'post_tag_rewrite_rules' instead
     1697                 *
     1698                 * @param array $rules The rewrite rules generated for tags.
     1699                 */
     1700                $rules = apply_filters( 'tag_rewrite_rules', $rules );
     1701            }
    16051702
    16061703            $this->extra_rules_top = array_merge($this->extra_rules_top, $rules);
     
    16131710            $this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $deprecated_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite,  $author_rewrite, $date_rewrite, $post_rewrite, $page_rewrite, $this->extra_rules);
    16141711
    1615         do_action_ref_array('generate_rewrite_rules', array(&$this));
    1616         $this->rules = apply_filters('rewrite_rules_array', $this->rules);
     1712        /**
     1713         * Fires after the rewrite rules are generated.
     1714         *
     1715         * @since 1.5.0
     1716         *
     1717         * @param WP_Rewrite $this Current WP_Rewrite instance, passed by reference.
     1718         */
     1719        do_action_ref_array( 'generate_rewrite_rules', array( &$this ) );
     1720
     1721        /**
     1722         * Filter the full set of generated rewrite rules.
     1723         *
     1724         * @since 1.5.0
     1725         *
     1726         * @param array $this->rules The compiled array of rewrite rules.
     1727         */
     1728        $this->rules = apply_filters( 'rewrite_rules_array', $this->rules );
    16171729
    16181730        return $this->rules;
     
    17221834        $rules .= "</IfModule>\n";
    17231835
    1724         $rules = apply_filters('mod_rewrite_rules', $rules);
    1725         $rules = apply_filters('rewrite_rules', $rules);  // Deprecated
     1836        /**
     1837         *
     1838         * Filter the list of rewrite rules formatted for output to an .htaccess file.
     1839         *
     1840         * @since 1.5.0
     1841         *
     1842         * @param string $rules mod_rewrite Rewrite rules formatted for .htaccess.
     1843         */
     1844        $rules = apply_filters( 'mod_rewrite_rules', $rules );
     1845
     1846        /**
     1847         * Filter the list of rewrite rules formatted for output to an .htaccess file.
     1848         *
     1849         * @since 1.5.0
     1850         * @deprecated 1.5.0 Use the mod_rewrite_rules filter instead.
     1851         *
     1852         * @param string $rules mod_rewrite Rewrite rules formatted for .htaccess.
     1853         */
     1854        $rules = apply_filters( 'rewrite_rules', $rules );  // Deprecated
    17261855
    17271856        return $rules;
     
    17691898        }
    17701899
    1771         $rules = apply_filters('iis7_url_rewrite_rules', $rules);
     1900        /**
     1901         * Filter the list of rewrite rules formatted for output to a web.config.
     1902         *
     1903         * @since 2.8.0
     1904         *
     1905         * @param string $rules Rewrite rules formatted for IIS web.config.
     1906         */
     1907        $rules = apply_filters( 'iis7_url_rewrite_rules', $rules );
    17721908
    17731909        return $rules;
     
    19172053         *
    19182054         * @since 3.7.0
    1919          * @param bool $hard Defaults to true.
     2055         *
     2056         * @param bool $hard Whether to flush rewrite rules "hard". Default true.
    19202057         */
    1921         if ( ! $hard || ! apply_filters( 'flush_rewrite_rules_hard', true ) )
     2058        if ( ! $hard || ! apply_filters( 'flush_rewrite_rules_hard', true ) ) {
    19222059            return;
     2060        }
    19232061        if ( function_exists( 'save_mod_rewrite_rules' ) )
    19242062            save_mod_rewrite_rules();
     
    19792117            update_option('permalink_structure', $permalink_structure);
    19802118            $this->init();
    1981             do_action('permalink_structure_changed', $old_permalink_structure, $permalink_structure);
     2119
     2120            /**
     2121             * Fires after the permalink structure is updated.
     2122             *
     2123             * @since 2.8.0
     2124             *
     2125             * @param string $old_permalink_structure The previous permalink structure.
     2126             * @param string $permalink_structure     The new permalink structure.
     2127             */
     2128            do_action( 'permalink_structure_changed', $old_permalink_structure, $permalink_structure );
    19822129        }
    19832130    }
Note: See TracChangeset for help on using the changeset viewer.