Changeset 7554
- Timestamp:
- 11/10/2013 02:04:10 AM (11 years ago)
- Location:
- trunk/bp-forums
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-forums/bp-forums-loader.php
r7454 r7554 6 6 * A discussion forums component. Comes bundled with bbPress stand-alone. 7 7 * 8 * Note: The bp-forums component has been retired. Use the bbPress WordPress 9 * plugin instead. 10 * 8 11 * @package BuddyPress 9 * @subpackage Forums Core12 * @subpackage Forums 10 13 */ 11 14 … … 16 19 17 20 /** 18 * Start the forums component creation process 19 * 20 * @since BuddyPress (1.5 )21 * Start the forums component creation process. 22 * 23 * @since BuddyPress (1.5.0) 21 24 */ 22 25 function __construct() { … … 32 35 33 36 /** 34 * Set up globals37 * Set up bp-forums global settings. 35 38 * 36 39 * The BP_FORUMS_SLUG constant is deprecated, and only used here for 37 40 * backwards compatibility. 38 41 * 39 * @since BuddyPress (1.5) 42 * @since BuddyPress (1.5.0) 43 * 44 * @see BP_Component::setup_globals() for description of parameters. 45 * 46 * @param array $args See {@link BP_Component::setup_globals()}. 40 47 */ 41 48 public function setup_globals( $args = array() ) { … … 68 75 69 76 /** 70 * Include files 77 * Include bp-forums files. 78 * 79 * @see BP_Component::includes() for description of parameters. 80 * 81 * @param array $includes See {@link BP_Component::includes()}. 71 82 */ 72 83 public function includes( $includes = array() ) { … … 96 107 97 108 /** 98 * Setup BuddyBar navigation 109 * Set up component navigation. 110 * 111 * @since BuddyPress (1.5.0) 112 * 113 * @see BP_Component::setup_nav() for a description of arguments. 114 * 115 * @param array $main_nav Optional. See BP_Component::setup_nav() for 116 * description. 117 * @param array $sub_nav Optional. See BP_Component::setup_nav() for 118 * description. 99 119 */ 100 120 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { … … 156 176 157 177 /** 158 * Set up the Toolbar 178 * Set up bp-forums integration with the WordPress admin bar. 179 * 180 * @since BuddyPress (1.5.0) 181 * 182 * @see BP_Component::setup_admin_bar() for a description of arguments. 183 * 184 * @param array $wp_admin_nav See BP_Component::setup_admin_bar() 185 * for description. 159 186 */ 160 187 public function setup_admin_bar( $wp_admin_nav = array() ) { … … 203 230 204 231 /** 205 * Set s up the title for pages and <title>232 * Set up the title for pages and the <title> element. 206 233 */ 207 234 function setup_title() { … … 226 253 } 227 254 255 /** 256 * Set up the bp-forums component. 257 */ 228 258 function bp_setup_forums() { 229 259 buddypress()->forums = new BP_Forums_Component(); -
trunk/bp-forums/bp-forums-screens.php
r7386 r7554 1 1 <?php 2 2 /** 3 * BuddyPress Forums Screen Functions 3 * BuddyPress Forums Screen Functions. 4 4 * 5 5 * @package BuddyPress … … 10 10 if ( !defined( 'ABSPATH' ) ) exit; 11 11 12 /** 13 * Load the Forums directory. 14 */ 12 15 function bp_forums_directory_forums_setup() { 13 16 … … 80 83 add_action( 'bp_screens', 'bp_forums_directory_forums_setup', 2 ); 81 84 85 /** 86 * Load the Topics Started screen. 87 */ 82 88 function bp_member_forums_screen_topics() { 83 89 do_action( 'bp_member_forums_screen_topics' ); … … 86 92 } 87 93 94 /** 95 * Load the Replied To screen. 96 */ 88 97 function bp_member_forums_screen_replies() { 89 98 do_action( 'bp_member_forums_screen_replies' ); … … 93 102 94 103 /** 95 * Load sthe template content for a user's Favorites forum tab.104 * Load the template content for a user's Favorites forum tab. 96 105 * 97 106 * Note that this feature is not fully implemented at the moment. 98 *99 * @package BuddyPress Forums100 107 */ 101 108 function bp_member_forums_screen_favorites() { … … 105 112 } 106 113 114 /** 115 * Load a single forum page. 116 */ 107 117 function bp_forums_screen_single_forum() { 108 118 … … 116 126 add_action( 'bp_screens', 'bp_forums_screen_single_forum' ); 117 127 128 /** 129 * Load a single forum topic page. 130 */ 118 131 function bp_forums_screen_single_topic() { 119 132 … … 131 144 132 145 /** 133 * The main theme compat class for legacy BuddyPress forums , as powered by bbPress 1.x146 * The main theme compat class for legacy BuddyPress forums. 134 147 * 135 148 * This class sets up the necessary theme compatability actions to safely output 136 149 * old forum template parts to the_title and the_content areas of a theme. 137 150 * 138 * @since BuddyPress (1.7 )151 * @since BuddyPress (1.7.0) 139 152 */ 140 153 class BP_Forum_Legacy_Theme_Compat { 141 154 142 155 /** 143 * Set up the old forums component theme compatibility144 * 145 * @since BuddyPress (1.7 )156 * Set up theme compatibility for the legacy forums component. 157 * 158 * @since BuddyPress (1.7.0) 146 159 */ 147 160 public function __construct() { … … 152 165 * Are we looking at something that needs old forum theme compatability? 153 166 * 154 * @since BuddyPress (1.7 )167 * @since BuddyPress (1.7.0) 155 168 */ 156 169 public function is_legacy_forum() { … … 185 198 186 199 /** 187 * Update the global $post with directory data 188 * 189 * @since BuddyPress (1.7 )200 * Update the global $post with directory data. 201 * 202 * @since BuddyPress (1.7.0) 190 203 */ 191 204 public function directory_dummy_post() { … … 212 225 213 226 /** 214 * Filter the_content with the old forum index template part 215 * 216 * @since BuddyPress (1.7 )227 * Filter the_content with the old forum index template part. 228 * 229 * @since BuddyPress (1.7.0) 217 230 */ 218 231 public function directory_content() { -
trunk/bp-forums/bp-forums-template.php
r7513 r7554 1 1 <?php 2 2 /** 3 * BuddyPress Forums Template Tags 3 * BuddyPress Forums Template Tags. 4 4 * 5 5 * @package BuddyPress … … 11 11 12 12 /** 13 * Output the forums component slug 14 * 15 * @package BuddyPress 16 * @subpackage Forums Template 17 * @since BuddyPress (1.5) 13 * Output the forums component slug. 14 * 15 * @since BuddyPress (1.5.0) 18 16 * 19 17 * @uses bp_get_forums_slug() … … 23 21 } 24 22 /** 25 * Return the forums component slug 26 * 27 * @ package BuddyPress28 * @subpackage Forums Template29 * @ since BuddyPress (1.5)23 * Return the forums component slug. 24 * 25 * @since BuddyPress (1.5.0) 26 * 27 * @return string Slug for the forums component. 30 28 */ 31 29 function bp_get_forums_slug() { … … 35 33 36 34 /** 37 * Output the forums component root slug 38 * 39 * @package BuddyPress 40 * @subpackage Forums Template 41 * @since BuddyPress (1.5) 35 * Output the forums component root slug. 36 * 37 * @since BuddyPress (1.5.0) 42 38 * 43 39 * @uses bp_get_forums_root_slug() … … 47 43 } 48 44 /** 49 * Return the forums component root slug 50 * 51 * @ package BuddyPress52 * @subpackage Forums Template53 * @ since BuddyPress (1.5)45 * Return the forums component root slug. 46 * 47 * @since BuddyPress (1.5.0) 48 * 49 * @return string Root slug for the forums component. 54 50 */ 55 51 function bp_get_forums_root_slug() { … … 59 55 60 56 /** 61 * Output forum directory permalink 62 * 63 * @package BuddyPress 64 * @subpackage Forums Template 65 * @since BuddyPress (1.5) 57 * Output permalink for the forum directory. 58 * 59 * @since BuddyPress (1.5.0) 60 * 66 61 * @uses bp_get_forums_directory_permalink() 67 62 */ … … 70 65 } 71 66 /** 72 * Return forum directory permalink 73 * 74 * @package BuddyPress 75 * @subpackage Forums Template 76 * @since BuddyPress (1.5) 67 * Return permalink for the forum directory. 68 * 69 * @since BuddyPress (1.5.0) 70 * 77 71 * @uses apply_filters() 78 72 * @uses traisingslashit() 79 73 * @uses bp_get_root_domain() 80 74 * @uses bp_get_forums_root_slug() 81 * @return string 75 * 76 * @return string The permalink for the forums component directory. 82 77 */ 83 78 function bp_get_forums_directory_permalink() { … … 85 80 } 86 81 82 /** 83 * The main forums template loop class. 84 * 85 * Responsible for loading a group of forum topics into a loop for display. 86 */ 87 87 class BP_Forums_Template_Forum { 88 /** 89 * The loop iterator. 90 * 91 * @access public 92 * @var int 93 */ 88 94 var $current_topic = -1; 95 96 /** 97 * The number of topics returned by the paged query. 98 * 99 * @access public 100 * @var int 101 */ 89 102 var $topic_count; 103 104 /** 105 * Array of topics located by the query. 106 * 107 * @access public 108 * @var array 109 */ 90 110 var $topics; 111 112 /** 113 * The topic object currently being iterated on. 114 * 115 * @access public 116 * @var object 117 */ 91 118 var $topic; 92 119 120 /** 121 * The ID of the forum whose topics are being queried. 122 * 123 * @access public 124 * @var int 125 */ 93 126 var $forum_id; 94 127 128 /** 129 * A flag for whether the loop is currently being iterated. 130 * 131 * @access public 132 * @var bool 133 */ 95 134 var $in_the_loop; 96 135 136 /** 137 * The page number being requested. 138 * 139 * @access public 140 * @var public 141 */ 97 142 var $pag_page; 143 144 /** 145 * The number of items being requested per page. 146 * 147 * @access public 148 * @var public 149 */ 98 150 var $pag_num; 151 152 /** 153 * An HTML string containing pagination links. 154 * 155 * @access public 156 * @var string 157 */ 99 158 var $pag_links; 159 160 /** 161 * The total number of topics matching the query parameters. 162 * 163 * @access public 164 * @var int 165 */ 100 166 var $total_topic_count; 101 167 168 /** 169 * Whether requesting a single topic. Not currently used. 170 * 171 * @access public 172 * @var bool 173 */ 102 174 var $single_topic = false; 103 175 176 /** 177 * Term to sort by. Not currently used. 178 * 179 * @access public 180 * @var string 181 */ 104 182 var $sort_by; 183 184 /** 185 * Sort order. Not currently used. 186 * 187 * @access public 188 * @var string 189 */ 105 190 var $order; 106 191 192 /** 193 * Constructor method. 194 * 195 * @param string $type The 'type' is the sort order/kind. 'newest', 196 * 'popular', 'unreplied', 'tags'. 197 * @param int $forum_id The ID of the forum for which topics are being 198 * queried. 199 * @param int $user_id The ID of the user to whom topics should be 200 * limited. Pass false to remove this filter. 201 * @param int $page The number of the page being requested. 202 * @param int $per_page The number of items being requested perpage. 203 * @param string $no_stickies Requested sticky format. 204 * @param string $search_terms Filter results by a string. 205 * @param int $offset Optional. Offset results by a given numeric value. 206 * @param int $number Optional. Total number of items to retrieve. 207 */ 107 208 function __construct( $type, $forum_id, $user_id, $page, $per_page, $max, $no_stickies, $search_terms, $offset = false, $number = false ) { 108 209 global $bp; … … 200 301 } 201 302 303 /** 304 * Whether there are topics available in the loop. 305 * 306 * @see bp_has_forum_topics() 307 * 308 * @return bool True if there are items in the loop, otherwise false. 309 */ 202 310 function has_topics() { 203 311 if ( $this->topic_count ) … … 207 315 } 208 316 317 /** 318 * Set up the next topic and iterate index. 319 * 320 * @return object The next topic to iterate over. 321 */ 209 322 function next_topic() { 210 323 $this->current_topic++; … … 214 327 } 215 328 329 /** 330 * Rewind the topics and reset topic index. 331 */ 216 332 function rewind_topics() { 217 333 $this->current_topic = -1; … … 221 337 } 222 338 339 /** 340 * Whether there are blogs left in the loop to iterate over. 341 * 342 * This method is used by {@link bp_forum_topics()} as part of the while loop 343 * that controls iteration inside the blogs loop, eg: 344 * while ( bp_forum_topics() ) { ... 345 * 346 * @see bp_forum_topics() 347 * 348 * @return bool True if there are more topics to show, otherwise false. 349 */ 223 350 function user_topics() { 224 351 if ( $this->current_topic + 1 < $this->topic_count ) { … … 234 361 } 235 362 363 /** 364 * Set up the current topic in the loop. 365 * 366 * @see bp_the_forum_topic() 367 */ 236 368 function the_topic() { 237 369 global $topic; … … 249 381 * Initiate the forum topics loop. 250 382 * 251 * Like other BuddyPress custom loops, the default arguments for this function are determined 252 * dynamically, depending on your current page. All of these $defaults can be overridden in the 253 * $args parameter. 254 * 255 * @package BuddyPress 256 * @uses apply_filters() Filter bp_has_topics to manipulate the $forums_template global before 257 * it's rendered, or to modify the value of has_topics(). 258 * 259 * @param array $args See inline definition of $defaults for explanation of arguments 260 * @return bool Returns true when forum topics are found corresponding to the args, false otherwise. 383 * Like other BuddyPress custom loops, the default arguments for this function 384 * are determined dynamically, depending on your current page. All of these 385 * $defaults can be overridden in the $args parameter. 386 * 387 * @uses apply_filters() Filter 'bp_has_topics' to manipulate the 388 * $forums_template global before it's rendered, or to modify the value 389 * of has_topics(). 390 * 391 * @param array $args { 392 * Arguments for limiting the contents of the forum topics loop. 393 * 394 * @type string $type The 'type' is the sort order/kind. 'newest', 395 * 'popular', 'unreplied', 'tags'. Default: 'newest'. 396 * @type int $forum_id The ID of the forum for which topics are being 397 * queried. Default: the ID of the forum belonging to the current 398 * group, if available. 399 * @type int $user_id The ID of a user to whom to limit results. If viewing 400 * a member's profile, defaults to that member's ID; otherwise 401 * defaults to 0. 402 * @type int $page The number of the page being requested. Default: 1, or 403 * the value of $_GET['p']. 404 * @type int $per_pag The number items to return per page. Default: 20, or 405 * the value of $_GET['n']. 406 * @type int $max Optional. Max records to return. Default: false (no max). 407 * @type int $number Optional. Number of records to return. Default: false. 408 * @type int $offset Optional. Offset results by a given value. 409 * Default: false. 410 * @type string $search_terms Optional. A string to which results should be 411 * limited. Default: false, or the value of $_GET['fs']. 412 * @type string|bool $do_stickies Whether to move stickies to the top of 413 * the sort order. Default: true if looking at a group forum, 414 * otherwise false. 415 * } 416 * @return bool True when forum topics are found corresponding to the args, 417 * false otherwise. 261 418 */ 262 419 function bp_has_forum_topics( $args = '' ) { … … 426 583 } 427 584 585 /** 586 * Determine whether there are still topics left in the loop. 587 * 588 * @global BP_Forums_Template_Forum $forum_template Template global. 589 * 590 * @return bool Returns true when topics are found. 591 */ 428 592 function bp_forum_topics() { 429 593 global $forum_template; … … 431 595 } 432 596 597 /** 598 * Get the current topic object in the loop. 599 * 600 * @global BP_Forums_Template_Forum $forum_template Template global. 601 * 602 * @return object The current topic object. 603 */ 433 604 function bp_the_forum_topic() { 434 605 global $forum_template; … … 436 607 } 437 608 609 /** 610 * Output the ID of the current topic in the loop. 611 */ 438 612 function bp_the_topic_id() { 439 613 echo bp_get_the_topic_id(); 440 614 } 615 /** 616 * Return the ID of the current topic in the loop. 617 * 618 * @return int ID of the current topic in the loop. 619 */ 441 620 function bp_get_the_topic_id() { 442 621 global $forum_template; … … 445 624 } 446 625 626 /** 627 * Output the title of the current topic in the loop. 628 */ 447 629 function bp_the_topic_title() { 448 630 echo bp_get_the_topic_title(); 449 631 } 632 /** 633 * Return the title of the current topic in the loop. 634 * 635 * @return string Title of the current topic in the loop. 636 */ 450 637 function bp_get_the_topic_title() { 451 638 global $forum_template; … … 454 641 } 455 642 643 /** 644 * Output the slug of the current topic in the loop. 645 */ 456 646 function bp_the_topic_slug() { 457 647 echo bp_get_the_topic_slug(); 458 648 } 649 /** 650 * Return the slug of the current topic in the loop. 651 * 652 * @return string Slug of the current topic in the loop. 653 */ 459 654 function bp_get_the_topic_slug() { 460 655 global $forum_template; … … 463 658 } 464 659 660 /** 661 * Output the text of the first post in the current topic in the loop. 662 */ 465 663 function bp_the_topic_text() { 466 664 echo bp_get_the_topic_text(); 467 665 } 666 /** 667 * Return the text of the first post in the current topic in the loop. 668 * 669 * @return string Text of the first post in the current topic. 670 */ 468 671 function bp_get_the_topic_text() { 469 672 global $forum_template; … … 473 676 } 474 677 678 /** 679 * Output the ID of the user who posted the current topic in the loop. 680 */ 475 681 function bp_the_topic_poster_id() { 476 682 echo bp_get_the_topic_poster_id(); 477 683 } 684 /** 685 * Return the ID of the user who posted the current topic in the loop. 686 * 687 * @return int ID of the user who posted the current topic. 688 */ 478 689 function bp_get_the_topic_poster_id() { 479 690 global $forum_template; … … 482 693 } 483 694 695 /** 696 * Output the avatar of the user who posted the current topic in the loop. 697 * 698 * @see bp_get_the_topic_poster_avatar() for a description of arguments. 699 * 700 * @param array $args See {@link bp_get_the_topic_poster_avatar()}. 701 */ 484 702 function bp_the_topic_poster_avatar( $args = '' ) { 485 703 echo bp_get_the_topic_poster_avatar( $args ); 486 704 } 705 /** 706 * Return the avatar of the user who posted the current topic in the loop. 707 * 708 * @param array $args { 709 * Arguments for building the avatar. 710 * @type string $type Avatar type. 'thumb' or 'full'. Default: 711 * 'thumb'. 712 * @type int $width Width of the avatar, in pixels. Default: the 713 * width corresponding to $type. 714 * See {@link bp_core_fetch_avatar()}. 715 * @type int $height Height of the avatar, in pixels. Default: the 716 * height corresponding to $type. 717 * See {@link bp_core_fetch_avatar()}. 718 * @type string $alt The text of the image's 'alt' attribute. 719 * Default: 'Profile picture of [user name]'. 720 * } 721 * @return string HTML of user avatar. 722 */ 487 723 function bp_get_the_topic_poster_avatar( $args = '' ) { 488 724 global $forum_template; … … 501 737 } 502 738 739 /** 740 * Output the name of the user who posted the current topic in the loop. 741 */ 503 742 function bp_the_topic_poster_name() { 504 743 echo bp_get_the_topic_poster_name(); 505 744 } 745 /** 746 * Return the name of the user who posted the current topic in the loop. 747 * 748 * @return string Name of the user who posted the current topic. 749 */ 506 750 function bp_get_the_topic_poster_name() { 507 751 global $forum_template; … … 515 759 } 516 760 761 /** 762 * Output the ID of the object associated with the current topic in the loop. 763 */ 517 764 function bp_the_topic_object_id() { 518 765 echo bp_get_the_topic_object_id(); 519 766 } 767 /** 768 * Return the ID of the object associated with the current topic in the loop. 769 * 770 * Objects are things like associated groups. 771 * 772 * @return int ID of the associated object. 773 */ 520 774 function bp_get_the_topic_object_id() { 521 775 global $forum_template; … … 524 778 } 525 779 780 /** 781 * Output the name of the object associated with the current topic in the loop. 782 */ 526 783 function bp_the_topic_object_name() { 527 784 echo bp_get_the_topic_object_name(); 528 785 } 786 /** 787 * Return the name of the object associated with the current topic in the loop. 788 * 789 * Objects are things like groups. So this function would return the 790 * name of the group associated with the forum topic, if it exists. 791 * 792 * @return string Object name. 793 */ 529 794 function bp_get_the_topic_object_name() { 530 795 global $forum_template; … … 538 803 } 539 804 805 /** 806 * Output the slug of the object associated with the current topic in the loop. 807 */ 540 808 function bp_the_topic_object_slug() { 541 809 echo bp_get_the_topic_object_slug(); 542 810 } 811 /** 812 * Return the slug of the object associated with the current topic in the loop. 813 * 814 * Objects are things like groups. So this function would return the 815 * slug of the group associated with the forum topic, if it exists. 816 * 817 * @return string Object slug. 818 */ 543 819 function bp_get_the_topic_object_slug() { 544 820 global $forum_template; … … 547 823 } 548 824 825 /** 826 * Output the permalink of the object associated with the current topic in the loop. 827 */ 549 828 function bp_the_topic_object_permalink() { 550 829 echo bp_get_the_topic_object_permalink(); 551 830 } 831 /** 832 * Return the permalink of the object associated with the current topic in the loop. 833 * 834 * Objects are things like groups. So this function would return the 835 * permalink of the group associated with the forum topic, if it exists. 836 * 837 * @return string Object permalink. 838 */ 552 839 function bp_get_the_topic_object_permalink() { 553 840 … … 561 848 } 562 849 850 /** 851 * Output the linked name of the user who last posted to the current topic in the loop. 852 */ 563 853 function bp_the_topic_last_poster_name() { 564 854 echo bp_get_the_topic_last_poster_name(); 565 855 } 856 /** 857 * Return the linked name of the user who last posted to the current topic in the loop. 858 * 859 * @return string HTML link to the profile of the user who last posted 860 * to the current topic. 861 */ 566 862 function bp_get_the_topic_last_poster_name() { 567 863 global $forum_template; … … 577 873 } 578 874 875 /** 876 * Output the permalink of the object associated with the current topic in the loop. 877 * 878 * @see bp_get_the_topic_object_avatar() for description of arguments. 879 * 880 * @param array $args See {@bp_get_the_topic_object_avatar()}. 881 */ 579 882 function bp_the_topic_object_avatar( $args = '' ) { 580 883 echo bp_get_the_topic_object_avatar( $args ); 581 884 } 885 /** 886 * Return the avatar of the object associated with the current topic in the loop. 887 * 888 * Objects are things like groups. So this function would return the 889 * avatar of the group associated with the forum topic, if it exists. 890 * 891 * @param array $args { 892 * Arguments for building the avatar. 893 * @type string $type Avatar type. 'thumb' or 'full'. Default: 894 * 'thumb'. 895 * @type int $width Width of the avatar, in pixels. Default: the 896 * width corresponding to $type. 897 * See {@link bp_core_fetch_avatar()}. 898 * @type int $height Height of the avatar, in pixels. Default: 899 * the height corresponding to $type. 900 * See {@link bp_core_fetch_avatar()}. 901 * @type string $alt The text of the image's 'alt' attribute. 902 * Default: 'Group logo for [group name]'. 903 * } 904 * @return string Object avatar. 905 */ 582 906 function bp_get_the_topic_object_avatar( $args = '' ) { 583 907 global $forum_template; … … 599 923 } 600 924 925 /** 926 * Output the avatar for the user who last posted to the current topic in the loop. 927 * 928 * @see bp_get_the_topic_last_poster_avatar() for description of arguments. 929 * 930 * @param array $args See {@bp_get_the_topic_last_poster_avatar()}. 931 */ 601 932 function bp_the_topic_last_poster_avatar( $args = '' ) { 602 933 echo bp_get_the_topic_last_poster_avatar( $args ); 603 934 } 935 /** 936 * Return the avatar for the user who last posted to the current topic in the loop. 937 * 938 * @param array $args { 939 * Arguments for building the avatar. 940 * @type string $type Avatar type. 'thumb' or 'full'. Default: 941 * 'thumb'. 942 * @type int $width Width of the avatar, in pixels. Default: the 943 * width corresponding to $type. 944 * See {@link bp_core_fetch_avatar()}. 945 * @type int $height Height of the avatar, in pixels. Default: 946 * the height corresponding to $type. 947 * See {@link bp_core_fetch_avatar()}. 948 * @type string $alt The text of the image's 'alt' attribute. 949 * Default: 'Profile picture of [group name]'. 950 * } 951 * @return string User avatar. 952 */ 604 953 function bp_get_the_topic_last_poster_avatar( $args = '' ) { 605 954 global $forum_template; … … 618 967 } 619 968 969 /** 970 * Output the start time of the current topic in the loop. 971 */ 620 972 function bp_the_topic_start_time() { 621 973 echo bp_get_the_topic_start_time(); 622 974 } 975 /** 976 * Return the start time of the current topic in the loop. 977 * 978 * @return string Start time of the current topic. 979 */ 623 980 function bp_get_the_topic_start_time() { 624 981 global $forum_template; … … 627 984 } 628 985 986 /** 987 * Output the topic time of the current topic in the loop. 988 */ 629 989 function bp_the_topic_time() { 630 990 echo bp_get_the_topic_time(); 631 991 } 992 /** 993 * Return the topic time of the current topic in the loop. 994 * 995 * @return string Topic time of the current topic. 996 */ 632 997 function bp_get_the_topic_time() { 633 998 global $forum_template; … … 636 1001 } 637 1002 1003 /** 1004 * Output the ID of the forum associated with the current topic in the loop. 1005 */ 638 1006 function bp_the_topic_forum_id() { 639 1007 echo bp_get_the_topic_forum_id(); 640 1008 } 1009 /** 1010 * Return the ID of the forum associated with the current topic in the loop. 1011 * 1012 * @return int ID of the forum associated with the current topic. 1013 */ 641 1014 function bp_get_the_topic_forum_id() { 642 1015 global $forum_template; … … 645 1018 } 646 1019 1020 /** 1021 * Output the status of the current topic in the loop. 1022 */ 647 1023 function bp_the_topic_status() { 648 1024 echo bp_get_the_topic_status(); 649 1025 } 1026 /** 1027 * Return the status of the current topic in the loop. 1028 * 1029 * @return string Status of the current topic. 1030 */ 650 1031 function bp_get_the_topic_status() { 651 1032 global $forum_template; … … 654 1035 } 655 1036 1037 /** 1038 * Output whether the current topic in the loop is open. 1039 */ 656 1040 function bp_the_topic_is_topic_open() { 657 1041 echo bp_get_the_topic_is_topic_open(); 658 1042 } 1043 /** 1044 * Return whether the current topic in the loop is open. 1045 * 1046 * @return unknown 1047 */ 659 1048 function bp_get_the_topic_is_topic_open() { 660 1049 global $forum_template; … … 663 1052 } 664 1053 1054 /** 1055 * Output the ID of the last post in the current topic in the loop. 1056 */ 665 1057 function bp_the_topic_last_post_id() { 666 1058 echo bp_get_the_topic_last_post_id(); 667 1059 } 1060 /** 1061 * Return the ID of the last post in the current topic in the loop. 1062 * 1063 * @return int ID of the last post in the current topic. 1064 */ 668 1065 function bp_get_the_topic_last_post_id() { 669 1066 global $forum_template; … … 672 1069 } 673 1070 1071 /** 1072 * Output whether the current topic in the loop is sticky. 1073 */ 674 1074 function bp_the_topic_is_sticky() { 675 1075 echo bp_get_the_topic_is_sticky(); 676 1076 } 1077 /** 1078 * Return whether the current topic in the loop is sticky. 1079 * 1080 * @return unknown 1081 */ 677 1082 function bp_get_the_topic_is_sticky() { 678 1083 global $forum_template; … … 681 1086 } 682 1087 1088 /** 1089 * Output a 'x posts' string with the number of posts in the current topic. 1090 */ 683 1091 function bp_the_topic_total_post_count() { 684 1092 echo bp_get_the_topic_total_post_count(); 685 1093 } 1094 /** 1095 * Return a 'x posts' string with the number of posts in the current topic. 1096 * 1097 * @return string String of the form 'x posts'. 1098 */ 686 1099 function bp_get_the_topic_total_post_count() { 687 1100 global $forum_template; … … 693 1106 } 694 1107 1108 /** 1109 * Output the total number of posts in the current topic in the loop. 1110 */ 695 1111 function bp_the_topic_total_posts() { 696 1112 echo bp_get_the_topic_total_posts(); 697 1113 } 1114 /** 1115 * Return the total number of posts in the current topic in the loop. 1116 * 1117 * @return int Total number of posts in the current topic. 1118 */ 698 1119 function bp_get_the_topic_total_posts() { 699 1120 global $forum_template; … … 702 1123 } 703 1124 1125 /** 1126 * Output the tag count for the current topic in the loop. 1127 */ 704 1128 function bp_the_topic_tag_count() { 705 1129 echo bp_get_the_topic_tag_count(); 706 1130 } 1131 /** 1132 * Return the tag count for the current topic in the loop. 1133 * 1134 * @return int Tag count for the current topic. 1135 */ 707 1136 function bp_get_the_topic_tag_count() { 708 1137 global $forum_template; … … 711 1140 } 712 1141 1142 /** 1143 * Output the permalink of the current topic in the loop. 1144 */ 713 1145 function bp_the_topic_permalink() { 714 1146 echo bp_get_the_topic_permalink(); 715 1147 } 1148 /** 1149 * Return the permalink for the current topic in the loop. 1150 * 1151 * @return string Permalink for the current topic. 1152 */ 716 1153 function bp_get_the_topic_permalink() { 717 1154 global $forum_template, $bp; … … 737 1174 } 738 1175 1176 /** 1177 * Output a 'since' string describing when the current topic was created. 1178 */ 739 1179 function bp_the_topic_time_since_created() { 740 1180 echo bp_get_the_topic_time_since_created(); 741 1181 } 1182 /** 1183 * Return a 'since' string describing when the current topic was created. 1184 * 1185 * @see bp_core_time_since() for a description of return value. 1186 * 1187 * @return string 1188 */ 742 1189 function bp_get_the_topic_time_since_created() { 743 1190 global $forum_template; … … 746 1193 } 747 1194 1195 /** 1196 * Output an excerpt from the latest post of the current topic in the loop. 1197 */ 748 1198 function bp_the_topic_latest_post_excerpt( $args = '' ) { 749 1199 echo bp_get_the_topic_latest_post_excerpt( $args ); 750 1200 } 1201 /** 1202 * Return an excerpt from the latest post of the current topic in the loop. 1203 * 1204 * @param array $args { 1205 * @type int $length The length of the excerpted text. Default: 225. 1206 * } 1207 * @return string Post excerpt. 1208 */ 751 1209 function bp_get_the_topic_latest_post_excerpt( $args = '' ) { 752 1210 global $forum_template; … … 765 1223 } 766 1224 1225 /** 1226 * Output a 'since' string describing when the last post in the current topic was created. 1227 */ 767 1228 function bp_the_topic_time_since_last_post() { 768 1229 echo bp_get_the_topic_time_since_last_post(); 769 1230 } 1231 /** 1232 * Return a 'since' string describing when the last post in the current topic was created. 1233 * 1234 * @see bp_core_time_since() for a description of return value. 1235 * 1236 * @return string 1237 */ 770 1238 function bp_get_the_topic_time_since_last_post() { 771 1239 global $forum_template; … … 774 1242 } 775 1243 1244 /** 1245 * Output whether the current topic in the loop belongs to the logged-in user. 1246 */ 776 1247 function bp_the_topic_is_mine() { 777 1248 echo bp_get_the_topic_is_mine(); 778 1249 } 1250 /** 1251 * Does the current topic belong to the logged-in user? 1252 * 1253 * @return bool True if the current topic in the loop was created by 1254 * the logged-in user, otherwise false. 1255 */ 779 1256 function bp_get_the_topic_is_mine() { 780 1257 global $forum_template; … … 783 1260 } 784 1261 1262 /** 1263 * Output the admin links for the current topic in the loop. 1264 * 1265 * @see bp_get_the_topic_admin_links() for a description of arguments. 1266 * 1267 * @param array $args See {@link bp_get_the_topic_admin_links()}. 1268 */ 785 1269 function bp_the_topic_admin_links( $args = '' ) { 786 1270 echo bp_get_the_topic_admin_links( $args ); 787 1271 } 1272 /** 1273 * Return the admin links for the current topic in the loop. 1274 * 1275 * @param array $args { 1276 * @type string $seperator The character to use when separating 1277 * links. Default: '|'. 1278 * } 1279 * @return HTML string containing the admin links for the current topic. 1280 */ 788 1281 function bp_get_the_topic_admin_links( $args = '' ) { 789 1282 global $forum_template; … … 815 1308 } 816 1309 1310 /** 1311 * Output the CSS class for the current topic in the loop. 1312 */ 817 1313 function bp_the_topic_css_class() { 818 1314 echo bp_get_the_topic_css_class(); 819 1315 } 820 1316 /** 1317 * Return the CSS class for the current topic in the loop. 1318 * 1319 * This class may contain keywords like 'alt', 'sticky', or 'closed', 1320 * based on context. 1321 * 1322 * @return string Contents of the 'class' attribute. 1323 */ 821 1324 function bp_get_the_topic_css_class() { 822 1325 global $forum_template; … … 836 1339 } 837 1340 1341 /** 1342 * Output the permalink to the 'personal' topics tab. 1343 */ 838 1344 function bp_my_forum_topics_link() { 839 1345 echo bp_get_my_forum_topics_link(); 840 1346 } 1347 /** 1348 * Return the permalink to the 'personal' topics tab. 1349 * 1350 * @return string Link to the 'personal' topics tab. 1351 */ 841 1352 function bp_get_my_forum_topics_link() { 842 1353 global $bp; … … 845 1356 } 846 1357 1358 /** 1359 * Output the permalink to the 'unreplied' topics tab. 1360 */ 847 1361 function bp_unreplied_forum_topics_link() { 848 1362 echo bp_get_unreplied_forum_topics_link(); 849 1363 } 1364 /** 1365 * Return the permalink to the 'unreplied' topics tab. 1366 * 1367 * @return string Link to the 'unreplied' topics tab. 1368 */ 850 1369 function bp_get_unreplied_forum_topics_link() { 851 1370 global $bp; … … 854 1373 } 855 1374 856 1375 /** 1376 * Output the permalink to the 'popular' topics tab. 1377 */ 857 1378 function bp_popular_forum_topics_link() { 858 1379 echo bp_get_popular_forum_topics_link(); 859 1380 } 1381 /** 1382 * Return the permalink to the 'popular' topics tab. 1383 * 1384 * @return string Link to the 'popular' topics tab. 1385 */ 860 1386 function bp_get_popular_forum_topics_link() { 861 1387 global $bp; … … 864 1390 } 865 1391 1392 /** 1393 * Output the link to the forums directory. 1394 */ 866 1395 function bp_newest_forum_topics_link() { 867 1396 echo bp_get_newest_forum_topics_link(); 868 1397 } 1398 /** 1399 * Return the link to the forums directory. 1400 * 1401 * @return string Link to the forums directory. 1402 */ 869 1403 function bp_get_newest_forum_topics_link() { 870 1404 global $bp; … … 873 1407 } 874 1408 1409 /** 1410 * Output the currently viewed topic list type. 1411 */ 875 1412 function bp_forum_topic_type() { 876 1413 echo bp_get_forum_topic_type(); 877 1414 } 1415 /** 1416 * Return the currently viewed topic list type. 1417 * 1418 * Eg, 'newest', 'popular', etc. 1419 * 1420 * @return string Type of the currently viewed topic list. 1421 */ 878 1422 function bp_get_forum_topic_type() { 879 1423 global $bp; … … 886 1430 887 1431 /** 888 * Echoes the output of bp_get_forum_topic_new_reply_link() 889 * 890 * @package BuddyPress 891 * @since BuddyPress (1.5) 1432 * Output the value of bp_get_forum_topic_new_reply_link(). 1433 * 1434 * @since BuddyPress (1.5.0) 892 1435 */ 893 1436 function bp_forum_topic_new_reply_link() { … … 895 1438 } 896 1439 /** 897 * Return s the permalink for the New Reply button at the top of forum topics898 * 899 * @ package BuddyPress900 * @since BuddyPress (1.5)901 * 902 * @uses apply_filters() Filter bp_get_forum_topic_new_reply_link to modify903 * @return string The URL for the New Reply link 1440 * Return the permalink for the New Reply button at the top of forum topics. 1441 * 1442 * @since BuddyPress (1.5.0) 1443 * 1444 * @uses apply_filters() Filter bp_get_forum_topic_new_reply_link to 1445 * modify. 1446 * @return string The URL for the New Reply link. 904 1447 */ 905 1448 function bp_get_forum_topic_new_reply_link() { … … 922 1465 923 1466 /** 924 * Echoes the output of bp_get_forums_tag_name() 925 * 926 * @package BuddyPress 1467 * Output the currently viewed tag name. 1468 * 927 1469 * @todo Deprecate? 928 1470 */ … … 931 1473 } 932 1474 /** 933 * Outputs the currently viewed tag name 934 * 935 * @package BuddyPress 1475 * Return the currently viewed tag name. 1476 * 936 1477 * @todo Deprecate? Seems unused 937 1478 */ … … 942 1483 } 943 1484 1485 /** 1486 * Output the pagination links for the current topic list. 1487 */ 944 1488 function bp_forum_pagination() { 945 1489 echo bp_get_forum_pagination(); 946 1490 } 1491 /** 1492 * Return the pagination links for the current topic list. 1493 * 1494 * @return string HTML pagination links. 1495 */ 947 1496 function bp_get_forum_pagination() { 948 1497 global $forum_template; … … 951 1500 } 952 1501 1502 /** 1503 * Output the pagination count for the current topic list. 1504 */ 953 1505 function bp_forum_pagination_count() { 954 1506 echo bp_get_forum_pagination_count(); 955 1507 } 1508 /** 1509 * Return the pagination count for the current topic list. 1510 * 1511 * The "count" is a string of the form "Viewing x of y topics". 1512 * 1513 * @return string 1514 */ 956 1515 function bp_get_forum_pagination_count() { 957 1516 global $bp, $forum_template; … … 969 1528 } 970 1529 1530 /** 1531 * Are we currently on an Edit Topic screen? 1532 * 1533 * @return bool True if currently editing a topic, otherwise false. 1534 */ 971 1535 function bp_is_edit_topic() { 972 1536 global $bp; … … 978 1542 } 979 1543 1544 /** 1545 * The single forum topic template loop class. 1546 * 1547 * Responsible for loading a topic's posts into a loop for display. 1548 */ 980 1549 class BP_Forums_Template_Topic { 1550 /** 1551 * The loop iterator. 1552 * 1553 * @access public 1554 * @var int 1555 */ 981 1556 var $current_post = -1; 1557 1558 /** 1559 * The number of posts returned by the paged query. 1560 * 1561 * @access public 1562 * @var int 1563 */ 982 1564 var $post_count; 1565 1566 /** 1567 * Array of posts located by the query. 1568 * 1569 * @access public 1570 * @var array 1571 */ 983 1572 var $posts; 1573 1574 /** 1575 * The post object currently being iterated on. 1576 * 1577 * @access public 1578 * @var object 1579 */ 984 1580 var $post; 985 1581 1582 /** 1583 * The ID of the forum whose topic is being queried. 1584 * 1585 * @access public 1586 * @var int 1587 */ 986 1588 var $forum_id; 1589 1590 /** 1591 * The ID of the topic whose posts are being queried. 1592 * 1593 * @access public 1594 * @var int 1595 */ 987 1596 var $topic_id; 1597 1598 /** 1599 * The topic object to which the posts belong. 1600 * 1601 * @access public 1602 * @var object 1603 */ 988 1604 var $topic; 989 1605 1606 /** 1607 * A flag for whether the loop is currently being iterated. 1608 * 1609 * @access public 1610 * @var bool 1611 */ 990 1612 var $in_the_loop; 991 1613 992 1614 /** 993 * Contains a 'total_pages' property holding total number of pages in this loop. 994 * 995 * @since BuddyPress (1.2) 1615 * Contains a 'total_pages' property holding total number of pages in 1616 * this loop. 1617 * 1618 * @since BuddyPress (1.2.0) 996 1619 * @var stdClass 997 1620 */ 998 1621 public $pag; 999 1622 1623 /** 1624 * The page number being requested. 1625 * 1626 * @access public 1627 * @var public 1628 */ 1000 1629 var $pag_page; 1630 1631 /** 1632 * The number of items being requested per page. 1633 * 1634 * @access public 1635 * @var public 1636 */ 1001 1637 var $pag_num; 1638 1639 /** 1640 * An HTML string containing pagination links. 1641 * 1642 * @access public 1643 * @var string 1644 */ 1002 1645 var $pag_links; 1646 1647 /** 1648 * The total number of posts matching the query parameters. 1649 * 1650 * @access public 1651 * @var int 1652 */ 1003 1653 var $total_post_count; 1004 1654 1655 /** 1656 * Whether requesting a single topic. Not currently used. 1657 * 1658 * @access public 1659 * @var bool 1660 */ 1005 1661 var $single_post = false; 1006 1662 1663 /** 1664 * Term to sort by. 1665 * 1666 * @access public 1667 * @var string 1668 */ 1007 1669 var $sort_by; 1670 1671 /** 1672 * Sort order. 1673 * 1674 * @access public 1675 * @var string 1676 */ 1008 1677 var $order; 1009 1678 1679 /** 1680 * Constructor method. 1681 * 1682 * @param int $topic_id ID of the topic whose posts are being requested. 1683 * @param int $per_page Number of items to return per page. 1684 * @param int $max Max records to return. 1685 * @param string $order Direction to order results. 1686 */ 1010 1687 function __construct( $topic_id, $per_page, $max, $order ) { 1011 1688 global $bp, $current_user, $forum_template; … … 1068 1745 } 1069 1746 1747 /** 1748 * Whether there are posts available in the loop. 1749 * 1750 * @see bp_has_forum_topic_posts() 1751 * 1752 * @return bool True if there are items in the loop, otherwise false. 1753 */ 1070 1754 function has_posts() { 1071 1755 if ( $this->post_count ) … … 1075 1759 } 1076 1760 1761 /** 1762 * Set up the next post and iterate index. 1763 * 1764 * @return object The next post to iterate over. 1765 */ 1077 1766 function next_post() { 1078 1767 $this->current_post++; … … 1082 1771 } 1083 1772 1773 /** 1774 * Rewind the posts and reset post index. 1775 */ 1084 1776 function rewind_posts() { 1085 1777 $this->current_post = -1; … … 1089 1781 } 1090 1782 1783 /** 1784 * Whether there are posts left in the loop to iterate over. 1785 * 1786 * This method is used by {@link bp_forum_topic_posts()} as part of 1787 * the while loop that controls iteration inside the blogs loop, eg: 1788 * while ( bp_forum_topic_posts() ) { ... 1789 * 1790 * @see bp_forum_topic_posts() 1791 * 1792 * @return bool True if there are more posts to show, otherwise false. 1793 */ 1091 1794 function user_posts() { 1092 1795 if ( $this->current_post + 1 < $this->post_count ) { … … 1102 1805 } 1103 1806 1807 /** 1808 * Set up the current topic in the loop. 1809 * 1810 * @see bp_the_forum_topic_post() 1811 */ 1104 1812 function the_post() { 1105 1813 global $post; … … 1114 1822 } 1115 1823 1824 /** 1825 * Initiate the loop for a single topic's posts. 1826 * 1827 * @param array $args { 1828 * Arguments for limiting the contents of the topic posts loop. 1829 * @type int $topic_id ID of the topic to which the posts belong. 1830 * @type int $per_page Number of items to return per page. Default: 15. 1831 * @type int $max Max items to return. Default: false. 1832 * @type string $order 'ASC' or 'DESC'. 1833 * } 1834 * @return bool True when posts are found corresponding to the args, 1835 * otherwise false. 1836 */ 1116 1837 function bp_has_forum_topic_posts( $args = '' ) { 1117 1838 global $topic_template; … … 1146 1867 } 1147 1868 1869 /** 1870 * Determine whether there are posts left in the loop. 1871 * 1872 * @return bool True when posts are found. 1873 */ 1148 1874 function bp_forum_topic_posts() { 1149 1875 global $topic_template; … … 1151 1877 } 1152 1878 1879 /** 1880 * Set up the current post in the loop. 1881 * 1882 * @return object 1883 */ 1153 1884 function bp_the_forum_topic_post() { 1154 1885 global $topic_template; … … 1156 1887 } 1157 1888 1889 /** 1890 * Output the ID of the current post in the loop. 1891 */ 1158 1892 function bp_the_topic_post_id() { 1159 1893 echo bp_get_the_topic_post_id(); 1160 1894 } 1895 /** 1896 * Return the ID of the current post in the loop. 1897 * 1898 * @return int ID of the current post in the loop. 1899 */ 1161 1900 function bp_get_the_topic_post_id() { 1162 1901 global $topic_template; … … 1165 1904 } 1166 1905 1906 /** 1907 * Output the content of the current post in the loop. 1908 */ 1167 1909 function bp_the_topic_post_content() { 1168 1910 echo bp_get_the_topic_post_content(); 1169 1911 } 1912 /** 1913 * Return the content of the current post in the loop. 1914 * 1915 * @return string Content of the current post. 1916 */ 1170 1917 function bp_get_the_topic_post_content() { 1171 1918 global $topic_template; … … 1174 1921 } 1175 1922 1923 /** 1924 * Output the CSS class of the current post in the loop. 1925 */ 1176 1926 function bp_the_topic_post_css_class() { 1177 1927 echo bp_get_the_topic_post_css_class(); 1178 1928 } 1179 1929 /** 1930 * Return the CSS class of the current post in the loop. 1931 * 1932 * May contain strings 'alt', 'deleted', or 'open', depending on 1933 * context. 1934 * 1935 * @return string String to put in the 'class' attribute of the current 1936 * post. 1937 */ 1180 1938 function bp_get_the_topic_post_css_class() { 1181 1939 global $topic_template; … … 1195 1953 } 1196 1954 1955 /** 1956 * Output the avatar of the user who posted the current post in the loop. 1957 * 1958 * @see bp_get_the_topic_post_poster_avatar() for a description of arguments. 1959 * 1960 * @param array $args See {@link bp_get_the_topic_post_poster_avatar()}. 1961 */ 1197 1962 function bp_the_topic_post_poster_avatar( $args = '' ) { 1198 1963 echo bp_get_the_topic_post_poster_avatar( $args ); 1199 1964 } 1965 /** 1966 * Return the avatar of the user who posted the current post in the loop. 1967 * 1968 * @param array $args { 1969 * Arguments for building the avatar. 1970 * @type string $type Avatar type. 'thumb' or 'full'. Default: 1971 * 'thumb'. 1972 * @type int $width Width of the avatar, in pixels. Default: the 1973 * width corresponding to $type. 1974 * See {@link bp_core_fetch_avatar()}. 1975 * @type int $height Height of the avatar, in pixels. Default: the 1976 * height corresponding to $type. 1977 * See {@link bp_core_fetch_avatar()}. 1978 * @type string $alt The text of the image's 'alt' attribute. 1979 * Default: 'Profile picture of [user name]'. 1980 * } 1981 * @return string HTML of user avatar. 1982 */ 1200 1983 function bp_get_the_topic_post_poster_avatar( $args = '' ) { 1201 1984 global $topic_template; … … 1214 1997 } 1215 1998 1999 /** 2000 * Output the name of the user who posted the current post in the loop. 2001 */ 1216 2002 function bp_the_topic_post_poster_name() { 1217 2003 echo bp_get_the_topic_post_poster_name(); 1218 2004 } 2005 /** 2006 * Return the name of the user who posted the current post in the loop. 2007 * 2008 * @return string Name of the user who posted the current post. 2009 */ 1219 2010 function bp_get_the_topic_post_poster_name() { 1220 2011 global $topic_template; … … 1226 2017 } 1227 2018 2019 /** 2020 * Output a link to the profile of the user who posted the current post. 2021 */ 1228 2022 function bp_the_topic_post_poster_link() { 1229 2023 echo bp_get_the_topic_post_poster_link(); 1230 2024 } 2025 /** 2026 * Return a link to the profile of the user who posted the current post. 2027 * 2028 * @return string Link to the profile of the user who posted the 2029 * current post. 2030 */ 1231 2031 function bp_get_the_topic_post_poster_link() { 1232 2032 global $topic_template; … … 1235 2035 } 1236 2036 2037 /** 2038 * Output a 'since' string describing when the current post in the loop was posted. 2039 */ 1237 2040 function bp_the_topic_post_time_since() { 1238 2041 echo bp_get_the_topic_post_time_since(); 1239 2042 } 2043 /** 2044 * Return a 'since' string describing when the current post in the loop was posted. 2045 * 2046 * @see bp_core_time_since() for a description of return value. 2047 * 2048 * @return string 2049 */ 1240 2050 function bp_get_the_topic_post_time_since() { 1241 2051 global $topic_template; … … 1244 2054 } 1245 2055 2056 /** 2057 * Output whether the current post in the loop belongs to the logged-in user. 2058 */ 1246 2059 function bp_the_topic_post_is_mine() { 1247 2060 echo bp_the_topic_post_is_mine(); 1248 2061 } 2062 /** 2063 * Does the current post belong to the logged-in user? 2064 * 2065 * @return bool True if the current post in the loop was created by 2066 * the logged-in user, otherwise false. 2067 */ 1249 2068 function bp_get_the_topic_post_is_mine() { 1250 2069 global $bp, $topic_template; … … 1253 2072 } 1254 2073 2074 /** 2075 * Output the admin links for the current post in the loop. 2076 * 2077 * @see bp_get_the_post_admin_links() for a description of arguments. 2078 * 2079 * @param array $args See {@link bp_get_the_post_admin_links()}. 2080 */ 1255 2081 function bp_the_topic_post_admin_links( $args = '' ) { 1256 2082 echo bp_get_the_topic_post_admin_links( $args ); 1257 2083 } 2084 /** 2085 * Return the admin links for the current post in the loop. 2086 * 2087 * @param array $args { 2088 * @type string $separator The character to use when separating 2089 * links. Default: '|'. 2090 * } 2091 * @return HTML string containing the admin links for the current post. 2092 */ 1258 2093 function bp_get_the_topic_post_admin_links( $args = '' ) { 1259 2094 global $topic_template; … … 1281 2116 } 1282 2117 2118 /** 2119 * Output the text to edit when editing a post. 2120 */ 1283 2121 function bp_the_topic_post_edit_text() { 1284 2122 echo bp_get_the_topic_post_edit_text(); 1285 2123 } 2124 /** 2125 * Return the text to edit when editing a post. 2126 * 2127 * @return string Editable text. 2128 */ 1286 2129 function bp_get_the_topic_post_edit_text() { 1287 2130 $post = bp_forums_get_post( bp_action_variable( 4 ) ); … … 1289 2132 } 1290 2133 2134 /** 2135 * Output the pagination links for the current topic. 2136 */ 1291 2137 function bp_the_topic_pagination() { 1292 2138 echo bp_get_the_topic_pagination(); 1293 2139 } 2140 /** 2141 * Return the pagination links for the current topic page. 2142 * 2143 * @return string HTML pagination links. 2144 */ 1294 2145 function bp_get_the_topic_pagination() { 1295 2146 global $topic_template; … … 1298 2149 } 1299 2150 2151 /** 2152 * Return the pagination count for the current topic page. 2153 * 2154 * The "count" is a string of the form "Viewing x of y posts". 2155 * 2156 * @return string 2157 */ 1300 2158 function bp_the_topic_pagination_count() { 1301 2159 global $bp, $topic_template; … … 1309 2167 } 1310 2168 2169 /** 2170 * Output whether this is the last page in the current topic. 2171 */ 1311 2172 function bp_the_topic_is_last_page() { 1312 2173 echo bp_get_the_topic_is_last_page(); 1313 2174 } 2175 /** 2176 * Is this the last page in the current topic? 2177 * 2178 * @return bool True if this is the last page of posts for the current 2179 * topic, otherwise false. 2180 */ 1314 2181 function bp_get_the_topic_is_last_page() { 1315 2182 global $topic_template; … … 1319 2186 1320 2187 /** 1321 * Echoes the forums directory search form2188 * Output the forums directory search form. 1322 2189 */ 1323 2190 function bp_directory_forums_search_form() { … … 1333 2200 } 1334 2201 2202 /** 2203 * Output the link to a given forum. 2204 * 2205 * @see bp_get_forum_permalink() for a description of arguments. 2206 * 2207 * @param int $forum_id See {@link bp_get_forum_permalink()}. 2208 */ 1335 2209 function bp_forum_permalink( $forum_id = 0 ) { 1336 2210 echo bp_get_forum_permalink( $forum_id ); 1337 2211 } 2212 /** 2213 * Return the permalink to a given forum. 2214 * 2215 * @param int $forum_id Optional. Defaults to the current forum, if 2216 * there is one. 2217 * @return string|bool False on failure, a URL on success. 2218 */ 1338 2219 function bp_get_forum_permalink( $forum_id = 0 ) { 1339 2220 global $bp; … … 1357 2238 } 1358 2239 2240 /** 2241 * Output the name of a given forum. 2242 * 2243 * @see bp_get_forum_name() for a description of parameters. 2244 * 2245 * @param int $forum_id See {@link bp_get_forum_name()}. 2246 */ 1359 2247 function bp_forum_name( $forum_id = 0 ) { 1360 2248 echo bp_get_forum_name( $forum_id ); 1361 2249 } 2250 /** 2251 * Return the name of a given forum. 2252 * 2253 * @param int $forum_id Optional. Defaults to the current forum, if 2254 * there is one. 2255 * @return string|bool False on failure, a name on success. 2256 */ 1362 2257 function bp_get_forum_name( $forum_id = 0 ) { 1363 2258 global $bp; … … 1375 2270 } 1376 2271 2272 /** 2273 * Get a heatmap of forum tags for the installation. 2274 * 2275 * A wrapper for {@link bb_tag_heat_map}, which provides it with BP-friendly 2276 * defaults. 2277 * 2278 * @param array $args { 2279 * An array of optional arguments. 2280 * @type int $smallest Size of the smallest link. Default: 10. 2281 * @type int $largest Size of the largest link. Default: 42. 2282 * @type string $sizing Unit for $largest and $smallest. Default: 'px'. 2283 * @type int $limit Max number of tags to display. Default: 50. 2284 * } 2285 */ 1377 2286 function bp_forums_tag_heat_map( $args = '' ) { 1378 2287 $defaults = array( … … 1390 2299 1391 2300 /** 1392 * Echo the current topic's tag list, comma-separated 1393 * 1394 * @package BuddyPress 1395 * @since BuddyPress (1.5) 2301 * Output the current topic's tag list, comma-separated 2302 * 2303 * @since BuddyPress (1.5.0) 1396 2304 */ 1397 2305 function bp_forum_topic_tag_list() { … … 1399 2307 } 1400 2308 /** 1401 * Get the current topic's tag list 1402 * 1403 * @ package BuddyPress1404 * @since BuddyPress (1.5)1405 * 1406 * @param string $format 'string' returns comma-separated string; otherwise returns array2309 * Get the current topic's tag list. 2310 * 2311 * @since BuddyPress (1.5.0) 2312 * 2313 * @param string $format 'string' returns comma-separated string; 2314 * otherwise returns array. 1407 2315 * @return mixed $tags 1408 2316 */ … … 1427 2335 1428 2336 /** 1429 * Returns true if the current topic has tags 1430 * 1431 * @package BuddyPress 1432 * @since BuddyPress (1.5) 1433 * 1434 * @return bool 2337 * Does the current topic have any tags? 2338 * 2339 * @since BuddyPress (1.5.0) 2340 * 2341 * @return bool True if the current topic has tags, otherwise false. 1435 2342 */ 1436 2343 function bp_forum_topic_has_tags() { … … 1445 2352 } 1446 2353 2354 /** 2355 * Output a URL to use in as a forum form 'action'. 2356 */ 1447 2357 function bp_forum_action() { 1448 2358 echo bp_get_forum_action(); 1449 2359 } 2360 /** 2361 * Get a URL to use in as a forum form 'action'. 2362 * 2363 * @return string URL of the current page, minus query args. 2364 */ 1450 2365 function bp_get_forum_action() { 1451 2366 global $topic_template; … … 1454 2369 } 1455 2370 2371 /** 2372 * Output a URL to use in as a forum topic form 'action'. 2373 */ 1456 2374 function bp_forum_topic_action() { 1457 2375 echo bp_get_forum_topic_action(); 1458 2376 } 2377 /** 2378 * Get a URL to use in as a forum topic form 'action'. 2379 * 2380 * @return string URL of the current page, minus query args. 2381 */ 1459 2382 function bp_get_forum_topic_action() { 1460 2383 return apply_filters( 'bp_get_forum_topic_action', $_SERVER['REQUEST_URI'] ); 1461 2384 } 1462 2385 2386 /** 2387 * Output the total topic count for a given user. 2388 * 2389 * @see bp_get_forum_topic_count_for_user() for description of parameters. 2390 * 2391 * @param int $user_id See {@link bp_get_forum_topic_count_for_user()}. 2392 */ 1463 2393 function bp_forum_topic_count_for_user( $user_id = 0 ) { 1464 2394 echo bp_get_forum_topic_count_for_user( $user_id ); 1465 2395 } 2396 /** 2397 * Return the total topic count for a given user. 2398 * 2399 * @param int $user_id See {@link bp_forums_total_topic_count_for_user}. 2400 */ 1466 2401 function bp_get_forum_topic_count_for_user( $user_id = 0 ) { 1467 2402 return apply_filters( 'bp_get_forum_topic_count_for_user', bp_forums_total_topic_count_for_user( $user_id ) ); 1468 2403 } 1469 2404 2405 /** 2406 * Output the total topic count for a given user. 2407 * 2408 * @see bp_get_forum_topic_count() for description of parameters. 2409 * 2410 * @param int $user_id See {@link bp_get_forum_topic_count()}. 2411 */ 1470 2412 function bp_forum_topic_count( $user_id = 0 ) { 1471 2413 echo bp_get_forum_topic_count( $user_id ); 1472 2414 } 2415 /** 2416 * Return the total topic count for a given user. 2417 * 2418 * @param int $user_id See {@link bp_forums_total_topic_count()}. 2419 */ 1473 2420 function bp_get_forum_topic_count( $user_id = 0 ) { 1474 2421 return apply_filters( 'bp_get_forum_topic_count', bp_forums_total_topic_count( $user_id ) );
Note: See TracChangeset
for help on using the changeset viewer.