Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/26/2011 08:43:59 PM (15 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.