Changeset 27341
- Timestamp:
- 03/01/2014 09:30:55 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rewrite.php
r27327 r27341 290 290 global $wp_rewrite; 291 291 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 ); 293 300 294 301 // First, check to see if there is a 'p=N' or 'page_id=N' to match against … … 1560 1567 $registration_pages['.*wp-register.php$'] = $this->index . '?register=true'; // Deprecated 1561 1568 1562 // Post 1569 // Post rewrite rules. 1563 1570 $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. 1567 1582 $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. 1571 1596 $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. 1575 1611 $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. 1579 1625 $search_structure = $this->get_search_permastruct(); 1580 1626 $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. 1584 1641 $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. 1588 1656 $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. 1592 1668 foreach ( $this->extra_permastructs as $permastructname => $struct ) { 1593 1669 if ( is_array( $struct ) ) { … … 1600 1676 } 1601 1677 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 } 1605 1702 1606 1703 $this->extra_rules_top = array_merge($this->extra_rules_top, $rules); … … 1613 1710 $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); 1614 1711 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 ); 1617 1729 1618 1730 return $this->rules; … … 1722 1834 $rules .= "</IfModule>\n"; 1723 1835 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 1726 1855 1727 1856 return $rules; … … 1769 1898 } 1770 1899 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 ); 1772 1908 1773 1909 return $rules; … … 1917 2053 * 1918 2054 * @since 3.7.0 1919 * @param bool $hard Defaults to true. 2055 * 2056 * @param bool $hard Whether to flush rewrite rules "hard". Default true. 1920 2057 */ 1921 if ( ! $hard || ! apply_filters( 'flush_rewrite_rules_hard', true ) ) 2058 if ( ! $hard || ! apply_filters( 'flush_rewrite_rules_hard', true ) ) { 1922 2059 return; 2060 } 1923 2061 if ( function_exists( 'save_mod_rewrite_rules' ) ) 1924 2062 save_mod_rewrite_rules(); … … 1979 2117 update_option('permalink_structure', $permalink_structure); 1980 2118 $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 ); 1982 2129 } 1983 2130 }
Note: See TracChangeset
for help on using the changeset viewer.