Browse Source

Updated Comopser

pull/67/head
Kanti 11 years ago
parent
commit
63755a1add
5 changed files with 111 additions and 49 deletions
  1. +47
    -47
      vendor/composer/installed.json
  2. +13
    -1
      vendor/suin/php-rss-writer/README.md
  3. +27
    -0
      vendor/suin/php-rss-writer/Source/Suin/RSSWriter/Item.php
  4. +9
    -0
      vendor/suin/php-rss-writer/Source/Suin/RSSWriter/ItemInterface.php
  5. +15
    -1
      vendor/suin/php-rss-writer/Tests/Suin/RSSWriter/ItemTest.php

+ 47
- 47
vendor/composer/installed.json View File

@ -1,51 +1,4 @@
[ [
{
"name": "suin/php-rss-writer",
"version": "1.2",
"version_normalized": "1.2.0.0",
"source": {
"type": "git",
"url": "git://github.com/suin/php-rss-writer.git",
"reference": "1.2"
},
"dist": {
"type": "zip",
"url": "https://github.com/suin/php-rss-writer/zipball/1.2",
"reference": "1.2",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"time": "2012-08-23 00:45:18",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-0": {
"Suin\\RSSWriter": "Source"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "suin",
"email": "suinyeze@gmail.com",
"homepage": "https://www.facebook.com/suinyeze",
"role": "Developer, Renaming Specialist"
}
],
"description": "Yet another simple RSS writer library for PHP 5.3 or later.",
"homepage": "https://github.com/suin/php-rss-writer",
"keywords": [
"feed",
"generator",
"rss",
"writer"
]
},
{ {
"name": "michelf/php-markdown", "name": "michelf/php-markdown",
"version": "dev-lib", "version": "dev-lib",
@ -98,5 +51,52 @@
"keywords": [ "keywords": [
"markdown" "markdown"
] ]
},
{
"name": "suin/php-rss-writer",
"version": "1.3",
"version_normalized": "1.3.0.0",
"source": {
"type": "git",
"url": "https://github.com/suin/php-rss-writer.git",
"reference": "82812ff988bb470f746d24e153cdc138e8838ff3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/suin/php-rss-writer/zipball/82812ff988bb470f746d24e153cdc138e8838ff3",
"reference": "82812ff988bb470f746d24e153cdc138e8838ff3",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"time": "2014-03-12 06:05:28",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-0": {
"Suin\\RSSWriter": "Source"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "suin",
"email": "suinyeze@gmail.com",
"homepage": "https://www.facebook.com/suinyeze",
"role": "Developer, Renaming Specialist"
}
],
"description": "Yet another simple RSS writer library for PHP 5.3 or later.",
"homepage": "https://github.com/suin/php-rss-writer",
"keywords": [
"feed",
"generator",
"rss",
"writer"
]
} }
] ]

+ 13
- 1
vendor/suin/php-rss-writer/README.md View File

