Ejemplo n.º 1
0
 public static function init()
 {
     global $wpabAdmin;
     global $wpabBlogFeed;
     global $wpabBlogFeedPost;
     global $wpabSweeper;
     $wpabAdmin = new WPAutoblog_Admin();
     $wpabAdmin->init();
     $wpabBlogFeed = new WPAutoblog_BlogFeed();
     $wpabBlogFeed->init();
     $wpabBlogFeedPost = new WPAutoblog_BlogFeedPost();
     $wpabBlogFeedPost->init();
     $wpabSweeper = new WPAutoblog_Sweeper();
     $wpabAdmin->registerComponent($wpabBlogFeed);
     $wpabAdmin->registerComponent($wpabSweeper);
     //
     //$wpabAdmin->registerComponent(new WPAutoblog_Readibility());
 }
Ejemplo n.º 2
0
function get_wpab_blog_feed_post_post_type()
{
    return WPAutoblog_BlogFeedPost::postName();
}
Ejemplo n.º 3
0
 private function createBlogPost($blog, $item, $body, $attachments)
 {
     $attachment_ids = array();
     $body = $body ? $body : $item->get_content();
     $post = array('post_content' => $body, 'post_name' => sanitize_title($item->get_title()), 'post_type' => WPAutoblog_BlogFeedPost::postName(), 'post_title' => $item->get_title(), 'post_status' => 'publish', 'post_excerpt' => strip_tags($item->get_description()), 'post_date' => $item->get_date('Y-m-d H:i:s'), 'post_parent' => $blog->ID);
     $post_id = wp_insert_post($post);
     add_post_meta($post_id, WPAB_ID . '-uuid', $item->get_id());
     add_post_meta($post_id, WPAB_ID . '-from-blog', $blog->ID);
     add_post_meta($post_id, WPAB_ID . '-original-url', $item->get_permalink());
     /* assign attachments */
     foreach ($attachments as $attachment) {
         $attach_id = wp_insert_attachment($attachment['attachment'], $attachment['file'], $post_id);
         require_once ABSPATH . 'wp-admin/includes/image.php';
         $attach_data = wp_generate_attachment_metadata($attach_id, $attachment['file']);
         wp_update_attachment_metadata($attach_id, $attach_data);
         $attachment_ids[] = $attach_id;
     }
     $isFeaturedImageFeatured = get_field('featured_image_featured', $blog->ID);
     $isFirstImageFeatured = get_field('first_image_featured', $blog->ID);
     if (($isFirstImageFeatured || $isFeaturedImageFeatured) && isset($attachment_ids[0])) {
         set_post_thumbnail($post_id, $attachment_ids[0]);
     }
     return $post_id;
 }