Example #1
0
 public static function get_lost_pages($allow_autodrafts = false)
 {
     global $wpdb;
     $lost_pages = array();
     $tree = ApmTreeDb::get_last_tree();
     if (!empty($tree)) {
         $tree = new ApmTree($tree);
         $tree_apm_ids = $tree->get_nodes_flat();
         $tree_wp_ids = ApmNodeDataIntern::get_wp_ids($tree_apm_ids);
         $tree_wp_ids = array_diff($tree_wp_ids, array(ApmTreeData::root_id));
         //Remove the zeroes (for root).
         $allowed_post_status = ApmConfig::$allowed_post_status;
         if ($allow_autodrafts) {
             $allowed_post_status[] = 'auto-draft';
         }
         $allowed_post_status = apply_filters('apm_allowed_post_status', $allowed_post_status, 'get_lost_pages');
         $allowed_post_status = array_map("addslashes", $allowed_post_status);
         $sql_status = " AND post_status IN ('" . implode("','", $allowed_post_status) . "') ";
         $sql = "SELECT * FROM {$wpdb->posts} AS p \n\t\t\t\t\t\t\t WHERE p.post_type = 'page' {$sql_status} AND p.ID NOT IN ('" . implode("','", $tree_wp_ids) . "')";
         $lost_pages_raw = $wpdb->get_results($sql);
         if (!empty($lost_pages_raw)) {
             foreach ($lost_pages_raw as $page) {
                 $page->post_title = _draft_or_post_title($page->ID);
                 $lost_pages[$page->ID] = $page;
             }
         }
     }
     return $lost_pages;
 }
Example #2
0
 public static function get_wp_ids_from_apm_ids($apm_ids)
 {
     return ApmNodeDataIntern::get_wp_ids($apm_ids);
 }