Exemplo n.º 1
0
 internal static Post Post(XmlRpcPost input)
 {
     return(new Post
     {
         PostId = input.postid,
         Body = input.description,
         mt_text_more = input.mt_text_more,
         post_content = input.post_content,
         Categories = input.categories,
         DateCreated = input.dateCreated,
         Tags = input.mt_keywords?.Split(','),
         Title = input.title,
         Permalink = input.permaLink,
         Url = input.link,
         mt_excerpt = input.mt_excerpt,
         mt_keywords = input.mt_keywords,
         wp_post_thumbnail = input.wp_post_thumbnail,
         PostType = input.post_type,
         PostStatus = input.post_status,
         CustomFields = input.custom_fields == null ? null : input.custom_fields.Select(cf => new CustomField()
         {
             Id = cf.id,
             Key = cf.key,
             Value = cf.value
         }).ToArray(),
         Terms = input.terms == null ? null : input.terms.Select(t => new Term()
         {
             Taxonomy = t.taxonomy,
             Terms = t.terms
         }).ToArray()
     });
 }
Exemplo n.º 2
0
 internal static Post Post(XmlRpcPost input)
 {
     return(new Post
     {
         PostID = input.postid,
         Body = input.description,
         Categories = input.categories,
         DateCreated = input.dateCreated,
         Tags = input.mt_keywords.Split(','),
         Title = input.title,
         Permalink = input.permaLink,
         PostType = input.post_type,
         CustomFields = input.custom_fields == null ? null : input.custom_fields.Select(cf => new CustomField()
         {
             ID = cf.id,
             Key = cf.key,
             Value = cf.value
         }).ToArray(),
         Terms = input.terms == null ? null : input.terms.Select(t => new Term()
         {
             Taxonomy = t.taxonomy,
             Terms = t.terms
         }).ToArray()
     });
 }
        protected override void OnAfterPostMapping(Post post, XmlRpcPost xmlRpcPost)
        {
            base.OnAfterPostMapping(post, xmlRpcPost);

            // WordPress doesn't like the id in custom_fields attribute, remove it if it's set
            if (xmlRpcPost.custom_fields != null)
            {
                for (var index = 0; index < xmlRpcPost.custom_fields.Length; index++)
                {
                    xmlRpcPost.custom_fields[index].id = null;
                }
            }
        }
Exemplo n.º 4
0
 protected virtual void OnAfterPostMapping(Post post, XmlRpcPost xmlRpcPost)
 {
 }