post-fixtures/classes/PostFixtures.inc

19 lines
374 B
PHP
Raw Normal View History

2009-11-22 20:35:39 +00:00
<?php
2009-11-22 20:50:16 +00:00
class PostFixtures {
function parse_json($input) {
if (($data = json_decode($input)) !== false) {
if (is_array($data) || is_object($data)) {
2009-11-22 20:56:00 +00:00
return array_values((array)$data);
2009-11-22 20:50:16 +00:00
}
}
return false;
}
2009-11-22 22:34:57 +00:00
function remove_all_posts() {
if (is_array($posts = get_posts('nopaging=1'))) {
foreach ($posts as $post) { wp_delete_post($post->ID); }
}
}
2009-11-22 20:50:16 +00:00
}