wordpress

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	AuthorID          int        `xml:"author_id"`
	AuthorLogin       string     `xml:"author_login"`
	AuthorEmail       string     `xml:"author_email"`
	AuthorDisplayName string     `xml:"author_display_name"`
	AuthorFirstName   string     `xml:"author_first_name"`
	AuthorLastName    string     `xml:"author_last_name"`
	AuthorArticles    []ItemThin `xml:"-"`
}

Author is the WordPress XML author object.

type Category

type Category struct {
	Domain      string `xml:"domain,attr"`
	DisplayName string `xml:",chardata"`
	URLSlug     string `xml:"nicename,attr"`
}

type Channel

type Channel struct {
	Title   string   `xml:"title"`
	Link    string   `xml:"link"`
	Authors []Author `xml:"author"`
	Items   []Item   `xml:"item"`
}

type Comment

type Comment struct {
	ID          int    `xml:"comment_id"`
	Parent      int    `xml:"comment_parent"`
	Author      string `xml:"comment_author"`
	AuthorEmail string `xml:"comment_author_email"`
	AuthorURL   string `xml:"comment_author_url"`
	DateGmt     string `xml:"comment_date_gmt"`
	Content     string `xml:"comment_content"`
	IndentLevel int    `xml:"-"`
}

type Convert

type Convert struct {
	XML WpXML
	// contains filtered or unexported fields
}

func New

func New(xmlPath string, s *store.Repository, sendEmail bool) (*Convert, error)

New - Construct

func (*Convert) Import

func (c *Convert) Import()

Import

The XML file into Wordpress by populating Authors and Posts.

type FailedAuthor

type FailedAuthor struct {
	FirstName string
	LastName  string
	Email     string
	Error     error
}

FailedAuthor defines a failure of an author that occurred during migration

type FailedMedia

type FailedMedia struct {
	URL   string
	Error error
}

FailedMedia defines a failure of an upload to the media library

type FailedPost

type FailedPost struct {
	Post  Item
	Media []FailedMedia
	Error error
}

FailedMedia defines a failure of a post that occurred during migration.

type Failures

type Failures struct {
	Posts   []FailedPost
	Authors []FailedAuthor
}

Failed import defines the errors that occurred when importing multiple entities into Verbis.

type Item

type Item struct {
	ID           int        `xml:"post_id"`
	Title        string     `xml:"title"`
	Creator      string     `xml:"creator"`
	Encoded      []string   `xml:"encoded"`
	IsSticky     int        `xml:"is_sticky"`
	Link         string     `xml:"link"`
	PubDate      string     `xml:"pubDate"`
	Description  string     `xml:"description"`
	PostDate     string     `xml:"post_date"`
	PostDateGmt  string     `xml:"post_date_gmt"`
	PostName     string     `xml:"post_name"`
	PostType     string     `xml:"post_type"`
	Status       string     `xml:"status"`
	Categories   []Category `xml:"category"`
	Comments     []Comment  `xml:"comment"`
	Meta         []Meta     `xml:"postmeta"`
	Content      string
	PostDatetime time.Time
	PubDatetime  time.Time
}

Item is a WordPress XML item which can be a post, page or other object.

type ItemThin

type ItemThin struct {
	Title string
	Index int
}

ItemThin is a WordPress XML item that is used as additional metadata in the Author object.

type Meta

type Meta struct {
	Text      string `xml:",chardata"`
	MetaKey   string `xml:"meta_key"`
	MetaValue string `xml:"meta_value"`
}

type Result

type Result struct {
	Failed     Failures
	Posts      domain.PostData
	Authors    domain.UsersParts
	Categories domain.Categories
}

type Rss

type Rss struct {
	Channel Channel `xml:"channel"`
}

type WpXML

type WpXML struct {
	Channel        Channel `xml:"channel"`
	CreatorCounts  map[string]int
	CreatorToIndex map[string]int
}

func NewWordpressXML

func NewWordpressXML() WpXML

func (*WpXML) AuthorForLogin

func (wpxml *WpXML) AuthorForLogin(authorLogin string) (Author, error)

AuthorForLogin returns the Author object for a given AuthorLogin or username.

func (*WpXML) AuthorsToIndex

func (wpxml *WpXML) AuthorsToIndex() map[string]int

func (*WpXML) ReadFile

func (wpxml *WpXML) ReadFile(filepath string) error

ReadXml reads a WordPress XML file from the provided path.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL