Ticket #7659: 7659.r8976.diff
File 7659.r8976.diff, 16.5 KB (added by , 16 years ago) |
---|
-
post-template.php
1 1 <?php 2 2 /** 3 * WordPress Post Template Functions 3 * WordPress Post Template Functions. 4 4 * 5 5 * Gets content for the current post in the loop. 6 6 * … … 9 9 */ 10 10 11 11 /** 12 * the_ID() - {@internal Missing Short Description}}12 * Display the ID of the current item in the WordPress Loop. 13 13 * 14 * {@internal Missing Long Description}}15 *16 14 * @since 0.71 17 15 * @uses $id 18 16 */ … … 22 20 } 23 21 24 22 /** 25 * get_the_ID() - {@internal Missing Short Description}}23 * Retrieve the ID of the current item in the WordPress Loop. 26 24 * 27 * {@internal Missing Long Description}}28 *29 25 * @since 2.1.0 30 26 * @uses $id 31 27 * … … 37 33 } 38 34 39 35 /** 40 * the_title() - {@internal Missing Short Description}}36 * Display or retrieve the current post title with optional content. 41 37 * 42 * {@internal Missing Long Description}}43 *44 38 * @since 0.71 45 39 * 46 * @param unknown_type $before47 * @param unknown_type $after48 * @param unknown_type $echo49 * @return unknown40 * @param string $before Optional. Content to prepend to the title. 41 * @param string $after Optional. Content to append to the title. 42 * @param bool $echo Optional, default to true.Whether to display or return. 43 * @return null|string Null on no title. String if $echo parameter is false. 50 44 */ 51 45 function the_title($before = '', $after = '', $echo = true) { 52 46 $title = get_the_title(); … … 63 57 } 64 58 65 59 /** 66 * the_title_attribute() - {@internal Missing Short Description}}60 * Sanitize the current title when retrieving or displaying. 67 61 * 68 * {@internal Missing Long Description}} 62 * Works like {@link the_title()}, except the parameters can be in a string or 63 * an array. See the function for what can be override in the $args parameter. 69 64 * 65 * The title before it is displayed will have the tags stripped and {@link 66 * attribute_escape()} before it is passed to the user or displayed. The default 67 * as with {@link the_title()}, is to display the title. 68 * 70 69 * @since 2.3.0 71 70 * 72 * @param unknown_type $args73 * @return unknown71 * @param string|array $args Optional. Override the defaults. 72 * @return string|null Null on failure or display. String when echo is false. 74 73 */ 75 74 function the_title_attribute( $args = '' ) { 76 75 $title = get_the_title(); … … 93 92 } 94 93 95 94 /** 96 * get_the_title() -{@internal Missing Short Description}}95 * {@internal Missing Short Description}} 97 96 * 98 97 * {@internal Missing Long Description}} 99 98 * 100 99 * @since 0.71 101 100 * 102 * @param unknown_type$id101 * @param int $id 103 102 * @return unknown 104 103 */ 105 104 function get_the_title( $id = 0 ) { … … 117 116 } 118 117 119 118 /** 120 * the_guid() -{@internal Missing Short Description}}119 * {@internal Missing Short Description}} 121 120 * 122 121 * {@internal Missing Long Description}} 123 122 * … … 130 129 } 131 130 132 131 /** 133 * get_the_guid() -{@internal Missing Short Description}}132 * {@internal Missing Short Description}} 134 133 * 135 134 * {@internal Missing Long Description}} 136 135 * … … 146 145 } 147 146 148 147 /** 149 * the_content() -{@internal Missing Short Description}}148 * {@internal Missing Short Description}} 150 149 * 151 150 * {@internal Missing Long Description}} 152 151 * … … 156 155 * @param unknown_type $stripteaser 157 156 * @param unknown_type $more_file 158 157 */ 159 function the_content($more_link_text = NULL, $stripteaser = 0, $more_file = '') {158 function the_content($more_link_text = null, $stripteaser = 0, $more_file = '') { 160 159 $content = get_the_content($more_link_text, $stripteaser, $more_file); 161 160 $content = apply_filters('the_content', $content); 162 161 $content = str_replace(']]>', ']]>', $content); … … 164 163 } 165 164 166 165 /** 167 * get_the_content() -{@internal Missing Short Description}}166 * {@internal Missing Short Description}} 168 167 * 169 168 * {@internal Missing Long Description}} 170 169 * … … 175 174 * @param unknown_type $more_file 176 175 * @return unknown 177 176 */ 178 function get_the_content($more_link_text = NULL, $stripteaser = 0, $more_file = '') {177 function get_the_content($more_link_text = null, $stripteaser = 0, $more_file = '') { 179 178 global $id, $post, $more, $page, $pages, $multipage, $preview, $pagenow; 180 179 181 if ( NULL== $more_link_text )180 if ( null == $more_link_text ) 182 181 $more_link_text = __( '(more...)' ); 183 182 184 183 $output = ''; … … 227 226 } 228 227 229 228 /** 230 * the_excerpt() -{@internal Missing Short Description}}229 * {@internal Missing Short Description}} 231 230 * 232 231 * {@internal Missing Long Description}} 233 232 * … … 239 238 } 240 239 241 240 /** 242 * get_the_excerpt() -{@internal Missing Short Description}}241 * {@internal Missing Short Description}} 243 242 * 244 243 * {@internal Missing Long Description}} 245 244 * … … 261 260 } 262 261 263 262 /** 264 * has_excerpt() -{@internal Missing Short Description}}263 * {@internal Missing Short Description}} 265 264 * 266 265 * {@internal Missing Long Description}} 267 266 * … … 276 275 } 277 276 278 277 /** 279 * Echo the classes for the post div278 * Display the classes for the post div. 280 279 * 281 280 * {@internal Missing Long Description}} 282 281 * 283 * @package WordPress 284 * @subpackage Post 285 * @since 2.7 282 * @since 2.7.0 286 283 * 287 284 * @param string|array $class One or more classes to add to the class list 288 * @param int $post_id An optional post ID 285 * @param int $post_id An optional post ID. 289 286 */ 290 287 function post_class( $class = '', $post_id = null ) { 291 288 // Separates classes with a single space, collates classes for post DIV … … 293 290 } 294 291 295 292 /** 296 * Ret urns the classes for the post div as an array293 * Retrieve the classes for the post div as an array. 297 294 * 298 295 * {@internal Missing Long Description}} 299 296 * 300 * @package WordPress 301 * @subpackage Post 302 * @since 2.7 297 * @since 2.7.0 303 298 * 304 299 * @param string|array $class One or more classes to add to the class list 305 300 * @param int $post_id An optional post ID … … 343 338 } 344 339 345 340 /** 346 * Determines if post requires a password and if the correct password has been provided 341 * Determines if post requires a password and if the correct password has been provided. 347 342 * 348 343 * {@internal Missing Long Description}} 349 344 * 350 * @package WordPress 351 * @subpackage Post 352 * @since 2.7 345 * @since 2.7.0 353 346 * 354 347 * @param int|object $post An optional post. Global $post used if not provided. 355 348 * @return bool false if a password is not required or the correct password cookie is present, true otherwise … … 370 363 } 371 364 372 365 /** 373 * Echo "sticky" CSS class if a post is sticky366 * Display "sticky" CSS class, if a post is sticky. 374 367 * 375 * {@internal Missing Long Description}}368 * @since 2.7.0 376 369 * 377 * @package WordPress378 * @subpackage Post379 * @since 2.7380 *381 370 * @param int $post_id An optional post ID 382 371 */ 383 372 function sticky_class( $post_id = null ) { … … 388 377 } 389 378 390 379 /** 391 * wp_link_pages() -{@internal Missing Short Description}}380 * {@internal Missing Short Description}} 392 381 * 393 382 * {@internal Missing Long Description}} 394 383 * … … 478 467 // 479 468 480 469 /** 481 * post_custom() - {@internal Missing Short Description}}470 * Retrieve post custom meta data field. 482 471 * 483 * {@internal Missing Long Description}}484 *485 472 * @since 1.5.0 486 473 * 487 * @param unknown_type $key488 * @return unknown474 * @param string $key Meta data key name. 475 * @return string|array Array of values or single value, if only one element exists. 489 476 */ 490 477 function post_custom( $key = '' ) { 491 478 $custom = get_post_custom(); … … 496 483 return $custom[$key]; 497 484 } 498 485 499 500 // this will probably change at some point...501 486 /** 502 * the_meta() - {@internal Missing Short Description}}487 * Display list of post custom fields. 503 488 * 504 * {@internal Missing Long Description}} 505 * 489 * @internal This will probably change at some point... 506 490 * @since 1.2.0 507 * @uses apply_filters() 491 * @uses apply_filters() Calls 'the_meta_key' on list item HTML content, with key and value as separate parameters. 508 492 */ 509 493 function the_meta() { 510 494 if ( $keys = get_post_custom_keys() ) { … … 527 511 // 528 512 529 513 /** 530 * wp_dropdown_pages() -{@internal Missing Short Description}}514 * {@internal Missing Short Description}} 531 515 * 532 516 * {@internal Missing Long Description}} 533 517 * … … 566 550 } 567 551 568 552 /** 569 * wp_list_pages() -{@internal Missing Short Description}}553 * {@internal Missing Short Description}} 570 554 * 571 555 * {@internal Missing Long Description}} 572 556 * 573 557 * @since 1.5.0 574 558 * 575 * @param unknown_type $args559 * @param array|string $args Optional. Override default arguments. 576 560 * @return unknown 577 561 */ 578 562 function wp_list_pages($args = '') { … … 622 606 } 623 607 624 608 /** 625 * Create menu of pages609 * Display menu of pages. 626 610 * 627 611 * @since 2.7.0 628 612 * … … 661 645 // 662 646 663 647 /** 664 * walk_page_tree() - {@internal Missing Short Description}}648 * Retrieve HTML list content for page list. 665 649 * 666 * {@internal Missing Long Description}} 667 * 650 * @uses Walker_Page to create HTML list content. 668 651 * @since 2.1.0 669 * 670 * @return unknown 652 * @see Walker_Page::walk() for parameters and return description. 671 653 */ 672 654 function walk_page_tree() { 673 655 $walker = new Walker_Page; … … 676 658 } 677 659 678 660 /** 679 * walk_page_dropdown_tree() - {@internal Missing Short Description}}661 * Retrieve HTML dropdown (select) content for page list. 680 662 * 681 * {@internal Missing Long Description}} 682 * 663 * @uses Walker_PageDropdown to create HTML dropdown content. 683 664 * @since 2.1.0 684 * 685 * @return unknown 665 * @see Walker_PageDropdown::walk() for parameters and return description. 686 666 */ 687 667 function walk_page_dropdown_tree() { 688 668 $walker = new Walker_PageDropdown; … … 695 675 // 696 676 697 677 /** 698 * the_attachment_link() -{@internal Missing Short Description}}678 * {@internal Missing Short Description}} 699 679 * 700 680 * {@internal Missing Long Description}} 701 681 * … … 712 692 echo wp_get_attachment_link($id, 'thumbnail', $permalink); 713 693 } 714 694 715 // get an attachment page link using an image or icon if possible 695 /** 696 * Retrieve an attachment page link using an image or icon, if possible. 697 * 698 * {@internal Missing Long Description}} 699 * 700 * @since unknown 701 * 702 * @param unknown_type $id 703 * @param unknown_type $size 704 * @param unknown_type $permalink 705 * @param unknown_type $icon 706 * @return unknown 707 */ 716 708 function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false) { 717 709 $id = intval($id); 718 710 $_post = & get_post( $id ); … … 733 725 734 726 } 735 727 736 // deprecated - use wp_get_attachment_link() 728 /** 729 * {@internal Missing Short Description}} 730 * 731 * {@internal Missing Long Description}} 732 * 733 * @since unknown 734 * @deprecated Use {@link wp_get_attachment_link()} 735 * @see wp_get_attachment_link() Use instead. 736 * 737 * @param unknown_type $id 738 * @param unknown_type $fullsize 739 * @param unknown_type $max_dims 740 * @param unknown_type $permalink 741 * @return unknown 742 */ 737 743 function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) { 738 744 $id = (int) $id; 739 745 $_post = & get_post($id); … … 750 756 return "<a href='$url' title='$post_title'>$innerHTML</a>"; 751 757 } 752 758 753 754 // deprecated: use wp_get_attachment_image_src()755 759 /** 756 * get_attachment_icon_src() -{@internal Missing Short Description}}760 * {@internal Missing Short Description}} 757 761 * 758 762 * {@internal Missing Long Description}} 759 763 * 760 764 * @since 2.1.0 765 * @deprecated Use {@link wp_get_attachment_image_src()} 766 * @see wp_get_attachment_image_src() Use instead. 761 767 * 762 768 * @param unknown_type $id 763 769 * @param unknown_type $fullsize … … 794 800 return array($src, $src_file); 795 801 } 796 802 797 // deprecated: use wp_get_attachment_image()798 803 /** 799 * get_attachment_icon() -{@internal Missing Short Description}}804 * {@internal Missing Short Description}} 800 805 * 801 806 * {@internal Missing Long Description}} 802 807 * 803 808 * @since 2.0.0 809 * @deprecated Use {@link wp_get_attachment_image()} 810 * @see wp_get_attachment_image() Use instead of. 804 811 * 805 812 * @param unknown_type $id 806 813 * @param unknown_type $fullsize … … 850 857 return apply_filters( 'attachment_icon', $icon, $post->ID ); 851 858 } 852 859 853 // deprecated: use wp_get_attachment_image()854 860 /** 855 * get_attachment_innerHTML() -{@internal Missing Short Description}}861 * {@internal Missing Short Description}} 856 862 * 857 863 * {@internal Missing Long Description}} 858 864 * 859 865 * @since 2.0.0 866 * @deprecated Use {@link wp_get_attachment_image()} 867 * @see wp_get_attachment_image() Use instead. 860 868 * 861 869 * @param unknown_type $id 862 870 * @param unknown_type $fullsize … … 878 886 } 879 887 880 888 /** 881 * prepend_attachment() -{@internal Missing Short Description}}889 * {@internal Missing Short Description}} 882 890 * 883 891 * {@internal Missing Long Description}} 884 892 * … … 907 915 // 908 916 909 917 /** 910 * get_the_password_form() - {@internal Missing Short Description}}918 * Retrieve protected post password form content. 911 919 * 912 * {@internal Missing Long Description}}913 *914 920 * @since 1.0.0 921 * @uses apply_filters() Calls 'the_password_form' filter on output. 915 922 * 916 * @return unknown923 * @return string HTML content for password form for password protected post. 917 924 */ 918 925 function get_the_password_form() { 919 926 global $post; … … 927 934 } 928 935 929 936 /** 930 * is_page_template() - Determine wether or not we are in a page template937 * Whether currently in a page template. 931 938 * 932 * This template tag allows you to determine w ether or not you are in a page template.933 * You can optional provide a template name and then the check will be specific to934 * that template.939 * This template tag allows you to determine whether or not you are in a page 940 * template. You can optional provide a template name and then the check will be 941 * specific to that template. 935 942 * 936 943 * @since 2.5.0 937 944 * @uses $wp_query 938 945 * 939 * @param string $template The specific template name if specific matching is required 940 * @return bool False on failure, true if success 946 * @param string $template The specific template name if specific matching is required. 947 * @return bool False on failure, true if success. 941 948 */ 942 949 function is_page_template($template = '') { 943 950 if (!is_page()) { … … 963 970 } 964 971 965 972 /** 966 * wp_post_revision_title() - returns formatted datetimestamp of a revision (linked to that revisions's page)973 * Retrieve formatted date timestamp of a revision (linked to that revisions's page). 967 974 * 968 975 * @package WordPress 969 * @subpackage Post 970 * @since 2.6 976 * @subpackage Post_Revisions 977 * @since 2.6.0 971 978 * 972 979 * @uses date_i18n() 973 980 * 974 * @param int|object $revision revision ID or revision object975 * @param bool $link optionalLink to revisions's page?976 * @return string i18n formatted datetimestamp or localized 'C orrent Revision'981 * @param int|object $revision Revision ID or revision object. 982 * @param bool $link Optional, default is true. Link to revisions's page? 983 * @return string i18n formatted datetimestamp or localized 'Current Revision'. 977 984 */ 978 985 function wp_post_revision_title( $revision, $link = true ) { 979 986 if ( !$revision = get_post( $revision ) ) … … 999 1006 } 1000 1007 1001 1008 /** 1002 * wp_list_post_revisions() - echoes list of a post's revisions1009 * Display list of a post's revisions. 1003 1010 * 1004 * Can output either a UL with edit links or a TABLE with diff interface, and restore action links 1011 * Can output either a UL with edit links or a TABLE with diff interface, and 1012 * restore action links. 1005 1013 * 1006 1014 * Second argument controls parameters: 1007 * (bool) parent : include the parent (the "Current Revision") in the list 1008 * (string) format : 'list' or 'form-table'. 'list' outputs UL, 'form-table' outputs TABLE with UI 1009 * (int) right : what revision is currently being viewed - used in form-table format 1010 * (int) left : what revision is currently being diffed against right - used in form-table format 1015 * (bool) parent : include the parent (the "Current Revision") in the list. 1016 * (string) format : 'list' or 'form-table'. 'list' outputs UL, 'form-table' 1017 * outputs TABLE with UI. 1018 * (int) right : what revision is currently being viewed - used in 1019 * form-table format. 1020 * (int) left : what revision is currently being diffed against right - 1021 * used in form-table format. 1011 1022 * 1012 1023 * @package WordPress 1013 * @subpackage Post 1014 * @since 2.6 1024 * @subpackage Post_Revisions 1025 * @since 2.6.0 1015 1026 * 1016 1027 * @uses wp_get_post_revisions() 1017 1028 * @uses wp_post_revision_title() 1018 1029 * @uses get_edit_post_link() 1019 1030 * @uses get_author_name() 1020 1031 * 1021 * @param int|object $post_id post ID or post object 1022 * @param string|array $args see description @see wp_parse_args() 1032 * @todo split into two functions (list, form-table) ? 1033 * 1034 * @param int|object $post_id Post ID or post object. 1035 * @param string|array $args See description {@link wp_parse_args()}. 1036 * @return null 1023 1037 */ 1024 function wp_list_post_revisions( $post_id = 0, $args = null ) { // TODO? split into two functions (list, form-table) ?1038 function wp_list_post_revisions( $post_id = 0, $args = null ) { 1025 1039 if ( !$post = get_post( $post_id ) ) 1026 1040 return; 1027 1041