Esempio n. 1
0
 public WpPost(XElement postXml, WpImportOptions options)
 {
     GetPost(postXml, options.IncludeComments, options.IncludeCategories, options.IncludeTags);
 }
Esempio n. 2
0
        private ImportSummary ImportBlog()
        {
            var options = new WpImportOptions
            {
                IncludeComments = ImportComments.Checked,
                IncludeCategories = ImportCategories.Checked,
                IncludeTags = ImportTags.Checked
            };

            string fileLocation = String.Format("{0}\\{1}", ApplicationContext.PackagePath, WordpressXmlFile.Value);
            LogMessage("Reading import file");
            var importManager = new WpImportManager(db, new FileBasedProvider(fileLocation), options);

            LogMessage("Creating blog");
            Item root = db.GetItem(litSummaryPath.Text);
            if (root != null)
            {
                var templateMappingItem = root.Database.GetItem(new ID(TemplatesMapping.Value));
                var templatesMapping = new TemplatesMapping(templateMappingItem);
                var blogItem = importManager.CreateBlogRoot(root, BlogName.Value, BlogEmail.Value, templatesMapping.BlogRootTemplate);

                LogMessage("Importing posts");
                LogTotal(importManager.Posts.Count);

                return importManager.ImportPosts(blogItem, templatesMapping, (itemName, count) =>
                {
                    LogMessage("Importing entry " + itemName);
                    LogProgress(count);
                });
            }
            else
            {
                LogMessage(String.Format("Parent item for blog root could not be found ({0})", litSummaryPath.Text));
            }

            return null;
        }
Esempio n. 3
0
 public WpImportManager(Database db, IWpPostProvider wpPostProvider, WpImportOptions options)
 {
     _db             = db;
     _wpPostProvider = wpPostProvider;
     _options        = options;
 }
Esempio n. 4
0
 public WpPost(XElement postXml, WpImportOptions options)
 {
     GetPost(postXml, options.IncludeComments, options.IncludeCategories, options.IncludeTags);
 }
Esempio n. 5
0
 private WpImportOptions BuildWpImportOptions(WordPressImportData data)
 {
     var options = new WpImportOptions
     {
         IncludeComments = data.ImportComments,
         IncludeCategories = data.ImportCategories,
         IncludeTags = data.ImportTags
     };
     return options;
 }