public static function start($post_ids = false) { $conversations_bucket = array(); if (!$post_ids) { $post_ids = get_posts(apply_filters('spotim_post_query_args', array('fields' => 'ids', 'posts_per_page' => -1))); } foreach ((array) $post_ids as $post_id) { $exporter_instance = new SpotIM_Export_Conversation($post_id); $post_result = $exporter_instance->export(); // if post was successfully processed, and guaranteed to have comments if ($post_result && !$exporter_instance->is_empty()) { $conversations_bucket[$post_id] = $post_result; } } return $conversations_bucket; }
/** * Get the webhook for the given ID * * @since 2.2 * @param int $id webhook ID * @param array $fields * @return array */ public function get_conversation($id, $fields = null) { $id = $this->validate_request($id, 'post', 'read'); if (is_wp_error($id)) { return $id; } $_G = $this->server->params['GET']; // GET $offset = array_key_exists('offset', $_G) ? $_G['offset'] : 0; $count = array_key_exists('count', $_G) ? $_G['count'] : 50; $result = array(); $exporter_instance = new SpotIM_Export_Conversation($id, $count, $offset); $post_result = $exporter_instance->export(); if ($post_result && !$exporter_instance->is_empty()) { $result = $post_result; } return array('metadata' => array('left_comments' => $exporter_instance->total_comments_count->approved - $exporter_instance->get_comment_count()), 'conversation' => $result); }