Permalink
Browse files

Merge branch 'hotfix/ZF2-508' of https://github.com/postalservice14/zf2

… into hotfix/zf2-508

Conflicts:
	README.md
  • Loading branch information...
2 parents c75b384 + 1abdada commit 97244a1032d1d129e3870d3a16f6a2dc26fb8a5f @weierophinney weierophinney committed Aug 31, 2012
View
@@ -4,15 +4,13 @@ Master: [![Build Status](https://secure.travis-ci.org/zendframework/zf2.png?bran
## RELEASE INFORMATION
-*Zend Framework 2.0.0rc7*
+*Zend Framework 2.0.1*
-This is the seventh release candidate for 2.0.0. At this time, we anticipate
-that this will be the final release candidate before issuing a stable release.
-We highly recommend testing your production applications against it.
+This is the first maintenance release for the 2.0 series.
-XX August 2012
+XX YYYY 2012
-### UPDATES IN RC7
+### UPDATES IN 2.0.1
- Zend\Di
- Fixes ArrayDefinition and ClassDefinition hasMethods() methods to return
@@ -33,6 +31,7 @@ XX August 2012
- Zend\View
- Breadcrumbs helper allows passing string container name now, allowing
multiple navigation containers.
+ - ServerUrl now works for servers behind proxies.
More than XX pull requests for a variety of features and bugfixes were handled
since RC6, as well as almost XX documentation changes!
@@ -42,6 +42,15 @@
);
/**
+ * Translatable attributes
+ *
+ * @var array
+ */
+ protected $translatableAttributes = array(
+ 'placeholder' => true
+ );
+
+ /**
* @var Doctype
*/
protected $doctypeHelper;
@@ -210,6 +219,16 @@ public function createAttributesString(array $attributes)
continue;
}
}
+
+ //check if attribute is translatable
+ if (isset($this->translatableAttributes[$key]) && !empty($value)) {
+ if (($translator = $this->getTranslator()) !== null) {
+ $value = $translator->translate(
+ $value, $this->getTranslatorTextDomain()
+ );
+ }
+ }
+
//@TODO Escape event attributes like AbstractHtmlElement view helper does in htmlAttribs ??
$strings[] = sprintf('%s="%s"', $escape($key), $escape($value));
}
@@ -35,48 +35,22 @@ class FormReset extends FormInput
);
/**
- * Determine input type to use
+ * Translatable attributes
*
- * @param ElementInterface $element
- * @return string
+ * @var array
*/
- protected function getType(ElementInterface $element)
- {
- return 'reset';
- }
+ protected $translatableAttributes = array(
+ 'value' => true
+ );
/**
- * Render a form <input> element from the provided $element
+ * Determine input type to use
*
* @param ElementInterface $element
* @return string
*/
- public function render(ElementInterface $element)
+ protected function getType(ElementInterface $element)
{
- $name = $element->getName();
- if ($name === null || $name === '') {
- throw new Exception\DomainException(sprintf(
- '%s requires that the element has an assigned name; none discovered',
- __METHOD__
- ));
- }
-
- $resetValue = $element->getValue();
- if (null !== ($translator = $this->getTranslator())) {
- $resetValue = $translator->translate(
- $resetValue, $this->getTranslatorTextDomain()
- );
- }
-
- $attributes = $element->getAttributes();
- $attributes['name'] = $name;
- $attributes['type'] = $this->getType($element);
- $attributes['value'] = $resetValue;
-
- return sprintf(
- '<input %s%s',
- $this->createAttributesString($attributes),
- $this->getInlineClosingBracket()
- );
+ return 'reset';
}
}
@@ -40,48 +40,22 @@ class FormSubmit extends FormInput
);
/**
- * Determine input type to use
+ * Translatable attributes
*
- * @param ElementInterface $element
- * @return string
+ * @var array
*/
- protected function getType(ElementInterface $element)
- {
- return 'submit';
- }
+ protected $translatableAttributes = array(
+ 'value' => true
+ );
/**
- * Render a form <input> element from the provided $element
+ * Determine input type to use
*
* @param ElementInterface $element
* @return string
*/
- public function render(ElementInterface $element)
+ protected function getType(ElementInterface $element)
{
- $name = $element->getName();
- if ($name === null || $name === '') {
- throw new Exception\DomainException(sprintf(
- '%s requires that the element has an assigned name; none discovered',
- __METHOD__
- ));
- }
-
- $submitValue = $element->getValue();
- if (null !== ($translator = $this->getTranslator())) {
- $submitValue = $translator->translate(
- $submitValue, $this->getTranslatorTextDomain()
- );
- }
-
- $attributes = $element->getAttributes();
- $attributes['name'] = $name;
- $attributes['type'] = $this->getType($element);
- $attributes['value'] = $submitValue;
-
- return sprintf(
- '<input %s%s',
- $this->createAttributesString($attributes),
- $this->getInlineClosingBracket()
- );
+ return 'submit';
}
}
@@ -35,7 +35,7 @@ class PostCode extends AbstractValidator
self::INVALID => "Invalid type given. String or integer expected",
self::NO_MATCH => "The input does not appear to be a postal code",
self::SERVICE => "The input does not appear to be a postal code",
- self::SERVICEFAILURE => "An exception has been raised while validating the input.",
+ self::SERVICEFAILURE => "An exception has been raised while validating the input",
);
/**
@@ -58,31 +58,28 @@ public function extract($object)
};
$attributes = array();
$methods = get_class_methods($object);
+
foreach ($methods as $method) {
- if (preg_match('/^get[A-Z]\w*/', $method)) {
+ if (!preg_match('/^(get|has|is)[A-Z]\w*/', $method)) {
+ continue;
+ }
+ if (preg_match('/^get/', $method)) {
// setter verification
$setter = preg_replace('/^get/', 'set', $method);
- if (!in_array($setter, $methods)) {
- continue;
- }
$attribute = substr($method, 3);
$attribute = lcfirst($attribute);
- if ($this->underscoreSeparatedKeys) {
- $attribute = preg_replace_callback('/([A-Z])/', $transform, $attribute);
- }
- $attributes[$attribute] = $this->extractValue($attribute, $object->$method());
- } elseif (preg_match('/^is[A-Z]\w*/', $method)) {
+ } else {
// setter verification
$setter = 'set' . ucfirst($method);
- if (!in_array($setter, $methods)) {
- continue;
- }
$attribute = $method;
- if ($this->underscoreSeparatedKeys) {
- $attribute = preg_replace_callback('/([A-Z])/', $transform, $attribute);
- }
- $attributes[$attribute] = $this->extractValue($attribute, $object->$method());
}
+ if (!in_array($setter, $methods)) {
+ continue;
+ }
+ if ($this->underscoreSeparatedKeys) {
+ $attribute = preg_replace_callback('/([A-Z])/', $transform, $attribute);
+ }
+ $attributes[$attribute] = $this->extractValue($attribute, $object->$method());
}
return $attributes;
@@ -57,7 +57,7 @@ class CreditCard extends AbstractValidator
self::LENGTH => "The input contains an invalid amount of digits",
self::PREFIX => "The input is not from an allowed institute",
self::SERVICE => "The input seems to be an invalid creditcard number",
- self::SERVICEFAILURE => "An exception has been raised while validating the input.",
+ self::SERVICEFAILURE => "An exception has been raised while validating the input",
);
/**
@@ -34,7 +34,7 @@ class DateStep extends AbstractValidator
protected $messageTemplates = array(
self::INVALID => "Invalid type given. String, integer, array or DateTime expected",
self::INVALID_DATE => "The input does not appear to be a valid date",
- self::NOT_STEP => "The input is not a valid step."
+ self::NOT_STEP => "The input is not a valid step"
);
/**
@@ -25,8 +25,8 @@ class Step extends AbstractValidator
* @var array
*/
protected $messageTemplates = array(
- self::INVALID => "Invalid value given. Scalar expected.",
- self::NOT_STEP => "The input is not a valid step."
+ self::INVALID => "Invalid value given. Scalar expected",
+ self::NOT_STEP => "The input is not a valid step"
);
/**
@@ -50,7 +50,14 @@ public function __construct()
}
$this->setScheme($scheme);
- if (isset($_SERVER['HTTP_HOST']) && !empty($_SERVER['HTTP_HOST'])) {
+ if (isset($_SERVER['HTTP_X_FORWARDED_HOST']) && !empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
+ $host = $_SERVER['HTTP_X_FORWARDED_HOST'];
+ if (strpos($host, ',') !== false) {
+ $hosts = explode(',', $host);
+ $host = trim(array_pop($hosts));
+ }
+ $this->setHost($host);
+ } elseif (isset($_SERVER['HTTP_HOST']) && !empty($_SERVER['HTTP_HOST'])) {
$this->setHost($_SERVER['HTTP_HOST']);
} elseif (isset($_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'])) {
$name = $_SERVER['SERVER_NAME'];
@@ -23,13 +23,13 @@
* EN-Revision: 30.Jul.2011
*/
return array(
+ // Zend_Captcha_AbstractWord
+ "Empty captcha value" => "Hodnota captcha nebyla zadána",
+ "Captcha ID field is missing" => "Chybí pole captcha ID",
+ "Captcha value is wrong" => "Chybná hodnota catpcha",
+
// Zend_Captcha_ReCaptcha
"Missing captcha fields" => "Chybí captcha pole",
"Failed to validate captcha" => "Captchu se nepodařilo ověřit",
"Captcha value is wrong: %value%" => "Hodnota captchy není správná: %value%",
-
- // Zend_Captcha_Word
- "Empty captcha value" => "Hodnota captcha nebyla zadána",
- "Captcha ID field is missing" => "Chybí pole captcha ID",
- "Captcha value is wrong" => "Chybná hodnota catpcha",
);
Oops, something went wrong.

0 comments on commit 97244a1

Please sign in to comment.