<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][7445] trunk/bp-core/bp-core-component.php: Improve inline docs in bp-core.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/7445">7445</a></dd>
<dt>Author</dt> <dd>boonebgorges</dd>
<dt>Date</dt> <dd>2013-10-19 13:21:35 +0000 (Sat, 19 Oct 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>Improve inline docs in bp-core. See <a href="http://buddypress.trac.wordpress.org/ticket/5022">#5022</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorebpcorecomponentphp">trunk/bp-core/bp-core-component.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcorebpcorecomponentphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-component.php (7444 => 7445)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-component.php 2013-10-19 09:58:33 UTC (rev 7444)
+++ trunk/bp-core/bp-core-component.php 2013-10-19 13:21:35 UTC (rev 7445)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> <?php
</span><span class="cx"> /**
</span><del>- * Component classes
</del><ins>+ * Component classes.
</ins><span class="cx"> *
</span><span class="cx"> * @package BuddyPress
</span><span class="cx"> * @subpackage Core
</span><span class="lines">@@ -11,7 +11,7 @@
</span><span class="cx">
</span><span class="cx"> if ( !class_exists( 'BP_Component' ) ) :
</span><span class="cx"> /**
</span><del>- * BuddyPress Component Class
</del><ins>+ * BuddyPress Component Class.
</ins><span class="cx"> *
</span><span class="cx"> * The BuddyPress component class is responsible for simplifying the creation
</span><span class="cx"> * of components that share similar behaviors and routines. It is used
</span><span class="lines">@@ -21,86 +21,107 @@
</span><span class="cx"> * @package BuddyPress
</span><span class="cx"> * @subpackage Component
</span><span class="cx"> *
</span><del>- * @since BuddyPress (1.5)
</del><ins>+ * @since BuddyPress (1.5.0)
</ins><span class="cx"> */
</span><span class="cx"> class BP_Component {
</span><span class="cx">
</span><span class="cx"> /** Variables *************************************************************/
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * @var string Unique name (for internal identification)
</del><ins>+ * Translatable name for the component.
+ *
</ins><span class="cx"> * @internal
</span><ins>+ * @var string $name
</ins><span class="cx"> */
</span><span class="cx"> public $name = '';
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * @var Unique ID (normally for custom post type)
</del><ins>+ * Unique ID for the component.
+ *
+ * @var string $id
</ins><span class="cx"> */
</span><span class="cx"> public $id = '';
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * @var string Unique slug (used in query string and permalinks)
</del><ins>+ * Unique slug for the component, for use in query strings and URLs.
+ *
+ * @var string $slug
</ins><span class="cx"> */
</span><span class="cx"> public $slug = '';
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * @var bool Does this component need a top-level directory?
</del><ins>+ * Does the component need a top-level directory?
+ *
+ * @var bool $has_directory
</ins><span class="cx"> */
</span><span class="cx"> public $has_directory = false;
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * @var string The path to the component's files
</del><ins>+ * The path to the component's files.
+ *
+ * @var string $path
</ins><span class="cx"> */
</span><span class="cx"> public $path = '';
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * @var WP_Query The loop for this component
</del><ins>+ * The WP_Query loop for this component.
+ *
+ * @var WP_Query $query
</ins><span class="cx"> */
</span><span class="cx"> public $query = false;
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * @var string The current ID of the queried object
</del><ins>+ * The current ID of the queried object.
+ *
+ * @var string $current_id
</ins><span class="cx"> */
</span><span class="cx"> public $current_id = '';
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * @var string Function to call for notifications
</del><ins>+ * Callback for formatting notifications.
+ *
+ * @var callable $notification_callback
</ins><span class="cx"> */
</span><span class="cx"> public $notification_callback = '';
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * @var array WordPress Toolbar links
</del><ins>+ * WordPress Toolbar links.
+ *
+ * @var array $admin_menu
</ins><span class="cx"> */
</span><span class="cx"> public $admin_menu = '';
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Search input box placeholder string for the component
</del><ins>+ * Placeholder text for component directory search box.
</ins><span class="cx"> *
</span><del>- * @since BuddyPress (1.5)
- * @var string
</del><ins>+ * @since BuddyPress (1.5.0)
+ * @var string $search_string
</ins><span class="cx"> */
</span><span class="cx"> public $search_string = '';
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Component's root slug
</del><ins>+ * Root slug for the component.
</ins><span class="cx"> *
</span><del>- * @since BuddyPress (1.5)
- * @var string
</del><ins>+ * @since BuddyPress (1.5.0)
+ * @var string $root_slug
</ins><span class="cx"> */
</span><span class="cx"> public $root_slug = '';
</span><span class="cx">
</span><span class="cx"> /** Methods ***************************************************************/
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Component loader
</del><ins>+ * Component loader.
</ins><span class="cx"> *
</span><del>- * @since BuddyPress (1.5)
</del><ins>+ * @since BuddyPress (1.5.0)
</ins><span class="cx"> *
</span><del>- * @param string $id Unique ID (for internal identification). Letters, numbers, and underscores only
- * @param string $name Unique name. This should be a translatable name, eg __( 'Groups', 'buddypress' )
- * @param string $path The file path for the component's files. Used by BP_Component::includes()
</del><ins>+ * @uses bp_Component::setup_actions() Set up the hooks and actions.
</ins><span class="cx"> *
</span><del>- * @uses bp_Component::setup_actions() Setup the hooks and actions
</del><ins>+ * @param string $id Unique ID (for internal identification). Letters,
+ * numbers, and underscores only.
+ * @param string $name Unique name. This should be a translatable name,
+ * eg __( 'Groups', 'buddypress' ).
+ * @param string $path The file path for the component's files. Used by
+ * {@link BP_Component::includes()}.
</ins><span class="cx"> */
</span><span class="cx"> public function start( $id = '', $name = '', $path = '' ) {
</span><span class="cx">
</span><span class="lines">@@ -128,23 +149,20 @@
</span><span class="cx"> * @param array $args {
</span><span class="cx"> * All values are optional.
</span><span class="cx"> * @type string $slug The component slug. Used to construct certain
</span><del>- * URLs, such as 'friends' in
- * http://example.com/members/joe/friends/
</del><ins>+ * URLs, such as 'friends' in http://example.com/members/joe/friends/
+ * Default: the value of $this->id.
</ins><span class="cx"> * @type string $root_slug The component root slug. Note that this
</span><del>- * value is generally unused if the component
- * has a root directory (the slug will be
- * overridden by the post_name of the
- * directory page).
</del><ins>+ * value is generally unused if the component has a root
+ * directory (the slug will be overridden by the post_name of
+ * the directory page).
</ins><span class="cx"> * @type bool $has_directory Set to true if the component requires
</span><del>- * an associated WordPress page.
- * @type string $notification_callback The callable function that
- * formats the component's
- * notifications.
</del><ins>+ * an associated WordPress page.
+ * @type callable $notification_callback Optional. The callable
+ * function that formats the component's notifications.
</ins><span class="cx"> * @type string $search_term Optional. The placeholder text in the
</span><del>- * component directory search box. Eg,
- * 'Search Groups...'.
</del><ins>+ * component directory search box. Eg, 'Search Groups...'.
</ins><span class="cx"> * @type array $global_tables Optional. An array of database table
</span><del>- * names.
</del><ins>+ * names.
</ins><span class="cx"> * }
</span><span class="cx"> */
</span><span class="cx"> public function setup_globals( $args = array() ) {
</span><span class="lines">@@ -197,31 +215,34 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Include required files
</del><ins>+ * Include required files.
</ins><span class="cx"> *
</span><del>- * Please note that, by default, this method is fired on the bp_include hook, with priority
- * 8. This is necessary so that core components are loaded in time to be available to
- * third-party plugins. However, this load order means that third-party plugins whose main
- * files are loaded at bp_include with priority 10 (as recommended), will not be loaded in
- * time for their includes() method to fire automatically.
</del><ins>+ * Please note that, by default, this method is fired on the bp_include
+ * hook, with priority 8. This is necessary so that core components are
+ * loaded in time to be available to third-party plugins. However, this
+ * load order means that third-party plugins whose main files are
+ * loaded at bp_include with priority 10 (as recommended), will not be
+ * loaded in time for their includes() method to fire automatically.
</ins><span class="cx"> *
</span><del>- * For this reason, it is recommended that your plugin has its own method or function for
- * requiring necessary files. If you must use this method, you will have to call it manually
- * in your constructor class, ie
</del><ins>+ * For this reason, it is recommended that your plugin has its own
+ * method or function for requiring necessary files. If you must use
+ * this method, you will have to call it manually in your constructor
+ * class, ie
</ins><span class="cx"> * $this->includes();
</span><span class="cx"> *
</span><del>- * Note that when you pass an array value like 'actions' to includes, it looks for the
- * following three files (assuming your component is called 'my_component'):
</del><ins>+ * Note that when you pass an array value like 'actions' to includes,
+ * it looks for the following three files (assuming your component is
+ * called 'my_component'):
</ins><span class="cx"> * - ./actions
</span><span class="cx"> * - ./bp-my_component/actions
</span><span class="cx"> * - ./bp-my_component/bp-my_component-actions.php
</span><span class="cx"> *
</span><del>- * @since BuddyPress (1.5)
</del><ins>+ * @since BuddyPress (1.5.0)
</ins><span class="cx"> *
</span><del>- * @uses do_action() Calls 'bp_{@link bp_Component::name}includes'
</del><ins>+ * @uses do_action() Calls 'bp_{@link bp_Component::name}includes'.
</ins><span class="cx"> *
</span><span class="cx"> * @param array $includes An array of file names, or file name chunks,
</span><del>- * to be parsed and then included.
</del><ins>+ * to be parsed and then included.
</ins><span class="cx"> */
</span><span class="cx"> public function includes( $includes = array() ) {
</span><span class="cx">
</span><span class="lines">@@ -260,12 +281,12 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Setup the actions
</del><ins>+ * Set up the actions.
</ins><span class="cx"> *
</span><del>- * @since BuddyPress (1.5)
</del><ins>+ * @since BuddyPress (1.5.0)
</ins><span class="cx"> *
</span><del>- * @uses add_action() To add various actions
- * @uses do_action() Calls 'bp_{@link BP_Component::name}setup_actions'
</del><ins>+ * @uses add_action() To add various actions.
+ * @uses do_action() Calls 'bp_{@link BP_Component::name}setup_actions'.
</ins><span class="cx"> */
</span><span class="cx"> public function setup_actions() {
</span><span class="cx">
</span><span class="lines">@@ -322,11 +343,10 @@
</span><span class="cx"> * in the $sub_nav parameter array should be formatted.
</span><span class="cx"> *
</span><span class="cx"> * @param array $main_nav Optional. Passed directly to
</span><del>- * bp_core_new_nav_item(). See that function for
- * a description.
</del><ins>+ * bp_core_new_nav_item(). See that function for a description.
</ins><span class="cx"> * @param array $sub_nav Optional. Multidimensional array, each item in
</span><del>- * which is passed to bp_core_new_subnav_item().
- * See that function for a description.
</del><ins>+ * which is passed to bp_core_new_subnav_item(). See that
+ * function for a description.
</ins><span class="cx"> */
</span><span class="cx"> public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
</span><span class="cx">
</span><span class="lines">@@ -354,10 +374,9 @@
</span><span class="cx"> * @global obj $wp_admin_bar
</span><span class="cx"> *
</span><span class="cx"> * @param array $wp_admin_nav An array of nav item arguments. Each item
</span><del>- * in this parameter array is passed to
- * WP_Admin_Bar::add_menu(). See that method
- * for a description of the required syntax
- * for each item.
</del><ins>+ * in this parameter array is passed to {@link WP_Admin_Bar::add_menu()}.
+ * See that method for a description of the required syntax for
+ * each item.
</ins><span class="cx"> */
</span><span class="cx"> public function setup_admin_bar( $wp_admin_nav = array() ) {
</span><span class="cx">
</span><span class="lines">@@ -392,55 +411,55 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Setup the component title
</del><ins>+ * Set up the component title.
</ins><span class="cx"> *
</span><del>- * @since BuddyPress (1.5)
</del><ins>+ * @since BuddyPress (1.5.0)
</ins><span class="cx"> *
</span><del>- * @uses do_action() Calls 'bp_{@link bp_Component::name}setup_title'
</del><ins>+ * @uses do_action() Calls 'bp_{@link bp_Component::name}setup_title'.
</ins><span class="cx"> */
</span><span class="cx"> public function setup_title() {
</span><span class="cx"> do_action( 'bp_' . $this->id . '_setup_title' );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Setup the component post types
</del><ins>+ * Set up the component post types.
</ins><span class="cx"> *
</span><del>- * @since BuddyPress (1.5)
</del><ins>+ * @since BuddyPress (1.5.0)
</ins><span class="cx"> *
</span><del>- * @uses do_action() Calls 'bp_{@link bp_Component::name}_register_post_types'
</del><ins>+ * @uses do_action() Calls 'bp_{@link bp_Component::name}_register_post_types'.
</ins><span class="cx"> */
</span><span class="cx"> public function register_post_types() {
</span><span class="cx"> do_action( 'bp_' . $this->id . '_register_post_types' );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Register component specific taxonomies
</del><ins>+ * Register component-specific taxonomies.
</ins><span class="cx"> *
</span><del>- * @since BuddyPress (1.5)
</del><ins>+ * @since BuddyPress (1.5.0)
</ins><span class="cx"> *
</span><del>- * @uses do_action() Calls 'bp_{@link bp_Component::name}_register_taxonomies'
</del><ins>+ * @uses do_action() Calls 'bp_{@link bp_Component::name}_register_taxonomies'.
</ins><span class="cx"> */
</span><span class="cx"> public function register_taxonomies() {
</span><span class="cx"> do_action( 'bp_' . $this->id . '_register_taxonomies' );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Add any additional rewrite tags
</del><ins>+ * Add any additional rewrite tags.
</ins><span class="cx"> *
</span><del>- * @since BuddyPress (1.5)
</del><ins>+ * @since BuddyPress (1.5.0)
</ins><span class="cx"> *
</span><del>- * @uses do_action() Calls 'bp_{@link bp_Component::name}_add_rewrite_tags'
</del><ins>+ * @uses do_action() Calls 'bp_{@link bp_Component::name}_add_rewrite_tags'.
</ins><span class="cx"> */
</span><span class="cx"> public function add_rewrite_tags() {
</span><span class="cx"> do_action( 'bp_' . $this->id . '_add_rewrite_tags' );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Add any additional rewrite rules
</del><ins>+ * Add any additional rewrite rules.
</ins><span class="cx"> *
</span><del>- * @since BuddyPress (1.9)
</del><ins>+ * @since BuddyPress (1.9.0)
</ins><span class="cx"> *
</span><del>- * @uses do_action() Calls 'bp_{@link bp_Component::name}_add_rewrite_rules'
</del><ins>+ * @uses do_action() Calls 'bp_{@link bp_Component::name}_add_rewrite_rules'.
</ins><span class="cx"> */
</span><span class="cx"> public function add_rewrite_rules() {
</span><span class="cx"> do_action( 'bp_' . $this->id . '_add_rewrite_rules' );
</span></span></pre>
</div>
</div>
</body>
</html>