<!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" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { 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 #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#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>
<title>[BuddyPress] [3227] branches/1.2/bp-themes/bp-default: Fixes #2607.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>3227</dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2010-08-30 21:00:44 +0000 (Mon, 30 Aug 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fixes #2607. Super props Paul Gibbs.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branches12bpthemesbpdefault_incglobaljs">branches/1.2/bp-themes/bp-default/_inc/global.js</a></li>
<li><a href="#branches12bpthemesbpdefaultfunctionsphp">branches/1.2/bp-themes/bp-default/functions.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branches12bpthemesbpdefault_incglobaljs"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-themes/bp-default/_inc/global.js (3226 => 3227)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-themes/bp-default/_inc/global.js        2010-08-29 13:13:54 UTC (rev 3226)
+++ branches/1.2/bp-themes/bp-default/_inc/global.js        2010-08-30 21:00:44 UTC (rev 3227)
</span><span class="lines">@@ -168,7 +168,7 @@
</span><span class="cx"> 
</span><span class="cx">                                 if ( 'fav' == type ) {
</span><span class="cx">                                         if ( !jq('div.item-list-tabs li#activity-favorites').length )
</span><del>-                                                jq('div.item-list-tabs ul li#activity-mentions').before( '&lt;li id=&quot;activity-favorites&quot;&gt;&lt;a href=&quot;#&quot;&gt;' + bp_terms_my_favs + ' (&lt;span&gt;0&lt;/span&gt;)&lt;/a&gt;&lt;/li&gt;');
</del><ins>+                                                jq('div.item-list-tabs ul li#activity-mentions').before( '&lt;li id=&quot;activity-favorites&quot;&gt;&lt;a href=&quot;#&quot;&gt;' + BP_DTheme.my_favs + ' (&lt;span&gt;0&lt;/span&gt;)&lt;/a&gt;&lt;/li&gt;');
</ins><span class="cx"> 
</span><span class="cx">                                         target.removeClass('fav');
</span><span class="cx">                                         target.addClass('unfav');
</span><span class="lines">@@ -460,7 +460,7 @@
</span><span class="cx"> 
</span><span class="cx">         jq('span.highlight span').click( function() {
</span><span class="cx">                 if ( !jq('div.help').length ) {
</span><del>-                        jq(this).parent().after( '&lt;div id=&quot;message&quot; class=&quot;info help&quot;&gt;&lt;p&gt;' + bp_terms_mention_explain + '&lt;/p&gt;&lt;/div&gt;' );
</del><ins>+                        jq(this).parent().after( '&lt;div id=&quot;message&quot; class=&quot;info help&quot;&gt;&lt;p&gt;' + BP_DTheme.mention_explain + '&lt;/p&gt;&lt;/div&gt;' );
</ins><span class="cx">                         jq('div.help').hide().slideDown(200);
</span><span class="cx">                 } else {
</span><span class="cx">                         jq('div.help').hide().remove();
</span><span class="lines">@@ -712,10 +712,10 @@
</span><span class="cx">                         } else {
</span><span class="cx">                                 button.fadeOut( 100, function() {
</span><span class="cx">                                         if ( jq(this).hasClass('accept') ) {
</span><del>-                                                jq(this).html( bp_terms_accepted ).fadeIn(50);
</del><ins>+                                                jq(this).html( BP_DTheme.accepted ).fadeIn(50);
</ins><span class="cx">                                                 jq(this).addClass('accepted');
</span><span class="cx">                                         } else {
</span><del>-                                                jq(this).html( bp_terms_rejected ).fadeIn(50);
</del><ins>+                                                jq(this).html( BP_DTheme.rejected ).fadeIn(50);
</ins><span class="cx">                                                 jq(this).addClass('rejected');
</span><span class="cx">                                         }
</span><span class="cx">                                 });
</span><span class="lines">@@ -1205,7 +1205,7 @@
</span><span class="cx">                                 jq(this).toggle();
</span><span class="cx"> 
</span><span class="cx">                                 if ( !i )
</span><del>-                                        jq(this).before( '&lt;li class=&quot;show-all&quot;&gt;&lt;a href=&quot;#' + parent_li.attr('id') + '/show-all/&quot; title=&quot;' + bp_terms_show_all_comments + '&quot;&gt;' + bp_terms_show_all + ' ' + comment_count + ' ' + bp_terms_comments + '&lt;/a&gt;&lt;/li&gt;' );
</del><ins>+                                        jq(this).before( '&lt;li class=&quot;show-all&quot;&gt;&lt;a href=&quot;#' + parent_li.attr('id') + '/show-all/&quot; title=&quot;' + BP_DTheme.show_all_comments + '&quot;&gt;' + BP_DTheme.show_all + ' ' + comment_count + ' ' + BP_DTheme.comments + '&lt;/a&gt;&lt;/li&gt;' );
</ins><span class="cx">                         }
</span><span class="cx">                 });
</span><span class="cx"> 
</span></span></pre></div>
<a id="branches12bpthemesbpdefaultfunctionsphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-themes/bp-default/functions.php (3226 => 3227)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-themes/bp-default/functions.php        2010-08-29 13:13:54 UTC (rev 3226)
+++ branches/1.2/bp-themes/bp-default/functions.php        2010-08-30 21:00:44 UTC (rev 3227)
</span><span class="lines">@@ -1,33 +1,60 @@
</span><span class="cx"> &lt;?php
</span><span class="cx"> 
</span><del>-/* Stop the theme from killing WordPress if BuddyPress is not enabled. */
</del><ins>+// Stop the theme from killing WordPress if BuddyPress is not enabled.
</ins><span class="cx"> if ( !class_exists( 'BP_Core_User' ) )
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-/* Register the widget columns */
</del><ins>+// Register the widget columns
</ins><span class="cx"> register_sidebars( 1,
</span><span class="cx">         array(
</span><del>-                'name' =&gt; 'Sidebar',
</del><ins>+                'name'          =&gt; 'Sidebar',
</ins><span class="cx">                 'before_widget' =&gt; '&lt;div id=&quot;%1$s&quot; class=&quot;widget %2$s&quot;&gt;',
</span><del>-                'after_widget' =&gt; '&lt;/div&gt;',
-                'before_title' =&gt; '&lt;h3 class=&quot;widgettitle&quot;&gt;',
-                'after_title' =&gt; '&lt;/h3&gt;'
</del><ins>+                'after_widget'  =&gt; '&lt;/div&gt;',
+                'before_title'  =&gt; '&lt;h3 class=&quot;widgettitle&quot;&gt;',
+                'after_title'   =&gt; '&lt;/h3&gt;'
</ins><span class="cx">         )
</span><span class="cx"> );
</span><span class="cx"> 
</span><del>-/* Load the AJAX functions for the theme */
</del><ins>+// Load the AJAX functions for the theme
</ins><span class="cx"> require_once( TEMPLATEPATH . '/_inc/ajax.php' );
</span><span class="cx"> 
</span><del>-/* Load the javascript for the theme */
</del><ins>+// Load the javascript for the theme
</ins><span class="cx"> wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ) );
</span><span class="cx"> 
</span><del>-/* Add the JS needed for blog comment replies */
</del><ins>+// Add words that we need to use in JS to the end of the page so they can be translated and still used.
+$params = array(
+        'my_favs'           =&gt; __( 'My Favorites', 'buddypress' ),
+        'accepted'          =&gt; __( 'Accepted', 'buddypress' ),
+        'rejected'          =&gt; __( 'Rejected', 'buddypress' ),
+        'show_all_comments' =&gt; __( 'Show all comments for this thread', 'buddypress' ),
+        'show_all'          =&gt; __( 'Show all', 'buddypress' ),
+        'comments'          =&gt; __( 'comments', 'buddypress' ),
+        'close'             =&gt; __( 'Close', 'buddypress' ),
+        'mention_explain'   =&gt; sprintf( __( &quot;%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.&quot;, 'buddypress' ), '@' . bp_get_displayed_user_username(), bp_get_user_firstname( bp_get_displayed_user_fullname() ), bp_get_user_firstname( bp_get_displayed_user_fullname() ) )
+);
+wp_localize_script( 'dtheme-ajax-js', 'BP_DTheme', $params );
+
+/**
+ * Add the JS needed for blog comment replies
+ *
+ * @package BuddyPress Theme
+ * @since 1.2
+ */
</ins><span class="cx"> function bp_dtheme_add_blog_comments_js() {
</span><span class="cx">         if ( is_singular() ) wp_enqueue_script( 'comment-reply' );
</span><span class="cx"> }
</span><span class="cx"> add_action( 'template_redirect', 'bp_dtheme_add_blog_comments_js' );
</span><span class="cx"> 
</span><del>-/* HTML for outputting blog comments as defined by the WP comment API */
</del><ins>+/**
+ * HTML for outputting blog comments as defined by the WP comment API
+ *
+ * @param mixed $comment Comment record from database
+ * @param array $args Arguments from wp_list_comments() call
+ * @param int $depth Comment nesting level
+ * @see wp_list_comments()
+ * @package BuddyPress Theme
+ * @since 1.2
+ */
</ins><span class="cx"> function bp_dtheme_blog_comments( $comment, $args, $depth ) {
</span><span class="cx">         $GLOBALS['comment'] = $comment; ?&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -68,7 +95,15 @@
</span><span class="cx"> &lt;?php
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-/* Filter the dropdown for selecting the page to show on front to include &quot;Activity Stream&quot; */
</del><ins>+/**
+ * Filter the dropdown for selecting the page to show on front to include &quot;Activity Stream&quot;
+ *
+ * @param string $page_html A list of pages as a dropdown (select list)
+ * @see wp_dropdown_pages()
+ * @return string
+ * @package BuddyPress Theme
+ * @since 1.2
+ */
</ins><span class="cx"> function bp_dtheme_wp_pages_filter( $page_html ) {
</span><span class="cx">         if ( !bp_is_active( 'activity' ) )
</span><span class="cx">                 return $page_html;
</span><span class="lines">@@ -87,7 +122,15 @@
</span><span class="cx"> }
</span><span class="cx"> add_filter( 'wp_dropdown_pages', 'bp_dtheme_wp_pages_filter' );
</span><span class="cx"> 
</span><del>-/* Hijack the saving of page on front setting to save the activity stream setting */
</del><ins>+/**
+ * Hijack the saving of page on front setting to save the activity stream setting
+ *
+ * @param $string $oldvalue Previous value of get_option( 'page_on_front' )
+ * @param $string $oldvalue New value of get_option( 'page_on_front' )
+ * @return string
+ * @package BuddyPress Theme
+ * @since 1.2
+ */
</ins><span class="cx"> function bp_dtheme_page_on_front_update( $oldvalue, $newvalue ) {
</span><span class="cx">         if ( !is_admin() || !is_super_admin() )
</span><span class="cx">                 return false;
</span><span class="lines">@@ -99,7 +142,15 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'pre_update_option_page_on_front', 'bp_dtheme_page_on_front_update', 10, 2 );
</span><span class="cx"> 
</span><del>-/* Load the activity stream template if settings allow */
</del><ins>+/**
+ * Load the activity stream template if settings allow
+ *
+ * @param string $template Absolute path to the page template 
+ * @return string
+ * @global WP_Query $wp_query WordPress query object
+ * @package BuddyPress Theme
+ * @since 1.2
+ */
</ins><span class="cx"> function bp_dtheme_page_on_front_template( $template ) {
</span><span class="cx">         global $wp_query;
</span><span class="cx"> 
</span><span class="lines">@@ -110,7 +161,13 @@
</span><span class="cx"> }
</span><span class="cx"> add_filter( 'page_template', 'bp_dtheme_page_on_front_template' );
</span><span class="cx"> 
</span><del>-/* Return the ID of a page set as the home page. */
</del><ins>+/**
+ * Return the ID of a page set as the home page.
+ *
+ * @return false|int ID of page set as the home page
+ * @package BuddyPress Theme
+ * @since 1.2
+ */
</ins><span class="cx"> function bp_dtheme_page_on_front() {
</span><span class="cx">         if ( 'page' != get_option( 'show_on_front' ) )
</span><span class="cx">                 return false;
</span><span class="lines">@@ -118,7 +175,13 @@
</span><span class="cx">         return apply_filters( 'bp_dtheme_page_on_front', get_option( 'page_on_front' ) );
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-/* Force the page ID as a string to stop the get_posts query from kicking up a fuss. */
</del><ins>+/**
+ * Force the page ID as a string to stop the get_posts query from kicking up a fuss.
+ *
+ * @global WP_Query $wp_query WordPress query object
+ * @package BuddyPress Theme
+ * @since 1.2
+ */
</ins><span class="cx"> function bp_dtheme_fix_get_posts_on_activity_front() {
</span><span class="cx">         global $wp_query;
</span><span class="cx"> 
</span><span class="lines">@@ -127,7 +190,15 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'pre_get_posts', 'bp_dtheme_fix_get_posts_on_activity_front' );
</span><span class="cx"> 
</span><del>-/* WP 3.0 requires there to be a non-null post in the posts array */
</del><ins>+/**
+ * WP 3.0 requires there to be a non-null post in the posts array
+ *
+ * @param array $posts Posts as retrieved by WP_Query
+ * @global WP_Query $wp_query WordPress query object
+ * @return array
+ * @package BuddyPress Theme
+ * @since 1.2.5
+ */
</ins><span class="cx"> function bp_dtheme_fix_the_posts_on_activity_front( $posts ) {
</span><span class="cx">         global $wp_query;
</span><span class="cx"> 
</span><span class="lines">@@ -139,8 +210,16 @@
</span><span class="cx"> }
</span><span class="cx"> add_filter( 'the_posts', 'bp_dtheme_fix_the_posts_on_activity_front' );
</span><span class="cx"> 
</span><ins>+/**
+ * Add secondary avatar image to this activity stream's record, if supported
+ *
+ * @param string $action The text of this activity
+ * @param BP_Activity_Activity $activity Activity object
+ * @return string
+ * @package BuddyPress Theme
+ * @since 1.2.6
+ */
</ins><span class="cx"> function bp_dtheme_activity_secondary_avatars( $action, $activity ) {
</span><del>-
</del><span class="cx">         switch ( $activity-&gt;component ) {
</span><span class="cx">                 case 'groups' :
</span><span class="cx">                 case 'blogs' :
</span><span class="lines">@@ -158,12 +237,15 @@
</span><span class="cx"> }
</span><span class="cx"> add_filter( 'bp_get_activity_action_pre_meta', 'bp_dtheme_activity_secondary_avatars', 10, 2 );
</span><span class="cx"> 
</span><del>-/****
</del><ins>+/**
</ins><span class="cx">  * Custom header image support. You can remove this entirely in a child theme by adding this line
</span><span class="cx">  * to your functions.php: define( 'BP_DTHEME_DISABLE_CUSTOM_HEADER', true );
</span><ins>+ *
+ * @package BuddyPress Theme
+ * @since 1.2
</ins><span class="cx">  */
</span><span class="cx"> function bp_dtheme_add_custom_header_support() {
</span><del>-        /* Set the defaults for the custom header image (http://ryan.boren.me/2007/01/07/custom-image-header-api/) */
</del><ins>+        // Set the defaults for the custom header image (http://ryan.boren.me/2007/01/07/custom-image-header-api/)
</ins><span class="cx">         define( 'HEADER_TEXTCOLOR', 'FFFFFF' );
</span><span class="cx">         define( 'HEADER_IMAGE', '%s/_inc/images/default_header.jpg' ); // %s is theme dir uri
</span><span class="cx">         define( 'HEADER_IMAGE_WIDTH', 1250 );
</span><span class="lines">@@ -235,7 +317,12 @@
</span><span class="cx"> if ( !defined( 'BP_DTHEME_DISABLE_CUSTOM_HEADER' ) )
</span><span class="cx">         add_action( 'init', 'bp_dtheme_add_custom_header_support' );
</span><span class="cx"> 
</span><del>-/* Show a notice when the theme is activated - workaround by Ozh (http://old.nabble.com/Activation-hook-exist-for-themes--td25211004.html) */
</del><ins>+/**
+ * Show a notice when the theme is activated - workaround by Ozh (http://old.nabble.com/Activation-hook-exist-for-themes--td25211004.html)
+ *
+ * @package BuddyPress Theme
+ * @since 1.2
+ */
</ins><span class="cx"> function bp_dtheme_show_notice() { ?&gt;
</span><span class="cx">         &lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;
</span><span class="cx">                 &lt;p&gt;&lt;?php printf( __( 'Theme activated! This theme contains &lt;a href=&quot;%s&quot;&gt;custom header image&lt;/a&gt; support and &lt;a href=&quot;%s&quot;&gt;sidebar widgets&lt;/a&gt;.', 'buddypress' ), admin_url( 'themes.php?page=custom-header' ), admin_url( 'widgets.php' ) ) ?&gt;&lt;/p&gt;
</span><span class="lines">@@ -246,21 +333,4 @@
</span><span class="cx"> }
</span><span class="cx"> if ( is_admin() &amp;&amp; isset($_GET['activated'] ) &amp;&amp; $pagenow == &quot;themes.php&quot; )
</span><span class="cx">         add_action( 'admin_notices', 'bp_dtheme_show_notice' );
</span><del>-
-/* Add words that we need to use in JS to the end of the page so they can be translated and still used. */
-function bp_dtheme_js_terms() { ?&gt;
-&lt;script type=&quot;text/javascript&quot;&gt;
-        var bp_terms_my_favs = '&lt;?php _e( &quot;My Favorites&quot;, &quot;buddypress&quot; ) ?&gt;';
-        var bp_terms_accepted = '&lt;?php _e( &quot;Accepted&quot;, &quot;buddypress&quot; ) ?&gt;';
-        var bp_terms_rejected = '&lt;?php _e( &quot;Rejected&quot;, &quot;buddypress&quot; ) ?&gt;';
-        var bp_terms_show_all_comments = '&lt;?php _e( &quot;Show all comments for this thread&quot;, &quot;buddypress&quot; ) ?&gt;';
-        var bp_terms_show_all = '&lt;?php _e( &quot;Show all&quot;, &quot;buddypress&quot; ) ?&gt;';
-        var bp_terms_comments = '&lt;?php _e( &quot;comments&quot;, &quot;buddypress&quot; ) ?&gt;';
-        var bp_terms_close = '&lt;?php _e( &quot;Close&quot;, &quot;buddypress&quot; ) ?&gt;';
-        var bp_terms_mention_explain = '&lt;?php printf( __( &quot;%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.&quot;, &quot;buddypress&quot; ), '@' . bp_get_displayed_user_username(), bp_get_user_firstname(bp_get_displayed_user_fullname()), bp_get_user_firstname(bp_get_displayed_user_fullname()) ); ?&gt;';
-        &lt;/script&gt;
-&lt;?php
-}
-add_action( 'wp_footer', 'bp_dtheme_js_terms' );
-
</del><span class="cx"> ?&gt;
</span><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>

</body>
</html>