In `wp_ajax_get_tagcloud()`, bail immediately if `$_POST['tax']` isn't set so that all of the variable setting can happen in the same nest scope as the rest of the function - `wp_die()` confuses Scrutinizer.

See #30224.


git-svn-id: https://develop.svn.wordpress.org/trunk@30168 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-11-01 22:53:35 +00:00
parent ce6a31c5fe
commit c50eaf3b0d
1 changed files with 11 additions and 8 deletions

View File

@ -819,17 +819,20 @@ function wp_ajax_add_tag() {
* @since 3.1.0
*/
function wp_ajax_get_tagcloud() {
if ( isset( $_POST['tax'] ) ) {
$taxonomy = sanitize_key( $_POST['tax'] );
$tax = get_taxonomy( $taxonomy );
if ( ! $tax )
wp_die( 0 );
if ( ! current_user_can( $tax->cap->assign_terms ) )
wp_die( -1 );
} else {
if ( ! isset( $_POST['tax'] ) ) {
wp_die( 0 );
}
$taxonomy = sanitize_key( $_POST['tax'] );
$tax = get_taxonomy( $taxonomy );
if ( ! $tax ) {
wp_die( 0 );
}
if ( ! current_user_can( $tax->cap->assign_terms ) ) {
wp_die( -1 );
}
$tags = get_terms( $taxonomy, array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) );
if ( empty( $tags ) )