[ZF-10690] Zend_Validate_EmailAddress #83

Closed
wants to merge 6 commits into
from
@@ -36,7 +36,7 @@
<programlisting language="php"><![CDATA[
// Use the default blowfish settings
-$filter = new Zend_Filter_Decrypt('myencryptionkey');
+$filter = new Zend_Filter_Decrypt(array('key' => 'myencryptionkey'));
// Set the vector with which the content was encrypted
$filter->setVector('myvector');
@@ -155,7 +155,7 @@ $filter->setAdapter('openssl');
<programlisting language="php"><![CDATA[
// Use the default blowfish settings
-$filter = new Zend_Filter_Encrypt('myencryptionkey');
+$filter = new Zend_Filter_Encrypt(array('key' => 'myencryptionkey'));
// Set a own vector, otherwise you must call getVector()
// and store this vector for later decryption
@@ -97,7 +97,7 @@ public function __construct($options = null, $locale = null)
if (is_array($options)) {
$this->setLocale($locale);
$this->setFormat($options);
- } else if (Locale\Locale::isLocale($options, false, false)) {
+ } else if (Locale\Locale::isLocale($options, false)) {
$this->setLocale($options);
$options = $locale;
} else {
@@ -176,7 +176,7 @@ public function toCurrency($value = null, array $options = array())
$locale = $options['locale'];
if (empty($format)) {
$format = Data::getContent($locale, 'currencynumber');
- } else if (Locale\Locale::isLocale($format, true, false)) {
+ } else if (Locale\Locale::isLocale($format, true)) {
$locale = $format;
$format = Data::getContent($format, 'currencynumber');
}
@@ -298,14 +298,14 @@ private function _checkParams($currency = null, $locale = null)
{
// Manage the params
if ((empty($locale)) and (!empty($currency)) and
- (Locale\Locale::isLocale($currency, true, false))) {
+ (Locale\Locale::isLocale($currency, true))) {
$locale = $currency;
$currency = null;
}
// Validate the locale and get the country short name
$country = null;
- if ((Locale\Locale::isLocale($locale, true, false)) and (strlen($locale) > 4)) {
+ if ((Locale\Locale::isLocale($locale, true)) and (strlen($locale) > 4)) {
$country = substr($locale, (strpos($locale, '_') + 1));
} else {
throw new Exception\InvalidArgumentException("No region found within the locale '" . (string) $locale . "'");
@@ -830,7 +830,7 @@ protected function _checkOptions(array $options = array())
break;
case 'format':
- if ((empty($value) === false) and (Locale\Locale::isLocale($value, null, false) === false)) {
+ if ((empty($value) === false) and (Locale\Locale::isLocale($value) === false)) {
if (!is_string($value) || (strpos($value, '0') === false)) {
throw new Exception\InvalidArgumentException('\''
. ((gettype($value) === 'object') ? get_class($value) : $value)
View
@@ -154,11 +154,11 @@ public function __construct($date = null, $part = null, $locale = null)
}
if (($date !== null) and !is_array($date) and !($date instanceof TimeSync\Protocol) and
- !($date instanceof Date) and !defined($date) and Locale::isLocale($date, true, false)) {
+ !($date instanceof Date) and !defined($date) and Locale::isLocale($date, true)) {
$locale = $date;
$date = null;
$part = null;
- } else if (($part !== null) and !defined($part) and Locale::isLocale($part, true, false)) {
+ } else if (($part !== null) and !defined($part) and Locale::isLocale($part, true)) {
$locale = $part;
$part = null;
}
@@ -438,16 +438,16 @@ public function toString($format = null, $type = null, $locale = null)
}
}
- if (($format !== null) && !defined($format)
+ if (($format !== null) && !defined($format)
&& ($format != 'ee') && ($format != 'ss') && ($format != 'GG') && ($format != 'MM') && ($format != 'EE') && ($format != 'TT')
- && Locale::isLocale($format, null, false)
+ && Locale::isLocale($format)
) {
$locale = $format;
$format = null;
}
if (($type !== null) and ($type != 'php') and ($type != 'iso') and
- Locale::isLocale($type, null, false)) {
+ Locale::isLocale($type)) {
$locale = $type;
$type = null;
}
@@ -531,7 +531,7 @@ public function get($part = null, $locale = null)
if (($part !== null) && !defined($part)
&& ($part != 'ee') && ($part != 'ss') && ($part != 'GG') && ($part != 'MM') && ($part != 'EE') && ($part != 'TT')
- && Locale::isLocale($part, null, false)
+ && Locale::isLocale($part)
) {
$locale = $part;
$part = null;
@@ -1290,7 +1290,7 @@ private function _calculate($calc, $date, $part, $locale)
throw new Exception\RuntimeException('parameter $date must be set, null is not allowed');
}
- if (($part !== null) && (strlen($part) !== 2) && (Locale::isLocale($part, null, false))) {
+ if (($part !== null) && (strlen($part) !== 2) && (Locale::isLocale($part))) {
$locale = $part;
$part = null;
}
@@ -4649,7 +4649,7 @@ public static function isDate($date, $format = null, $locale = null)
}
if (($format !== null) && ($format != 'ee') && ($format != 'ss') && ($format != 'GG') && ($format != 'MM') && ($format != 'EE') && ($format != 'TT')
- && (Locale::isLocale($format, null, false))
+ && (Locale::isLocale($format))
) {
$locale = $format;
$format = null;
@@ -152,7 +152,7 @@ private static function _findRoute($locale, $path, $attribute, $value, &$temp)
$filename = __DIR__ . '/Data/resources/' . $locale . '.xml';
if (!file_exists($filename)) {
throw new Exception\InvalidArgumentException(
- "Missing locale file '$filename' for '$locale' locale."
+ "Missing locale file '$filename' for '$locale' locale."
);
}
@@ -282,9 +282,9 @@ private static function _checkLocale($locale)
$locale = new Locale();
}
- if (!(Locale::isLocale((string) $locale, null, false))) {
+ if (!(Locale::isLocale((string) $locale))) {
throw new Exception\InvalidArgumentException(
- "Locale (" . (string) $locale . ") is a unknown locale"
+ "Locale (" . (string) $locale . ") is a unknown locale"
);
}
@@ -901,7 +901,7 @@ public static function getList($locale, $path, $value = false)
default :
throw new Exception\InvalidArgumentException(
- "Unknown list ($path) for parsing locale data."
+ "Unknown list ($path) for parsing locale data."
);
break;
}
@@ -1401,7 +1401,7 @@ public static function getContent($locale, $path, $value = false)
default :
throw new Exception\InvalidArgumentException(
- "Unknown detail ($path) for parsing locale data."
+ "Unknown detail ($path) for parsing locale data."
);
break;
}
@@ -193,14 +193,6 @@ class Locale
const ENVIRONMENT = 'environment';
const ZFDEFAULT = 'default';
- /**
- * Defines if old behaviour should be supported
- * Old behaviour throws notices and will be deleted in future releases
- *
- * @var boolean
- */
- public static $compatibilityMode = false;
-
/**
* Internal variable
*
@@ -299,21 +291,6 @@ public function __toString()
*/
public static function getDefault()
{
- if ((self::$compatibilityMode === true) or (func_num_args() > 0)) {
- if (!self::$_breakChain) {
- self::$_breakChain = true;
- trigger_error('You are running Zend\\Locale in compatibility mode... please migrate your scripts', E_USER_NOTICE);
- $params = func_get_args();
- $param = null;
- if (isset($params[0])) {
- $param = $params[0];
- }
- return self::getOrder($param);
- }
-
- self::$_breakChain = false;
- }
-
return self::$_default;
}
@@ -812,10 +789,9 @@ private static function _prepareQuestionString($input)
*
* @param string|\Zend\Locale\Locale $locale Locale to check for
* @param boolean $strict (Optional) If true, no rerouting will be done when checking
- * @param boolean $compatible (DEPRECATED) Only for internal usage, brakes compatibility mode
* @return boolean If the locale is known dependend on the settings
*/
- public static function isLocale($locale, $strict = false, $compatible = true)
+ public static function isLocale($locale, $strict = false)
{
if (($locale instanceof Locale)
|| (is_string($locale) && array_key_exists($locale, self::$_localeData))
@@ -833,24 +809,12 @@ public static function isLocale($locale, $strict = false, $compatible = true)
return false;
}
- if (($compatible === true) and (self::$compatibilityMode === true)) {
- trigger_error('You are running Zend_Locale in compatibility mode... please migrate your scripts', E_USER_NOTICE);
- if (isset(self::$_localeData[$locale]) === true) {
- return $locale;
- } else if (!$strict) {
- $locale = explode('_', $locale);
- if (isset(self::$_localeData[$locale[0]]) === true) {
- return $locale[0];
- }
- }
- } else {
- if (isset(self::$_localeData[$locale]) === true) {
+ if (isset(self::$_localeData[$locale]) === true) {
+ return true;
+ } else if (!$strict) {
+ $locale = explode('_', $locale);
+ if (isset(self::$_localeData[$locale[0]]) === true) {
return true;
- } else if (!$strict) {
- $locale = explode('_', $locale);
- if (isset(self::$_localeData[$locale[0]]) === true) {
- return true;
- }
}
}
@@ -879,8 +843,8 @@ public static function findLocale($locale = null)
$locale = new Locale();
}
- if (!Locale::isLocale($locale, true, false)) {
- if (!Locale::isLocale($locale, false, false)) {
+ if (!Locale::isLocale($locale, true)) {
+ if (!Locale::isLocale($locale, false)) {
$locale = Locale::getLocaleToTerritory($locale);
if (empty($locale)) {
@@ -75,7 +75,7 @@
*/
public function __construct($value, $type = null, $locale = null)
{
- if (($type !== null) and (Locale\Locale::isLocale($type, null, false))) {
+ if (($type !== null) and (Locale\Locale::isLocale($type))) {
$locale = $type;
$type = null;
}
@@ -121,8 +121,8 @@ public function setLocale($locale = null, $check = false)
$locale = new Locale\Locale();
}
- if (!Locale\Locale::isLocale($locale, true, false)) {
- if (!Locale\Locale::isLocale($locale, false, false)) {
+ if (!Locale\Locale::isLocale($locale, true)) {
+ if (!Locale\Locale::isLocale($locale, false)) {
throw new Exception("Language (" . (string) $locale . ") is unknown");
}
@@ -170,7 +170,7 @@ public function getValue($round = -1, $locale = null)
*/
public function setValue($value, $type = null, $locale = null)
{
- if (($type !== null) and (Locale\Locale::isLocale($type, null, false))) {
+ if (($type !== null) and (Locale\Locale::isLocale($type))) {
$locale = $type;
$type = null;
}
@@ -145,7 +145,7 @@ class Number extends AbstractMeasure
*/
public function __construct($value, $type, $locale = null)
{
- if (($type !== null) and (Locale\Locale::isLocale($type, null, false))) {
+ if (($type !== null) and (Locale\Locale::isLocale($type))) {
$locale = $type;
$type = null;
}
@@ -154,8 +154,8 @@ public function __construct($value, $type, $locale = null)
$locale = new Locale\Locale();
}
- if (!Locale\Locale::isLocale($locale, true, false)) {
- if (!Locale\Locale::isLocale($locale, true, false)) {
+ if (!Locale\Locale::isLocale($locale, true)) {
+ if (!Locale\Locale::isLocale($locale, false)) {
throw new Exception("Language (" . (string) $locale . ") is unknown");
}
Oops, something went wrong.