Skip to:
Content

BuddyPress.org

Changeset 3937


Ignore:
Timestamp:
01/26/2011 08:43:59 PM (14 years ago)
Author:
johnjamesjacoby
Message:

Clean up bp-blogs-template whitespace and code formatting. Add checks to BP_Component::_setup_nav and set params to optional.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-blogs/bp-blogs-functions.php

    r3917 r3937  
    308308
    309309    // Delete activity stream item
    310     bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component' => $bp->blogs->slug, 'type' => 'new_blog' ) );
     310    bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component' => $bp->blogs->id, 'type' => 'new_blog' ) );
    311311
    312312    do_action( 'bp_blogs_remove_blog', $blog_id );
     
    323323
    324324    // Delete activity stream item
    325     bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component' => $bp->blogs->slug, 'type' => 'new_blog' ) );
     325    bp_blogs_delete_activity( array( 'item_id' => $blog_id, 'component' => $bp->blogs->id, 'type' => 'new_blog' ) );
    326326
    327327    do_action( 'bp_blogs_remove_blog_for_user', $blog_id, $user_id );
  • trunk/bp-blogs/bp-blogs-template.php

    r3778 r3937  
    9797
    9898        $this->in_the_loop = true;
    99         $this->blog = $this->next_blog();
     99        $this->blog        = $this->next_blog();
    100100
    101101        if ( 0 == $this->current_blog ) // loop has just started
     
    118118     * pass their parameters directly to the loop.
    119119     */
    120     $type = 'active';
    121     $user_id = 0;
     120    $type         = 'active';
     121    $user_id      = 0;
    122122    $search_terms = null;
    123123
     
    127127
    128128    $defaults = array(
    129         'type' => $type,
    130         'page' => 1,
    131         'per_page' => 20,
    132         'max' => false,
    133 
    134         'user_id' => $user_id, // Pass a user_id to limit to only blogs this user has higher than subscriber access to
     129        'type'         => $type,
     130        'page'         => 1,
     131        'per_page'     => 20,
     132        'max'          => false,
     133
     134        'user_id'      => $user_id, // Pass a user_id to limit to only blogs this user has higher than subscriber access to
    135135        'search_terms' => $search_terms // Pass search terms to filter on the blog title or description.
    136136    );
     
    171171
    172172    $start_num = intval( ( $blogs_template->pag_page - 1 ) * $blogs_template->pag_num ) + 1;
    173     $from_num = bp_core_number_format( $start_num );
    174     $to_num = bp_core_number_format( ( $start_num + ( $blogs_template->pag_num - 1 ) > $blogs_template->total_blog_count ) ? $blogs_template->total_blog_count : $start_num + ( $blogs_template->pag_num - 1 ) );
    175     $total = bp_core_number_format( $blogs_template->total_blog_count );
     173    $from_num  = bp_core_number_format( $start_num );
     174    $to_num    = bp_core_number_format( ( $start_num + ( $blogs_template->pag_num - 1 ) > $blogs_template->total_blog_count ) ? $blogs_template->total_blog_count : $start_num + ( $blogs_template->pag_num - 1 ) );
     175    $total     = bp_core_number_format( $blogs_template->total_blog_count );
    176176
    177177    echo sprintf( __( 'Viewing blog %1$s to %2$s (of %3$s blogs)', 'buddypress' ), $from_num, $to_num, $total ); ?>  
     
    195195
    196196        $defaults = array(
    197             'type' => 'full',
    198             'width' => false,
    199             'height' => false,
    200             'class' => 'avatar',
    201             'id' => false,
    202             'alt' => __( 'Blog authored by %s', 'buddypress' ),
     197            'type'    => 'full',
     198            'width'   => false,
     199            'height'  => false,
     200            'class'   => 'avatar',
     201            'id'      => false,
     202            'alt'     => __( 'Blog authored by %s', 'buddypress' ),
    203203            'no_grav' => true
    204204        );
     
    274274
    275275function bp_blog_hidden_fields() {
    276     if ( isset( $_REQUEST['s'] ) ) {
     276    if ( isset( $_REQUEST['s'] ) )
    277277        echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['s'] ). '" name="search_terms" />';
    278     }
    279 
    280     if ( isset( $_REQUEST['letter'] ) ) {
     278
     279    if ( isset( $_REQUEST['letter'] ) )
    281280        echo '<input type="hidden" id="selected_letter" value="' . esc_attr( $_REQUEST['letter'] ) . '" name="selected_letter" />';
    282     }
    283 
    284     if ( isset( $_REQUEST['blogs_search'] ) ) {
     281
     282    if ( isset( $_REQUEST['blogs_search'] ) )
    285283        echo '<input type="hidden" id="search_terms" value="' . esc_attr( $_REQUEST['blogs_search'] ) . '" name="search_terms" />';
    286     }
    287284}
    288285
     
    373370
    374371    if ( $errmsg = $errors->get_error_message('blogname') ) { ?>
     372
    375373        <p class="error"><?php echo $errmsg ?></p>
     374
    376375    <?php }
    377376
     
    395394    // Blog Title
    396395    ?>
     396
    397397    <label for="blog_title"><?php _e('Blog Title:', 'buddypress') ?></label>
     398
    398399    <?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?>
     400
    399401        <p class="error"><?php echo $errmsg ?></p>
     402
    400403    <?php }
    401404    echo '<input name="blog_title" type="text" id="blog_title" value="'.esc_html($blog_title, 1).'" /></p>';
     
    464467function bp_blogs_confirm_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = '' ) {
    465468    $protocol = is_ssl() ? 'https://' : 'http://';
    466     $blog_url = $protocol . $domain . $path;
    467     ?>
    468     <p><?php _e('Congratulations! You have successfully registered a new blog.', 'buddypress') ?></p>
     469    $blog_url = $protocol . $domain . $path; ?>
     470
     471    <p><?php _e( 'Congratulations! You have successfully registered a new blog.', 'buddypress' ) ?></p>
    469472    <p>
    470         <?php printf(__('<a href="%1$s">%2$s</a> is your new blog.  <a href="%3$s">Login</a> as "%4$s" using your existing password.', 'buddypress'), $blog_url, $blog_url, $blog_url . "wp-login.php", $user_name) ?>
     473        <?php printf(__( '<a href="%1$s">%2$s</a> is your new blog.  <a href="%3$s">Login</a> as "%4$s" using your existing password.', 'buddypress' ), $blog_url, $blog_url, $blog_url . "wp-login.php", $user_name ); ?>
    471474    </p>
    472     <?php
     475
     476<?php
    473477    do_action('signup_finished');
    474478}
     
    477481    global $bp;
    478482
    479     if ( bp_is_my_profile() )   {
    480         echo apply_filters( 'bp_create_blog_link', '<a href="' . $bp->root_domain . '/' . $bp->blogs->slug . '/create">' . __('Create a Blog', 'buddypress') . '</a>' );
    481     }
     483    if ( bp_is_my_profile() )
     484        echo apply_filters( 'bp_create_blog_link', '<a href="' . $bp->root_domain . '/' . $bp->blogs->root_slug . '/create/">' . __( 'Create a Blog', 'buddypress' ) . '</a>' );
    482485}
    483486
     
    489492        return false;
    490493
    491     $current_tab = $bp->current_action
    492 ?>
     494    $current_tab = $bp->current_action; ?>
     495
    493496    <ul class="content-header-nav">
    494         <li<?php if ( 'my-blogs' == $current_tab || empty( $current_tab ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->blogs->slug ?>/my-blogs"><?php printf( __( "%s's Blogs", 'buddypress' ), $bp->displayed_user->fullname ) ?></a></li>
    495         <li<?php if ( 'recent-posts' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->blogs->slug ?>/recent-posts"><?php printf( __( "%s's Recent Posts", 'buddypress' ), $bp->displayed_user->fullname ) ?></a></li>
    496         <li<?php if ( 'recent-comments' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->blogs->slug ?>/recent-comments"><?php printf( __( "%s's Recent Comments", 'buddypress' ), $bp->displayed_user->fullname ) ?></a></li>
     497        <li<?php if ( 'my-blogs' == $current_tab || empty( $current_tab ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( $bp->displayed_user->domain . $bp->blogs->slug . '/my-blogs' ); ?>"><?php printf( __( "%s's Blogs", 'buddypress' ), $bp->displayed_user->fullname ); ?></a></li>
     498        <li<?php if ( 'recent-posts' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( $bp->displayed_user->domain . $bp->blogs->slug . '/recent-posts' ); ?>"><?php printf( __( "%s's Recent Posts", 'buddypress' ), $bp->displayed_user->fullname ); ?></a></li>
     499        <li<?php if ( 'recent-comments' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo trailingslashit( $bp->displayed_user->domain . $bp->blogs->slug . '/recent-comments' );?>"><?php printf( __( "%s's Recent Comments", 'buddypress' ), $bp->displayed_user->fullname ); ?></a></li>
    497500    </ul>
     501
    498502<?php
    499503    do_action( 'bp_blogs_blog_tabs', $current_tab );
     
    504508
    505509    $default_search_value = bp_get_search_default_text();
    506     $search_value = !empty( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : $default_search_value;
    507 
    508     ?>
     510    $search_value = !empty( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : $default_search_value; ?>
     511
    509512    <form action="" method="get" id="search-blogs-form">
    510513        <label><input type="text" name="s" id="blogs_search" value="<?php echo esc_attr( $search_value ) ?>"  onfocus="if (this.value == '<?php echo $default_search_value ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php echo $default_search_value ?>';}" /></label>
    511514        <input type="submit" id="blogs_search_submit" name="blogs_search_submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
    512515    </form>
     516
    513517<?php
    514518}
  • trunk/bp-core/bp-core-buddybar.php

    r3917 r3937  
    446446    if ( bp_blog_signup_enabled() ) {
    447447        echo '<li' . $alt . '>';
    448         echo '<a href="' . $bp->root_domain . '/' . $bp->blogs->slug . '/create/">' . __( 'Create a Blog!', 'buddypress' ) . '</a>';
     448        echo '<a href="' . $bp->root_domain . '/' . $bp->blogs->root_slug . '/create/">' . __( 'Create a Blog!', 'buddypress' ) . '</a>';
    449449        echo '</li>';
    450450    }
  • trunk/bp-core/bp-core-component.php

    r3923 r3937  
    207207     * Setup the navigation
    208208     *
    209      * @param arr $main_nav
    210      * @param arr $sub_nav
    211      */
    212     function _setup_nav( $main_nav, $sub_nav ) {
    213         bp_core_new_nav_item( $main_nav );
    214 
    215         foreach( $sub_nav as $nav )
    216             bp_core_new_subnav_item( $nav );
     209     * @param arr $main_nav Optional
     210     * @param arr $sub_nav Optional
     211     */
     212    function _setup_nav( $main_nav = '', $sub_nav = '' ) {
     213        // No sub nav items without a main nav item
     214        if ( !empty( $main_nav ) ) {
     215            bp_core_new_nav_item( $main_nav );
     216
     217            // Sub nav items are not required
     218            if ( !empty( $sub_nav ) ) {
     219                foreach( $sub_nav as $nav ) {
     220                    bp_core_new_subnav_item( $nav );
     221                }
     222            }
     223        }
    217224
    218225        // Call action
Note: See TracChangeset for help on using the changeset viewer.