2470 | | // Get list of pages ids and titles |
2471 | | $page_list = $wpdb->get_results(" |
2472 | | SELECT ID page_id, |
2473 | | post_title page_title, |
2474 | | post_parent page_parent_id, |
2475 | | post_date_gmt, |
2476 | | post_date, |
2477 | | post_status |
2478 | | FROM {$wpdb->posts} |
2479 | | WHERE post_type = 'page' |
2480 | | ORDER BY ID |
2481 | | "); |
2482 | | |
2483 | | // The date needs to be formatted properly. |
2484 | | $num_pages = count($page_list); |
2485 | | for ( $i = 0; $i < $num_pages; $i++ ) { |
2486 | | $page_list[$i]->dateCreated = $this->_convert_date( $page_list[$i]->post_date ); |
2487 | | $page_list[$i]->date_created_gmt = $this->_convert_date_gmt( $page_list[$i]->post_date_gmt, $page_list[$i]->post_date ); |
2488 | | |
2489 | | unset($page_list[$i]->post_date_gmt); |
2490 | | unset($page_list[$i]->post_date); |
2491 | | unset($page_list[$i]->post_status); |
| 2470 | $pages = get_posts( array('post_type' => 'page', 'post_status' => 'any', 'numberposts' => $num_pages) ); |
| 2471 | $num_pages = count($pages); |
| 2472 | |
| 2473 | $pages_struct = array(); |
| 2474 | // If we have pages, put together their info. |
| 2475 | if ( $num_pages >= 1 ) { |
| 2476 | foreach ( $pages as $page ) { |
| 2477 | if ( current_user_can( 'edit_page', $page->ID ) ) { |
| 2478 | $current_page_with_all_details = $this->_prepare_page( $page ); |
| 2479 | $current_page = new stdClass(); |
| 2480 | $current_page->page_id = $current_page_with_all_details['page_id']; |
| 2481 | $current_page->page_title = $current_page_with_all_details['title']; |
| 2482 | $current_page->page_parent_id = $current_page_with_all_details['wp_page_parent_id']; |
| 2483 | $current_page->post_status = $current_page_with_all_details['page_status']; |
| 2484 | $current_page->dateCreated = $current_page_with_all_details['dateCreated']; |
| 2485 | $current_page->date_created_gmt = $current_page_with_all_details['date_created_gmt']; |
| 2486 | $pages_struct[] = $current_page; |
| 2487 | } |
| 2488 | } |