Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit d926c5a

Browse files
committed
Merging develop to master in preparation for 2.12.0 release.
2 parents 8e0eaf6 + 27e9b75 commit d926c5a

File tree

16 files changed

+143
-6
lines changed

16 files changed

+143
-6
lines changed

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,36 @@
22

33
All notable changes to this project will be documented in this file, in reverse chronological order by release.
44

5+
## 2.12.0 - 2019-03-05
6+
7+
### Added
8+
9+
- [#96](https://github.com/zendframework/zend-feed/pull/96) adds the methods `Zend\Feed\Reader\Extension\Podcast\Entry::getTitle() : string`
10+
and `Zend\Feed\Writer\Extension\ITunes\Entry::setTitle(string $value)`; these
11+
provide the ability to read and manipulate `<itunes:title>` tags in feeds.
12+
13+
### Changed
14+
15+
- Nothing.
16+
17+
### Deprecated
18+
19+
- [#101](https://github.com/zendframework/zend-feed/pull/101) deprecates the method `Zend\Feed\Writer\Writer::lcfirst()`; use the PHP
20+
built-in function instead.
21+
22+
- [#97](https://github.com/zendframework/zend-feed/pull/97) deprecates the classes `Zend\Feed\Reader\AbstractEntry` (use
23+
`Zend\Feed\Reader\Entry\AbstractEntry` instead), `Zend\Feed\Reader\AbstractFeed` (use `Zend\Feed\Reader\Feed\AbstractFeed` instead), and
24+
`Zend\Feed\Reader\Collection` (use Zend\Feed\Reader\Collection\Author`, `Zend\Feed\Reader\Collection\Category`, or
25+
`Zend\Feed\Reader\Collection\Collection` instead, based on context).
26+
27+
### Removed
28+
29+
- Nothing.
30+
31+
### Fixed
32+
33+
- Nothing.
34+
535
## 2.11.1 - 2019-03-05
636

737
### Added

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
},
5656
"extra": {
5757
"branch-alias": {
58-
"dev-master": "2.11.x-dev",
59-
"dev-develop": "2.12.x-dev"
58+
"dev-master": "2.12.x-dev",
59+
"dev-develop": "2.13.x-dev"
6060
}
6161
},
6262
"scripts": {

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Reader/AbstractEntry.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
use DOMElement;
1414
use DOMXPath;
1515

16+
/**
17+
* @deprecated This (abstract) class is deprecated. Use Zend\Feed\Reader\Entry\AbstractEntry instead.
18+
*/
1619
abstract class AbstractEntry
1720
{
1821
/**

src/Reader/AbstractFeed.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
use DOMElement;
1414
use DOMXPath;
1515

16+
/**
17+
* @deprecated This (abstract) class is deprecated. Use \Zend\Feed\Reader\Feed\AbstractFeed instead.
18+
*/
1619
abstract class AbstractFeed implements Feed\FeedInterface
1720
{
1821
/**

src/Reader/Collection.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
* Zend Framework (http://framework.zend.com/)
44
*
55
* @link http://github.com/zendframework/zf2 for the canonical source repository
6-
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
6+
* @copyright Copyright (c) 2005-2019 Zend Technologies USA Inc. (http://www.zend.com)
77
* @license http://framework.zend.com/license/new-bsd New BSD License
88
*/
99

1010
namespace Zend\Feed\Reader;
1111

1212
use ArrayObject;
1313

14+
/**
15+
* @deprecated This class is deprecated. Use the concrete collection classes
16+
* \Zend\Feed\Reader\Collection\Author and \Zend\Feed\Reader\Collection\Category
17+
* or the generic class \Zend\Feed\Reader\Collection\Collection instead.
18+
*/
1419
class Collection extends ArrayObject
1520
{
1621
}

src/Reader/Extension/Podcast/Entry.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,28 @@ public function getKeywords()
129129
return $this->data['keywords'];
130130
}
131131

132+
/**
133+
* Get the entry title
134+
*
135+
* @return string
136+
*/
137+
public function getTitle()
138+
{
139+
if (isset($this->data['title'])) {
140+
return $this->data['title'];
141+
}
142+
143+
$title = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:title)');
144+
145+
if (! $title) {
146+
$title = null;
147+
}
148+
149+
$this->data['title'] = $title;
150+
151+
return $this->data['title'];
152+
}
153+
132154
/**
133155
* Get the entry subtitle
134156
*

src/Writer/Extension/ITunes/Entry.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,23 @@ public function setItunesKeywords(array $value)
191191
return $this;
192192
}
193193

194+
/**
195+
* Set title
196+
*
197+
* @param string $value
198+
* @return Entry
199+
* @throws Writer\Exception\InvalidArgumentException
200+
*/
201+
public function setItunesTitle($value)
202+
{
203+
if ($this->stringWrapper->strlen($value) > 255) {
204+
throw new Writer\Exception\InvalidArgumentException('invalid parameter: "title" may only'
205+
. ' contain a maximum of 255 characters');
206+
}
207+
$this->data['title'] = $value;
208+
return $this;
209+
}
210+
194211
/**
195212
* Set subtitle
196213
*

src/Writer/Extension/ITunes/Renderer/Entry.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public function render()
3939
$this->_setImage($this->dom, $this->base);
4040
$this->_setExplicit($this->dom, $this->base);
4141
$this->_setKeywords($this->dom, $this->base);
42+
$this->_setTitle($this->dom, $this->base);
4243
$this->_setSubtitle($this->dom, $this->base);
4344
$this->_setSummary($this->dom, $this->base);
4445
$this->_setEpisode($this->dom, $this->base);
@@ -198,6 +199,28 @@ protected function _setKeywords(DOMDocument $dom, DOMElement $root)
198199
$this->called = true;
199200
}
200201

202+
/**
203+
* Set entry title
204+
*
205+
* @param DOMDocument $dom
206+
* @param DOMElement $root
207+
* @return void
208+
*/
209+
// @codingStandardsIgnoreStart
210+
protected function _setTitle(DOMDocument $dom, DOMElement $root)
211+
{
212+
// @codingStandardsIgnoreEnd
213+
$title = $this->getDataContainer()->getItunesTitle();
214+
if (! $title) {
215+
return;
216+
}
217+
$el = $dom->createElement('itunes:title');
218+
$text = $dom->createTextNode($title);
219+
$el->appendChild($text);
220+
$root->appendChild($el);
221+
$this->called = true;
222+
}
223+
201224
/**
202225
* Set entry subtitle
203226
*

src/Writer/Writer.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,15 @@ public static function registerCoreExtensions()
205205
);
206206
}
207207

208+
/**
209+
* @deprecated This method is deprecated and will be removed with version 3.0
210+
* Use PHP's lcfirst function instead. @see https://php.net/manual/function.lcfirst.php
211+
* @param string $str
212+
* @return string
213+
*/
208214
public static function lcfirst($str)
209215
{
210-
$str[0] = strtolower($str[0]);
211-
return $str;
216+
return lcfirst($str);
212217
}
213218

214219
/**

0 commit comments

Comments
 (0)