WordPress.org

Make WordPress Core

Changeset 32965


Ignore:
Timestamp:
06/27/2015 01:11:45 AM (6 years ago)
Author:
wonderboymusic
Message:

ob_get_contents() followed by ob_end_clean() can be replaced by ob_get_clean().

See #32444.

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r32778 r32965  
    435435        if ( $parent ) // Do these all at once in a second
    436436            continue;
     437
    437438        ob_start();
    438             wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name, 'descendants_and_self' => $cat_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids ));
    439         $data = ob_get_contents();
    440         ob_end_clean();
     439
     440        wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name, 'descendants_and_self' => $cat_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids ));
     441
     442        $data = ob_get_clean();
     443
    441444        $add = array(
    442445            'what' => $taxonomy->name,
     
    459462
    460463        ob_start();
    461             wp_terms_checklist( 0, array('taxonomy' => $taxonomy->name, 'descendants_and_self' => $term_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids));
    462         $data = ob_get_contents();
    463         ob_end_clean();
     464
     465        wp_terms_checklist( 0, array('taxonomy' => $taxonomy->name, 'descendants_and_self' => $term_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids));
     466
     467        $data = ob_get_clean();
     468
    464469        $add = array(
    465470            'what' => $taxonomy->name,
     
    471476
    472477    ob_start();
    473         wp_dropdown_categories( array(
    474             'taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new'.$taxonomy->name.'_parent', 'orderby' => 'name',
    475             'hierarchical' => 1, 'show_option_none' => '— '.$taxonomy->labels->parent_item.' —'
    476         ) );
    477     $sup = ob_get_contents();
    478     ob_end_clean();
     478
     479    wp_dropdown_categories( array(
     480        'taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new'.$taxonomy->name.'_parent', 'orderby' => 'name',
     481        'hierarchical' => 1, 'show_option_none' => '— '.$taxonomy->labels->parent_item.' —'
     482    ) );
     483
     484    $sup = ob_get_clean();
     485
    479486    $add['supplemental'] = array( 'newcat_parent' => $sup );
    480487
     
    915922        $wp_list_table->single_row( $comment );
    916923    }
    917     $comment_list_item = ob_get_contents();
    918     ob_end_clean();
     924    $comment_list_item = ob_get_clean();
    919925
    920926    $x->add( array(
  • trunk/src/wp-admin/includes/class-wp-upgrader-skins.php

    r32781 r32965  
    948948     */
    949949    public function footer() {
    950         $output = ob_get_contents();
     950        $output = ob_get_clean();
    951951        if ( ! empty( $output ) )
    952952            $this->feedback( $output );
    953         ob_end_clean();
    954953    }
    955954}
  • trunk/src/wp-admin/includes/plugin.php

    r32927 r32965  
    772772    $url = wp_nonce_url('plugins.php?action=delete-selected&verify-delete=1&' . implode('&', $checked), 'bulk-plugins');
    773773    if ( false === ($credentials = request_filesystem_credentials($url)) ) {
    774         $data = ob_get_contents();
    775         ob_end_clean();
     774        $data = ob_get_clean();
     775
    776776        if ( ! empty($data) ){
    777777            include_once( ABSPATH . 'wp-admin/admin-header.php');
     
    785785    if ( ! WP_Filesystem($credentials) ) {
    786786        request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
    787         $data = ob_get_contents();
    788         ob_end_clean();
     787        $data = ob_get_clean();
     788
    789789        if ( ! empty($data) ){
    790790            include_once( ABSPATH . 'wp-admin/admin-header.php');
  • trunk/src/wp-admin/includes/theme.php

    r32654 r32965  
    2828        $redirect = wp_nonce_url('themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet);
    2929    if ( false === ($credentials = request_filesystem_credentials($redirect)) ) {
    30         $data = ob_get_contents();
    31         ob_end_clean();
     30        $data = ob_get_clean();
     31
    3232        if ( ! empty($data) ){
    3333            include_once( ABSPATH . 'wp-admin/admin-header.php');
     
    4141    if ( ! WP_Filesystem($credentials) ) {
    4242        request_filesystem_credentials($redirect, '', true); // Failed to connect, Error and request again
    43         $data = ob_get_contents();
    44         ob_end_clean();
     43        $data = ob_get_clean();
     44
    4545        if ( ! empty($data) ) {
    4646            include_once( ABSPATH . 'wp-admin/admin-header.php');
  • trunk/src/wp-includes/class-wp-customize-control.php

    r32913 r32965  
    302302        ob_start();
    303303        $this->maybe_render();
    304         $template = trim( ob_get_contents() );
    305         ob_end_clean();
    306         return $template;
     304        return trim( ob_get_clean() );
    307305    }
    308306
  • trunk/src/wp-includes/class-wp-customize-panel.php

    r32876 r32965  
    253253        ob_start();
    254254        $this->maybe_render();
    255         $template = trim( ob_get_contents() );
    256         ob_end_clean();
    257         return $template;
     255        return trim( ob_get_clean() );
    258256    }
    259257
  • trunk/src/wp-includes/class-wp-customize-section.php

    r32877 r32965  
    270270        ob_start();
    271271        $this->maybe_render();
    272         $template = trim( ob_get_contents() );
    273         ob_end_clean();
    274         return $template;
     272        return trim( ob_get_clean() );
    275273    }
    276274
Note: See TracChangeset for help on using the changeset viewer.