Browse files

ZF2 2.0.0beta5/rc1 readiness

- s/events/getEventManager/ everywhere
- fixed validators -- message templates property is no longer prefixed
- PSR1/2 updates
- Proper escaping via new Escaper component
  • Loading branch information...
1 parent c2a3dc2 commit d81aad05ace3c53061642feb19b34e9274cf0260 @weierophinney weierophinney committed Jul 13, 2012
View
4 src/PhlyBlog/AuthorEntity.php
@@ -1,8 +1,8 @@
<?php
namespace PhlyBlog;
-use PhlyCommon\Entity as EntityDefinition,
- Zend\InputFilter\InputFilterInterface;
+use PhlyCommon\Entity as EntityDefinition;
+use Zend\InputFilter\InputFilterInterface;
class AuthorEntity implements EntityDefinition
{
View
11 src/PhlyBlog/Compiler.php
@@ -6,11 +6,8 @@
use Zend\EventManager\EventManagerAwareInterface;
use Zend\EventManager\EventManagerInterface;
use Zend\EventManager\EventManager;
-use Zend\EventManager\EventsCapableInterface;
-class Compiler implements
- EventManagerAwareInterface,
- EventsCapableInterface
+class Compiler implements EventManagerAwareInterface
{
protected $events;
protected $files;
@@ -30,7 +27,7 @@ public function setEventManager(EventManagerInterface $events)
return $this;
}
- public function events()
+ public function getEventManager()
{
if (!$this->events) {
$this->setEventManager(new EventManager());
@@ -80,11 +77,11 @@ public function compile()
$event->setEntry($entry);
$event->setDate($date);
- $this->events()->trigger('compile', $event);
+ $this->getEventManager()->trigger('compile', $event);
}
$event = new Compiler\Event();
$event->setTarget($this);
- $this->events()->trigger('compile.end', $event);
+ $this->getEventManager()->trigger('compile.end', $event);
}
}
View
1 src/PhlyBlog/Compiler/Listener/ByDate.php
@@ -66,4 +66,3 @@ public function createDayPages($template = null)
}
}
}
-
View
16 src/PhlyBlog/Compiler/PhpFileFilter.php
@@ -1,14 +1,14 @@
<?php
namespace PhlyBlog\Compiler;
-use DirectoryIterator,
- FilterIterator,
- InvalidArgumentException,
- Iterator,
- RecursiveDirectoryIterator,
- RecursiveIterator,
- RecursiveIteratorIterator,
- SplFileInfo;
+use DirectoryIterator;
+use FilterIterator;
+use InvalidArgumentException;
+use Iterator;
+use RecursiveDirectoryIterator;
+use RecursiveIterator;
+use RecursiveIteratorIterator;
+use SplFileInfo;
/**
* Usage:
View
1 src/PhlyBlog/Compiler/ResponseFile.php
@@ -15,4 +15,3 @@ public function getFilename()
return $this->filename;
}
}
-
View
4 src/PhlyBlog/Compiler/SortedEntries.php
@@ -1,8 +1,8 @@
<?php
namespace PhlyBlog\Compiler;
-use SplPriorityQueue,
- PhlyBlog\EntryEntity;
+use SplPriorityQueue;
+use PhlyBlog\EntryEntity;
class SortedEntries extends SplPriorityQueue
{
View
6 src/PhlyBlog/CompilerOptions.php
@@ -1,10 +1,10 @@
<?php
namespace PhlyBlog;
-use Zend\Stdlib\Options,
- Zend\Uri\UriFactory;
+use Zend\Stdlib\AbstractOptions;
+use Zend\Uri\UriFactory;
-class CompilerOptions extends Options
+class CompilerOptions extends AbstractOptions
{
protected $entryTemplate;
View
6 src/PhlyBlog/EntryEntity.php
@@ -1,9 +1,9 @@
<?php
namespace PhlyBlog;
-use PhlyCommon\Entity as EntityDefinition,
- PhlyCommon\Filter\Timestamp as TimestampFilter,
- Zend\InputFilter\InputFilterInterface;
+use PhlyCommon\Entity as EntityDefinition;
+use PhlyCommon\Filter\Timestamp as TimestampFilter;
+use Zend\InputFilter\InputFilterInterface;
class EntryEntity implements EntityDefinition
{
View
3 src/PhlyBlog/Filter/AuthorIsValid.php
@@ -11,7 +11,7 @@ class AuthorIsValid extends AbstractValidator
const INVALID_NAME_TOO_SHORT = 'authorNameTooShort';
const INVALID_TYPE = 'authorTypeInvalid';
- protected $_messageTemplates = array(
+ protected $messageTemplates = array(
self::INVALID_AUTHOR => 'Invalid author provided',
self::INVALID_NAME => 'Author name must be 1 alphabetic character followed by 0 or more alphanumeric, dash, or underscore characters',
self::INVALID_NAME_TOO_SHORT => 'Author name must be at least 1 character',
@@ -54,4 +54,3 @@ public function isValid($value)
return true;
}
}
-
View
4 src/PhlyBlog/Filter/EntryFilter.php
@@ -1,8 +1,8 @@
<?php
namespace PhlyBlog\Filter;
-use PhlyCommon\Filter\Timezone as TimezoneValidator,
- Zend\InputFilter\InputFilter;
+use PhlyCommon\Filter\Timezone as TimezoneValidator;
+use Zend\InputFilter\InputFilter;
class EntryFilter extends InputFilter
{
View
2 src/PhlyBlog/Filter/Tags.php
@@ -8,7 +8,7 @@ class Tags extends AbstractValidator
const INVALID_TAG = 'tagInvalid';
const INVALID_TAGS = 'tagsInvalid';
- protected $_messageTemplates = array(
+ protected $messageTemplates = array(
self::INVALID_TAG => 'Invalid tag provided; expected a string, received "%value%".',
self::INVALID_TAGS => 'Invalid tags provided; expected an array or string, received "%value%".',
);
View
2 src/PhlyBlog/Filter/Url.php
@@ -9,7 +9,7 @@ class Url extends AbstractValidator
{
const INVALID_URL = 'urlInvalid';
- protected $_messageTemplates = array(
+ protected $messageTemplates = array(
self::INVALID_URL => 'Invalid url provided; received "%value%".',
);
View
2 test/PhlyBlog/Compiler/Listener/ArchivesTest.php
@@ -9,7 +9,7 @@ public function setUp()
{
TestHelper::injectScaffolds($this);
$this->archives = new Archives($this->view, $this->writer, $this->file, $this->options);
- $this->compiler->events()->attach($this->archives);
+ $this->compiler->getEventManager()->attach($this->archives);
}
public function testCreatesNoFilesPriorToCompilation()
View
2 test/PhlyBlog/Compiler/Listener/AuthorsTest.php
@@ -9,7 +9,7 @@ public function setUp()
{
TestHelper::injectScaffolds($this);
$this->authors = new Authors($this->view, $this->writer, $this->file, $this->options);
- $this->compiler->events()->attach($this->authors);
+ $this->compiler->getEventManager()->attach($this->authors);
}
public function testCreatesNoFilesPriorToCompilation()
View
4 test/PhlyBlog/Compiler/Listener/ByDateTest.php
@@ -11,11 +11,11 @@ public function setUp()
{
TestHelper::injectScaffolds($this);
$this->byDate = new ByDate($this->view, $this->writer, $this->file, $this->options);
- $this->compiler->events()->attach($this->byDate);
+ $this->compiler->getEventManager()->attach($this->byDate);
$this->dates = array();
$self = $this;
- $this->compiler->events()->attach('compile', function($e) use ($self) {
+ $this->compiler->getEventManager()->attach('compile', function($e) use ($self) {
$entry = $e->getEntry();
if ($entry->isDraft() || !$entry->isPublic()) {
return;
View
4 test/PhlyBlog/Compiler/Listener/ByMonthTest.php
@@ -11,11 +11,11 @@ public function setUp()
{
TestHelper::injectScaffolds($this);
$this->byMonth = new ByMonth($this->view, $this->writer, $this->file, $this->options);
- $this->compiler->events()->attach($this->byMonth);
+ $this->compiler->getEventManager()->attach($this->byMonth);
$this->months = array();
$self = $this;
- $this->compiler->events()->attach('compile', function($e) use ($self) {
+ $this->compiler->getEventManager()->attach('compile', function($e) use ($self) {
$entry = $e->getEntry();
if ($entry->isDraft() || !$entry->isPublic()) {
return;
View
2 test/PhlyBlog/Compiler/Listener/ByYearTest.php
@@ -9,7 +9,7 @@ public function setUp()
{
TestHelper::injectScaffolds($this);
$this->byYear = new ByYear($this->view, $this->writer, $this->file, $this->options);
- $this->compiler->events()->attach($this->byYear);
+ $this->compiler->getEventManager()->attach($this->byYear);
}
public function testCreatesNoFilesPriorToCompilation()
View
2 test/PhlyBlog/Compiler/Listener/EntriesTest.php
@@ -9,7 +9,7 @@ public function setUp()
{
TestHelper::injectScaffolds($this);
$this->entries = new Entries($this->view, $this->file, $this->options);
- $this->compiler->events()->attach($this->entries);
+ $this->compiler->getEventManager()->attach($this->entries);
}
public function testCreatesNoFilesPriorToCompilation()
View
2 test/PhlyBlog/Compiler/Listener/TagsTest.php
@@ -9,7 +9,7 @@ public function setUp()
{
TestHelper::injectScaffolds($this);
$this->tags = new Tags($this->view, $this->writer, $this->file, $this->options);
- $this->compiler->events()->attach($this->tags);
+ $this->compiler->getEventManager()->attach($this->tags);
}
public function testCreatesNoFilesPriorToCompilation()
View
2 test/PhlyBlog/Compiler/ResponseStrategyTest.php
@@ -18,7 +18,7 @@ public function setUp()
public function testAddsResponseStrategyToView()
{
- $events = $this->view->events();
+ $events = $this->view->getEventManager();
$listeners = $events->getListeners('response');
$found = false;
foreach ($listeners as $listener) {
View
8 test/PhlyBlog/CompilerTest.php
@@ -26,7 +26,7 @@ public function testTriggersCompileEventForEachValidEntryFile()
$marker = new stdClass;
$marker->count = 0;
- $this->compiler->events()->attach('compile', function($e) use ($marker) {
+ $this->compiler->getEventManager()->attach('compile', function($e) use ($marker) {
$marker->count++;
});
@@ -38,7 +38,7 @@ public function testTriggersCompileEventForEachValidEntryFile()
public function testCompileEventPassesEntryAndDate()
{
$self = $this;
- $this->compiler->events()->attach('compile', function($e) use ($self) {
+ $this->compiler->getEventManager()->attach('compile', function($e) use ($self) {
$entry = $e->getEntry();
$self->assertInstanceOf('PhlyBlog\EntryEntity', $entry);
@@ -52,7 +52,7 @@ public function testCompileEndEventIsTriggeredExactlyOnce()
{
$marker = new stdClass;
$marker->count = 0;
- $this->compiler->events()->attach('compile.end', function($e) use ($marker) {
+ $this->compiler->getEventManager()->attach('compile.end', function($e) use ($marker) {
$marker->count++;
});
@@ -63,7 +63,7 @@ public function testCompileEndEventIsTriggeredExactlyOnce()
public function testCompileEndEventReceivesEmptyEntryAndDate()
{
$self = $this;
- $this->compiler->events()->attach('compile.end', function($e) use ($self) {
+ $this->compiler->getEventManager()->attach('compile.end', function($e) use ($self) {
$entry = $e->getEntry();
$date = $e->getDate();
$self->assertNull($entry);
View
2 view/phly-blog/entry-short.phtml
@@ -9,7 +9,7 @@ $ds = function($ts) use ($entry) {
};
$url = $this->plugin('url');
$entryUrl = $url('phly-blog/entry', array('id' => $entry->getId()));
-$title = $this->escape($entry->getTitle());
+$title = $this->escapeHtml($entry->getTitle());
?>
<aside class="entry meta">
<p class="date"><?php echo $ds($entry->getCreated()) ?></p>
View
2 view/phly-blog/entry.phtml
@@ -2,7 +2,7 @@
$entry = $this->entry;
$title = $entry->getTitle();
$this->headTitle()->prepend($title);
-$title = $this->escape($title);
+$title = $this->escapeHtml($title);
$url = $this->url('phly-blog/entry', array('id' => $entry->getId()));
$ds = function($ts) use ($entry) {
$tz = $entry->getTimezone();

0 comments on commit d81aad0

Please sign in to comment.