@ -2,6 +2,8 @@
`\Suin\RSSWriter` is yet another simple RSS writer library for PHP 5.3 or later. This component is Licensed under MIT license. `\Suin\RSSWriter` is yet another simple RSS writer library for PHP 5.3 or later. This component is Licensed under MIT license.
This library can also be used to publish Podcasts.
The build status of the current master branch is tracked by Travis CI: [![Build Status](https://secure.travis-ci.org/suin/php-rss-writer.png?branch=master)](http://travis-ci.org/suin/php-rss-writer) The build status of the current master branch is tracked by Travis CI: [![Build Status](https://secure.travis-ci.org/suin/php-rss-writer.png?branch=master)](http://travis-ci.org/suin/php-rss-writer)
@ -18,6 +20,7 @@ $channel
->url('http://blog.example.com') ->url('http://blog.example.com')
->appendTo($feed); ->appendTo($feed);
// RSS item
$item = new Item(); $item = new Item();
$item $item
->title("Blog Entry Title") ->title("Blog Entry Title")
@ -25,6 +28,15 @@ $item
->url('http://blog.example.com/2012/08/21/blog-entry/') ->url('http://blog.example.com/2012/08/21/blog-entry/')
->appendTo($channel); ->appendTo($channel);
// Podcast item
$item = new Item();
$item
->title("Some Podcast Entry")
->description("<div>Podcast body</div>")
->url('http://podcast.example.com/2012/08/21/podcast-entry/')
->enclosure('http://link-to-audio-file.com/2013/08/21/podcast.mp3', 4889, 'audio/mpeg')
->appendTo($channel);
echo $feed; echo $feed;
``` ```
@ -81,4 +93,4 @@ If you want to know APIs, please see `FeedInterface`, `ChannelInterface` and `It
## License ## License
MIT license
MIT license

+ 27
- 0
vendor/suin/php-rss-writer/Source/Suin/RSSWriter/Item.php View File

@ -20,6 +20,8 @@ class Item implements \Suin\RSSWriter\ItemInterface
protected $isPermalink; protected $isPermalink;
/** @var int */ /** @var int */
protected $pubDate; protected $pubDate;
/** @var array */
protected $enclosure;
/** /**
* Set item title * Set item title
@ -90,6 +92,19 @@ class Item implements \Suin\RSSWriter\ItemInterface
return $this; return $this;
} }
/**
* Set enclosure
* @param var $url Url to media file
* @param int $length Length in bytes of the media file
* @param var $type Media type, default is audio/mpeg
* @return $this
*/
public function enclosure($url, $length = 0, $type = 'audio/mpeg')
{
$this->enclosure = array('url' => $url, 'length' => $length, 'type' => $type);
return $this;
}
/** /**
* Append item to the channel * Append item to the channel
* @param \Suin\RSSWriter\ChannelInterface $channel * @param \Suin\RSSWriter\ChannelInterface $channel
@ -137,6 +152,18 @@ class Item implements \Suin\RSSWriter\ItemInterface
$xml->addChild('pubDate', date(DATE_RSS, $this->pubDate)); $xml->addChild('pubDate', date(DATE_RSS, $this->pubDate));
} }
if (is_array($this->enclosure) && (count($this->enclosure) == 3))
{
$element = $xml->addChild('enclosure');
$element->addAttribute('url', $this->enclosure['url']);
$element->addAttribute('type', $this->enclosure['type']);
if ($this->enclosure['length'])
{
$element->addAttribute('length', $this->enclosure['length']);
}
}
return $xml; return $xml;
} }
} }

+ 9
- 0
vendor/suin/php-rss-writer/Source/Suin/RSSWriter/ItemInterface.php View File

@ -51,6 +51,15 @@ interface ItemInterface
*/ */
public function pubDate($pubDate); public function pubDate($pubDate);
/**
* Set enclosure
* @param var $url Url to media file
* @param int $length Length in bytes of the media file
* @param var $type Media type, default is audio/mpeg
* @return $this
*/
public function enclosure($url, $length = 0, $type = 'audio/mpeg');
/** /**
* Append item to the channel * Append item to the channel
* @param \Suin\RSSWriter\ChannelInterface $channel * @param \Suin\RSSWriter\ChannelInterface $channel


+ 15
- 1
vendor/suin/php-rss-writer/Tests/Suin/RSSWriter/ItemTest.php View File

@ -88,6 +88,15 @@ class ItemTest extends \XoopsUnit\TestCase
$this->assertSame($item, $item->appendTo($channel)); $this->assertSame($item, $item->appendTo($channel));
} }
public function testEnclosure()
{
$url = uniqid();
$enclosure = array('url' => $url, 'length' => 0, 'type' => 'audio/mpeg');
$item = new Item();
$this->assertSame($item, $item->enclosure($url));
$this->assertAttributeSame($enclosure, 'enclosure', $item);
}
public function testAsXML() public function testAsXML()
{ {
$now = time(); $now = time();
@ -104,6 +113,10 @@ class ItemTest extends \XoopsUnit\TestCase
'guid' => "http://inessential.com/2002/09/01.php#a2", 'guid' => "http://inessential.com/2002/09/01.php#a2",
'isPermalink' => true, 'isPermalink' => true,
'pubDate' => $now, 'pubDate' => $now,
'enclosure' => array(
'url' => 'http://link-to-audio-file.com/test.mp3',
'length' => 4992,
'type' => 'audio/mpeg')
); );
$item = new Item(); $item = new Item();
@ -122,6 +135,7 @@ class ItemTest extends \XoopsUnit\TestCase
<category domain=\"{$data['categories'][1][1]}\">{$data['categories'][1][0]}</category> <category domain=\"{$data['categories'][1][1]}\">{$data['categories'][1][0]}</category>
<guid isPermaLink=\"true\">{$data['guid']}</guid> <guid isPermaLink=\"true\">{$data['guid']}</guid>
<pubDate>{$nowString}</pubDate> <pubDate>{$nowString}</pubDate>
<enclosure url=\"{$data['enclosure']['url']}\" length=\"{$data['enclosure']['length']}\" type=\"{$data['enclosure']['type']}\"/>
</item> </item>
"; ";
$this->assertXmlStringEqualsXmlString($expect, $item->asXML()->asXML()); $this->assertXmlStringEqualsXmlString($expect, $item->asXML()->asXML());
@ -133,7 +147,7 @@ class ItemTest extends \XoopsUnit\TestCase
$nowString = date(DATE_RSS, $now); $nowString = date(DATE_RSS, $now);
$data = array( $data = array(
'title' => "日本語",
'title' => "Venice Film Festival",
'url' => 'http://nytimes.com/2004/12/07FEST.html', 'url' => 'http://nytimes.com/2004/12/07FEST.html',
'description' => "Some of the most heated chatter at the Venice Film Festival this week was about the way that the arrival of the stars at the Palazzo del Cinema was being staged.", 'description' => "Some of the most heated chatter at the Venice Film Festival this week was about the way that the arrival of the stars at the Palazzo del Cinema was being staged.",
); );


Loading…
Cancel
Save