public static function getPostById($core, $get) { if (empty($get['id'])) { throw new Exception('No post ID'); } $params = array('post_id' => (int) $get['id']); if (isset($get['post_type'])) { $params['post_type'] = $get['post_type']; } $rs = $core->blog->getPosts($params); if ($rs->isEmpty()) { throw new Exception('No post for this ID'); } $rsp = new xmlTag('post'); $rsp->id = $rs->post_id; $rsp->blog_id($rs->blog_id); $rsp->user_id($rs->user_id); $rsp->cat_id($rs->cat_id); $rsp->post_dt($rs->post_dt); $rsp->post_creadt($rs->post_creadt); $rsp->post_upddt($rs->post_upddt); $rsp->post_format($rs->post_format); $rsp->post_url($rs->post_url); $rsp->post_lang($rs->post_lang); $rsp->post_title($rs->post_title); $rsp->post_excerpt($rs->post_excerpt); $rsp->post_excerpt_xhtml($rs->post_excerpt_xhtml); $rsp->post_content($rs->post_content); $rsp->post_content_xhtml($rs->post_content_xhtml); $rsp->post_notes($rs->post_notes); $rsp->post_status($rs->post_status); $rsp->post_selected($rs->post_selected); $rsp->post_open_comment($rs->post_open_comment); $rsp->post_open_tb($rs->post_open_tb); $rsp->nb_comment($rs->nb_comment); $rsp->nb_trackback($rs->nb_trackback); $rsp->user_name($rs->user_name); $rsp->user_firstname($rs->user_firstname); $rsp->user_displayname($rs->user_displayname); $rsp->user_email($rs->user_email); $rsp->user_url($rs->user_url); $rsp->cat_title($rs->cat_title); $rsp->cat_url($rs->cat_url); $rsp->post_display_content($rs->getContent(true)); $rsp->post_display_excerpt($rs->getExcerpt(true)); $metaTag = new xmlTag('meta'); if (($meta = @unserialize($rs->post_meta)) !== false) { foreach ($meta as $K => $V) { foreach ($V as $v) { $metaTag->{$K}($v); } } } $rsp->post_meta($metaTag); return $rsp; }