Changeset 8924 for trunk/wp-includes/rewrite.php
- Timestamp:
- 09/18/2008 06:14:01 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/rewrite.php
r8899 r8924 192 192 193 193 /** 194 195 196 197 198 199 * @since unknown (2.3.0?)200 201 202 203 204 194 * Filter the URL base for taxonomies. 195 * 196 * To remove any manually prepended /index.php/. 197 * 198 * @access private 199 * @since 2.6.0 200 * @author Mark Jaquith 201 * 202 * @param string $base The taxonomy base that we're going to filter 203 * @return string 204 */ 205 205 function _wp_filter_taxonomy_base( $base ) { 206 206 if ( !empty( $base ) ) { … … 482 482 * The difference between the root property is that WordPress might be 483 483 * located at example/WordPress/index.php, if permalinks are turned off. The 484 * index.php will be the front portion. If permalinks are turned on, this485 * will most likely be empty or not set.484 * WordPress/index.php will be the front portion. If permalinks are turned 485 * on, this will most likely be empty or not set. 486 486 * 487 487 * @since 1.5.0 … … 513 513 514 514 /** 515 * {@internal Missing Description}}515 * Request match string. 516 516 * 517 517 * @since 1.5.0 … … 553 553 554 554 /** 555 * Rules that don't redirect to WP's index.php 555 * Rules that don't redirect to WP's index.php. 556 * 557 * These rules are written to the mod_rewrite portion of the .htaccess. 556 558 * 557 559 * @since 2.1.0 … … 562 564 563 565 /** 564 * {@internal Missing Description}}566 * Extra permalink structures. 565 567 * 566 568 * @since 2.1.0 … … 580 582 581 583 /** 582 * {@internal Missing Description}} 584 * Whether to write every mod_rewrite rule for WordPress. 585 * 586 * This is off by default, turning it on might print a lot of rewrite rules 587 * to the .htaccess file. 583 588 * 584 589 * @since 2.0.0 … … 589 594 590 595 /** 591 * {@internal Missing Description}}596 * Whether to write every mod_rewrite rule for WordPress pages. 592 597 * 593 598 * @since 2.5.0 … … 598 603 599 604 /** 600 * {@internal Missing Description}}605 * Permalink structure search for preg_replace. 601 606 * 602 607 * @since 1.5.0 … … 622 627 623 628 /** 624 * {@internal Missing Description}}629 * Preg_replace values for the search, see {@link WP_Rewrite::$rewritecode}. 625 630 * 626 631 * @since 1.5.0 … … 646 651 647 652 /** 648 * {@internal Missing Description}}653 * Search for the query to look for replacing. 649 654 * 650 655 * @since 1.5.0 … … 736 741 737 742 /** 738 * {@internal Missing Short Description}} 739 * 740 * {@internal Missing Long Description}} 743 * Index for matches for usage in preg_*() functions. 744 * 745 * The format of the string is, with empty matches property value, '$NUM'. 746 * The 'NUM' will be replaced with the value in the $number parameter. With 747 * the matches property not empty, the value of the returned string will 748 * contain that value of the matches property. The format then will be 749 * '$MATCHES[NUM]', with MATCHES as the value in the property and NUM the 750 * value of the $number parameter. 741 751 * 742 752 * @since 1.5.0 … … 750 760 $match_suffix = ''; 751 761 752 if ( ! empty($this->matches)) {762 if ( ! empty($this->matches) ) { 753 763 $match_prefix = '$' . $this->matches . '['; 754 764 $match_suffix = ']'; … … 759 769 760 770 /** 761 * {@internal Missing Short Description}} 762 * 763 * {@internal Missing Long Description}} 771 * Retrieve all page and attachments for pages URIs. 772 * 773 * The attachments are for those that have pages as parents and will be 774 * retrieved. 764 775 * 765 776 * @since 2.5.0 766 777 * @access public 767 778 * 768 * @return unknown779 * @return array Array of page URIs as first element and attachment URIs as second element. 769 780 */ 770 781 function page_uri_index() { … … 781 792 if ( !$posts ) 782 793 return array( array(), array() ); 783 784 794 785 795 foreach ($posts as $id => $post) { … … 801 811 802 812 /** 803 * {@internal Missing Short Description}} 804 * 805 * {@internal Missing Long Description}} 806 * 807 * @since 1.5.0 808 * @access public 809 * 810 * @return unknown 813 * Retrieve all of the rewrite rules for pages. 814 * 815 * If the 'use_verbose_page_rules' property is false, then there will only 816 * be a single rewrite rule for pages for those matching '%pagename%'. With 817 * the property set to true, the attachments and the pages will be added for 818 * each individual attachment URI and page URI, respectively. 819 * 820 * @since 1.5.0 821 * @access public 822 * 823 * @return array 811 824 */ 812 825 function page_rewrite_rules() { … … 823 836 $uris = $page_uris[0]; 824 837 $attachment_uris = $page_uris[1]; 825 826 838 827 839 if( is_array( $attachment_uris ) ) { … … 973 985 * Retrieve the permalink structure for categories. 974 986 * 975 * {@internal Missing Long Description}} 987 * If the category_base property has no value, then the category structure 988 * will have the front property value, followed by 'category', and finally 989 * '%category%'. If it does, then the root property will be used, along with 990 * the category_base property value. 976 991 * 977 992 * @since 1.5.0 … … 1003 1018 * Retrieve the permalink structure for tags. 1004 1019 * 1005 * {@internal Missing Long Description}} 1020 * If the tag_base property has no value, then the tag structure will have 1021 * the front property value, followed by 'tag', and finally '%tag%'. If it 1022 * does, then the root property will be used, along with the tag_base 1023 * property value. 1006 1024 * 1007 1025 * @since 2.3.0 … … 1181 1199 1182 1200 /** 1183 * {@internal Missing Short Description}} 1184 * 1185 * {@internal Missing Long Description}} 1186 * 1187 * @since 1.5.0 1188 * @access public 1189 * 1190 * @param unknown_type $tag 1191 * @param unknown_type $pattern 1192 * @param unknown_type $query 1201 * Append or update tag, pattern, and query for replacement. 1202 * 1203 * If the tag already exists, replace the existing pattern and query for 1204 * that tag, otherwise add the new tag, pattern, and query to the end of the 1205 * arrays. 1206 * 1207 * @internal What is the purpose of this function again? Need to finish long 1208 * description. 1209 * 1210 * @since 1.5.0 1211 * @access public 1212 * 1213 * @param string $tag Append tag to rewritecode property array. 1214 * @param string $pattern Append pattern to rewritereplace property array. 1215 * @param string $query Append query to queryreplace property array. 1193 1216 */ 1194 1217 function add_rewrite_tag($tag, $pattern, $query) { 1195 // If the tag already exists, replace the existing pattern and query for1196 // that tag, otherwise add the new tag, pattern, and query to the end of1197 // the arrays.1198 1218 $position = array_search($tag, $this->rewritecode); 1199 if ( FALSE !== $position && NULL !== $position) {1219 if ( false !== $position && null !== $position ) { 1200 1220 $this->rewritereplace[$position] = $pattern; 1201 1221 $this->queryreplace[$position] = $query; … … 1210 1230 * Generate the rules from permalink structure. 1211 1231 * 1212 * {@internal Missing Long Description}}1213 * 1214 * The main WP_Rewrite function.1215 * 1216 * @since 1.5.0 1217 * @access public 1218 * 1219 * @param unknown_type $permalink_structure1220 * @param unknown_type $ep_mask1221 * @param unknown_type $paged1222 * @param unknown_type $feed1223 * @param unknown_type $forcomments1224 * @param unknown_type $walk_dirs1225 * @param unknown_type $endpoints1226 * @return unknown1232 * The main WP_Rewrite function for building the rewrite rule list. The 1233 * contents of the function is a mix of black magic and regular expressions, 1234 * so best just ignore the contents and move to the parameters. 1235 * 1236 * @since 1.5.0 1237 * @access public 1238 * 1239 * @param string $permalink_structure The permalink structure. 1240 * @param int $ep_mask Optional, default is EP_NONE. Endpoint constant, see EP_* constants. 1241 * @param bool $paged Optional, default is true. Whether permalink request is paged. 1242 * @param bool $feed Optional, default is true. Whether for feed. 1243 * @param bool $forcomments Optional, default is false. Whether for comments. 1244 * @param bool $walk_dirs Optional, default is true. Whether to create list of directories to walk over. 1245 * @param bool $endpoints Optional, default is true. Whether endpoints are enabled. 1246 * @return array Rewrite rule list. 1227 1247 */ 1228 1248 function generate_rewrite_rules($permalink_structure, $ep_mask = EP_NONE, $paged = true, $feed = true, $forcomments = false, $walk_dirs = true, $endpoints = true) { … … 1443 1463 1444 1464 /** 1445 * {@internal Missing Short Description}} 1446 * 1447 * {@internal Missing Long Description}} 1448 * 1449 * @since 1.5.0 1450 * @access public 1451 * 1452 * @param unknown_type $permalink_structure 1453 * @param unknown_type $walk_dirs 1454 * @return unknown 1465 * Generate Rewrite rules with permalink structure and walking directory only. 1466 * 1467 * Shorten version of {@link WP_Rewrite::generate_rewrite_rules()} that 1468 * allows for shorter list of parameters. See the method for longer 1469 * description of what generating rewrite rules does. 1470 * 1471 * @uses WP_Rewrite::generate_rewrite_rules() See for long description and rest of parameters. 1472 * @since 1.5.0 1473 * @access public 1474 * 1475 * @param string $permalink_structure The permalink structure to generate rules. 1476 * @param bool $walk_dirs Optional, default is false. Whether to create list of directories to walk over. 1477 * @return array 1455 1478 */ 1456 1479 function generate_rewrite_rule($permalink_structure, $walk_dirs = false) { … … 1459 1482 1460 1483 /** 1461 * Construct rewrite matches and queries from permalink structure 1462 * 1463 * {@internal Missing Long Description}} 1464 * 1465 * @since 1.5.0 1466 * @access public 1467 * 1468 * @return array an associate array of matches and queries 1484 * Construct rewrite matches and queries from permalink structure. 1485 * 1486 * Runs the action 'generate_rewrite_rules' with the parameter that is an 1487 * reference to the current WP_Rewrite instance to further manipulate the 1488 * permalink structures and rewrite rules. Runs the 'rewrite_rules_array' 1489 * filter on the full rewrite rule array. 1490 * 1491 * There are two ways to manipulate the rewrite rules, one by hooking into 1492 * the 'generate_rewrite_rules' action and gaining full control of the 1493 * object or just manipulating the rewrite rule array before it is passed 1494 * from the function. 1495 * 1496 * @since 1.5.0 1497 * @access public 1498 * 1499 * @return array An associate array of matches and queries. 1469 1500 */ 1470 1501 function rewrite_rules() { … … 1540 1571 1541 1572 /** 1542 * {@internal Missing Short Description}} 1543 * 1544 * {@internal Missing Long Description}} 1545 * 1546 * @since 1.5.0 1547 * @access public 1548 * 1549 * @return unknown 1573 * Retrieve the rewrite rules. 1574 * 1575 * The difference between this method and {@link 1576 * WP_Rewrite::rewrite_rules()} is that this method stores the rewrite rules 1577 * in the 'rewrite_rules' option and retrieves it. This prevents having to 1578 * process all of the permalinks to get the rewrite rules in the form of 1579 * caching. 1580 * 1581 * @since 1.5.0 1582 * @access public 1583 * 1584 * @return array Rewrite rules. 1550 1585 */ 1551 1586 function wp_rewrite_rules() { … … 1561 1596 1562 1597 /** 1563 * {@internal Missing Short Description}} 1564 * 1565 * {@internal Missing Long Description}} 1566 * 1567 * @since 1.5.0 1568 * @access public 1569 * 1570 * @return unknown 1598 * Retrieve mod_rewrite formatted rewrite rules to write to .htaccess. 1599 * 1600 * Does not actually write to the .htaccess file, but creates the rules for 1601 * the process that will. 1602 * 1603 * Will add the non_wp_rules property rules to the .htaccess file before 1604 * the WordPress rewrite rules one. 1605 * 1606 * @since 1.5.0 1607 * @access public 1608 * 1609 * @return string 1571 1610 */ 1572 1611 function mod_rewrite_rules() { … … 1638 1677 1639 1678 /** 1640 * Add a straight rewrite rule 1641 * 1642 * {@internal Missing Long Description}} 1679 * Add a straight rewrite rule. 1680 * 1681 * Any value in the $after parameter that isn't 'bottom' will be placed at 1682 * the top of the rules. 1643 1683 * 1644 1684 * @since 2.1.0 1645 1685 * @access public 1646 1686 * 1647 * @param unknown_type $regex1648 * @param unknown_type $redirect1649 * @param unknown_type $after1687 * @param string $regex Regular expression to match against request. 1688 * @param string $redirect URL regex redirects to when regex matches request. 1689 * @param string $after Optional, default is bottom. Location to place rule. 1650 1690 */ 1651 1691 function add_rule($regex, $redirect, $after = 'bottom') { … … 1665 1705 1666 1706 /** 1667 * Add a rule that doesn't redirect to index.php 1668 * 1669 * {@internal Missing Long Description}}1707 * Add a rule that doesn't redirect to index.php. 1708 * 1709 * Can redirect to any place. 1670 1710 * 1671 1711 * @since 2.1.0 1672 1712 * @access public 1673 1713 * 1674 * @param unknown_type $regex1675 * @param unknown_type $redirect1714 * @param string $regex Regular expression to match against request. 1715 * @param string $redirect URL regex redirects to when regex matches request. 1676 1716 */ 1677 1717 function add_external_rule($regex, $redirect) { … … 1680 1720 1681 1721 /** 1682 * Add an endpoint, like /trackback/ 1683 * 1684 * {@internal Missing Long Description}} 1685 * 1686 * To be inserted after certain URL types (specified in $places) 1722 * Add an endpoint, like /trackback/. 1723 * 1724 * To be inserted after certain URL types (specified in $places). 1687 1725 * 1688 1726 * @since 2.1.0 1689 1727 * @access public 1690 1728 * 1691 * @param unknown_type $name1692 * @param unknown_type $places1729 * @param string $name Name of endpoint. 1730 * @param array $places URL types that endpoint can be used. 1693 1731 */ 1694 1732 function add_endpoint($name, $places) { … … 1699 1737 1700 1738 /** 1701 * {@internal Missing Short Description}} 1702 * 1703 * {@internal Missing Long Description}} 1739 * Add permalink structure. 1740 * 1741 * These are added along with the extra rewrite rules that are merged to the 1742 * top. 1704 1743 * 1705 1744 * @since unknown 1706 1745 * @access public 1707 1746 * 1708 * @param unknown_type $name1709 * @param unknown_type $struct1710 * @param unknown_type $with_front1747 * @param string $name Name for permalink structure. 1748 * @param string $struct Permalink structure. 1749 * @param bool $with_front Prepend front base to permalink structure. 1711 1750 */ 1712 1751 function add_permastruct($name, $struct, $with_front = true) { … … 1734 1773 1735 1774 /** 1736 * {@internal Missing Short Description}} 1737 * 1738 * {@internal Missing Long Description}} 1775 * Sets up the object's properties. 1776 * 1777 * The 'use_verbose_page_rules' object property will be turned on, if the 1778 * permalink structure includes the following: '%postname%', '%category%', 1779 * '%tag%', or '%author%'. 1739 1780 * 1740 1781 * @since 1.5.0
Note: See TracChangeset
for help on using the changeset viewer.