function stats_get_posts($args) { list($post_ids) = $args; $post_ids = array_map('intval', (array) $post_ids); $r = array('include' => $post_ids, 'post_type' => 'any', 'post_status' => 'any'); $posts = get_posts($r); foreach ($posts as $i => $post) { $posts[$i] = stats_get_post($post); } return $posts; }
function stats_update_post($post_id) { if (!in_array(get_post_type($post_id), array('post', 'page', 'attachment'))) { return; } stats_add_call('wpStats.update_postinfo', stats_get_api_key(), stats_get_option('blog_id'), stats_get_post($post_id)); }
function stats_get_posts($args) { list($post_ids) = $args; $post_ids = array_map('intval', (array) $post_ids); $r = array('include' => $post_ids, 'post_type' => array_values(get_post_types(array('public' => true))), 'post_status' => array_values(get_post_stati(array('public' => true)))); $posts = get_posts($r); foreach ($posts as $i => $post) { $posts[$i] = stats_get_post($post); } return $posts; }