Skip to:
Content

BuddyPress.org

Ticket #2607: patch-2607.patch

File patch-2607.patch, 9.0 KB (added by DJPaul, 15 years ago)

v1

  • bp-themes/bp-default/functions.php

     
    11<?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.
    43if ( !class_exists( 'BP_Core_User' ) )
    54        return false;
    65
    7 /* Register the widget columns */
     6// Register the widget columns
    87register_sidebars( 1,
    98        array(
    109                'name' => 'Sidebar',
     
    1514        )
    1615);
    1716
    18 /* Load the AJAX functions for the theme */
     17// Load the AJAX functions for the theme
    1918require_once( TEMPLATEPATH . '/_inc/ajax.php' );
    2019
    21 /* Load the javascript for the theme */
     20// Load the javascript for the theme
    2221wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ) );
    2322
    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);
     34wp_localize_script( 'dtheme-ajax-js', 'BP_DTheme', $params );
     35
     36// Add the JS needed for blog comment replies
    2537function bp_dtheme_add_blog_comments_js() {
    2638        if ( is_singular() ) wp_enqueue_script( 'comment-reply' );
    2739}
    2840add_action( 'template_redirect', 'bp_dtheme_add_blog_comments_js' );
    2941
    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
    3143function bp_dtheme_blog_comments( $comment, $args, $depth ) {
    3244        $GLOBALS['comment'] = $comment; ?>
    3345
     
    6880<?php
    6981}
    7082
    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"
    7284function bp_dtheme_wp_pages_filter( $page_html ) {
    7385        if ( !bp_is_active( 'activity' ) )
    7486                return $page_html;
     
    8799}
    88100add_filter( 'wp_dropdown_pages', 'bp_dtheme_wp_pages_filter' );
    89101
    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
    91103function bp_dtheme_page_on_front_update( $oldvalue, $newvalue ) {
    92104        if ( !is_admin() || !is_super_admin() )
    93105                return false;
     
    99111}
    100112add_action( 'pre_update_option_page_on_front', 'bp_dtheme_page_on_front_update', 10, 2 );
    101113
    102 /* Load the activity stream template if settings allow */
     114// Load the activity stream template if settings allow
    103115function bp_dtheme_page_on_front_template( $template ) {
    104116        global $wp_query;
    105117
     
    110122}
    111123add_filter( 'page_template', 'bp_dtheme_page_on_front_template' );
    112124
    113 /* Return the ID of a page set as the home page. */
     125// Return the ID of a page set as the home page.
    114126function bp_dtheme_page_on_front() {
    115127        if ( 'page' != get_option( 'show_on_front' ) )
    116128                return false;
     
    118130        return apply_filters( 'bp_dtheme_page_on_front', get_option( 'page_on_front' ) );
    119131}
    120132
    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.
    122134function bp_dtheme_fix_get_posts_on_activity_front() {
    123135        global $wp_query;
    124136
     
    127139}
    128140add_action( 'pre_get_posts', 'bp_dtheme_fix_get_posts_on_activity_front' );
    129141
    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
    131143function bp_dtheme_fix_the_posts_on_activity_front( $posts ) {
    132144        global $wp_query;
    133145
     
    163175 * to your functions.php: define( 'BP_DTHEME_DISABLE_CUSTOM_HEADER', true );
    164176 */
    165177function 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/)
    167179        define( 'HEADER_TEXTCOLOR', 'FFFFFF' );
    168180        define( 'HEADER_IMAGE', '%s/_inc/images/default_header.jpg' ); // %s is theme dir uri
    169181        define( 'HEADER_IMAGE_WIDTH', 1250 );
     
    235247if ( !defined( 'BP_DTHEME_DISABLE_CUSTOM_HEADER' ) )
    236248        add_action( 'init', 'bp_dtheme_add_custom_header_support' );
    237249
    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)
    239251function bp_dtheme_show_notice() { ?>
    240252        <div id="message" class="updated fade">
    241253                <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>
     
    246258}
    247259if ( is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" )
    248260        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 <?php
    263 }
    264 add_action( 'wp_footer', 'bp_dtheme_js_terms' );
    265 
    266261?>
    267  No newline at end of file
  • bp-themes/bp-default/_inc/global.js

     
    168168
    169169                                if ( 'fav' == type ) {
    170170                                        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>');
    172172
    173173                                        target.removeClass('fav');
    174174                                        target.addClass('unfav');
     
    460460
    461461        jq('span.highlight span').click( function() {
    462462                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>' );
    464464                        jq('div.help').hide().slideDown(200);
    465465                } else {
    466466                        jq('div.help').hide().remove();
     
    712712                        } else {
    713713                                button.fadeOut( 100, function() {
    714714                                        if ( jq(this).hasClass('accept') ) {
    715                                                 jq(this).html( bp_terms_accepted ).fadeIn(50);
     715                                                jq(this).html( BP_DTheme.accepted ).fadeIn(50);
    716716                                                jq(this).addClass('accepted');
    717717                                        } else {
    718                                                 jq(this).html( bp_terms_rejected ).fadeIn(50);
     718                                                jq(this).html( BP_DTheme.rejected ).fadeIn(50);
    719719                                                jq(this).addClass('rejected');
    720720                                        }
    721721                                });
     
    12051205                                jq(this).toggle();
    12061206
    12071207                                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>' );
    12091209                        }
    12101210                });
    12111211