当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Service_Delicious::createNewPost方法代码示例

本文整理汇总了PHP中Zend_Service_Delicious::createNewPost方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Service_Delicious::createNewPost方法的具体用法?PHP Zend_Service_Delicious::createNewPost怎么用?PHP Zend_Service_Delicious::createNewPost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Service_Delicious的用法示例。


在下文中一共展示了Zend_Service_Delicious::createNewPost方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: publishToDelicious

function publishToDelicious($title, $url, $note, $tags = array())
{
    if (DELICIOUS_PUB) {
        /* Setup Zend */
        require_once 'Zend/Loader.php';
        Zend_Loader::loadClass('Zend_Service_Delicious');
        $delicious = new Zend_Service_Delicious(DELICIOUS_USER, DELICIOUS_PASS);
        $delicious->createNewPost($title, $url)->setNotes($note)->setTags($tags)->save();
    }
}
开发者ID:nickavv,项目名称:iSENSE,代码行数:10,代码来源:social.php

示例2: _testAddDeletePost

    /**
     *
     * @return void
     */
    public function _testAddDeletePost()
    {
        $newPost = $this->_delicious->createNewPost(self::$TEST_POST_TITLE, self::$TEST_POST_URL)
                                    ->setNotes(self::$TEST_POST_NOTES)
                                    ->setTags(self::$TEST_POST_TAGS)
                                    ->setShared(self::$TEST_POST_SHARED);

        // check if post was created correctly
        $this->assertEquals(self::$TEST_POST_TITLE, $newPost->getTitle());
        $this->assertEquals(self::$TEST_POST_URL, $newPost->getUrl());
        $this->assertEquals(self::$TEST_POST_NOTES, $newPost->getNotes());
        $this->assertEquals(self::$TEST_POST_TAGS, $newPost->getTags());
        $this->assertEquals(self::$TEST_POST_SHARED, $newPost->getShared());

        // test tag adding to tag
        $newTagName = uniqid('tag');
        $newPost->addTag($newTagName);
        $this->assertContains($newTagName, $newPost->getTags());

        // test tag removeing
        $newPost->removeTag($newTagName);
        $this->assertNotContains($newTagName, $newPost->getTags());

        // send post to del.icio.us
        $newPost->save();

        sleep(15);

        // get the post back
        $returnedPosts = $this->_delicious->getPosts(null, null, self::$TEST_POST_URL);

        $this->assertEquals(1, count($returnedPosts));

        $savedPost = $returnedPosts[0];

        // check if post was saved correctly
        $this->assertEquals(self::$TEST_POST_TITLE, $savedPost->getTitle());
        $this->assertEquals(self::$TEST_POST_URL, $savedPost->getUrl());
        $this->assertEquals(self::$TEST_POST_NOTES, $savedPost->getNotes());
        $this->assertEquals(self::$TEST_POST_TAGS, $savedPost->getTags());
        $this->assertEquals(self::$TEST_POST_SHARED, $savedPost->getShared());
        $this->assertType('Zend_Date', $savedPost->getDate());
        $this->assertType('string', $savedPost->getHash());
        $this->assertType('int', $savedPost->getOthers());

        // delete post
        $savedPost->delete();

        sleep(15);

        // check if post was realy deleted
        $returnedPosts = $this->_delicious->getPosts(null, null, self::$TEST_POST_URL);
        $this->assertEquals(0, count($returnedPosts));
    }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:58,代码来源:PrivateDataTest.php


注:本文中的Zend_Service_Delicious::createNewPost方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。