Changeset 9274
- Timestamp:
- 10/22/2008 03:08:33 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/link-template.php (modified) (47 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/link-template.php
r9243 r9274 8 8 9 9 /** 10 * {@internal Missing Short Description}} 11 * 12 * {@internal Missing Long Description}} 10 * Display the permalink for the current post. 13 11 * 14 12 * @since 1.2.0 15 * @uses apply_filters() 13 * @uses apply_filters() Calls 'the_permalink' filter on the permalink string. 16 14 */ 17 15 function the_permalink() { … … 20 18 21 19 /** 22 * {@internal Missing Short Description}} 23 * 24 * Conditionally adds a trailing slash if the permalink structure 25 * has a trailing slash, strips the trailing slash if not 26 * {@internal Missing Long Description}} 20 * Retrieve trailing slash string, if blog set for adding trailing slashes. 21 * 22 * Conditionally adds a trailing slash if the permalink structure has a trailing 23 * slash, strips the trailing slash if not. The string is passed through the 24 * 'user_trailingslashit' filter. Will remove trailing slash from string, if 25 * blog is not set to have them. 27 26 * 28 27 * @since 2.2.0 29 28 * @uses $wp_rewrite 30 29 * 31 * @param $string String a URL with or without a trailing slash 32 * @param $type_of_url String the type of URL being considered (e.g. single, category, etc) for use in the filter 30 * @param $string String a URL with or without a trailing slash. 31 * @param $type_of_url String the type of URL being considered (e.g. single, category, etc) for use in the filter. 33 32 * @return string 34 33 */ … … 47 46 48 47 /** 49 * {@internal Missing Short Description}} 50 * 51 * {@internal Missing Long Description}} 48 * Display permalink anchor for current post. 49 * 50 * The permalink mode title will use the post title for the 'a' element 'id' 51 * attribute. The id mode uses 'post-' with the post ID for the 'id' attribute. 52 52 * 53 53 * @since 0.71 54 54 * 55 * @param unknown_type $mode55 * @param string $mode Permalink mode can be either 'title', 'id', or default, which is 'id'. 56 56 */ 57 57 function permalink_anchor($mode = 'id') { … … 70 70 71 71 /** 72 * {@internal Missing Short Description}} 73 * 74 * {@internal Missing Long Description}} 72 * Retrieve full permalink for current post or post ID. 75 73 * 76 74 * @since 1.0.0 77 75 * 78 * @param unknown_type $id 79 * @return unknown 80 */ 81 function get_permalink($id = 0, $leavename=false) { 76 * @param int $id Optional. Post ID. 77 * @param bool $leavename Optional, defaults to false. Whether to keep post name or page name. 78 * @return string 79 */ 80 function get_permalink($id = 0, $leavename = false) { 82 81 $rewritecode = array( 83 82 '%year%', … … 96 95 $post = &get_post($id); 97 96 98 if ( empty($post->ID) ) return FALSE;97 if ( empty($post->ID) ) return false; 99 98 100 99 if ( $post->post_type == 'page' ) … … 115 114 $category = $cats[0]->slug; 116 115 if ( $parent=$cats[0]->parent ) 117 $category = get_category_parents($parent, FALSE, '/', TRUE) . $category;116 $category = get_category_parents($parent, false, '/', true) . $category; 118 117 119 118 // show default category in permalinks, without … … 158 157 * Retrieve permalink from post ID. 159 158 * 160 * {@internal Missing Long Description}}161 *162 159 * @since 1.0.0 163 160 * 164 * @param unknown_type $post_id165 * @param unknown_type $deprecated166 * @return unknown161 * @param int $post_id Optional. Post ID. 162 * @param mixed $deprecated Not used. 163 * @return string 167 164 */ 168 165 function post_permalink($post_id = 0, $deprecated = '') { … … 170 167 } 171 168 172 // Respects page_on_front. Use this one. 173 /** 174 * {@internal Missing Short Description}} 175 * 176 * {@internal Missing Long Description}} 169 /** 170 * Retrieve the permalink for current page or page ID. 171 * 172 * Respects page_on_front. Use this one. 177 173 * 178 174 * @since 1.5.0 179 175 * 180 * @param unknown_type $id 181 * @return unknown 176 * @param int $id Optional. Post ID. 177 * @param bool $leavename Optional, defaults to false. Whether to keep post name or page name. 178 * @return string 182 179 */ 183 180 function get_page_link($id = false, $leavename = false) { … … 197 194 198 195 /** 199 * {@internal Missing Short Description}} 200 * 201 * {@internal Missing Long Description}} 196 * Retrieve the page permalink. 202 197 * 203 198 * Ignores page_on_front. Internal use only. … … 206 201 * @access private 207 202 * 208 * @param unknown_type $id 209 * @return unknown 203 * @param int $id Optional. Post ID. 204 * @param bool $leavename Optional. Leave name. 205 * @return string 210 206 */ 211 207 function _get_page_link( $id = false, $leavename = false ) { … … 232 228 233 229 /** 234 * {@internal Missing Short Description}}235 * 236 * {@internal Missing Long Description}}230 * Retrieve permalink for attachment. 231 * 232 * This can be used in the WordPress Loop or outside of it. 237 233 * 238 234 * @since 2.0.0 239 235 * 240 * @param unknown_type $id241 * @return unknown236 * @param int $id Optional. Post ID. 237 * @return string 242 238 */ 243 239 function get_attachment_link($id = false) { … … 273 269 274 270 /** 275 * {@internal Missing Short Description}} 276 * 277 * {@internal Missing Long Description}} 271 * Retrieve the permalink for the year archives. 278 272 * 279 273 * @since 1.5.0 280 274 * 281 * @param unknown_type $year282 * @return unknown275 * @param int|bool $year False for current year or year for permalink. 276 * @return string 283 277 */ 284 278 function get_year_link($year) { … … 296 290 297 291 /** 298 * {@internal Missing Short Description}} 299 * 300 * {@internal Missing Long Description}} 292 * Retrieve the permalink for the month archives with year. 301 293 * 302 294 * @since 1.0.0 303 295 * 304 * @param unknown_type $year305 * @param unknown_type $month306 * @return unknown296 * @param bool|int $year False for current year. Integer of year. 297 * @param bool|int $month False for current month. Integer of month. 298 * @return string 307 299 */ 308 300 function get_month_link($year, $month) { … … 323 315 324 316 /** 325 * {@internal Missing Short Description}} 326 * 327 * {@internal Missing Long Description}} 317 * Retrieve the permalink for the day archives with year and month. 328 318 * 329 319 * @since 1.0.0 330 320 * 331 * @param unknown_type $year332 * @param unknown_type $month333 * @param unknown_type $day334 * @return unknown321 * @param bool|int $year False for current year. Integer of year. 322 * @param bool|int $month False for current month. Integer of month. 323 * @param bool|int $day False for current day. Integer of day. 324 * @return string 335 325 */ 336 326 function get_day_link($year, $month, $day) { … … 355 345 356 346 /** 357 * {@internal Missing Short Description}} 358 * 359 * {@internal Missing Long Description}} 347 * Retrieve the permalink for the feed type. 360 348 * 361 349 * @since 1.5.0 362 350 * 363 * @param unknown_type $feed364 * @return unknown351 * @param string $feed Optional, defaults to default feed. Feed type. 352 * @return string 365 353 */ 366 354 function get_feed_link($feed = '') { … … 394 382 395 383 /** 396 * {@internal Missing Short Description}} 397 * 398 * {@internal Missing Long Description}} 384 * Retrieve the permalink for the post comments feed. 399 385 * 400 386 * @since 2.2.0 401 387 * 402 * @param unknown_type $post_id403 * @param unknown_type $feed404 * @return unknown388 * @param int $post_id Optional. Post ID. 389 * @param string $feed Optional. Feed type. 390 * @return string 405 391 */ 406 392 function get_post_comments_feed_link($post_id = '', $feed = '') { … … 464 450 * 465 451 * @param int $author_id ID of an author. 466 * @param string $feed Feed type.452 * @param string $feed Optional. Feed type. 467 453 * @return string Link to the feed for the author specified by $author_id. 468 454 */ … … 502 488 * 503 489 * @param int $cat_id ID of a category. 504 * @param string $feed Feed type.490 * @param string $feed Optional. Feed type. 505 491 * @return string Link to the feed for the category specified by $cat_id. 506 492 */ … … 536 522 537 523 /** 538 * {@internal Missing Short Description}} 539 * 540 * {@internal Missing Long Description}} 524 * Retrieve permalink for feed of tag. 541 525 * 542 526 * @since 2.3.0 543 527 * 544 * @param unknown_type $tag_id545 * @param unknown_type $feed546 * @return unknown528 * @param int $tag_id Tag ID. 529 * @param string $feed Optional. Feed type. 530 * @return string 547 531 */ 548 532 function get_tag_feed_link($tag_id, $feed = '') { … … 576 560 577 561 /** 578 * {@internal Missing Short Description}} 579 * 580 * {@internal Missing Long Description}} 562 * Retrieve the permalink for the feed of the search results. 581 563 * 582 564 * @since 2.5.0 583 565 * 584 * @param unknown_type $search_query585 * @param unknown_type $feed586 * @return unknown566 * @param string $search_query Optional. Search query. 567 * @param string $feed Optional. Feed type. 568 * @return string 587 569 */ 588 570 function get_search_feed_link($search_query = '', $feed = '') { … … 603 585 604 586 /** 605 * {@internal Missing Short Description}} 606 * 607 * {@internal Missing Long Description}} 587 * Retrieve the permalink for the comments feed of the search results. 608 588 * 609 589 * @since 2.5.0 610 590 * 611 * @param unknown_type $search_query612 * @param unknown_type $feed613 * @return unknown591 * @param string $search_query Optional. Search query. 592 * @param string $feed Optional. Feed type. 593 * @return string 614 594 */ 615 595 function get_search_comments_feed_link($search_query = '', $feed = '') { … … 630 610 631 611 /** 632 * {@internal Missing Short Description}} 633 * 634 * {@internal Missing Long Description}} 612 * Retrieve edit posts link for post. 613 * 614 * Can be used within the WordPress loop or outside of it. Can be used with 615 * pages, posts, attachments, and revisions. 635 616 * 636 617 * @since 2.3.0 637 618 * 638 * @param unknown_type $id 639 * @return unknown 619 * @param int $id Optional. Post ID. 620 * @param string $context Optional, default to display. How to write the '&', defaults to '&'. 621 * @return string 640 622 */ 641 623 function get_edit_post_link( $id = 0, $context = 'display' ) { … … 680 662 681 663 /** 682 * {@internal Missing Short Description}} 683 * 684 * {@internal Missing Long Description}} 664 * Retrieve edit posts link for post. 685 665 * 686 666 * @since 1.0.0 687 667 * 688 * @param unknown_type $link689 * @param unknown_type $before690 * @param unknown_type $after668 * @param string $link Optional. Anchor text. 669 * @param string $before Optional. Display before edit link. 670 * @param string $after Optional. Display after edit link. 691 671 */ 692 672 function edit_post_link( $link = 'Edit This', $before = '', $after = '' ) { … … 706 686 707 687 /** 708 * {@internal Missing Short Description}} 709 * 710 * {@internal Missing Long Description}} 688 * Retrieve edit comment link. 711 689 * 712 690 * @since 2.3.0 713 691 * 714 * @param unknown_type $comment_id715 * @return unknown692 * @param int $comment_id Optional. Comment ID. 693 * @return string 716 694 */ 717 695 function get_edit_comment_link( $comment_id = 0 ) { … … 732 710 733 711 /** 734 * {@internal Missing Short Description}} 735 * 736 * {@internal Missing Long Description}} 712 * Display or retrieve edit comment link with formatting. 737 713 * 738 714 * @since 1.0.0 739 715 * 740 * @param unknown_type $link 741 * @param unknown_type $before 742 * @param unknown_type $after 716 * @param string $link Optional. Anchor text. 717 * @param string $before Optional. Display before edit link. 718 * @param string $after Optional. Display after edit link. 719 * @param bool $echo Optional, defaults to true. Whether to echo or return HTML. 720 * @return string|null HTML content, if $echo is set to false. 743 721 */ 744 722 function edit_comment_link( $link = 'Edit This', $before = '', $after = '', $echo = true ) { … … 763 741 764 742 /** 765 * {@internal Missing Short Description}} 766 * 767 * {@internal Missing Long Description}} 768 * 769 * @since unknown 770 * 771 * @param unknown_type $link 772 * @return unknown 743 * Display edit bookmark (literally a URL external to blog) link. 744 * 745 * @since 2.7.0 746 * 747 * @param int $link Optional. Bookmark ID. 748 * @return string 773 749 */ 774 750 function get_edit_bookmark_link( $link = 0 ) { … … 783 759 784 760 /** 785 * {@internal Missing Short Description}} 786 * 787 * {@internal Missing Long Description}} 788 * 789 * @since unknown 790 * 791 * @param unknown_type $link 792 * @param unknown_type $before 793 * @param unknown_type $after 794 * @param unknown_type $bookmark 761 * Display edit bookmark (literally a URL external to blog) link anchor content. 762 * 763 * @since 2.7.0 764 * 765 * @param string $link Optional. Anchor text. 766 * @param string $before Optional. Display before edit link. 767 * @param string $after Optional. Display after edit link. 768 * @param int $bookmark Optional. Bookmark ID. 795 769 */ 796 770 function edit_bookmark_link( $link = '', $before = '', $after = '', $bookmark = null ) { … … 810 784 811 785 /** 812 * {@internal Missing Short Description}} 813 * 814 * {@internal Missing Long Description}} 786 * Retrieve previous post link that is adjacent to current post. 815 787 * 816 788 * @since 1.5.0 817 789 * 818 * @param unknown_type $in_same_cat819 * @param unknown_type $excluded_categories820 * @return unknown790 * @param bool $in_same_cat Optional. Whether link should be in same category. 791 * @param string $excluded_categories Optional. Excluded categories IDs. 792 * @return string 821 793 */ 822 794 function get_previous_post($in_same_cat = false, $excluded_categories = '') { … … 825 797 826 798 /** 827 * {@internal Missing Short Description}} 828 * 829 * {@internal Missing Long Description}} 799 * Retrieve next post link that is adjacent to current post. 830 800 * 831 801 * @since 1.5.0 832 802 * 833 * @param unknown_type $in_same_cat834 * @param unknown_type $excluded_categories835 * @return unknown803 * @param bool $in_same_cat Optional. Whether link should be in same category. 804 * @param string $excluded_categories Optional. Excluded categories IDs. 805 * @return string 836 806 */ 837 807 function get_next_post($in_same_cat = false, $excluded_categories = '') { … … 840 810 841 811 /** 842 * {@internal Missing Short Description}}843 * 844 * {@internal Missing Long Description}}812 * Retrieve adjacent post link. 813 * 814 * Can either be next or previous post link. 845 815 * 846 816 * @since 2.5.0 847 817 * 848 * @param unknown_type $in_same_cat849 * @param unknown_type $excluded_categories850 * @param unknown_type $previous851 * @return unknown818 * @param bool $in_same_cat Optional. Whether link should be in same category. 819 * @param string $excluded_categories Optional. Excluded categories IDs. 820 * @param bool $previous Optional. Whether to retrieve previous post. 821 * @return string 852 822 */ 853 823 function get_adjacent_post($in_same_cat = false, $excluded_categories = '', $previous = true) { … … 895 865 896 866 /** 897 * {@internal Missing Short Description}} 898 * 899 * {@internal Missing Long Description}} 867 * Display previous post link that is adjacent to the current post. 900 868 * 901 869 * @since 1.5.0 902 870 * 903 * @param unknown_type $format904 * @param unknown_type $link905 * @param unknown_type $in_same_cat906 * @param unknown_type $excluded_categories871 * @param string $format Optional. Link anchor format. 872 * @param string $link Optional. Link permalink format. 873 * @param bool $in_same_cat Optional. Whether link should be in same category. 874 * @param string $excluded_categories Optional. Excluded categories IDs. 907 875 */ 908 876 function previous_post_link($format='« %link', $link='%title', $in_same_cat = false, $excluded_categories = '') { … … 911 879 912 880 /** 913 * {@internal Missing Short Description}} 914 * 915 * {@internal Missing Long Description}} 881 * Display next post link that is adjacent to the current post. 916 882 * 917 883 * @since 1.5.0 918 884 * 919 * @param unknown_type $format920 * @param unknown_type $link921 * @param unknown_type $in_same_cat922 * @param unknown_type $excluded_categories885 * @param string $format Optional. Link anchor format. 886 * @param string $link Optional. Link permalink format. 887 * @param bool $in_same_cat Optional. Whether link should be in same category. 888 * @param string $excluded_categories Optional. Excluded categories IDs. 923 889 */ 924 890 function next_post_link($format='%link »', $link='%title', $in_same_cat = false, $excluded_categories = '') { … … 927 893 928 894 /** 929 * {@internal Missing Short Description}}930 * 931 * {@internal Missing Long Description}}895 * Display adjacent post link. 896 * 897 * Can be either next post link or previous. 932 898 * 933 899 * @since 2.5.0 934 900 * 935 * @param unknown_type $format936 * @param unknown_type $link937 * @param unknown_type $in_same_cat938 * @param unknown_type $excluded_categories939 * @param unknown_type $previous901 * @param string $format Link anchor format. 902 * @param string $link Link permalink format. 903 * @param bool $in_same_cat Optional. Whether link should be in same category. 904 * @param string $excluded_categories Optional. Excluded categories IDs. 905 * @param bool $previous Optional, default is true. Whether display link to previous post. 940 906 */ 941 907 function adjacent_post_link($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true) { … … 968 934 969 935 /** 970 * {@internal Missing Short Description}} 971 * 972 * {@internal Missing Long Description}} 936 * Retrieve get links for page numbers. 973 937 * 974 938 * @since 1.5.0 975 939 * 976 * @param unknown_type $pagenum977 * @return unknown940 * @param int $pagenum Optional. Page ID. 941 * @return string 978 942 */ 979 943 function get_pagenum_link($pagenum = 1) { … … 1032 996 1033 997 /** 1034 * {@internal Missing Short Description}} 1035 * 1036 * {@internal Missing Long Description}} 998 * Retrieve next posts pages link. 999 * 1037 1000 * Backported from 2.1.3 to 2.0.10. 1038 1001 * 1039 1002 * @since 2.0.10 1040 1003 * 1041 * @param unknown_type $max_page1042 * @return unknown1004 * @param int $max_page Optional. Max pages. 1005 * @return string 1043 1006 */ 1044 1007 function get_next_posts_page_link($max_page = 0) { … … 1055 1018 1056 1019 /** 1057 * {@internal Missing Short Description}} 1058 * 1059 * {@internal Missing Long Description}} 1020 * Display the next posts pages link. 1060 1021 * 1061 1022 * @since 0.71 1062 1023 * 1063 * @param unknown_type $max_page1024 * @param int $max_page Optional. Max pages. 1064 1025 */ 1065 1026 function next_posts($max_page = 0) { … … 1068 1029 1069 1030 /** 1070 * {@internal Missing Short Description}} 1071 * 1072 * {@internal Missing Long Description}} 1031 * Display the next posts pages link. 1073 1032 * 1074 1033 * @since 0.71 1075 1034 * 1076 * @param unknown_type $label1077 * @param unknown_type $max_page1035 * @param string $label Content for link text. 1036 * @param int $max_page Optional. Max pages. 1078 1037 */ 1079 1038 function next_posts_link($label='Next Page »', $max_page=0) { … … 1094 1053 1095 1054 /** 1096 * {@internal Missing Short Description}} 1097 * 1098 * {@internal Missing Long Description}} 1099 * 1100 * @since 2.0.10 Backported 1101 * @since 2.1.3 1102 * 1103 * @return unknown 1055 * Retrieve previous post pages link. 1056 * 1057 * Will only return string, if not on a single page or post. 1058 * 1059 * Backported to 2.0.10 from 2.1.3. 1060 * 1061 * @since 2.0.10 1062 * 1063 * @return string|null 1104 1064 */ 1105 1065 function get_previous_posts_page_link() { … … 1115 1075 1116 1076 /** 1117 * {@internal Missing Short Description}} 1118 * 1119 * {@internal Missing Long Description}} 1077 * Display previous posts pages link. 1120 1078 * 1121 1079 * @since 0.71 1122 *1123 1080 */ 1124 1081 function previous_posts() { … … 1127 1084 1128 1085 /** 1129 * {@internal Missing Short Description}} 1130 * 1131 * {@internal Missing Long Description}} 1086 * Display previous posts page link. 1132 1087 * 1133 1088 * @since 0.71 1134 1089 * 1135 * @param unknown_type $label1090 * @param string $label Optional. Previous page link text. 1136 1091 */ 1137 1092 function previous_posts_link($label='« Previous Page') { … … 1146 1101 1147 1102 /** 1148 * {@internal Missing Short Description}} 1149 * 1150 * {@internal Missing Long Description}} 1103 * Display post pages link navigation for previous and next pages. 1151 1104 * 1152 1105 * @since 0.71 1153 1106 * 1154 * @param unknown_type $sep1155 * @param unknown_type $prelabel1156 * @param unknown_type $nxtlabel1107 * @param string $sep Optional. Separator for posts navigation links. 1108 * @param string $prelabel Optional. Label for previous pages. 1109 * @param string $nxtlabel Optional Label for next pages. 1157 1110 */ 1158 1111 function posts_nav_link($sep=' — ', $prelabel='« Previous Page', $nxtlabel='Next Page »') { … … 1175 1128 } 1176 1129 1130 /** 1131 * Retrieve page numbers links. 1132 * 1133 * @since 2.7.0 1134 * 1135 * @param int $pagenum Optional. Page number. 1136 * @return string 1137 */ 1177 1138 function get_comments_pagenum_link($pagenum = 1) { 1178 1139 global $wp_rewrite; … … 1204 1165 } 1205 1166 1167 /** 1168 * Display link to next comments pages. 1169 * 1170 * @since 2.7.0 1171 * 1172 * @param string $label Optional. Label for link text. 1173 * @param int $max_page Optional. Max page. 1174 */ 1206 1175 function next_comments_link($label='', $max_page = 0) { 1207 1176 global $wp_query; … … 1231 1200 } 1232 1201 1202 /** 1203 * Display the previous comments page link. 1204 * 1205 * @since 2.7.0 1206 * 1207 * @param string $label Optional. Label for comments link text. 1208 */ 1233 1209 function previous_comments_link($label='') { 1234 1210 global $wp_query; … … 1255 1231 } 1256 1232 1257 /** Create pagination links for the comments on the current post1258 * 1259 * @package WordPress1260 * @see paginate_links 1261 * @since 2.7 1233 /** 1234 * Create pagination links for the comments on the current post. 1235 * 1236 * @see paginate_links() 1237 * @since 2.7.0 1262 1238 * 1263 1239 * @param string|array $args Optional args. See paginate_links. 1264 * @return string Markup for pagination links 1240 * @return string Markup for pagination links. 1265 1241 */ 1266 1242 function paginate_comments_links($args = array()) { … … 1292 1268 1293 1269 /** 1294 * {@internal Missing Short Description}}1295 * 1296 * {@internal Missing Long Description}}1297 * 1298 * @since unknown1299 * 1300 * @return unknown1270 * Retrieve shortcut link. 1271 * 1272 * Use this in 'a' element 'href' attribute. 1273 * 1274 * @since 2.6.0 1275 * 1276 * @return string 1301 1277 */ 1302 1278 function get_shortcut_link() { … … 1336 1312 * overridden. 1337 1313 * 1314 * @package WordPress 1338 1315 * @since 2.6.0 1339 1316 *
Note: See TracChangeset
for help on using the changeset viewer.