|
@@ -43,7 +43,7 @@ class Zend_Filter_PregReplace implements Zend_Filter_Interface
|
|
|
* @var mixed
|
|
* @var mixed
|
|
|
*/
|
|
*/
|
|
|
protected $_replacement = '';
|
|
protected $_replacement = '';
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Is unicode enabled?
|
|
* Is unicode enabled?
|
|
|
*
|
|
*
|
|
@@ -61,10 +61,10 @@ class Zend_Filter_PregReplace implements Zend_Filter_Interface
|
|
|
if (self::$_unicodeSupportEnabled === null) {
|
|
if (self::$_unicodeSupportEnabled === null) {
|
|
|
self::_determineUnicodeSupport();
|
|
self::_determineUnicodeSupport();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return self::$_unicodeSupportEnabled;
|
|
return self::$_unicodeSupportEnabled;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Method to cache the regex needed to determine if unicode support is available
|
|
* Method to cache the regex needed to determine if unicode support is available
|
|
|
*
|
|
*
|
|
@@ -74,12 +74,12 @@ class Zend_Filter_PregReplace implements Zend_Filter_Interface
|
|
|
{
|
|
{
|
|
|
self::$_unicodeSupportEnabled = (@preg_match('/\pL/u', 'a')) ? true : false;
|
|
self::$_unicodeSupportEnabled = (@preg_match('/\pL/u', 'a')) ? true : false;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Constructor
|
|
* Constructor
|
|
|
- *
|
|
|
|
|
- * @param string $match
|
|
|
|
|
- * @param string $replace
|
|
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param string $match
|
|
|
|
|
+ * @param string $replace
|
|
|
* @return void
|
|
* @return void
|
|
|
*/
|
|
*/
|
|
|
public function __construct($matchPattern = null, $replacement = null)
|
|
public function __construct($matchPattern = null, $replacement = null)
|
|
@@ -87,12 +87,12 @@ class Zend_Filter_PregReplace implements Zend_Filter_Interface
|
|
|
if ($matchPattern) {
|
|
if ($matchPattern) {
|
|
|
$this->setMatchPattern($matchPattern);
|
|
$this->setMatchPattern($matchPattern);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if ($replacement) {
|
|
if ($replacement) {
|
|
|
$this->setReplacement($replacement);
|
|
$this->setReplacement($replacement);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Set the match pattern for the regex being called within filter()
|
|
* Set the match pattern for the regex being called within filter()
|
|
|
*
|
|
*
|
|
@@ -107,14 +107,14 @@ class Zend_Filter_PregReplace implements Zend_Filter_Interface
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Get currently set match pattern
|
|
* Get currently set match pattern
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* @return string
|
|
* @return string
|
|
|
*/
|
|
*/
|
|
|
public function getMatchPattern()
|
|
public function getMatchPattern()
|
|
|
{
|
|
{
|
|
|
return $this->_matchPattern;
|
|
return $this->_matchPattern;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Set the Replacement pattern/string for the preg_replace called in filter
|
|
* Set the Replacement pattern/string for the preg_replace called in filter
|
|
|
*
|
|
*
|
|
@@ -129,18 +129,18 @@ class Zend_Filter_PregReplace implements Zend_Filter_Interface
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Get currently set replacement value
|
|
* Get currently set replacement value
|
|
|
- *
|
|
|
|
|
|
|
+ *
|
|
|
* @return string
|
|
* @return string
|
|
|
*/
|
|
*/
|
|
|
public function getReplacement()
|
|
public function getReplacement()
|
|
|
{
|
|
{
|
|
|
return $this->_replacement;
|
|
return $this->_replacement;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Perform regexp replacement as filter
|
|
* Perform regexp replacement as filter
|
|
|
- *
|
|
|
|
|
- * @param string $value
|
|
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param string $value
|
|
|
* @return string
|
|
* @return string
|
|
|
*/
|
|
*/
|
|
|
public function filter($value)
|
|
public function filter($value)
|
|
@@ -149,8 +149,8 @@ class Zend_Filter_PregReplace implements Zend_Filter_Interface
|
|
|
require_once 'Zend/Filter/Exception.php';
|
|
require_once 'Zend/Filter/Exception.php';
|
|
|
throw new Zend_Filter_Exception(get_class($this) . ' does not have a valid MatchPattern set.');
|
|
throw new Zend_Filter_Exception(get_class($this) . ' does not have a valid MatchPattern set.');
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- return preg_replace($this->_matchPattern, $this->_replacement, $value);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ return preg_replace($this->_matchPattern, $this->_replacement, $value);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|