コード例 #1
0
ファイル: Program.cs プロジェクト: ericdellis17/JoeBlogs
    static void Main(string[] args)
    {
        //remember to include the http://
        string Url = "http://joeblogstest.alexjamesbrown.com/xmlrpc.php"; //change this to the location of your xmlrpc.php file
        //typically http://www.yourdomain.com/xmlrpc.php (if your wordpress blog is installed in root dir)

        string User     = "******";    //enter your username
        string Password = "******"; //enter your password

        _wpWrapper = new WordPressWrapper(Url, User, Password);

        #region Posts
        //create a new post
        var newPostID = createNewPost();

        //edit the post created above
        editPost(newPostID);

        //delete post created above
        _wpWrapper.DeletePost(newPostID);

        //get list of post status'
        var statusList = _wpWrapper.GetPostStatusList();
        #endregion

        #region Authors
        _wpWrapper.GetAuthors();
        #endregion

        #region Pages
        //create new page
        var newpageID = createPage();

        //get list of pages
        var pageList = _wpWrapper.GetPageList();

        //delete page
        var pageHasBeenDeleted = _wpWrapper.DeletePage(newpageID);

        //get page (using the ID from the page created above)
        var page = _wpWrapper.GetPage(newpageID);

        //todo: edit page
        #endregion

        #region Category

        //create a category
        var category = new CategoryNew
        {
            Description = "This is a test description",
            Name        = "Alex Cat",
            Slug        = "testSlug"
        };

        var catID = _wpWrapper.NewCategory(category);

        var cats = _wpWrapper.GetCategories();

        var deletedCat = _wpWrapper.DeleteCategory(catID);
        #endregion

        #region Comments
        //create a new post
        var newPostForComment = createNewPost();

        var comment = new Comment(newPostForComment)
        {
            AuthorEmail = "*****@*****.**",
            AuthorName  = "Joe Blogs",
            Content     = "This is a bit of text for the comment",
            AuthorUrl   = "www.alexjamesbrown.com"
        };

        //add a comment to this post
        _wpWrapper.NewComment(newPostForComment, comment);
        #endregion
    }
コード例 #2
0
ファイル: Program.cs プロジェクト: hallojoe/JoeBlogs
    static void Main(string[] args)
    {
        //remember to include the http://
        string Url = "http://joeblogstest.alexjamesbrown.com/xmlrpc.php"; //change this to the location of your xmlrpc.php file
        //typically http://www.yourdomain.com/xmlrpc.php (if your wordpress blog is installed in root dir)

        string User = "******"; //enter your username
        string Password = "******"; //enter your password

        _wpWrapper = new WordPressWrapper(Url, User, Password);

        #region Posts
        //create a new post
        var newPostID = createNewPost();

        //edit the post created above
        editPost(newPostID);

        //delete post created above
        _wpWrapper.DeletePost(newPostID);

        //get list of post status'
        var statusList = _wpWrapper.GetPostStatusList();
        #endregion

        #region Authors
        _wpWrapper.GetAuthors();
        #endregion

        #region Pages
        //create new page
        var newpageID = createPage();

        //get list of pages
        var pageList = _wpWrapper.GetPageList();

        //delete page
        var pageHasBeenDeleted = _wpWrapper.DeletePage(newpageID);

        //get page (using the ID from the page created above)
        var page = _wpWrapper.GetPage(newpageID);

        //todo: edit page
        #endregion

        #region Category

        //create a category
        var description = "This is a test description";
        var name = "Alex Cat";
        var slug = "testSlug";

        var catID = _wpWrapper.NewCategory(description, null, name, slug);

        var cats = _wpWrapper.GetCategories();

        var deletedCat = _wpWrapper.DeleteCategory(catID);
        #endregion

        #region Comments
        //create a new post
        var newPostForComment = createNewPost();

        var authorEmail = "*****@*****.**";
        var authorName = "Joe Blogs";
        var content = "This is a bit of text for the comment";
        var authorUrl = "www.alexjamesbrown.com";

        //add a comment to this post
        _wpWrapper.NewComment(newPostForComment, null, content, authorName, authorUrl, authorEmail);
        #endregion
    }
コード例 #3
0
        public override int Run(string[] remainingArguments)
        {
            _wpWrapper = LoginInfo.GetWordPressClient();
            
            #region Posts
            //create a new post
            var newPostID = createNewPost();

            //edit the post created above
            editPost(newPostID);

            //delete post created above
            _wpWrapper.DeletePost(newPostID);

            //get list of post status'
            var statusList = _wpWrapper.GetPostStatusList();
            #endregion

            #region Authors
            _wpWrapper.GetAuthors();
            #endregion

            #region Pages
            //create new page
            var newpageID = createPage();

            //get list of pages
            var pageList = _wpWrapper.GetPageList();

            //delete page
            var pageHasBeenDeleted = _wpWrapper.DeletePage(newpageID);

            //get page (using the ID from the page created above)
            var page = _wpWrapper.GetPage(newpageID);

            //todo: edit page
            #endregion

            #region Category

            //create a category
            var description = "This is a test description";
            var name = "Alex Cat";
            var slug = "testSlug";

            var catID = _wpWrapper.NewCategory(description, null, name, slug);

            var cats = _wpWrapper.GetCategories();

            var deletedCat = _wpWrapper.DeleteCategory(catID);
            #endregion

            #region Comments
            //create a new post
            var newPostForComment = createNewPost();

            var authorEmail = "*****@*****.**";
            var authorName = "Joe Blogs";
            var content = "This is a bit of text for the comment";
            var authorUrl = "www.alexjamesbrown.com";

            //add a comment to this post
            _wpWrapper.NewComment(newPostForComment, null, content, authorName, authorUrl, authorEmail);

            #endregion

            return 0;
        }