Ticket #2607: patch-2607.patch
File patch-2607.patch, 9.0 KB (added by , 15 years ago) |
---|
-
bp-themes/bp-default/functions.php
1 1 <?php 2 3 /* Stop the theme from killing WordPress if BuddyPress is not enabled. */ 2 // Stop the theme from killing WordPress if BuddyPress is not enabled. 4 3 if ( !class_exists( 'BP_Core_User' ) ) 5 4 return false; 6 5 7 / * Register the widget columns */6 // Register the widget columns 8 7 register_sidebars( 1, 9 8 array( 10 9 'name' => 'Sidebar', … … 15 14 ) 16 15 ); 17 16 18 / * Load the AJAX functions for the theme */17 // Load the AJAX functions for the theme 19 18 require_once( TEMPLATEPATH . '/_inc/ajax.php' ); 20 19 21 / * Load the javascript for the theme */20 // Load the javascript for the theme 22 21 wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ) ); 23 22 24 /* Add the JS needed for blog comment replies */ 23 // Add words that we need to use in JS to the end of the page so they can be translated and still used. 24 $params = array( 25 'my_favs' => __( "My Favorites", "buddypress" ), 26 'accepted' => __( "Accepted", "buddypress" ), 27 'rejected' => __( "Rejected", "buddypress" ), 28 'show_all_comments' => __( "Show all comments for this thread", "buddypress" ), 29 'show_all' => __( "Show all", "buddypress" ), 30 'comments' => __( "comments", "buddypress" ), 31 'close' => __( "Close", "buddypress" ), 32 'mention_explain' => sprintf( __( "%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.", "buddypress" ), '@' . bp_get_displayed_user_username(), bp_get_user_firstname( bp_get_displayed_user_fullname() ), bp_get_user_firstname( bp_get_displayed_user_fullname() ) ) 33 ); 34 wp_localize_script( 'dtheme-ajax-js', 'BP_DTheme', $params ); 35 36 // Add the JS needed for blog comment replies 25 37 function bp_dtheme_add_blog_comments_js() { 26 38 if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); 27 39 } 28 40 add_action( 'template_redirect', 'bp_dtheme_add_blog_comments_js' ); 29 41 30 / * HTML for outputting blog comments as defined by the WP comment API */42 // HTML for outputting blog comments as defined by the WP comment API 31 43 function bp_dtheme_blog_comments( $comment, $args, $depth ) { 32 44 $GLOBALS['comment'] = $comment; ?> 33 45 … … 68 80 <?php 69 81 } 70 82 71 / * Filter the dropdown for selecting the page to show on front to include "Activity Stream" */83 // Filter the dropdown for selecting the page to show on front to include "Activity Stream" 72 84 function bp_dtheme_wp_pages_filter( $page_html ) { 73 85 if ( !bp_is_active( 'activity' ) ) 74 86 return $page_html; … … 87 99 } 88 100 add_filter( 'wp_dropdown_pages', 'bp_dtheme_wp_pages_filter' ); 89 101 90 / * Hijack the saving of page on front setting to save the activity stream setting */102 // Hijack the saving of page on front setting to save the activity stream setting 91 103 function bp_dtheme_page_on_front_update( $oldvalue, $newvalue ) { 92 104 if ( !is_admin() || !is_super_admin() ) 93 105 return false; … … 99 111 } 100 112 add_action( 'pre_update_option_page_on_front', 'bp_dtheme_page_on_front_update', 10, 2 ); 101 113 102 / * Load the activity stream template if settings allow */114 // Load the activity stream template if settings allow 103 115 function bp_dtheme_page_on_front_template( $template ) { 104 116 global $wp_query; 105 117 … … 110 122 } 111 123 add_filter( 'page_template', 'bp_dtheme_page_on_front_template' ); 112 124 113 / * Return the ID of a page set as the home page. */125 // Return the ID of a page set as the home page. 114 126 function bp_dtheme_page_on_front() { 115 127 if ( 'page' != get_option( 'show_on_front' ) ) 116 128 return false; … … 118 130 return apply_filters( 'bp_dtheme_page_on_front', get_option( 'page_on_front' ) ); 119 131 } 120 132 121 / * Force the page ID as a string to stop the get_posts query from kicking up a fuss. */133 // Force the page ID as a string to stop the get_posts query from kicking up a fuss. 122 134 function bp_dtheme_fix_get_posts_on_activity_front() { 123 135 global $wp_query; 124 136 … … 127 139 } 128 140 add_action( 'pre_get_posts', 'bp_dtheme_fix_get_posts_on_activity_front' ); 129 141 130 / * WP 3.0 requires there to be a non-null post in the posts array */142 // WP 3.0 requires there to be a non-null post in the posts array 131 143 function bp_dtheme_fix_the_posts_on_activity_front( $posts ) { 132 144 global $wp_query; 133 145 … … 163 175 * to your functions.php: define( 'BP_DTHEME_DISABLE_CUSTOM_HEADER', true ); 164 176 */ 165 177 function bp_dtheme_add_custom_header_support() { 166 / * Set the defaults for the custom header image (http://ryan.boren.me/2007/01/07/custom-image-header-api/) */178 // Set the defaults for the custom header image (http://ryan.boren.me/2007/01/07/custom-image-header-api/) 167 179 define( 'HEADER_TEXTCOLOR', 'FFFFFF' ); 168 180 define( 'HEADER_IMAGE', '%s/_inc/images/default_header.jpg' ); // %s is theme dir uri 169 181 define( 'HEADER_IMAGE_WIDTH', 1250 ); … … 235 247 if ( !defined( 'BP_DTHEME_DISABLE_CUSTOM_HEADER' ) ) 236 248 add_action( 'init', 'bp_dtheme_add_custom_header_support' ); 237 249 238 / * Show a notice when the theme is activated - workaround by Ozh (http://old.nabble.com/Activation-hook-exist-for-themes--td25211004.html) */250 // Show a notice when the theme is activated - workaround by Ozh (http://old.nabble.com/Activation-hook-exist-for-themes--td25211004.html) 239 251 function bp_dtheme_show_notice() { ?> 240 252 <div id="message" class="updated fade"> 241 253 <p><?php printf( __( 'Theme activated! This theme contains <a href="%s">custom header image</a> support and <a href="%s">sidebar widgets</a>.', 'buddypress' ), admin_url( 'themes.php?page=custom-header' ), admin_url( 'widgets.php' ) ) ?></p> … … 246 258 } 247 259 if ( is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) 248 260 add_action( 'admin_notices', 'bp_dtheme_show_notice' ); 249 250 /* Add words that we need to use in JS to the end of the page so they can be translated and still used. */251 function bp_dtheme_js_terms() { ?>252 <script type="text/javascript">253 var bp_terms_my_favs = '<?php _e( "My Favorites", "buddypress" ) ?>';254 var bp_terms_accepted = '<?php _e( "Accepted", "buddypress" ) ?>';255 var bp_terms_rejected = '<?php _e( "Rejected", "buddypress" ) ?>';256 var bp_terms_show_all_comments = '<?php _e( "Show all comments for this thread", "buddypress" ) ?>';257 var bp_terms_show_all = '<?php _e( "Show all", "buddypress" ) ?>';258 var bp_terms_comments = '<?php _e( "comments", "buddypress" ) ?>';259 var bp_terms_close = '<?php _e( "Close", "buddypress" ) ?>';260 var bp_terms_mention_explain = '<?php printf( __( "%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.", "buddypress" ), '@' . bp_get_displayed_user_username(), bp_get_user_firstname(bp_get_displayed_user_fullname()), bp_get_user_firstname(bp_get_displayed_user_fullname()) ); ?>';261 </script>262 <?php263 }264 add_action( 'wp_footer', 'bp_dtheme_js_terms' );265 266 261 ?> 267 No newline at end of file -
bp-themes/bp-default/_inc/global.js
168 168 169 169 if ( 'fav' == type ) { 170 170 if ( !jq('div.item-list-tabs li#activity-favorites').length ) 171 jq('div.item-list-tabs ul li#activity-mentions').before( '<li id="activity-favorites"><a href="#">' + bp_terms_my_favs + ' (<span>0</span>)</a></li>');171 jq('div.item-list-tabs ul li#activity-mentions').before( '<li id="activity-favorites"><a href="#">' + BP_DTheme.my_favs + ' (<span>0</span>)</a></li>'); 172 172 173 173 target.removeClass('fav'); 174 174 target.addClass('unfav'); … … 460 460 461 461 jq('span.highlight span').click( function() { 462 462 if ( !jq('div.help').length ) { 463 jq(this).parent().after( '<div id="message" class="info help"><p>' + bp_terms_mention_explain + '</p></div>' );463 jq(this).parent().after( '<div id="message" class="info help"><p>' + BP_DTheme.mention_explain + '</p></div>' ); 464 464 jq('div.help').hide().slideDown(200); 465 465 } else { 466 466 jq('div.help').hide().remove(); … … 712 712 } else { 713 713 button.fadeOut( 100, function() { 714 714 if ( jq(this).hasClass('accept') ) { 715 jq(this).html( bp_terms_accepted ).fadeIn(50);715 jq(this).html( BP_DTheme.accepted ).fadeIn(50); 716 716 jq(this).addClass('accepted'); 717 717 } else { 718 jq(this).html( bp_terms_rejected ).fadeIn(50);718 jq(this).html( BP_DTheme.rejected ).fadeIn(50); 719 719 jq(this).addClass('rejected'); 720 720 } 721 721 }); … … 1205 1205 jq(this).toggle(); 1206 1206 1207 1207 if ( !i ) 1208 jq(this).before( '<li class="show-all"><a href="#' + parent_li.attr('id') + '/show-all/" title="' + bp_terms_show_all_comments + '">' + bp_terms_show_all + ' ' + comment_count + ' ' + bp_terms_comments + '</a></li>' );1208 jq(this).before( '<li class="show-all"><a href="#' + parent_li.attr('id') + '/show-all/" title="' + BP_DTheme.show_all_comments + '">' + BP_DTheme.show_all + ' ' + comment_count + ' ' + BP_DTheme.comments + '</a></li>' ); 1209 1209 } 1210 1210 }); 1211 1211