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

See #32444.


git-svn-id: https://develop.svn.wordpress.org/trunk@32965 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-06-27 01:11:45 +00:00
parent f162be6046
commit 550763988b
7 changed files with 32 additions and 33 deletions

View File

@ -434,10 +434,13 @@ function _wp_ajax_add_hierarchical_term() {
$checked_categories[] = $cat_id; $checked_categories[] = $cat_id;
if ( $parent ) // Do these all at once in a second if ( $parent ) // Do these all at once in a second
continue; continue;
ob_start(); ob_start();
wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name, 'descendants_and_self' => $cat_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids ));
$data = ob_get_contents(); wp_terms_checklist( 0, array( 'taxonomy' => $taxonomy->name, 'descendants_and_self' => $cat_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids ));
ob_end_clean();
$data = ob_get_clean();
$add = array( $add = array(
'what' => $taxonomy->name, 'what' => $taxonomy->name,
'id' => $cat_id, 'id' => $cat_id,
@ -458,9 +461,11 @@ function _wp_ajax_add_hierarchical_term() {
} }
ob_start(); ob_start();
wp_terms_checklist( 0, array('taxonomy' => $taxonomy->name, 'descendants_and_self' => $term_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids));
$data = ob_get_contents(); wp_terms_checklist( 0, array('taxonomy' => $taxonomy->name, 'descendants_and_self' => $term_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids));
ob_end_clean();
$data = ob_get_clean();
$add = array( $add = array(
'what' => $taxonomy->name, 'what' => $taxonomy->name,
'id' => $term_id, 'id' => $term_id,
@ -470,12 +475,14 @@ function _wp_ajax_add_hierarchical_term() {
} }
ob_start(); ob_start();
wp_dropdown_categories( array(
'taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new'.$taxonomy->name.'_parent', 'orderby' => 'name', wp_dropdown_categories( array(
'hierarchical' => 1, 'show_option_none' => '— '.$taxonomy->labels->parent_item.' —' 'taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new'.$taxonomy->name.'_parent', 'orderby' => 'name',
) ); 'hierarchical' => 1, 'show_option_none' => '— '.$taxonomy->labels->parent_item.' —'
$sup = ob_get_contents(); ) );
ob_end_clean();
$sup = ob_get_clean();
$add['supplemental'] = array( 'newcat_parent' => $sup ); $add['supplemental'] = array( 'newcat_parent' => $sup );
$x = new WP_Ajax_Response( $add ); $x = new WP_Ajax_Response( $add );
@ -914,8 +921,7 @@ function wp_ajax_get_comments( $action ) {
get_comment( $comment ); get_comment( $comment );
$wp_list_table->single_row( $comment ); $wp_list_table->single_row( $comment );
} }
$comment_list_item = ob_get_contents(); $comment_list_item = ob_get_clean();
ob_end_clean();
$x->add( array( $x->add( array(
'what' => 'comments', 'what' => 'comments',

View File

@ -947,9 +947,8 @@ class Automatic_Upgrader_Skin extends WP_Upgrader_Skin {
* @access public * @access public
*/ */
public function footer() { public function footer() {
$output = ob_get_contents(); $output = ob_get_clean();
if ( ! empty( $output ) ) if ( ! empty( $output ) )
$this->feedback( $output ); $this->feedback( $output );
ob_end_clean();
} }
} }

View File

@ -771,8 +771,8 @@ function delete_plugins( $plugins, $deprecated = '' ) {
ob_start(); ob_start();
$url = wp_nonce_url('plugins.php?action=delete-selected&verify-delete=1&' . implode('&', $checked), 'bulk-plugins'); $url = wp_nonce_url('plugins.php?action=delete-selected&verify-delete=1&' . implode('&', $checked), 'bulk-plugins');
if ( false === ($credentials = request_filesystem_credentials($url)) ) { if ( false === ($credentials = request_filesystem_credentials($url)) ) {
$data = ob_get_contents(); $data = ob_get_clean();
ob_end_clean();
if ( ! empty($data) ){ if ( ! empty($data) ){
include_once( ABSPATH . 'wp-admin/admin-header.php'); include_once( ABSPATH . 'wp-admin/admin-header.php');
echo $data; echo $data;
@ -784,8 +784,8 @@ function delete_plugins( $plugins, $deprecated = '' ) {
if ( ! WP_Filesystem($credentials) ) { if ( ! WP_Filesystem($credentials) ) {
request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
$data = ob_get_contents(); $data = ob_get_clean();
ob_end_clean();
if ( ! empty($data) ){ if ( ! empty($data) ){
include_once( ABSPATH . 'wp-admin/admin-header.php'); include_once( ABSPATH . 'wp-admin/admin-header.php');
echo $data; echo $data;

View File

@ -27,8 +27,8 @@ function delete_theme($stylesheet, $redirect = '') {
if ( empty( $redirect ) ) if ( empty( $redirect ) )
$redirect = wp_nonce_url('themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet); $redirect = wp_nonce_url('themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet);
if ( false === ($credentials = request_filesystem_credentials($redirect)) ) { if ( false === ($credentials = request_filesystem_credentials($redirect)) ) {
$data = ob_get_contents(); $data = ob_get_clean();
ob_end_clean();
if ( ! empty($data) ){ if ( ! empty($data) ){
include_once( ABSPATH . 'wp-admin/admin-header.php'); include_once( ABSPATH . 'wp-admin/admin-header.php');
echo $data; echo $data;
@ -40,8 +40,8 @@ function delete_theme($stylesheet, $redirect = '') {
if ( ! WP_Filesystem($credentials) ) { if ( ! WP_Filesystem($credentials) ) {
request_filesystem_credentials($redirect, '', true); // Failed to connect, Error and request again request_filesystem_credentials($redirect, '', true); // Failed to connect, Error and request again
$data = ob_get_contents(); $data = ob_get_clean();
ob_end_clean();
if ( ! empty($data) ) { if ( ! empty($data) ) {
include_once( ABSPATH . 'wp-admin/admin-header.php'); include_once( ABSPATH . 'wp-admin/admin-header.php');
echo $data; echo $data;

View File

@ -301,9 +301,7 @@ class WP_Customize_Control {
final public function get_content() { final public function get_content() {
ob_start(); ob_start();
$this->maybe_render(); $this->maybe_render();
$template = trim( ob_get_contents() ); return trim( ob_get_clean() );
ob_end_clean();
return $template;
} }
/** /**

View File

@ -252,9 +252,7 @@ class WP_Customize_Panel {
final public function get_content() { final public function get_content() {
ob_start(); ob_start();
$this->maybe_render(); $this->maybe_render();
$template = trim( ob_get_contents() ); return trim( ob_get_clean() );
ob_end_clean();
return $template;
} }
/** /**

View File

@ -269,9 +269,7 @@ class WP_Customize_Section {
final public function get_content() { final public function get_content() {
ob_start(); ob_start();
$this->maybe_render(); $this->maybe_render();
$template = trim( ob_get_contents() ); return trim( ob_get_clean() );
ob_end_clean();
return $template;
} }
/** /**