當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。