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

Commit

Permalink
Merge branch 'master' into ValidatorMessages
Browse files Browse the repository at this point in the history
  • Loading branch information
Matej Szendi committed Nov 4, 2013
153 parents 1b9fd60 + 8a8b989 + 10da323 + e6aba5a + b71d0a2 + 2aa926c + 8405746 + bf1a8de + f16339d + ed1dbc8 + dbf56da + bdb277e + 364ced3 + 9fccdf3 + 40f5963 + 9d7ddea + e1e4aa8 + 870703b + 958decf + e49a08e + a051e7e + b9f6e35 + 2bbef72 + aea30ce + faec0a2 + 098e166 + 51d6372 + 8757ace + 42477b6 + 32cf329 + 0ebadc5 + 188fa4d + a41bbf0 + a29bbbc + 941280d + d691226 + e547023 + d91c234 + 006ef75 + 69d1518 + 7dc0d1a + a995715 + e780008 + e810876 + 9e4090a + 269bf01 + 3a1f2fd + 0cab32d + 704cc7f + e20c9e6 + a0dfc1a + 76b3e1c + fd429e8 + 187ea79 + 2b43ea6 + e3b1be1 + 19f0ef6 + 33bf9c0 + 3729984 + a5ce396 + 698dbe0 + 0efca0b + 08b2a78 + ddaa846 + 7fe4493 + 0da7331 + 7226b1d + 851904c + a2eb795 + f658a03 + de83270 + 806df8a + 4e7ff23 + 409b768 + 1b97191 + d2649e3 + f0162d1 + 6f01416 + a2b3753 + 1786961 + d157fcb + 4444c37 + 192d20c + 811122b + 3a2cf9b + eb2029b + 7a6edab + 8d8a05d + c1ddf21 + 0090b4d + ef80e35 + 59b30de + 4656098 + 377b920 + ccba82c + 5d2770e + 41714a1 + 8adef43 + a78628f + b35fa7a + 3953c79 + aa28e42 + 38f9a49 + 47ed633 + 0a6bf6e + b61d89d + a1fbb6f + 238512b + f40a328 + 62dc143 + 328df3b + e12fe2d + e34a942 + 04e956d + a19a8c2 + ac4b6c0 + d28282e + bd5af3d + b976cb5 + 4feb67b + 7164be7 + 40174df + e4918ae + 1d9f9a2 + c77ae57 + 223b881 + c2f4e25 + e08b166 + e58e548 + 85e6bbd + 0ac2052 + c7ba6af + f443c57 + 1380626 + 5316b6e + a6136d4 + d233be3 + c100a2a + c6a0e2c + e7eef3c + 812f35d + 604cdcd + 5472285 + 6e2f420 + 6bc8c90 + 6ec1d0f + 53d9070 + fefc773 + 83cbc8a + 76c4d1c + c60cca9 + a67cdeb + 5d412ee commit 132380c
Show file tree
Hide file tree
Showing 86 changed files with 154 additions and 361 deletions.
12 changes: 8 additions & 4 deletions src/Helper/FlashMessenger.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@ public function render($namespace = PluginFlashMessenger::NAMESPACE_DEFAULT, arr

// Prepare classes for opening tag
if (empty($classes)) {
$classes = isset($this->classMessages[$namespace]) ?
$this->classMessages[$namespace] : $this->classMessages[PluginFlashMessenger::NAMESPACE_DEFAULT];
if (isset($this->classMessages[$namespace])) {
$classes = $this->classMessages[$namespace];
} else {
$classes = $this->classMessages[PluginFlashMessenger::NAMESPACE_DEFAULT];
}
$classes = array($classes);
}

Expand All @@ -118,10 +121,11 @@ public function render($namespace = PluginFlashMessenger::NAMESPACE_DEFAULT, arr
$translator = $this->getTranslator();
$translatorTextDomain = $this->getTranslatorTextDomain();

array_walk_recursive($messages, function($item) use (&$messagesToPrint, $escapeHtml, $translator, $translatorTextDomain) {
array_walk_recursive($messages, function ($item) use (&$messagesToPrint, $escapeHtml, $translator, $translatorTextDomain) {
if ($translator !== null) {
$item = $translator->translate(
$item, $translatorTextDomain
$item,
$translatorTextDomain
);
}
$messagesToPrint[] = $escapeHtml($item);
Expand Down
2 changes: 1 addition & 1 deletion src/Helper/Gravatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public function getDefaultImg()
public function setEmail($email)
{
$this->emailIsHashed = (bool) preg_match('/^[A-Za-z0-9]{32}$/', $email);
$this->email = $email;
$this->email = strtolower(trim($email));
return $this;
}

Expand Down
35 changes: 25 additions & 10 deletions src/Helper/HeadLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@
* Zend_Layout_View_Helper_HeadLink
*
* @see http://www.w3.org/TR/xhtml1/dtds.html
*
* Creates the following virtual methods:
* @method HeadLink appendStylesheet($href, $media, $conditionalStylesheet, $extras)
* @method HeadLink offsetSetStylesheet($index, $href, $media, $conditionalStylesheet, $extras)
* @method HeadLink prependStylesheet($href, $media, $conditionalStylesheet, $extras)
* @method HeadLink setStylesheet($href, $media, $conditionalStylesheet, $extras)
* @method HeadLink appendAlternate($href, $type, $title, $extras)
* @method HeadLink offsetSetAlternate($index, $href, $type, $title, $extras)
* @method HeadLink prependAlternate($href, $type, $title, $extras)
* @method HeadLink setAlternate($href, $type, $title, $extras)
*/
class HeadLink extends Placeholder\Container\AbstractStandalone
{
Expand Down Expand Up @@ -46,6 +56,21 @@ public function __construct()
$this->setSeparator(PHP_EOL);
}

/**
* Proxy to __invoke()
*
* Allows calling $helper->headLink(), but, more importantly, chaining calls
* like ->appendStylesheet()->headLink().
*
* @param array $attributes
* @param string $placement
* @return HeadLink
*/
public function headLink(array $attributes = null, $placement = Placeholder\Container\AbstractContainer::APPEND)
{
return call_user_func_array(array($this, '__invoke'), func_get_args());
}

/**
* headLink() - View Helper Method
*
Expand Down Expand Up @@ -80,16 +105,6 @@ public function __invoke(array $attributes = null, $placement = Placeholder\Cont
/**
* Overload method access
*
* Creates the following virtual methods:
* - appendStylesheet($href, $media, $conditionalStylesheet, $extras)
* - offsetSetStylesheet($index, $href, $media, $conditionalStylesheet, $extras)
* - prependStylesheet($href, $media, $conditionalStylesheet, $extras)
* - setStylesheet($href, $media, $conditionalStylesheet, $extras)
* - appendAlternate($href, $type, $title, $extras)
* - offsetSetAlternate($index, $href, $type, $title, $extras)
* - prependAlternate($href, $type, $title, $extras)
* - setAlternate($href, $type, $title, $extras)
*
* Items that may be added in the future:
* - Navigation? need to find docs on this
* - public function appendStart()
Expand Down
28 changes: 14 additions & 14 deletions src/Helper/HeadMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@
* Zend\View\Helper\HeadMeta
*
* @see http://www.w3.org/TR/xhtml1/dtds.html
*
* Allows the following 'virtual' methods:
* @method HeadMeta appendName($keyValue, $content, $modifiers = array())
* @method HeadMeta offsetGetName($index, $keyValue, $content, $modifiers = array())
* @method HeadMeta prependName($keyValue, $content, $modifiers = array())
* @method HeadMeta setName($keyValue, $content, $modifiers = array())
* @method HeadMeta appendHttpEquiv($keyValue, $content, $modifiers = array())
* @method HeadMeta offsetGetHttpEquiv($index, $keyValue, $content, $modifiers = array())
* @method HeadMeta prependHttpEquiv($keyValue, $content, $modifiers = array())
* @method HeadMeta setHttpEquiv($keyValue, $content, $modifiers = array())
* @method HeadMeta appendProperty($keyValue, $content, $modifiers = array())
* @method HeadMeta offsetGetProperty($index, $keyValue, $content, $modifiers = array())
* @method HeadMeta prependProperty($keyValue, $content, $modifiers = array())
* @method HeadMeta setProperty($keyValue, $content, $modifiers = array())
*/
class HeadMeta extends Placeholder\Container\AbstractStandalone
{
Expand Down Expand Up @@ -94,20 +108,6 @@ public function __invoke($content = null, $keyValue = null, $keyType = 'name', $
/**
* Overload method access
*
* Allows the following 'virtual' methods:
* - appendName($keyValue, $content, $modifiers = array())
* - offsetGetName($index, $keyValue, $content, $modifiers = array())
* - prependName($keyValue, $content, $modifiers = array())
* - setName($keyValue, $content, $modifiers = array())
* - appendHttpEquiv($keyValue, $content, $modifiers = array())
* - offsetGetHttpEquiv($index, $keyValue, $content, $modifiers = array())
* - prependHttpEquiv($keyValue, $content, $modifiers = array())
* - setHttpEquiv($keyValue, $content, $modifiers = array())
* - appendProperty($keyValue, $content, $modifiers = array())
* - offsetGetProperty($index, $keyValue, $content, $modifiers = array())
* - prependProperty($keyValue, $content, $modifiers = array())
* - setProperty($keyValue, $content, $modifiers = array())
*
* @param string $method
* @param array $args
* @throws Exception\BadMethodCallException
Expand Down
22 changes: 11 additions & 11 deletions src/Helper/HeadScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@

/**
* Helper for setting and retrieving script elements for HTML head section
*
* Allows the following method calls:
* @method HeadScript appendFile($src, $type = 'text/javascript', $attrs = array())
* @method HeadScript offsetSetFile($index, $src, $type = 'text/javascript', $attrs = array())
* @method HeadScript prependFile($src, $type = 'text/javascript', $attrs = array())
* @method HeadScript setFile($src, $type = 'text/javascript', $attrs = array())
* @method HeadScript appendScript($script, $type = 'text/javascript', $attrs = array())
* @method HeadScript offsetSetScript($index, $src, $type = 'text/javascript', $attrs = array())
* @method HeadScript prependScript($script, $type = 'text/javascript', $attrs = array())
* @method HeadScript setScript($script, $type = 'text/javascript', $attrs = array())
*/
class HeadScript extends Placeholder\Container\AbstractStandalone
{
Expand Down Expand Up @@ -115,7 +125,7 @@ public function __construct()
* @param string $type Script type and/or array of script attributes
* @return HeadScript
*/
public function __invoke($mode = HeadScript::FILE, $spec = null, $placement = 'APPEND', array $attrs = array(), $type = 'text/javascript')
public function __invoke($mode = self::FILE, $spec = null, $placement = 'APPEND', array $attrs = array(), $type = 'text/javascript')
{
if ((null !== $spec) && is_string($spec)) {
$action = ucfirst(strtolower($mode));
Expand All @@ -139,16 +149,6 @@ public function __invoke($mode = HeadScript::FILE, $spec = null, $placement = 'A
/**
* Overload method access
*
* Allows the following method calls:
* - appendFile($src, $type = 'text/javascript', $attrs = array())
* - offsetSetFile($index, $src, $type = 'text/javascript', $attrs = array())
* - prependFile($src, $type = 'text/javascript', $attrs = array())
* - setFile($src, $type = 'text/javascript', $attrs = array())
* - appendScript($script, $type = 'text/javascript', $attrs = array())
* - offsetSetScript($index, $src, $type = 'text/javascript', $attrs = array())
* - prependScript($script, $type = 'text/javascript', $attrs = array())
* - setScript($script, $type = 'text/javascript', $attrs = array())
*
* @param string $method Method to call
* @param array $args Arguments of method
* @throws Exception\BadMethodCallException if too few arguments or invalid method
Expand Down
12 changes: 6 additions & 6 deletions src/Helper/HeadStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@

/**
* Helper for setting and retrieving stylesheets
*
* Allows the following method calls:
* @method HeadStyle appendStyle($content, $attributes = array())
* @method HeadStyle offsetSetStyle($index, $content, $attributes = array())
* @method HeadStyle prependStyle($content, $attributes = array())
* @method HeadStyle setStyle($content, $attributes = array())
*/
class HeadStyle extends Placeholder\Container\AbstractStandalone
{
Expand Down Expand Up @@ -109,12 +115,6 @@ public function __invoke($content = null, $placement = 'APPEND', $attributes = a
/**
* Overload method calls
*
* Allows the following method calls:
* - appendStyle($content, $attributes = array())
* - offsetSetStyle($index, $content, $attributes = array())
* - prependStyle($content, $attributes = array())
* - setStyle($content, $attributes = array())
*
* @param string $method
* @param array $args
* @throws Exception\BadMethodCallException When no $content provided or invalid method
Expand Down
2 changes: 1 addition & 1 deletion src/Helper/InlineScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class InlineScript extends HeadScript
* @param string $type Script type and/or array of script attributes
* @return InlineScript
*/
public function __invoke($mode = HeadScript::FILE, $spec = null, $placement = 'APPEND', array $attrs = array(), $type = 'text/javascript')
public function __invoke($mode = self::FILE, $spec = null, $placement = 'APPEND', array $attrs = array(), $type = 'text/javascript')
{
return parent::__invoke($mode, $spec, $placement, $attrs, $type);
}
Expand Down
22 changes: 17 additions & 5 deletions src/Helper/Placeholder/Container/AbstractContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public function set($value)
* Prepend a value to the top of the container
*
* @param mixed $value
* @return void
* @return self
*/
public function prepend($value)
{
Expand All @@ -271,6 +271,18 @@ public function prepend($value)
return $this;
}

/**
* Append a value to the end of the container
*
* @param mixed $value
* @return self
*/
public function append($value)
{
parent::append($value);
return $this;
}

/**
* Next Index as defined by the PHP manual
*
Expand All @@ -291,7 +303,7 @@ public function nextIndex()
* optionally, if a number is passed, it will be the number of spaces
*
* @param string|int $indent
* @return AbstractContainer
* @return self
*/
public function setIndent($indent)
{
Expand All @@ -313,7 +325,7 @@ public function getIndent()
* Set postfix for __toString() serialization
*
* @param string $postfix
* @return AbstractContainer
* @return self
*/
public function setPostfix($postfix)
{
Expand All @@ -335,7 +347,7 @@ public function getPostfix()
* Set prefix for __toString() serialization
*
* @param string $prefix
* @return AbstractContainer
* @return self
*/
public function setPrefix($prefix)
{
Expand All @@ -359,7 +371,7 @@ public function getPrefix()
* Used to implode elements in container
*
* @param string $separator
* @return AbstractContainer
* @return self
*/
public function setSeparator($separator)
{
Expand Down
8 changes: 5 additions & 3 deletions src/HelperPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ class HelperPluginManager extends AbstractPluginManager
// basepath and url are not very useful without their factories, however the doctype
// helper works fine as an invokable. The factory for doctype simply checks for the
// config value from the merged config.
'doctype' => 'Zend\View\Helper\Doctype', // overridden by a factory in ViewHelperManagerFactory
'basepath' => 'Zend\View\Helper\BasePath',
'url' => 'Zend\View\Helper\Url',
'cycle' => 'Zend\View\Helper\Cycle',
'declarevars' => 'Zend\View\Helper\DeclareVars',
'doctype' => 'Zend\View\Helper\Doctype', // overridden by a factory in ViewHelperManagerFactory
'escapehtml' => 'Zend\View\Helper\EscapeHtml',
'escapehtmlattr' => 'Zend\View\Helper\EscapeHtmlAttr',
'escapejs' => 'Zend\View\Helper\EscapeJs',
Expand All @@ -73,6 +72,7 @@ class HelperPluginManager extends AbstractPluginManager
'renderchildmodel' => 'Zend\View\Helper\RenderChildModel',
'rendertoplaceholder' => 'Zend\View\Helper\RenderToPlaceholder',
'serverurl' => 'Zend\View\Helper\ServerUrl',
'url' => 'Zend\View\Helper\Url',
'viewmodel' => 'Zend\View\Helper\ViewModel',
);

Expand Down Expand Up @@ -145,7 +145,9 @@ public function injectTranslator($helper)
{
if ($helper instanceof TranslatorAwareInterface) {
$locator = $this->getServiceLocator();
if ($locator && $locator->has('translator')) {
if ($locator && $locator->has('MvcTranslator')) {
$helper->setTranslator($locator->get('MvcTranslator'));
} elseif ($locator && $locator->has('translator')) {
$helper->setTranslator($locator->get('translator'));
}
}
Expand Down
4 changes: 0 additions & 4 deletions test/Helper/AbstractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link https://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_View
*/

namespace ZendTest\View\Helper;
Expand All @@ -14,9 +13,6 @@
use ZendTest\View\Helper\TestAsset\ConcreteHelper;

/**
* @category Zend
* @package Zend_View
* @subpackage UnitTests
* @group Zend_View
* @group Zend_View_Helper
*/
Expand Down
4 changes: 0 additions & 4 deletions test/Helper/BasePathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link https://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_View
*/

namespace ZendTest\View\Helper;
Expand All @@ -14,9 +13,6 @@
use Zend\View\Helper\BasePath;

/**
* @category Zend
* @package Zend_View
* @subpackage UnitTests
* @group Zend_View
* @group Zend_View_Helper
*/
Expand Down
4 changes: 0 additions & 4 deletions test/Helper/CycleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link https://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_View
*/

namespace ZendTest\View\Helper;
Expand All @@ -15,9 +14,6 @@
/**
* Test class for Zend_View_Helper_Cycle.
*
* @category Zend
* @package Zend_View
* @subpackage UnitTests
* @group Zend_View
* @group Zend_View_Helper
*/
Expand Down
4 changes: 0 additions & 4 deletions test/Helper/DeclareVarsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link https://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_View
*/

namespace ZendTest\View\Helper;
Expand All @@ -14,9 +13,6 @@
use Zend\View\Helper\DeclareVars;

/**
* @category Zend
* @package Zend_View
* @subpackage UnitTests
* @group Zend_View
* @group Zend_View_Helper
*/
Expand Down
4 changes: 0 additions & 4 deletions test/Helper/DoctypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @link https://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_View
*/

namespace ZendTest\View\Helper;
Expand All @@ -15,9 +14,6 @@
/**
* Test class for Zend_View_Helper_Doctype.
*
* @category Zend
* @package Zend_View
* @subpackage UnitTests
* @group Zend_View
* @group Zend_View_Helper
*/
Expand Down
Loading

0 comments on commit 132380c

Please sign in to comment.