<!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][7476] trunk/bp-core/bp-core-catchuri.php: Improve inline docs in bp-core-catchuri.php.</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/7476">7476</a></dd>
<dt>Author</dt> <dd>boonebgorges</dd>
<dt>Date</dt> <dd>2013-10-24 01:46:03 +0000 (Thu, 24 Oct 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>Improve inline docs in bp-core-catchuri.php. See <a href="http://buddypress.trac.wordpress.org/ticket/5022">#5022</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorebpcorecatchuriphp">trunk/bp-core/bp-core-catchuri.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcorebpcorecatchuriphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-catchuri.php (7475 => 7476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-catchuri.php 2013-10-24 01:41:20 UTC (rev 7475)
+++ trunk/bp-core/bp-core-catchuri.php 2013-10-24 01:46:03 UTC (rev 7476)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * BuddyPress URI catcher
</del><ins>+ * BuddyPress URI catcher.
</ins><span class="cx"> *
</span><span class="cx"> * Functions for parsing the URI and determining which BuddyPress template file
</span><span class="cx"> * to use on-screen.
</span><span class="lines">@@ -14,12 +14,13 @@
</span><span class="cx"> if ( !defined( 'ABSPATH' ) ) exit;
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Analyzes the URI structure and breaks it down into parts for use in code.
- * BuddyPress can use complete custom friendly URI's without the user having to
- * add new re-write rules. Custom components are able to use their own custom
</del><ins>+ * Analyze the URI and break it down into BuddyPress-usable chunks.
+ *
+ * BuddyPress can use complete custom friendly URIs without the user having to
+ * add new rewrite rules. Custom components are able to use their own custom
</ins><span class="cx"> * URI structures with very little work.
</span><span class="cx"> *
</span><del>- * The URI's are broken down as follows:
</del><ins>+ * The URIs are broken down as follows:
</ins><span class="cx"> * - http:// domain.com / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...
</span><span class="cx"> * - OUTSIDE ROOT: http:// domain.com / sites / buddypress / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...
</span><span class="cx"> *
</span><span class="lines">@@ -29,8 +30,7 @@
</span><span class="cx"> * - $bp->current_action: string 'edit'
</span><span class="cx"> * - $bp->action_variables: array ['group', 5]
</span><span class="cx"> *
</span><del>- * @package BuddyPress Core
- * @since BuddyPress (1.0)
</del><ins>+ * @since BuddyPress (1.0.0)
</ins><span class="cx"> */
</span><span class="cx"> function bp_core_set_uri_globals() {
</span><span class="cx"> global $bp, $current_blog, $wp_rewrite;
</span><span class="lines">@@ -316,10 +316,11 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Are root profiles enabled and allowed
</del><ins>+ * Are root profiles enabled and allowed?
</ins><span class="cx"> *
</span><del>- * @since BuddyPress (1.6)
- * @return bool True if yes, false if no
</del><ins>+ * @since BuddyPress (1.6.0)
+ *
+ * @return bool True if yes, false if no.
</ins><span class="cx"> */
</span><span class="cx"> function bp_core_enable_root_profiles() {
</span><span class="cx">
</span><span class="lines">@@ -339,9 +340,8 @@
</span><span class="cx"> * Loads:
</span><span class="cx"> * wp-content/themes/[activated_theme]/members/index.php
</span><span class="cx"> *
</span><del>- * @package BuddyPress Core
- * @param string $username Username to check.
- * @return int|bool The user ID of the matched user, or false.
</del><ins>+ * @param array $templates Array of templates to attempt to load.
+ * @return bool|null Returns false on failure.
</ins><span class="cx"> */
</span><span class="cx"> function bp_core_load_template( $templates ) {
</span><span class="cx"> global $post, $bp, $wp_query, $wpdb;
</span><span class="lines">@@ -412,11 +412,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * bp_core_catch_profile_uri()
- *
- * If the extended profiles component is not installed we still need
- * to catch the /profile URI's and display whatever we have installed.
- *
</del><ins>+ * Redirect away from /profile URIs if XProfile is not enabled.
</ins><span class="cx"> */
</span><span class="cx"> function bp_core_catch_profile_uri() {
</span><span class="cx"> if ( !bp_is_active( 'xprofile' ) ) {
</span><span class="lines">@@ -425,10 +421,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Catches invalid access to BuddyPress pages and redirects them accordingly.
</del><ins>+ * Catch unauthorized access to certain BuddyPress pages and redirect accordingly.
</ins><span class="cx"> *
</span><del>- * @package BuddyPress Core
- * @since BuddyPress (1.5)
</del><ins>+ * @since BuddyPress (1.5.0)
</ins><span class="cx"> */
</span><span class="cx"> function bp_core_catch_no_access() {
</span><span class="cx"> global $bp, $wp_query;
</span><span class="lines">@@ -445,12 +440,26 @@
</span><span class="cx"> add_action( 'bp_template_redirect', 'bp_core_catch_no_access', 1 );
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Redirects a user to login for BP pages that require access control and adds an error message (if
- * one is provided).
</del><ins>+ * Redirect a user to log in for BP pages that require access control.
+ *
+ * Add an error message (if one is provided).
+ *
</ins><span class="cx"> * If authenticated, redirects user back to requested content by default.
</span><span class="cx"> *
</span><del>- * @package BuddyPress Core
- * @since BuddyPress (1.5)
</del><ins>+ * @since BuddyPress (1.5.0)
+ *
+ * @param array $args {
+ * @type int $mode Specifies the destintation of the redirect. 1 will
+ * direct to the root domain (home page), which assumes you have a
+ * log-in form there; 2 directs to wp-login.php. Default: 2.
+ * @type string $redirect The URL the user will be redirected to after
+ * successfully logging in. Default: the URL originally requested.
+ * @type string $root The root URL of the site, used in case of error or
+ * mode 1 redirects. Default: the value of {@link bp_get_root_domain()}.
+ * @type string $message An error message to display to the user on the
+ * log-in page. Default: "You must log in to access the page you
+ * requested."
+ * }
</ins><span class="cx"> */
</span><span class="cx"> function bp_core_no_access( $args = '' ) {
</span><span class="cx">
</span><span class="lines">@@ -512,12 +521,13 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Adds an error message to wp-login.php.
</del><ins>+ * Add an error message to wp-login.php.
+ *
</ins><span class="cx"> * Hooks into the "bpnoaccess" action defined in bp_core_no_access().
</span><span class="cx"> *
</span><del>- * @package BuddyPress Core
- * @global $error
- * @since BuddyPress (1.5)
</del><ins>+ * @since BuddyPress (1.5.0)
+ *
+ * @global $error Error message to pass to wp-login.php
</ins><span class="cx"> */
</span><span class="cx"> function bp_core_no_access_wp_login_error() {
</span><span class="cx"> global $error;
</span><span class="lines">@@ -530,17 +540,19 @@
</span><span class="cx"> add_action( 'login_form_bpnoaccess', 'bp_core_no_access_wp_login_error' );
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Canonicalizes BuddyPress URLs
</del><ins>+ * Canonicalize BuddyPress URLs.
</ins><span class="cx"> *
</span><del>- * This function ensures that requests for BuddyPress content are always redirected to their
- * canonical versions. Canonical versions are always trailingslashed, and are typically the most
- * general possible versions of the URL - eg, example.com/groups/mygroup/ instead of
- * example.com/groups/mygroup/home/
</del><ins>+ * This function ensures that requests for BuddyPress content are always
+ * redirected to their canonical versions. Canonical versions are always
+ * trailingslashed, and are typically the most general possible versions of the
+ * URL - eg, example.com/groups/mygroup/ instead of
+ * example.com/groups/mygroup/home/.
</ins><span class="cx"> *
</span><del>- * @since BuddyPress (1.6)
- * @see BP_Members_Component::setup_globals() where $bp->canonical_stack['base_url'] and
- * ['component'] may be set
- * @see bp_core_new_nav_item() where $bp->canonical_stack['action'] may be set
</del><ins>+ * @since BuddyPress (1.6.0)
+ *
+ * @see BP_Members_Component::setup_globals() where
+ * $bp->canonical_stack['base_url'] and ['component'] may be set.
+ * @see bp_core_new_nav_item() where $bp->canonical_stack['action'] may be set.
</ins><span class="cx"> * @uses bp_get_canonical_url()
</span><span class="cx"> * @uses bp_get_requested_url()
</span><span class="cx"> */
</span><span class="lines">@@ -588,9 +600,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Output rel=canonical header tag for BuddyPress content
</del><ins>+ * Output rel=canonical header tag for BuddyPress content.
</ins><span class="cx"> *
</span><del>- * @since BuddyPress (1.6)
</del><ins>+ * @since BuddyPress (1.6.0)
</ins><span class="cx"> */
</span><span class="cx"> function bp_rel_canonical() {
</span><span class="cx"> $canonical_url = bp_get_canonical_url();
</span><span class="lines">@@ -600,12 +612,18 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Returns the canonical URL of the current page
</del><ins>+ * Get the canonical URL of the current page.
</ins><span class="cx"> *
</span><del>- * @since BuddyPress (1.6)
- * @uses apply_filters() Filter bp_get_canonical_url to modify return value
- * @param array $args
- * @return string
</del><ins>+ * @since BuddyPress (1.6.0)
+ *
+ * @uses apply_filters() Filter bp_get_canonical_url to modify return value.
+ *
+ * @param array $args {
+ * Optional array of arguments.
+ * @type bool $include_query_args Whether to include current URL arguments
+ * in the canonical URL returned from the function.
+ * }
+ * @return string Canonical URL for the current page.
</ins><span class="cx"> */
</span><span class="cx"> function bp_get_canonical_url( $args = array() ) {
</span><span class="cx"> global $bp;
</span><span class="lines">@@ -683,10 +701,11 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Returns the URL as requested on the current page load by the user agent
</del><ins>+ * Return the URL as requested on the current page load by the user agent.
</ins><span class="cx"> *
</span><del>- * @since BuddyPress (1.6)
- * @return string
</del><ins>+ * @since BuddyPress (1.6.0)
+ *
+ * @return string Requested URL string.
</ins><span class="cx"> */
</span><span class="cx"> function bp_get_requested_url() {
</span><span class="cx"> global $bp;
</span><span class="lines">@@ -700,14 +719,16 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Remove WordPress's really awesome canonical redirect if we are trying to load
- * BuddyPress specific content. Avoids issues with WordPress thinking that a
- * BuddyPress URL might actually be a blog post or page.
</del><ins>+ * Remove WP's canonical redirect when we are trying to load BP-specific content.
</ins><span class="cx"> *
</span><ins>+ * Avoids issues with WordPress thinking that a BuddyPress URL might actually
+ * be a blog post or page.
+ *
</ins><span class="cx"> * This function should be considered temporary, and may be removed without
</span><span class="cx"> * notice in future versions of BuddyPress.
</span><span class="cx"> *
</span><del>- * @since BuddyPress (1.6)
</del><ins>+ * @since BuddyPress (1.6.0)
+ *
</ins><span class="cx"> * @uses bp_is_blog_page()
</span><span class="cx"> */
</span><span class="cx"> function _bp_maybe_remove_redirect_canonical() {
</span><span class="lines">@@ -717,7 +738,7 @@
</span><span class="cx"> add_action( 'bp_init', '_bp_maybe_remove_redirect_canonical' );
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Rehook maybe_redirect_404() to run later than the default
</del><ins>+ * Rehook maybe_redirect_404() to run later than the default.
</ins><span class="cx"> *
</span><span class="cx"> * WordPress's maybe_redirect_404() allows admins on a multisite installation
</span><span class="cx"> * to define 'NOBLOGREDIRECT', a URL to which 404 requests will be redirected.
</span><span class="lines">@@ -752,13 +773,12 @@
</span><span class="cx"> add_action( 'template_redirect', '_bp_rehook_maybe_redirect_404', 1 );
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Remove WordPress's rel=canonical HTML tag if we are trying to load BuddyPress
- * specific content.
</del><ins>+ * Remove WP's rel=canonical HTML tag if we are trying to load BP-specific content.
</ins><span class="cx"> *
</span><span class="cx"> * This function should be considered temporary, and may be removed without
</span><span class="cx"> * notice in future versions of BuddyPress.
</span><span class="cx"> *
</span><del>- * @since BuddyPress (1.6)
</del><ins>+ * @since BuddyPress (1.6.0)
</ins><span class="cx"> */
</span><span class="cx"> function _bp_maybe_remove_rel_canonical() {
</span><span class="cx"> if ( ! bp_is_blog_page() && ! is_404() ) {
</span></span></pre>
</div>
</div>
</body>
</html>