Ticket #10659: PagesFound.diff

File PagesFound.diff, 1.2 KB (added by redsweater, 3 years ago)
  • xmlrpc.php

     
    596596                $blog_id        = (int) $args[0]; 
    597597                $username       = $args[1]; 
    598598                $password       = $args[2]; 
    599                 $num_pages      = (int) $args[3]; 
    600599 
     600                // If a specific page count was provided, use it, otherwise default to 10 pages 
     601                if (count($args) >= 4) { 
     602                        $page_limit = (int) $args[3]; 
     603                }  
     604                else { 
     605                        $page_limit = 10; 
     606                } 
     607 
    601608                if ( !$user = $this->login($username, $password) ) { 
    602609                        return $this->error; 
    603610                } 
     
    607614 
    608615                do_action('xmlrpc_call', 'wp.getPages'); 
    609616 
    610                 $page_limit = 10; 
    611                 if( isset( $num_pages ) ) { 
    612                         $page_limit = $num_pages; 
    613                 } 
    614  
    615617                $pages = get_posts( array('post_type' => 'page', 'post_status' => 'all', 'numberposts' => $page_limit) ); 
    616                 $num_pages = count($pages); 
     618                $pages_found = count($pages); 
    617619 
    618620                // If we have pages, put together their info. 
    619                 if($num_pages >= 1) { 
     621                if($pages_found >= 1) { 
    620622                        $pages_struct = array(); 
    621623 
    622                         for($i = 0; $i < $num_pages; $i++) { 
     624                        for($i = 0; $i < $pages_found; $i++) { 
    623625                                $page = wp_xmlrpc_server::wp_getPage(array( 
    624626                                        $blog_id, $pages[$i]->ID, $username, $password 
    625627                                ));