Current File : /home/k/a/r/karenpetzb/www/items/category/Filter.zip |
PK �G[��"�
�
Compression/Flate.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_Filter_Compression */
require_once 'Zend/Pdf/Filter/Compression.php';
/**
* Flate stream filter
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Filter_Compression_Flate extends Zend_Pdf_Filter_Compression
{
/**
* Encode data
*
* @param string $data
* @param array $params
* @return string
* @throws Zend_Pdf_Exception
*/
public static function encode($data, $params = null)
{
if ($params != null) {
$data = self::_applyEncodeParams($data, $params);
}
if (extension_loaded('zlib')) {
$trackErrors = ini_get( "track_errors");
ini_set('track_errors', '1');
if (($output = @gzcompress($data)) === false) {
ini_set('track_errors', $trackErrors);
throw new Zend_Pdf_Exception($php_errormsg);
}
ini_set('track_errors', $trackErrors);
} else {
throw new Zend_Pdf_Exception('Not implemented yet. You have to use zlib extension.');
}
return $output;
}
/**
* Decode data
*
* @param string $data
* @param array $params
* @return string
* @throws Zend_Pdf_Exception
*/
public static function decode($data, $params = null)
{
global $php_errormsg;
if (extension_loaded('zlib')) {
$trackErrors = ini_get( "track_errors");
ini_set('track_errors', '1');
if (($output = @gzuncompress($data)) === false) {
ini_set('track_errors', $trackErrors);
throw new Zend_Pdf_Exception($php_errormsg);
}
ini_set('track_errors', $trackErrors);
} else {
throw new Zend_Pdf_Exception('Not implemented yet');
}
if ($params !== null) {
return self::_applyDecodeParams($output, $params);
} else {
return $output;
}
}
}
PK �G[F;�� � Compression/Lzw.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_Filter_Compression */
require_once 'Zend/Pdf/Filter/Compression.php';
/**
* LZW stream filter
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Filter_Compression_Lzw extends Zend_Pdf_Filter_Compression
{
/**
* Get EarlyChange decode param value
*
* @param array $params
* @return integer
* @throws Zend_Pdf_Exception
*/
private static function _getEarlyChangeValue($params)
{
if (isset($params['EarlyChange'])) {
$earlyChange = $params['EarlyChange'];
if ($earlyChange != 0 && $earlyChange != 1) {
throw new Zend_Pdf_Exception('Invalid value of \'EarlyChange\' decode param - ' . $earlyChange . '.' );
}
return $earlyChange;
} else {
return 1;
}
}
/**
* Encode data
*
* @param string $data
* @param array $params
* @return string
* @throws Zend_Pdf_Exception
*/
public static function encode($data, $params = null)
{
if ($params != null) {
$data = self::_applyEncodeParams($data, $params);
}
throw new Zend_Pdf_Exception('Not implemented yet');
}
/**
* Decode data
*
* @param string $data
* @param array $params
* @return string
* @throws Zend_Pdf_Exception
*/
public static function decode($data, $params = null)
{
throw new Zend_Pdf_Exception('Not implemented yet');
if ($params !== null) {
return self::_applyDecodeParams($data, $params);
} else {
return $data;
}
}
}
PK �G[�L`� � AsciiHex.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_Filter_Interface */
require_once 'Zend/Pdf/Filter/Interface.php';
/**
* AsciiHex stream filter
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Filter_AsciiHex implements Zend_Pdf_Filter_Interface
{
/**
* Encode data
*
* @param string $data
* @param array $params
* @return string
* @throws Zend_Pdf_Exception
*/
public static function encode($data, $params = null)
{
return bin2hex($data) . '>';
}
/**
* Decode data
*
* @param string $data
* @param array $params
* @return string
* @throws Zend_Pdf_Exception
*/
public static function decode($data, $params = null)
{
$output = '';
$oddCode = true;
$commentMode = false;
for ($count = 0; $count < strlen($data) && $data[$count] != '>'; $count++) {
$charCode = ord($data[$count]);
if ($commentMode) {
if ($charCode == 0x0A || $charCode == 0x0D ) {
$commentMode = false;
}
continue;
}
switch ($charCode) {
//Skip white space
case 0x00: // null character
// fall through to next case
case 0x09: // Tab
// fall through to next case
case 0x0A: // Line feed
// fall through to next case
case 0x0C: // Form Feed
// fall through to next case
case 0x0D: // Carriage return
// fall through to next case
case 0x20: // Space
// Do nothing
break;
case 0x25: // '%'
// Switch to comment mode
$commentMode = true;
break;
default:
if ($charCode >= 0x30 /*'0'*/ && $charCode <= 0x39 /*'9'*/) {
$code = $charCode - 0x30;
} else if ($charCode >= 0x41 /*'A'*/ && $charCode <= 0x46 /*'F'*/) {
$code = $charCode - 0x37/*0x41 - 0x0A*/;
} else if ($charCode >= 0x61 /*'a'*/ && $charCode <= 0x66 /*'f'*/) {
$code = $charCode - 0x57/*0x61 - 0x0A*/;
} else {
throw new Zend_Pdf_Exception('Wrong character in a encoded stream');
}
if ($oddCode) {
// Odd pass. Store hex digit for next pass
// Scope of $hexCodeHigh variable is whole function
$hexCodeHigh = $code;
} else {
// Even pass.
// Add decoded character to the output
// ($hexCodeHigh is stored in previous pass)
$output .= chr($hexCodeHigh*16 + $code);
}
$oddCode = !$oddCode;
break;
}
}
/* Check that stream is terminated by End Of Data marker */
if ($data[$count] != '>') {
throw new Zend_Pdf_Exception('Wrong encoded stream End Of Data marker.');
}
/* Last '0' character is omitted */
if (!$oddCode) {
$output .= chr($hexCodeHigh*16);
}
return $output;
}
}
PK �G[`���B B Ascii85.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_Filter_Interface */
require_once 'Zend/Pdf/Filter/Interface.php';
/**
* ASCII85 stream filter
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Filter_Ascii85 implements Zend_Pdf_Filter_Interface
{
/**
* Encode data
*
* @param string $data
* @param array $params
* @return string
* @throws Zend_Pdf_Exception
*/
public static function encode($data, $params = null)
{
throw new Zend_Pdf_Exception('Not implemented yet');
}
/**
* Decode data
*
* @param string $data
* @param array $params
* @return string
* @throws Zend_Pdf_Exception
*/
public static function decode($data, $params = null)
{
throw new Zend_Pdf_Exception('Not implemented yet');
}
}
PK �G[gC��/ /
Interface.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Log
* @subpackage Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Interface.php 8064 2008-02-16 10:58:39Z thomas $
*/
/**
* @category Zend
* @package Zend_Log
* @subpackage Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Interface.php 8064 2008-02-16 10:58:39Z thomas $
*/
interface Zend_Log_Filter_Interface
{
/**
* Returns TRUE to accept the message, FALSE to block it.
*
* @param array $event event data
* @return boolean accepted?
*/
public function accept($event);
}
PK �G[���h�: �: Compression.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_Filter_Interface */
require_once 'Zend/Pdf/Filter/Interface.php';
/**
* ASCII85 stream filter
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_Filter_Compression implements Zend_Pdf_Filter_Interface
{
/**
* Paeth prediction function
*
* @param integer $a
* @param integer $b
* @param integer $c
* @return integer
*/
private static function _paeth($a, $b, $c)
{
// $a - left, $b - above, $c - upper left
$p = $a + $b - $c; // initial estimate
$pa = abs($p - $a); // distances to a, b, c
$pb = abs($p - $b);
$pc = abs($p - $c);
// return nearest of a,b,c,
// breaking ties in order a,b,c.
if ($pa <= $pb && $pa <= $pc) {
return $a;
} else if ($pb <= $pc) {
return $b;
} else {
return $c;
}
}
/**
* Get Predictor decode param value
*
* @param array $params
* @return integer
* @throws Zend_Pdf_Exception
*/
private static function _getPredictorValue(&$params)
{
if (isset($params['Predictor'])) {
$predictor = $params['Predictor'];
if ($predictor != 1 && $predictor != 2 &&
$predictor != 10 && $predictor != 11 && $predictor != 12 &&
$predictor != 13 && $predictor != 14 && $predictor != 15) {
throw new Zend_Pdf_Exception('Invalid value of \'Predictor\' decode param - ' . $predictor . '.' );
}
return $predictor;
} else {
return 1;
}
}
/**
* Get Colors decode param value
*
* @param array $params
* @return integer
* @throws Zend_Pdf_Exception
*/
private static function _getColorsValue(&$params)
{
if (isset($params['Colors'])) {
$colors = $params['Colors'];
if ($colors != 1 && $colors != 2 && $colors != 3 && $colors != 4) {
throw new Zend_Pdf_Exception('Invalid value of \'Color\' decode param - ' . $colors . '.' );
}
return $colors;
} else {
return 1;
}
}
/**
* Get BitsPerComponent decode param value
*
* @param array $params
* @return integer
* @throws Zend_Pdf_Exception
*/
private static function _getBitsPerComponentValue(&$params)
{
if (isset($params['BitsPerComponent'])) {
$bitsPerComponent = $params['BitsPerComponent'];
if ($bitsPerComponent != 1 && $bitsPerComponent != 2 &&
$bitsPerComponent != 4 && $bitsPerComponent != 8 &&
$bitsPerComponent != 16 ) {
throw new Zend_Pdf_Exception('Invalid value of \'BitsPerComponent\' decode param - ' . $bitsPerComponent . '.' );
}
return $bitsPerComponent;
} else {
return 8;
}
}
/**
* Get Columns decode param value
*
* @param array $params
* @return integer
*/
private static function _getColumnsValue(&$params)
{
if (isset($params['Columns'])) {
return $params['Columns'];
} else {
return 1;
}
}
/**
* Convert stream data according to the filter params set before encoding.
*
* @param string $data
* @param array $params
* @return string
* @throws Zend_Pdf_Exception
*/
protected static function _applyEncodeParams($data, $params) {
$predictor = self::_getPredictorValue($params);
$colors = self::_getColorsValue($params);
$bitsPerComponent = self::_getBitsPerComponentValue($params);
$columns = self::_getColumnsValue($params);
/** None of prediction */
if ($predictor == 1) {
return $data;
}
/** TIFF Predictor 2 */
if ($predictor == 2) {
throw new Zend_Pdf_Exception('Not implemented yet' );
}
/** Optimal PNG prediction */
if ($predictor == 15) {
/** Use Paeth prediction as optimal */
$predictor = 14;
}
/** PNG prediction */
if ($predictor == 10 || /** None of prediction */
$predictor == 11 || /** Sub prediction */
$predictor == 12 || /** Up prediction */
$predictor == 13 || /** Average prediction */
$predictor == 14 /** Paeth prediction */
) {
$predictor -= 10;
if($bitsPerComponent == 16) {
throw new Zend_Pdf_Exception("PNG Prediction with bit depth greater than 8 not yet supported.");
}
$bitsPerSample = $bitsPerComponent*$colors;
$bytesPerSample = (int)(($bitsPerSample + 7)/8); // (int)ceil(...) emulation
$bytesPerRow = (int)(($bitsPerSample*$columns + 7)/8); // (int)ceil(...) emulation
$rows = strlen($data)/$bytesPerRow;
$output = '';
$offset = 0;
if (!is_integer($rows)) {
throw new Zend_Pdf_Exception('Wrong data length.');
}
switch ($predictor) {
case 0: // None of prediction
for ($count = 0; $count < $rows; $count++) {
$output .= chr($predictor);
$output .= substr($data, $offset, $bytesPerRow);
$offset += $bytesPerRow;
}
break;
case 1: // Sub prediction
for ($count = 0; $count < $rows; $count++) {
$output .= chr($predictor);
$lastSample = array_fill(0, $bytesPerSample, 0);
for ($count2 = 0; $count2 < $bytesPerRow; $count2++) {
$newByte = ord($data[$offset++]);
// Note. chr() automatically cuts input to 8 bit
$output .= chr($newByte - $lastSample[$count2 % $bytesPerSample]);
$lastSample[$count2 % $bytesPerSample] = $newByte;
}
}
break;
case 2: // Up prediction
$lastRow = array_fill(0, $bytesPerRow, 0);
for ($count = 0; $count < $rows; $count++) {
$output .= chr($predictor);
for ($count2 = 0; $count2 < $bytesPerRow; $count2++) {
$newByte = ord($data[$offset++]);
// Note. chr() automatically cuts input to 8 bit
$output .= chr($newByte - $lastRow[$count2]);
$lastRow[$count2] = $newByte;
}
}
break;
case 3: // Average prediction
$lastRow = array_fill(0, $bytesPerRow, 0);
for ($count = 0; $count < $rows; $count++) {
$output .= chr($predictor);
$lastSample = array_fill(0, $bytesPerSample, 0);
for ($count2 = 0; $count2 < $bytesPerRow; $count2++) {
$newByte = ord($data[$offset++]);
// Note. chr() automatically cuts input to 8 bit
$output .= chr($newByte - floor(( $lastSample[$count2 % $bytesPerSample] + $lastRow[$count2])/2));
$lastSample[$count2 % $bytesPerSample] = $lastRow[$count2] = $newByte;
}
}
break;
case 4: // Paeth prediction
$lastRow = array_fill(0, $bytesPerRow, 0);
$currentRow = array();
for ($count = 0; $count < $rows; $count++) {
$output .= chr($predictor);
$lastSample = array_fill(0, $bytesPerSample, 0);
for ($count2 = 0; $count2 < $bytesPerRow; $count2++) {
$newByte = ord($data[$offset++]);
// Note. chr() automatically cuts input to 8 bit
$output .= chr($newByte - self::_paeth( $lastSample[$count2 % $bytesPerSample],
$lastRow[$count2],
($count2 - $bytesPerSample < 0)?
0 : $lastRow[$count2 - $bytesPerSample] ));
$lastSample[$count2 % $bytesPerSample] = $currentRow[$count2] = $newByte;
}
$lastRow = $currentRow;
}
break;
}
return $output;
}
throw new Zend_Pdf_Exception('Unknown prediction algorithm - ' . $predictor . '.' );
}
/**
* Convert stream data according to the filter params set after decoding.
*
* @param string $data
* @param array $params
* @return string
*/
protected static function _applyDecodeParams($data, $params) {
$predictor = self::_getPredictorValue($params);
$colors = self::_getColorsValue($params);
$bitsPerComponent = self::_getBitsPerComponentValue($params);
$columns = self::_getColumnsValue($params);
/** None of prediction */
if ($predictor == 1) {
return $data;
}
/** TIFF Predictor 2 */
if ($predictor == 2) {
throw new Zend_Pdf_Exception('Not implemented yet' );
}
/**
* PNG prediction
* Prediction code is duplicated on each row.
* Thus all cases can be brought to one
*/
if ($predictor == 10 || /** None of prediction */
$predictor == 11 || /** Sub prediction */
$predictor == 12 || /** Up prediction */
$predictor == 13 || /** Average prediction */
$predictor == 14 || /** Paeth prediction */
$predictor == 15 /** Optimal prediction */) {
$bitsPerSample = $bitsPerComponent*$colors;
$bytesPerSample = ceil($bitsPerSample/8);
$bytesPerRow = ceil($bitsPerSample*$columns/8);
$rows = ceil(strlen($data)/($bytesPerRow + 1));
$output = '';
$offset = 0;
$lastRow = array_fill(0, $bytesPerRow, 0);
for ($count = 0; $count < $rows; $count++) {
$lastSample = array_fill(0, $bytesPerSample, 0);
switch (ord($data[$offset++])) {
case 0: // None of prediction
$output .= substr($data, $offset, $bytesPerRow);
for ($count2 = 0; $count2 < $bytesPerRow && $offset < strlen($data); $count2++) {
$lastSample[$count2 % $bytesPerSample] = $lastRow[$count2] = ord($data[$offset++]);
}
break;
case 1: // Sub prediction
for ($count2 = 0; $count2 < $bytesPerRow && $offset < strlen($data); $count2++) {
$decodedByte = (ord($data[$offset++]) + $lastSample[$count2 % $bytesPerSample]) & 0xFF;
$lastSample[$count2 % $bytesPerSample] = $lastRow[$count2] = $decodedByte;
$output .= chr($decodedByte);
}
break;
case 2: // Up prediction
for ($count2 = 0; $count2 < $bytesPerRow && $offset < strlen($data); $count2++) {
$decodedByte = (ord($data[$offset++]) + $lastRow[$count2]) & 0xFF;
$lastSample[$count2 % $bytesPerSample] = $lastRow[$count2] = $decodedByte;
$output .= chr($decodedByte);
}
break;
case 3: // Average prediction
for ($count2 = 0; $count2 < $bytesPerRow && $offset < strlen($data); $count2++) {
$decodedByte = (ord($data[$offset++]) +
floor(( $lastSample[$count2 % $bytesPerSample] + $lastRow[$count2])/2)
) & 0xFF;
$lastSample[$count2 % $bytesPerSample] = $lastRow[$count2] = $decodedByte;
$output .= chr($decodedByte);
}
break;
case 4: // Paeth prediction
$currentRow = array();
for ($count2 = 0; $count2 < $bytesPerRow && $offset < strlen($data); $count2++) {
$decodedByte = (ord($data[$offset++]) +
self::_paeth($lastSample[$count2 % $bytesPerSample],
$lastRow[$count2],
($count2 - $bytesPerSample < 0)?
0 : $lastRow[$count2 - $bytesPerSample])
) & 0xFF;
$lastSample[$count2 % $bytesPerSample] = $currentRow[$count2] = $decodedByte;
$output .= chr($decodedByte);
}
$lastRow = $currentRow;
break;
default:
throw new Zend_Pdf_Exception('Unknown prediction tag.');
}
}
return $output;
}
throw new Zend_Pdf_Exception('Unknown prediction algorithm - ' . $predictor . '.' );
}
}
PK (�G[%� �� � Word/SeparatorToDash.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: CamelCaseToUnderscore.php 6779 2007-11-08 15:10:41Z matthew $
*/
/**
* @see Zend_Filter_SeperatorToSeparator
*/
require_once 'Zend/Filter/Word/SeparatorToSeparator.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Word_SeparatorToDash extends Zend_Filter_Word_SeparatorToSeparator
{
/**
* Constructor
*
* @param string $searchSeparator Seperator to search for change
* @return void
*/
public function __construct($searchSeparator = ' ')
{
parent::__construct($searchSeparator, '-');
}
}PK (�G[=�> > Word/SeparatorToCamelCase.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: CamelCaseToSeparator.php 6779 2007-11-08 15:10:41Z matthew $
*/
/**
* @see Zend_Filter_PregReplace
*/
require_once 'Zend/Filter/Word/Separator/Abstract.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Word_SeparatorToCamelCase extends Zend_Filter_Word_Separator_Abstract
{
public function filter($value)
{
// a unicode safe way of converting characters to \x00\x00 notation
$pregQuotedSeparator = preg_quote($this->_separator, '#');
if (self::isUnicodeSupportEnabled()) {
parent::setMatchPattern(array('#('.$pregQuotedSeparator.')(\p{L}{1})#e','#(^\p{Ll}{1})#e'));
parent::setReplacement(array("strtoupper('\\2')","strtoupper('\\1')"));
} else {
parent::setMatchPattern(array('#('.$pregQuotedSeparator.')([A-Z]{1})#e','#(^[a-z]{1})#e'));
parent::setReplacement(array("strtoupper('\\2')","strtoupper('\\1')"));
}
return parent::filter($value);
}
}
PK (�G[
��X X Word/DashToUnderscore.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: CamelCaseToSeparator.php 6779 2007-11-08 15:10:41Z matthew $
*/
/**
* @see Zend_Filter_PregReplace
*/
require_once 'Zend/Filter/Word/SeparatorToSeparator.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Word_DashToUnderscore extends Zend_Filter_Word_SeparatorToSeparator
{
/**
* Constructor
*
* @param string $separator Space by default
* @return void
*/
public function __construct()
{
parent::__construct('-', '_');
}
}PK (�G[Yj�� � Word/Separator/Abstract.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: CamelCaseToUnderscore.php 6779 2007-11-08 15:10:41Z matthew $
*/
/**
* @see Zend_Filter_PregReplace
*/
require_once 'Zend/Filter/PregReplace.php';
/**
* @category Zend
* @package Zend_Filter
* @uses Zend_Filter_PregReplace
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Filter_Word_Separator_Abstract extends Zend_Filter_PregReplace
{
protected $_separator = null;
/**
* Constructor
*
* @param string $separator Space by default
* @return void
*/
public function __construct($separator = ' ')
{
$this->setSeparator($separator);
}
/**
* Sets a new seperator
*
* @param string $separator Seperator
* @return $this
*/
public function setSeparator($separator)
{
if ($separator == null) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception('"' . $separator . '" is not a valid separator.');
}
$this->_separator = $separator;
return $this;
}
/**
* Returns the actual set seperator
*
* @return string
*/
public function getSeparator()
{
return $this->_separator;
}
}PK (�G[��= = Word/DashToSeparator.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: CamelCaseToSeparator.php 6779 2007-11-08 15:10:41Z matthew $
*/
/**
* @see Zend_Filter_PregReplace
*/
require_once 'Zend/Filter/Word/Separator/Abstract.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Word_DashToSeparator extends Zend_Filter_Word_Separator_Abstract
{
public function filter($value)
{
$this->setMatchPattern('#-#');
$this->setReplacement($this->_separator);
return parent::filter($value);
}
}
PK (�G[$P�� � Word/CamelCaseToSeparator.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: CamelCaseToSeparator.php 6779 2007-11-08 15:10:41Z matthew $
*/
/**
* @see Zend_Filter_PregReplace
*/
require_once 'Zend/Filter/Word/Separator/Abstract.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Word_CamelCaseToSeparator extends Zend_Filter_Word_Separator_Abstract
{
public function filter($value)
{
if (self::isUnicodeSupportEnabled()) {
parent::setMatchPattern(array('#(?<=(?:\p{Lu}))(\p{Lu}\p{Ll})#','#(?<=(?:\p{Ll}))(\p{Lu})#'));
parent::setReplacement(array($this->_separator . '\1', $this->_separator . '\1'));
} else {
parent::setMatchPattern(array('#(?<=(?:[A-Z]))([A-Z]+)([A-Z][A-z])#', '#(?<=(?:[a-z]))([A-Z])#'));
parent::setReplacement(array('\1' . $this->_separator . '\2', $this->_separator . '\1'));
}
return parent::filter($value);
}
}
PK (�G[�k�0 0 Word/CamelCaseToUnderscore.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: CamelCaseToUnderscore.php 6779 2007-11-08 15:10:41Z matthew $
*/
/**
* @see Zend_Filter_CamelCaseToSeparator
*/
require_once 'Zend/Filter/Word/CamelCaseToSeparator.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Word_CamelCaseToUnderscore extends Zend_Filter_Word_CamelCaseToSeparator
{
/**
* Constructor
*
* @return void
*/
public function __construct()
{
parent::__construct('_');
}
}
PK (�G[g�v� � Word/UnderscoreToSeparator.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: UnderscoreToPathSeparator.php 6793 2007-11-09 18:10:06Z matthew $
*/
/**
* @see Zend_Filter_PregReplace
*/
require_once 'Zend/Filter/Word/SeparatorToSeparator.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Word_UnderscoreToSeparator extends Zend_Filter_Word_SeparatorToSeparator
{
/**
* Constructor
*
* @param string $separator Space by default
* @return void
*/
public function __construct($replacementSeparator = ' ')
{
parent::__construct('_', $replacementSeparator);
}
}
PK (�G[;���\ \ Word/SeparatorToSeparator.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: CamelCaseToUnderscore.php 6779 2007-11-08 15:10:41Z matthew $
*/
/**
* @see Zend_Filter_PregReplace
*/
require_once 'Zend/Filter/PregReplace.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Word_SeparatorToSeparator extends Zend_Filter_PregReplace
{
protected $_searchSeparator = null;
protected $_replacementSeparator = null;
/**
* Constructor
*
* @param string $searchSeparator Seperator to search for
* @param string $replacementSeperator Seperator to replace with
* @return void
*/
public function __construct($searchSeparator = ' ', $replacementSeparator = '-')
{
$this->setSearchSeparator($searchSeparator);
$this->setReplacementSeparator($replacementSeparator);
}
/**
* Sets a new seperator to search for
*
* @param string $separator Seperator to search for
* @return $this
*/
public function setSearchSeparator($separator)
{
$this->_searchSeparator = $separator;
return $this;
}
/**
* Returns the actual set seperator to search for
*
* @return string
*/
public function getSearchSeparator()
{
return $this->_searchSeparator;
}
/**
* Sets a new seperator which replaces the searched one
*
* @param string $separator Seperator which replaces the searched one
* @return $this
*/
public function setReplacementSeparator($separator)
{
$this->_replacementSeparator = $separator;
return $this;
}
/**
* Returns the actual set seperator which replaces the searched one
*
* @return string
*/
public function getReplacementSeparator()
{
return $this->_replacementSeparator;
}
/**
* Defined by Zend_Filter_Interface
*
* Returns the string $value, replacing the searched seperators with the defined ones
*
* @param string $value
* @return string
*/
public function filter($value)
{
return $this->_separatorToSeparatorFilter($value);
}
/**
* Do the real work, replaces the seperator to search for with the replacement seperator
*
* Returns the replaced string
*
* @param string $value
* @return string
*/
protected function _separatorToSeparatorFilter($value)
{
if ($this->_searchSeparator == null) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception('You must provide a search separator for this filter to work.');
}
$this->setMatchPattern('#' . preg_quote($this->_searchSeparator, '#') . '#');
$this->setReplacement($this->_replacementSeparator);
return parent::filter($value);
}
}PK (�G[4�= Word/CamelCaseToDash.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: CamelCaseToDash.php 6779 2007-11-08 15:10:41Z matthew $
*/
/**
* @see Zend_Filter_Interface
*/
require_once 'Zend/Filter/Word/CamelCaseToSeparator.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Word_CamelCaseToDash extends Zend_Filter_Word_CamelCaseToSeparator
{
/**
* Constructor
*
* @return void
*/
public function __construct()
{
parent::__construct('-');
}
}
PK (�G[Y{/ Word/UnderscoreToCamelCase.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: CamelCaseToDash.php 6779 2007-11-08 15:10:41Z matthew $
*/
/**
* @see Zend_Filter_Interface
*/
require_once 'Zend/Filter/Word/SeparatorToCamelCase.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Word_UnderscoreToCamelCase extends Zend_Filter_Word_SeparatorToCamelCase
{
/**
* Constructor
*
* @return void
*/
public function __construct()
{
parent::__construct('_');
}
}
PK (�G[���sW W Word/UnderscoreToDash.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: CamelCaseToSeparator.php 6779 2007-11-08 15:10:41Z matthew $
*/
/**
* @see Zend_Filter_PregReplace
*/
require_once 'Zend/Filter/Word/SeparatorToSeparator.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Word_UnderscoreToDash extends Zend_Filter_Word_SeparatorToSeparator
{
/**
* Constructor
*
* @param string $separator Space by default
* @return void
*/
public function __construct()
{
parent::__construct('_', '-');
}
}PK (�G[�6� Word/DashToCamelCase.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: CamelCaseToDash.php 6779 2007-11-08 15:10:41Z matthew $
*/
/**
* @see Zend_Filter_Interface
*/
require_once 'Zend/Filter/Word/SeparatorToCamelCase.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Word_DashToCamelCase extends Zend_Filter_Word_SeparatorToCamelCase
{
/**
* Constructor
*
* @return void
*/
public function __construct()
{
parent::__construct('-');
}
}
PK (�G[ȁ�N N RealPath.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: RealPath.php 8064 2008-02-16 10:58:39Z thomas $
*/
/**
* @see Zend_Filter_Interface
*/
require_once 'Zend/Filter/Interface.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_RealPath implements Zend_Filter_Interface
{
/**
* Defined by Zend_Filter_Interface
*
* Returns realpath($value)
*
* @param string $value
* @return string
*/
public function filter($value)
{
return realpath((string) $value);
}
}
PK (�G[�D ��% �%
StripTags.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: StripTags.php 8064 2008-02-16 10:58:39Z thomas $
*/
/**
* @see Zend_Filter_Interface
*/
require_once 'Zend/Filter/Interface.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_StripTags implements Zend_Filter_Interface
{
/**
* Unique ID prefix used for allowing comments
*/
const UNIQUE_ID_PREFIX = '__Zend_Filter_StripTags__';
/**
* Whether comments are allowed
*
* If false (the default), then comments are removed from the input string.
*
* @var boolean
*/
public $commentsAllowed;
/**
* Array of allowed tags and allowed attributes for each allowed tag
*
* Tags are stored in the array keys, and the array values are themselves
* arrays of the attributes allowed for the corresponding tag.
*
* @var array
*/
protected $_tagsAllowed = array();
/**
* Array of allowed attributes for all allowed tags
*
* Attributes stored here are allowed for all of the allowed tags.
*
* @var array
*/
protected $_attributesAllowed = array();
/**
* Sets the filter options
*
* @param array|string $tagsAllowed
* @param array|string $attributesAllowed
* @param boolean $allowComments
* @return void
*/
public function __construct($tagsAllowed = null, $attributesAllowed = null, $commentsAllowed = false)
{
$this->setTagsAllowed($tagsAllowed);
$this->setAttributesAllowed($attributesAllowed);
$this->commentsAllowed = (boolean) $commentsAllowed;
}
/**
* Returns the tagsAllowed option
*
* @return array
*/
public function getTagsAllowed()
{
return $this->_tagsAllowed;
}
/**
* Sets the tagsAllowed option
*
* @param array|string $tagsAllowed
* @return Zend_Filter_StripTags Provides a fluent interface
*/
public function setTagsAllowed($tagsAllowed)
{
if (!is_array($tagsAllowed)) {
$tagsAllowed = array($tagsAllowed);
}
foreach ($tagsAllowed as $index => $element) {
// If the tag was provided without attributes
if (is_int($index) && is_string($element)) {
// Canonicalize the tag name
$tagName = strtolower($element);
// Store the tag as allowed with no attributes
$this->_tagsAllowed[$tagName] = array();
}
// Otherwise, if a tag was provided with attributes
else if (is_string($index) && (is_array($element) || is_string($element))) {
// Canonicalize the tag name
$tagName = strtolower($index);
// Canonicalize the attributes
if (is_string($element)) {
$element = array($element);
}
// Store the tag as allowed with the provided attributes
$this->_tagsAllowed[$tagName] = array();
foreach ($element as $attribute) {
if (is_string($attribute)) {
// Canonicalize the attribute name
$attributeName = strtolower($attribute);
$this->_tagsAllowed[$tagName][$attributeName] = null;
}
}
}
}
return $this;
}
/**
* Returns the attributesAllowed option
*
* @return array
*/
public function getAttributesAllowed()
{
return $this->_attributesAllowed;
}
/**
* Sets the attributesAllowed option
*
* @param array|string $attributesAllowed
* @return Zend_Filter_StripTags Provides a fluent interface
*/
public function setAttributesAllowed($attributesAllowed)
{
if (!is_array($attributesAllowed)) {
$attributesAllowed = array($attributesAllowed);
}
// Store each attribute as allowed
foreach ($attributesAllowed as $attribute) {
if (is_string($attribute)) {
// Canonicalize the attribute name
$attributeName = strtolower($attribute);
$this->_attributesAllowed[$attributeName] = null;
}
}
return $this;
}
/**
* Defined by Zend_Filter_Interface
*
* @todo improve docblock descriptions
*
* @param string $value
* @return string
*/
public function filter($value)
{
$valueCopy = (string) $value;
// If comments are allowed, then replace them with unique identifiers
if ($this->commentsAllowed) {
preg_match_all('/<\!--.*?--\s*>/s' , (string) $valueCopy, $matches);
$comments = array_unique($matches[0]);
foreach ($comments as $k => $v) {
$valueCopy = str_replace($v, self::UNIQUE_ID_PREFIX . $k, $valueCopy);
}
}
// Initialize accumulator for filtered data
$dataFiltered = '';
// Parse the input data iteratively as regular pre-tag text followed by a
// tag; either may be empty strings
preg_match_all('/([^<]*)(<?[^>]*>?)/', (string) $valueCopy, $matches);
// Iterate over each set of matches
foreach ($matches[1] as $index => $preTag) {
// If the pre-tag text is non-empty, strip any ">" characters from it
if (strlen($preTag)) {
$preTag = str_replace('>', '', $preTag);
}
// If a tag exists in this match, then filter the tag
$tag = $matches[2][$index];
if (strlen($tag)) {
$tagFiltered = $this->_filterTag($tag);
} else {
$tagFiltered = '';
}
// Add the filtered pre-tag text and filtered tag to the data buffer
$dataFiltered .= $preTag . $tagFiltered;
}
// If comments are allowed, then replace the unique identifiers with the corresponding comments
if ($this->commentsAllowed) {
foreach ($comments as $k => $v) {
$dataFiltered = str_replace(self::UNIQUE_ID_PREFIX . $k, $v, $dataFiltered);
}
}
// Return the filtered data
return $dataFiltered;
}
/**
* Filters a single tag against the current option settings
*
* @param string $tag
* @return string
*/
protected function _filterTag($tag)
{
// Parse the tag into:
// 1. a starting delimiter (mandatory)
// 2. a tag name (if available)
// 3. a string of attributes (if available)
// 4. an ending delimiter (if available)
$isMatch = preg_match('~(</?)(\w*)((/(?!>)|[^/>])*)(/?>)~', $tag, $matches);
// If the tag does not match, then strip the tag entirely
if (!$isMatch) {
return '';
}
// Save the matches to more meaningfully named variables
$tagStart = $matches[1];
$tagName = strtolower($matches[2]);
$tagAttributes = $matches[3];
$tagEnd = $matches[5];
// If the tag is not an allowed tag, then remove the tag entirely
if (!isset($this->_tagsAllowed[$tagName])) {
return '';
}
// Trim the attribute string of whitespace at the ends
$tagAttributes = trim($tagAttributes);
// If there are non-whitespace characters in the attribute string
if (strlen($tagAttributes)) {
// Parse iteratively for well-formed attributes
preg_match_all('/(\w+)=([\'"])((.(?!=\2))+)\2/s', $tagAttributes, $matches);
// Initialize valid attribute accumulator
$tagAttributes = '';
// Iterate over each matched attribute
foreach ($matches[1] as $index => $attributeName) {
$attributeName = strtolower($attributeName);
$attributeDelimiter = $matches[2][$index];
$attributeValue = $matches[3][$index];
// If the attribute is not allowed, then remove it entirely
if (!array_key_exists($attributeName, $this->_tagsAllowed[$tagName])
&& !array_key_exists($attributeName, $this->_attributesAllowed)) {
continue;
}
// Add the attribute to the accumulator
$tagAttributes .= " $attributeName=" . $attributeDelimiter
. $attributeValue . $attributeDelimiter;
}
}
// Reconstruct tags ending with "/>" as backwards-compatible XHTML tag
if (strpos($tagEnd, '/') !== false) {
$tagEnd = " $tagEnd";
}
// Return the filtered tag
return $tagStart . $tagName . $tagAttributes . $tagEnd;
}
}
PK (�G[
27( ( StringToLower.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: StringToLower.php 8064 2008-02-16 10:58:39Z thomas $
*/
/**
* @see Zend_Filter_Interface
*/
require_once 'Zend/Filter/Interface.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_StringToLower implements Zend_Filter_Interface
{
/**
* Encoding for the input string
*
* @var string
*/
protected $_encoding = null;
/**
* Set the input encoding for the given string
*
* @param string $encoding
* @throws Zend_Filter_Exception
*/
public function setEncoding($encoding = null)
{
if (!function_exists('mb_strtolower')) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception('mbstring is required for this feature');
}
$this->_encoding = $encoding;
}
/**
* Defined by Zend_Filter_Interface
*
* Returns the string $value, converting characters to lowercase as necessary
*
* @param string $value
* @return string
*/
public function filter($value)
{
if ($this->_encoding) {
return mb_strtolower((string) $value, $this->_encoding);
}
return strtolower((string) $value);
}
}
PK (�G[Pbӯ( ( StringToUpper.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: StringToUpper.php 8064 2008-02-16 10:58:39Z thomas $
*/
/**
* @see Zend_Filter_Interface
*/
require_once 'Zend/Filter/Interface.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_StringToUpper implements Zend_Filter_Interface
{
/**
* Encoding for the input string
*
* @var string
*/
protected $_encoding = null;
/**
* Set the input encoding for the given string
*
* @param string $encoding
* @throws Zend_Filter_Exception
*/
public function setEncoding($encoding = null)
{
if (!function_exists('mb_strtoupper')) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception('mbstring is required for this feature');
}
$this->_encoding = $encoding;
}
/**
* Defined by Zend_Filter_Interface
*
* Returns the string $value, converting characters to uppercase as necessary
*
* @param string $value
* @return string
*/
public function filter($value)
{
if ($this->_encoding) {
return mb_strtoupper((string) $value, $this->_encoding);
}
return strtoupper((string) $value);
}
}
PK (�G[Xwy�� � File/LowerCase.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: $
*/
/**
* @see Zend_Filter_StringToLower
*/
require_once 'Zend/Filter/StringToLower.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_File_LowerCase extends Zend_Filter_StringToLower
{
/**
* Adds options to the filter at initiation
*
* @param string $options
*/
public function __construct($options = null)
{
if (!empty($options)) {
$this->setEncoding($options);
}
}
/**
* Defined by Zend_Filter_Interface
*
* Does a lowercase on the content of the given file
*
* @param string $value Full path of file to change
* @return string The given $value
* @throws Zend_Filter_Exception
*/
public function filter($value)
{
if (!file_exists($value)) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception("File '$value' not found");
}
if (!is_writable($value)) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception("File '$value' is not writable");
}
$content = file_get_contents($value);
if (!$content) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception("Problem while reading file '$value'");
}
$content = parent::filter($content);
$result = file_put_contents($value, $content);
if (!$result) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception("Problem while writing file '$value'");
}
return $value;
}
}
PK (�G[�$Y^� � File/UpperCase.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: $
*/
/**
* @see Zend_Filter_StringToUpper
*/
require_once 'Zend/Filter/StringToUpper.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_File_UpperCase extends Zend_Filter_StringToUpper
{
/**
* Adds options to the filter at initiation
*
* @param string $options
*/
public function __construct($options = null)
{
if (!empty($options)) {
$this->setEncoding($options);
}
}
/**
* Defined by Zend_Filter_Interface
*
* Does a lowercase on the content of the given file
*
* @param string $value Full path of file to change
* @return string The given $value
* @throws Zend_Filter_Exception
*/
public function filter($value)
{
if (!file_exists($value)) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception("File '$value' not found");
}
if (!is_writable($value)) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception("File '$value' is not writable");
}
$content = file_get_contents($value);
if (!$content) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception("Problem while reading file '$value'");
}
$content = parent::filter($content);
$result = file_put_contents($value, $content);
if (!$result) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception("Problem while writing file '$value'");
}
return $value;
}
}
PK (�G[nUYH�! �! File/Rename.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: $
*/
/**
* @see Zend_Filter_Interface
*/
require_once 'Zend/Filter/Interface.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_File_Rename implements Zend_Filter_Interface
{
/**
* Internal array of array(source, target, overwrite)
*/
protected $_files = array();
/**
* Class constructor
*
* Options argument may be either a string, a Zend_Config object, or an array.
* If an array or Zend_Config object, it accepts the following keys:
* 'source' => Source filename or directory which will be renamed
* 'target' => Target filename or directory, the new name of the sourcefile
* 'overwrite' => Shall existing files be overwritten ?
*
* @param string|array $options Target file or directory to be renamed
* @param string $target Source filename or directory (deprecated)
* @param bool $overwrite Should existing files be overwritten (deprecated)
* @return void
*/
public function __construct($options)
{
if ($options instanceof Zend_Config) {
$options = $options->toArray();
} elseif (is_string($options)) {
$options = array('target' => $options);
} elseif (!is_array($options)) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception('Invalid options argument provided to filter');
}
if (1 < func_num_args()) {
trigger_error('Support for multiple arguments is deprecated in favor of a single options array', E_USER_NOTICE);
$argv = func_get_args();
array_shift($argv);
$source = array_shift($argv);
$overwrite = false;
if (!empty($argv)) {
$overwrite = array_shift($argv);
}
$options['source'] = $source;
$options['overwrite'] = $overwrite;
}
$this->setFile($options);
}
/**
* Returns the files to rename and their new name and location
*
* @return array
*/
public function getFile()
{
return $this->_files;
}
/**
* Sets a new file or directory as target, deleting existing ones
*
* Array accepts the following keys:
* 'source' => Source filename or directory which will be renamed
* 'target' => Target filename or directory, the new name of the sourcefile
* 'overwrite' => Shall existing files be overwritten ?
*
* @param string|array $options Old file or directory to be rewritten
* @return Zend_Filter_File_Rename
*/
public function setFile($options)
{
$this->_files = array();
$this->addFile($options);
return $this;
}
/**
* Adds a new file or directory as target to the existing ones
*
* Array accepts the following keys:
* 'source' => Source filename or directory which will be renamed
* 'target' => Target filename or directory, the new name of the sourcefile
* 'overwrite' => Shall existing files be overwritten ?
*
* @param string|array $options Old file or directory to be rewritten
* @return Zend_Filter_File_Rename
*/
public function addFile($options)
{
if (is_string($options)) {
$options = array('target' => $options);
} elseif (!is_array($options)) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception ('Invalid options to rename filter provided');
}
$this->_convertOptions($options);
return $this;
}
/**
* Defined by Zend_Filter_Interface
*
* Renames the file $value to the new name set before
* Returns the file $value, removing all but digit characters
*
* @param string $value Full path of file to change
* @return string The new filename which has been set, or false when there were errors
*/
public function filter($value)
{
$file = $this->_getFileName($value);
if ($file['source'] == $file['target']) {
return $value;
}
if (!file_exists($file['source'])) {
return $value;
}
if (($file['overwrite'] == true) and (file_exists($file['target']))) {
unlink($file['target']);
}
if (file_exists($file['target'])) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception(sprintf("File '%s' could not be renamed. It already exists.", $value));
}
$result = rename($file['source'], $file['target']);
if ($result === true) {
return $file['target'];
}
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception(sprintf("File '%s' could not be renamed. An error occured while processing the file.", $value));
}
/**
* Internal method for creating the file array
* Supports single and nested arrays
*
* @param array $options
* @return array
*/
protected function _convertOptions($options) {
$files = array();
foreach ($options as $key => $value) {
if (is_array($value)) {
$this->_convertOptions($value);
continue;
}
switch ($key) {
case "source":
$files['source'] = (string) $value;
break;
case 'target' :
$files['target'] = (string) $value;
break;
case 'overwrite' :
$files['overwrite'] = (boolean) $value;
break;
default:
break;
}
}
if (empty($files)) {
return $this;
}
if (empty($files['source'])) {
$files['source'] = '*';
}
if (empty($files['target'])) {
$files['target'] = '*';
}
if (empty($files['overwrite'])) {
$files['overwrite'] = false;
}
$found = false;
foreach ($this->_files as $key => $value) {
if ($value['source'] == $files['source']) {
$this->_files[$key] = $files;
$found = true;
}
}
if (!$found) {
$count = count($this->_files);
$this->_files[$count] = $files;
}
return $this;
}
/**
* Internal method to resolve the requested source
* and return all other related parameters
*
* @param string $file Filename to get the informations for
* @return array
*/
protected function _getFileName($file)
{
$rename = array();
foreach ($this->_files as $value) {
if ($value['source'] == '*') {
if (!isset($rename['source'])) {
$rename = $value;
$rename['source'] = $file;
}
}
if ($value['source'] == $file) {
$rename = $value;
}
}
if (!isset($rename['source'])) {
return $file;
}
if (!isset($rename['target']) or ($rename['target'] == '*')) {
$rename['target'] = $rename['source'];
}
if (is_dir($rename['target'])) {
$name = basename($rename['source']);
$last = $rename['target'][strlen($rename['target']) - 1];
if (($last != '/') and ($last != '\\')) {
$rename['target'] .= DIRECTORY_SEPARATOR;
}
$rename['target'] .= $name;
}
return $rename;
}
}
PK (�G[־�? ? Int.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Int.php 8064 2008-02-16 10:58:39Z thomas $
*/
/**
* @see Zend_Filter_Interface
*/
require_once 'Zend/Filter/Interface.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Int implements Zend_Filter_Interface
{
/**
* Defined by Zend_Filter_Interface
*
* Returns (int) $value
*
* @param string $value
* @return integer
*/
public function filter($value)
{
return (int) ((string) $value);
}
}
PK (�G[i�P� � CustomAccent.phpnu &1i� <?php
require_once 'Zend/Filter/Interface.php';
class Zend_Filter_CustomAccent implements Zend_Filter_Interface
{
public function filter($valeur)
{
$accents = array('�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�',
'�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�');
$sans = array('A','A','A','A','A','A','C','E','E','E','E','I','I','I','I','O','O','O','O','O',
'U','U','U','U','Y','a','a','a','a','a','a','c','e','e','e','e','i','i','i','i','o','o','o','o','o','o','u','u','u','u','y','y');
return str_replace($accents, $sans, $valeur);
}
}
?>PK (�G[�ns�N N StripNewlines.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: $
*/
/**
* @see Zend_Filter_Interface
*/
require_once 'Zend/Filter/Interface.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_StripNewlines implements Zend_Filter_Interface
{
/**
* Defined by Zend_Filter_Interface
*
* Returns $value without newline control characters
*
* @param string $value
* @return string
*/
public function filter ($value)
{
return str_replace(array("\n", "\r"), '', $value);
}
}
PK (�G[���!#8 #8
Inflector.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Inflector.php 12501 2008-11-10 16:28:31Z matthew $
*/
/**
* @see Zend_Filter
* @see Zend_Filter_Interface
*/
require_once 'Zend/Filter.php';
/**
* @see Zend_Loader_PluginLoader
*/
require_once 'Zend/Loader/PluginLoader.php';
/**
* Filter chain for string inflection
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Inflector implements Zend_Filter_Interface
{
/**
* @var Zend_Loader_PluginLoader_Interface
*/
protected $_pluginLoader = null;
/**
* @var string
*/
protected $_target = null;
/**
* @var bool
*/
protected $_throwTargetExceptionsOn = true;
/**
* @var string
*/
protected $_targetReplacementIdentifier = ':';
/**
* @var array
*/
protected $_rules = array();
/**
* Constructor
*
* @param string $target
* @param array $rules
*/
public function __construct($target = null, Array $rules = array(), $throwTargetExceptionsOn = null, $targetReplacementIdentifer = null)
{
if ($target instanceof Zend_Config) {
$this->setConfig($target);
} else {
if ((null !== $target) && is_string($target)) {
$this->setTarget($target);
}
if (null !== $rules) {
$this->addRules($rules);
}
if ($throwTargetExceptionsOn !== null) {
$this->setThrowTargetExceptionsOn($throwTargetExceptionsOn);
}
if ($targetReplacementIdentifer != '') {
$this->setTargetReplacementIdentifier($targetReplacementIdentifer);
}
}
}
/**
* Retreive PluginLoader
*
* @return Zend_Loader_PluginLoader_Interface
*/
public function getPluginLoader()
{
if (!$this->_pluginLoader instanceof Zend_Loader_PluginLoader_Interface) {
$this->_pluginLoader = new Zend_Loader_PluginLoader(array('Zend_Filter_' => 'Zend/Filter/'), __CLASS__);
}
return $this->_pluginLoader;
}
/**
* Set PluginLoader
*
* @param Zend_Loader_PluginLoader_Interface $pluginLoader
* @return Zend_Filter_Inflector
*/
public function setPluginLoader(Zend_Loader_PluginLoader_Interface $pluginLoader)
{
$this->_pluginLoader = $pluginLoader;
return $this;
}
/**
* Use Zend_Config object to set object state
*
* @param Zend_Config $config
* @return Zend_Filter_Inflector
*/
public function setConfig(Zend_Config $config)
{
foreach ($config as $key => $value) {
switch ($key) {
case 'target':
$this->setTarget($value);
break;
case 'filterPrefixPath':
if (is_scalar($value)) {
break;
}
$paths = $value->toArray();
foreach ($paths as $prefix => $path) {
$this->addFilterPrefixPath($prefix, $path);
}
break;
case 'throwTargetExceptionsOn':
$this->setThrowTargetExceptionsOn($value);
break;
case 'targetReplacementIdentifier':
$this->setTargetReplacementIdentifier($value);
break;
case 'rules':
$this->addRules($value->toArray());
break;
default:
break;
}
}
return $this;
}
/**
* Convienence method to add prefix and path to PluginLoader
*
* @param string $prefix
* @param string $path
* @return Zend_Filter_Inflector
*/
public function addFilterPrefixPath($prefix, $path)
{
$this->getPluginLoader()->addPrefixPath($prefix, $path);
return $this;
}
/**
* Set Whether or not the inflector should throw an exception when a replacement
* identifier is still found within an inflected target.
*
* @param bool $throwTargetExceptions
* @return Zend_Filter_Inflector
*/
public function setThrowTargetExceptionsOn($throwTargetExceptionsOn)
{
$this->_throwTargetExceptionsOn = ($throwTargetExceptionsOn == true) ? true : false;
return $this;
}
/**
* Will exceptions be thrown?
*
* @return bool
*/
public function isThrowTargetExceptionsOn()
{
return $this->_throwTargetExceptionsOn;
}
/**
* Set the Target Replacement Identifier, by default ':'
*
* @param string $targetReplacementIdentifier
* @return Zend_Filter_Inflector
*/
public function setTargetReplacementIdentifier($targetReplacementIdentifier)
{
$this->_targetReplacementIdentifier = (string) $targetReplacementIdentifier;
return $this;
}
/**
* Get Target Replacement Identifier
*
* @return string
*/
public function getTargetReplacementIdentifier()
{
return $this->_targetReplacementIdentifier;
}
/**
* Set a Target
* ex: 'scripts/:controller/:action.:suffix'
*
* @param string
* @return Zend_Filter_Inflector
*/
public function setTarget($target)
{
$this->_target = (string) $target;
return $this;
}
/**
* Retrieve target
*
* @return string
*/
public function getTarget()
{
return $this->_target;
}
/**
* Set Target Reference
*
* @param reference $target
* @return Zend_Filter_Inflector
*/
public function setTargetReference(&$target)
{
$this->_target =& $target;
return $this;
}
/**
* SetRules() is the same as calling addRules() with the exception that it
* clears the rules before adding them.
*
* @param array $rules
* @return Zend_Filter_Inflector
*/
public function setRules(Array $rules)
{
$this->clearRules();
$this->addRules($rules);
return $this;
}
/**
* AddRules(): multi-call to setting filter rules.
*
* If prefixed with a ":" (colon), a filter rule will be added. If not
* prefixed, a static replacement will be added.
*
* ex:
* array(
* ':controller' => array('CamelCaseToUnderscore','StringToLower'),
* ':action' => array('CamelCaseToUnderscore','StringToLower'),
* 'suffix' => 'phtml'
* );
*
* @param array
* @return Zend_Filter_Inflector
*/
public function addRules(Array $rules)
{
$keys = array_keys($rules);
foreach ($keys as $spec) {
if ($spec[0] == ':') {
$this->addFilterRule($spec, $rules[$spec]);
} else {
$this->setStaticRule($spec, $rules[$spec]);
}
}
return $this;
}
/**
* Get rules
*
* By default, returns all rules. If a $spec is provided, will return those
* rules if found, false otherwise.
*
* @param string $spec
* @return array|false
*/
public function getRules($spec = null)
{
if (null !== $spec) {
$spec = $this->_normalizeSpec($spec);
if (isset($this->_rules[$spec])) {
return $this->_rules[$spec];
}
return false;
}
return $this->_rules;
}
/**
* getRule() returns a rule set by setFilterRule(), a numeric index must be provided
*
* @param string $spec
* @param int $index
* @return Zend_Filter_Interface|false
*/
public function getRule($spec, $index)
{
$spec = $this->_normalizeSpec($spec);
if (isset($this->_rules[$spec]) && is_array($this->_rules[$spec])) {
if (isset($this->_rules[$spec][$index])) {
return $this->_rules[$spec][$index];
}
}
return false;
}
/**
* ClearRules() clears the rules currently in the inflector
*
* @return Zend_Filter_Inflector
*/
public function clearRules()
{
$this->_rules = array();
return $this;
}
/**
* Set a filtering rule for a spec. $ruleSet can be a string, Filter object
* or an array of strings or filter objects.
*
* @param string $spec
* @param array|string|Zend_Filter_Interface $ruleSet
* @return Zend_Filter_Inflector
*/
public function setFilterRule($spec, $ruleSet)
{
$spec = $this->_normalizeSpec($spec);
$this->_rules[$spec] = array();
return $this->addFilterRule($spec, $ruleSet);
}
/**
* Add a filter rule for a spec
*
* @param mixed $spec
* @param mixed $ruleSet
* @return void
*/
public function addFilterRule($spec, $ruleSet)
{
$spec = $this->_normalizeSpec($spec);
if (!isset($this->_rules[$spec])) {
$this->_rules[$spec] = array();
}
if (!is_array($ruleSet)) {
$ruleSet = array($ruleSet);
}
foreach ($ruleSet as $rule) {
$this->_rules[$spec][] = $this->_getRule($rule);
}
return $this;
}
/**
* Set a static rule for a spec. This is a single string value
*
* @param string $name
* @param string $value
* @return Zend_Filter_Inflector
*/
public function setStaticRule($name, $value)
{
$name = $this->_normalizeSpec($name);
$this->_rules[$name] = (string) $value;
return $this;
}
/**
* Set Static Rule Reference.
*
* This allows a consuming class to pass a property or variable
* in to be referenced when its time to build the output string from the
* target.
*
* @param string $name
* @param mixed $reference
* @return Zend_Filter_Inflector
*/
public function setStaticRuleReference($name, &$reference)
{
$name = $this->_normalizeSpec($name);
$this->_rules[$name] =& $reference;
return $this;
}
/**
* Inflect
*
* @param string|array $source
* @return string
*/
public function filter($source)
{
// clean source
foreach ( (array) $source as $sourceName => $sourceValue) {
$source[ltrim($sourceName, ':')] = $sourceValue;
}
$pregQuotedTargetReplacementIdentifier = preg_quote($this->_targetReplacementIdentifier, '#');
$processedParts = array();
foreach ($this->_rules as $ruleName => $ruleValue) {
if (isset($source[$ruleName])) {
if (is_string($ruleValue)) {
// overriding the set rule
$processedParts['#'.$pregQuotedTargetReplacementIdentifier.$ruleName.'#'] = str_replace('\\', '\\\\', $source[$ruleName]);
} elseif (is_array($ruleValue)) {
$processedPart = $source[$ruleName];
foreach ($ruleValue as $ruleFilter) {
$processedPart = $ruleFilter->filter($processedPart);
}
$processedParts['#'.$pregQuotedTargetReplacementIdentifier.$ruleName.'#'] = str_replace('\\', '\\\\', $processedPart);
}
} elseif (is_string($ruleValue)) {
$processedParts['#'.$pregQuotedTargetReplacementIdentifier.$ruleName.'#'] = str_replace('\\', '\\\\', $ruleValue);
}
}
// all of the values of processedParts would have been str_replace('\\', '\\\\', ..)'d to disable preg_replace backreferences
$inflectedTarget = preg_replace(array_keys($processedParts), array_values($processedParts), $this->_target);
if ($this->_throwTargetExceptionsOn && (preg_match('#(?='.$pregQuotedTargetReplacementIdentifier.'[A-Za-z]{1})#', $inflectedTarget) == true)) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception('A replacement identifier ' . $this->_targetReplacementIdentifier . ' was found inside the inflected target, perhaps a rule was not satisfied with a target source? Unsatisfied inflected target: ' . $inflectedTarget);
}
return $inflectedTarget;
}
/**
* Normalize spec string
*
* @param string $spec
* @return string
*/
protected function _normalizeSpec($spec)
{
return ltrim((string) $spec, ':&');
}
/**
* Resolve named filters and convert them to filter objects.
*
* @param string $rule
* @return Zend_Filter_Interface
*/
protected function _getRule($rule)
{
if ($rule instanceof Zend_Filter_Interface) {
return $rule;
}
$rule = (string) $rule;
$className = $this->getPluginLoader()->load($rule);
$ruleObject = new $className();
if (!$ruleObject instanceof Zend_Filter_Interface) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception('No class named ' . $rule . ' implementing Zend_Filter_Interface could be found');
}
return $ruleObject;
}
}
PK (�G[�ͳ�p �p Input.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Input.php 8856 2008-03-16 11:28:48Z thomas $
*/
/**
* @see Zend_Loader
*/
require_once 'Zend/Loader.php';
/**
* @see Zend_Filter
*/
require_once 'Zend/Filter.php';
/**
* @see Zend_Validate
*/
require_once 'Zend/Validate.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Input
{
const ALLOW_EMPTY = 'allowEmpty';
const BREAK_CHAIN = 'breakChainOnFailure';
const DEFAULT_VALUE = 'default';
const MESSAGES = 'messages';
const ESCAPE_FILTER = 'escapeFilter';
const FIELDS = 'fields';
const FILTER = 'filter';
const FILTER_CHAIN = 'filterChain';
const MISSING_MESSAGE = 'missingMessage';
const INPUT_NAMESPACE = 'inputNamespace';
const NOT_EMPTY_MESSAGE = 'notEmptyMessage';
const PRESENCE = 'presence';
const PRESENCE_OPTIONAL = 'optional';
const PRESENCE_REQUIRED = 'required';
const RULE = 'rule';
const RULE_WILDCARD = '*';
const VALIDATE = 'validate';
const VALIDATOR = 'validator';
const VALIDATOR_CHAIN = 'validatorChain';
const VALIDATOR_CHAIN_COUNT = 'validatorChainCount';
/**
* @var array Input data, before processing.
*/
protected $_data = array();
/**
* @var array Association of rules to filters.
*/
protected $_filterRules = array();
/**
* @var array Association of rules to validators.
*/
protected $_validatorRules = array();
/**
* @var array After processing data, this contains mapping of valid fields
* to field values.
*/
protected $_validFields = array();
/**
* @var array After processing data, this contains mapping of validation
* rules that did not pass validation to the array of messages returned
* by the validator chain.
*/
protected $_invalidMessages = array();
/**
* @var array After processing data, this contains mapping of validation
* rules that did not pass validation to the array of error identifiers
* returned by the validator chain.
*/
protected $_invalidErrors = array();
/**
* @var array After processing data, this contains mapping of validation
* rules in which some fields were missing to the array of messages
* indicating which fields were missing.
*/
protected $_missingFields = array();
/**
* @var array After processing, this contains a copy of $_data elements
* that were not mentioned in any validation rule.
*/
protected $_unknownFields = array();
/**
* @var Zend_Filter_Interface The filter object that is run on values
* returned by the getEscaped() method.
*/
protected $_defaultEscapeFilter = null;
/**
* Plugin loaders
* @var array
*/
protected $_loaders = array();
/**
* @var array Default values to use when processing filters and validators.
*/
protected $_defaults = array(
self::ALLOW_EMPTY => false,
self::BREAK_CHAIN => false,
self::ESCAPE_FILTER => 'HtmlEntities',
self::MISSING_MESSAGE => "Field '%field%' is required by rule '%rule%', but the field is missing",
self::NOT_EMPTY_MESSAGE => "You must give a non-empty value for field '%field%'",
self::PRESENCE => self::PRESENCE_OPTIONAL
);
/**
* @var boolean Set to False initially, this is set to True after the
* input data have been processed. Reset to False in setData() method.
*/
protected $_processed = false;
/**
* @param array $filterRules
* @param array $validatorRules
* @param array $data OPTIONAL
* @param array $options OPTIONAL
*/
public function __construct($filterRules, $validatorRules, array $data = null, array $options = null)
{
if ($options) {
$this->setOptions($options);
}
$this->_filterRules = (array) $filterRules;
$this->_validatorRules = (array) $validatorRules;
if ($data) {
$this->setData($data);
}
}
/**
* @param mixed $namespaces
* @return Zend_Filter_Input
* @deprecated since 1.5.0RC1 - use addFilterPrefixPath() or addValidatorPrefixPath instead.
*/
public function addNamespace($namespaces)
{
if (!is_array($namespaces)) {
$namespaces = array($namespaces);
}
foreach ($namespaces as $namespace) {
$prefix = $namespace;
$path = str_replace('_', DIRECTORY_SEPARATOR, $prefix);
$this->addFilterPrefixPath($prefix, $path);
$this->addValidatorPrefixPath($prefix, $path);
}
return $this;
}
/**
* Add prefix path for all elements
*
* @param string $prefix
* @param string $path
* @return Zend_Filter_Input
*/
public function addFilterPrefixPath($prefix, $path)
{
$this->getPluginLoader(self::FILTER)->addPrefixPath($prefix, $path);
return $this;
}
/**
* Add prefix path for all elements
*
* @param string $prefix
* @param string $path
* @return Zend_Filter_Input
*/
public function addValidatorPrefixPath($prefix, $path)
{
$this->getPluginLoader(self::VALIDATE)->addPrefixPath($prefix, $path);
return $this;
}
/**
* Set plugin loaders for use with decorators and elements
*
* @param Zend_Loader_PluginLoader_Interface $loader
* @param string $type 'filter' or 'validate'
* @return Zend_Filter_Input
* @throws Zend_Filter_Exception on invalid type
*/
public function setPluginLoader(Zend_Loader_PluginLoader_Interface $loader, $type)
{
$type = strtolower($type);
switch ($type) {
case self::FILTER:
case self::VALIDATE:
$this->_loaders[$type] = $loader;
return $this;
default:
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception(sprintf('Invalid type "%s" provided to setPluginLoader()', $type));
}
return $this;
}
/**
* Retrieve plugin loader for given type
*
* $type may be one of:
* - filter
* - validator
*
* If a plugin loader does not exist for the given type, defaults are
* created.
*
* @param string $type 'filter' or 'validate'
* @return Zend_Loader_PluginLoader_Interface
* @throws Zend_Filter_Exception on invalid type
*/
public function getPluginLoader($type)
{
$type = strtolower($type);
if (!isset($this->_loaders[$type])) {
switch ($type) {
case self::FILTER:
$prefixSegment = 'Zend_Filter_';
$pathSegment = 'Zend/Filter/';
break;
case self::VALIDATE:
$prefixSegment = 'Zend_Validate_';
$pathSegment = 'Zend/Validate/';
break;
default:
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception(sprintf('Invalid type "%s" provided to getPluginLoader()', $type));
}
require_once 'Zend/Loader/PluginLoader.php';
$this->_loaders[$type] = new Zend_Loader_PluginLoader(
array($prefixSegment => $pathSegment)
);
}
return $this->_loaders[$type];
}
/**
* @return array
*/
public function getMessages()
{
$this->_process();
return array_merge($this->_invalidMessages, $this->_missingFields);
}
/**
* @return array
*/
public function getErrors()
{
$this->_process();
return $this->_invalidErrors;
}
/**
* @return array
*/
public function getInvalid()
{
$this->_process();
return $this->_invalidMessages;
}
/**
* @return array
*/
public function getMissing()
{
$this->_process();
return $this->_missingFields;
}
/**
* @return array
*/
public function getUnknown()
{
$this->_process();
return $this->_unknownFields;
}
/**
* @param string $fieldName OPTIONAL
* @return mixed
*/
public function getEscaped($fieldName = null)
{
$this->_process();
$this->_getDefaultEscapeFilter();
if ($fieldName === null) {
return $this->_escapeRecursive($this->_validFields);
}
if (array_key_exists($fieldName, $this->_validFields)) {
return $this->_escapeRecursive($this->_validFields[$fieldName]);
}
return null;
}
/**
* @param mixed $value
* @return mixed
*/
protected function _escapeRecursive($data)
{
if (!is_array($data)) {
return $this->_getDefaultEscapeFilter()->filter($data);
}
foreach ($data as &$element) {
$element = $this->_escapeRecursive($element);
}
return $data;
}
/**
* @param string $fieldName OPTIONAL
* @return mixed
*/
public function getUnescaped($fieldName = null)
{
$this->_process();
if ($fieldName === null) {
return $this->_validFields;
}
if (array_key_exists($fieldName, $this->_validFields)) {
return $this->_validFields[$fieldName];
}
return null;
}
/**
* @param string $fieldName
* @return mixed
*/
public function __get($fieldName)
{
return $this->getEscaped($fieldName);
}
/**
* @return boolean
*/
public function hasInvalid()
{
$this->_process();
return !(empty($this->_invalidMessages));
}
/**
* @return boolean
*/
public function hasMissing()
{
$this->_process();
return !(empty($this->_missingFields));
}
/**
* @return boolean
*/
public function hasUnknown()
{
$this->_process();
return !(empty($this->_unknownFields));
}
/**
* @return boolean
*/
public function hasValid()
{
$this->_process();
return !(empty($this->_validFields));
}
/**
* @param string $fieldName
* @return boolean
*/
public function isValid($fieldName = null)
{
$this->_process();
if ($fieldName === null) {
return !($this->hasMissing() || $this->hasInvalid());
}
return array_key_exists($fieldName, $this->_validFields);
}
/**
* @param string $fieldName
* @return boolean
*/
public function __isset($fieldName)
{
$this->_process();
return isset($this->_validFields[$fieldName]);
}
/**
* @return Zend_Filter_Input
* @throws Zend_Filter_Exception
*/
public function process()
{
$this->_process();
if ($this->hasInvalid()) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception("Input has invalid fields");
}
if ($this->hasMissing()) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception("Input has missing fields");
}
return $this;
}
/**
* @param array $data
* @return Zend_Filter_Input
*/
public function setData(array $data)
{
$this->_data = $data;
/**
* Reset to initial state
*/
$this->_validFields = array();
$this->_invalidMessages = array();
$this->_invalidErrors = array();
$this->_missingFields = array();
$this->_unknownFields = array();
$this->_processed = false;
return $this;
}
/**
* @param mixed $escapeFilter
* @return Zend_Filter_Interface
*/
public function setDefaultEscapeFilter($escapeFilter)
{
if (is_string($escapeFilter) || is_array($escapeFilter)) {
$escapeFilter = $this->_getFilter($escapeFilter);
}
if (!$escapeFilter instanceof Zend_Filter_Interface) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception('Escape filter specified does not implement Zend_Filter_Interface');
}
$this->_defaultEscapeFilter = $escapeFilter;
return $escapeFilter;
}
/**
* @param array $options
* @return Zend_Filter_Input
* @throws Zend_Filter_Exception if an unknown option is given
*/
public function setOptions(array $options)
{
foreach ($options as $option => $value) {
switch ($option) {
case self::ESCAPE_FILTER:
$this->setDefaultEscapeFilter($value);
break;
case self::INPUT_NAMESPACE:
$this->addNamespace($value);
break;
case self::ALLOW_EMPTY:
case self::BREAK_CHAIN:
case self::MISSING_MESSAGE:
case self::NOT_EMPTY_MESSAGE:
case self::PRESENCE:
$this->_defaults[$option] = $value;
break;
default:
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception("Unknown option '$option'");
break;
}
}
return $this;
}
/*
* Protected methods
*/
/**
* @return void
*/
protected function _filter()
{
foreach ($this->_filterRules as $ruleName => &$filterRule) {
/**
* Make sure we have an array representing this filter chain.
* Don't typecast to (array) because it might be a Zend_Filter object
*/
if (!is_array($filterRule)) {
$filterRule = array($filterRule);
}
/**
* Filters are indexed by integer, metacommands are indexed by string.
* Pick out the filters.
*/
$filterList = array();
foreach ($filterRule as $key => $value) {
if (is_int($key)) {
$filterList[] = $value;
}
}
/**
* Use defaults for filter metacommands.
*/
$filterRule[self::RULE] = $ruleName;
if (!isset($filterRule[self::FIELDS])) {
$filterRule[self::FIELDS] = $ruleName;
}
/**
* Load all the filter classes and add them to the chain.
*/
if (!isset($filterRule[self::FILTER_CHAIN])) {
$filterRule[self::FILTER_CHAIN] = new Zend_Filter();
foreach ($filterList as $filter) {
if (is_string($filter) || is_array($filter)) {
$filter = $this->_getFilter($filter);
}
$filterRule[self::FILTER_CHAIN]->addFilter($filter);
}
}
/**
* If the ruleName is the special wildcard rule,
* then apply the filter chain to all input data.
* Else just process the field named by the rule.
*/
if ($ruleName == self::RULE_WILDCARD) {
foreach (array_keys($this->_data) as $field) {
$this->_filterRule(array_merge($filterRule, array(self::FIELDS => $field)));
}
} else {
$this->_filterRule($filterRule);
}
}
}
/**
* @param array $filterRule
* @return void
*/
protected function _filterRule(array $filterRule)
{
$field = $filterRule[self::FIELDS];
if (!array_key_exists($field, $this->_data)) {
return;
}
if (is_array($this->_data[$field])) {
foreach ($this->_data[$field] as $key => $value) {
$this->_data[$field][$key] = $filterRule[self::FILTER_CHAIN]->filter($value);
}
} else {
$this->_data[$field] =
$filterRule[self::FILTER_CHAIN]->filter($this->_data[$field]);
}
}
/**
* @return Zend_Filter_Interface
*/
protected function _getDefaultEscapeFilter()
{
if ($this->_defaultEscapeFilter !== null) {
return $this->_defaultEscapeFilter;
}
return $this->setDefaultEscapeFilter($this->_defaults[self::ESCAPE_FILTER]);
}
/**
* @param string $rule
* @param string $field
* @return string
*/
protected function _getMissingMessage($rule, $field)
{
$message = $this->_defaults[self::MISSING_MESSAGE];
$message = str_replace('%rule%', $rule, $message);
$message = str_replace('%field%', $field, $message);
return $message;
}
/**
* @return string
*/
protected function _getNotEmptyMessage($rule, $field)
{
$message = $this->_defaults[self::NOT_EMPTY_MESSAGE];
$message = str_replace('%rule%', $rule, $message);
$message = str_replace('%field%', $field, $message);
return $message;
}
/**
* @return void
*/
protected function _process()
{
if ($this->_processed === false) {
$this->_filter();
$this->_validate();
$this->_processed = true;
}
}
/**
* @return void
*/
protected function _validate()
{
/**
* Special case: if there are no validators, treat all fields as valid.
*/
if (!$this->_validatorRules) {
$this->_validFields = $this->_data;
$this->_data = array();
return;
}
foreach ($this->_validatorRules as $ruleName => &$validatorRule) {
/**
* Make sure we have an array representing this validator chain.
* Don't typecast to (array) because it might be a Zend_Validate object
*/
if (!is_array($validatorRule)) {
$validatorRule = array($validatorRule);
}
/**
* Validators are indexed by integer, metacommands are indexed by string.
* Pick out the validators.
*/
$validatorList = array();
foreach ($validatorRule as $key => $value) {
if (is_int($key)) {
$validatorList[] = $value;
}
}
/**
* Use defaults for validation metacommands.
*/
$validatorRule[self::RULE] = $ruleName;
if (!isset($validatorRule[self::FIELDS])) {
$validatorRule[self::FIELDS] = $ruleName;
}
if (!isset($validatorRule[self::BREAK_CHAIN])) {
$validatorRule[self::BREAK_CHAIN] = $this->_defaults[self::BREAK_CHAIN];
}
if (!isset($validatorRule[self::PRESENCE])) {
$validatorRule[self::PRESENCE] = $this->_defaults[self::PRESENCE];
}
if (!isset($validatorRule[self::ALLOW_EMPTY])) {
$validatorRule[self::ALLOW_EMPTY] = $this->_defaults[self::ALLOW_EMPTY];
}
if (!isset($validatorRule[self::MESSAGES])) {
$validatorRule[self::MESSAGES] = array();
} else if (!is_array($validatorRule[self::MESSAGES])) {
$validatorRule[self::MESSAGES] = array($validatorRule[self::MESSAGES]);
} else if (!array_intersect_key($validatorList, $validatorRule[self::MESSAGES])) {
$validatorRule[self::MESSAGES] = array($validatorRule[self::MESSAGES]);
}
/**
* Load all the validator classes and add them to the chain.
*/
if (!isset($validatorRule[self::VALIDATOR_CHAIN])) {
$validatorRule[self::VALIDATOR_CHAIN] = new Zend_Validate();
$i = 0;
foreach ($validatorList as $validator) {
if (is_string($validator) || is_array($validator)) {
$validator = $this->_getValidator($validator);
}
if (isset($validatorRule[self::MESSAGES][$i])) {
$value = $validatorRule[self::MESSAGES][$i];
if (is_array($value)) {
$validator->setMessages($value);
} else {
$validator->setMessage($value);
}
}
$validatorRule[self::VALIDATOR_CHAIN]->addValidator($validator, $validatorRule[self::BREAK_CHAIN]);
++$i;
}
$validatorRule[self::VALIDATOR_CHAIN_COUNT] = $i;
}
/**
* If the ruleName is the special wildcard rule,
* then apply the validator chain to all input data.
* Else just process the field named by the rule.
*/
if ($ruleName == self::RULE_WILDCARD) {
foreach (array_keys($this->_data) as $field) {
$this->_validateRule(array_merge($validatorRule, array(self::FIELDS => $field)));
}
} else {
$this->_validateRule($validatorRule);
}
}
/**
* Unset fields in $_data that have been added to other arrays.
* We have to wait until all rules have been processed because
* a given field may be referenced by multiple rules.
*/
foreach (array_merge(array_keys($this->_missingFields), array_keys($this->_invalidMessages)) as $rule) {
foreach ((array) $this->_validatorRules[$rule][self::FIELDS] as $field) {
unset($this->_data[$field]);
}
}
foreach ($this->_validFields as $field => $value) {
unset($this->_data[$field]);
}
/**
* Anything left over in $_data is an unknown field.
*/
$this->_unknownFields = $this->_data;
}
/**
* @param array $validatorRule
* @return void
*/
protected function _validateRule(array $validatorRule)
{
/**
* Get one or more data values from input, and check for missing fields.
* Apply defaults if fields are missing.
*/
$data = array();
foreach ((array) $validatorRule[self::FIELDS] as $field) {
if (array_key_exists($field, $this->_data)) {
$data[$field] = $this->_data[$field];
} else
if (array_key_exists(self::DEFAULT_VALUE, $validatorRule)) {
if (is_array($validatorRule[self::DEFAULT_VALUE])) {
$key = array_search($field, (array) $validatorRule[self::FIELDS]);
if (array_key_exists($key, $validatorRule[self::DEFAULT_VALUE])) {
$data[$field] = $validatorRule[self::DEFAULT_VALUE][$key];
}
} else {
$data[$field] = $validatorRule[self::DEFAULT_VALUE];
}
} else
if ($validatorRule[self::PRESENCE] == self::PRESENCE_REQUIRED) {
$this->_missingFields[$validatorRule[self::RULE]][] =
$this->_getMissingMessage($validatorRule[self::RULE], $field);
}
}
/**
* If any required fields are missing, break the loop.
*/
if (isset($this->_missingFields[$validatorRule[self::RULE]]) && count($this->_missingFields[$validatorRule[self::RULE]]) > 0) {
return;
}
/**
* Evaluate the inputs against the validator chain.
*/
if (count((array) $validatorRule[self::FIELDS]) > 1) {
if (!$validatorRule[self::VALIDATOR_CHAIN]->isValid($data)) {
$this->_invalidMessages[$validatorRule[self::RULE]] = $validatorRule[self::VALIDATOR_CHAIN]->getMessages();
$this->_invalidErrors[$validatorRule[self::RULE]] = $validatorRule[self::VALIDATOR_CHAIN]->getErrors();
return;
}
} else {
$failed = false;
foreach ($data as $fieldKey => $field) {
if (!is_array($field)) {
$field = array($field);
}
foreach ($field as $value) {
if (empty($value)) {
if ($validatorRule[self::ALLOW_EMPTY] == true) {
continue;
}
if ($validatorRule[self::VALIDATOR_CHAIN_COUNT] == 0) {
$notEmptyValidator = $this->_getValidator('NotEmpty');
$notEmptyValidator->setMessage($this->_getNotEmptyMessage($validatorRule[self::RULE], $fieldKey));
$validatorRule[self::VALIDATOR_CHAIN]->addValidator($notEmptyValidator);
}
}
if (!$validatorRule[self::VALIDATOR_CHAIN]->isValid($value)) {
$this->_invalidMessages[$validatorRule[self::RULE]] =
$validatorRule[self::VALIDATOR_CHAIN]->getMessages();
$this->_invalidErrors[$validatorRule[self::RULE]] =
$validatorRule[self::VALIDATOR_CHAIN]->getErrors();
unset($this->_validFields[$fieldKey]);
$failed = true;
if ($validatorRule[self::BREAK_CHAIN]) {
return;
}
}
}
}
if ($failed) {
return;
}
}
/**
* If we got this far, the inputs for this rule pass validation.
*/
foreach ((array) $validatorRule[self::FIELDS] as $field) {
if (array_key_exists($field, $data)) {
$this->_validFields[$field] = $data[$field];
}
}
}
/**
* @param mixed $classBaseName
* @return Zend_Filter_Interface
*/
protected function _getFilter($classBaseName)
{
return $this->_getFilterOrValidator(self::FILTER, $classBaseName);
}
/**
* @param mixed $classBaseName
* @return Zend_Validate_Interface
*/
protected function _getValidator($classBaseName)
{
return $this->_getFilterOrValidator(self::VALIDATE, $classBaseName);
}
/**
* @param string $type
* @param mixed $classBaseName
* @return Zend_Filter_Interface|Zend_Validate_Interface
* @throws Zend_Filter_Exception
*/
protected function _getFilterOrValidator($type, $classBaseName)
{
$args = array();
if (is_array($classBaseName)) {
$args = $classBaseName;
$classBaseName = array_shift($args);
}
$interfaceName = 'Zend_' . ucfirst($type) . '_Interface';
$className = $this->getPluginLoader($type)->load(ucfirst($classBaseName));
$class = new ReflectionClass($className);
if (!$class->implementsInterface($interfaceName)) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception("Class based on basename '$classBaseName' must implement the '$interfaceName' interface");
}
if ($class->hasMethod('__construct')) {
$object = $class->newInstanceArgs($args);
} else {
$object = $class->newInstance();
}
return $object;
}
}
PK (�G[#vZ6B B Dir.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Dir.php 8064 2008-02-16 10:58:39Z thomas $
*/
/**
* @see Zend_Filter_Interface
*/
require_once 'Zend/Filter/Interface.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Dir implements Zend_Filter_Interface
{
/**
* Defined by Zend_Filter_Interface
*
* Returns dirname($value)
*
* @param string $value
* @return string
*/
public function filter($value)
{
return dirname((string) $value);
}
}
PK (�G[���a} } PregReplace.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: PregReplace.php 8064 2008-02-16 10:58:39Z thomas $
*/
/**
* @see Zend_Filter_Interface
*/
require_once 'Zend/Filter/Interface.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_PregReplace implements Zend_Filter_Interface
{
/**
* Pattern to match
* @var mixed
*/
protected $_matchPattern = null;
/**
* Replacement pattern
* @var mixed
*/
protected $_replacement = '';
/**
* Is unicode enabled?
*
* @var bool
*/
static protected $_unicodeSupportEnabled = null;
/**
* Is Unicode Support Enabled Utility function
*
* @return bool
*/
static public function isUnicodeSupportEnabled()
{
if (self::$_unicodeSupportEnabled === null) {
self::_determineUnicodeSupport();
}
return self::$_unicodeSupportEnabled;
}
/**
* Method to cache the regex needed to determine if unicode support is available
*
* @return bool
*/
static protected function _determineUnicodeSupport()
{
self::$_unicodeSupportEnabled = (@preg_match('/\pL/u', 'a')) ? true : false;
}
/**
* Constructor
*
* @param string $match
* @param string $replace
* @return void
*/
public function __construct($matchPattern = null, $replacement = null)
{
if ($matchPattern) {
$this->setMatchPattern($matchPattern);
}
if ($replacement) {
$this->setReplacement($replacement);
}
}
/**
* Set the match pattern for the regex being called within filter()
*
* @param mixed $match - same as the first argument of preg_replace
* @return Zend_Filter_PregReplace
*/
public function setMatchPattern($match)
{
$this->_matchPattern = $match;
return $this;
}
/**
* Get currently set match pattern
*
* @return string
*/
public function getMatchPattern()
{
return $this->_matchPattern;
}
/**
* Set the Replacement pattern/string for the preg_replace called in filter
*
* @param mixed $replacement - same as the second argument of preg_replace
* @return Zend_Filter_PregReplace
*/
public function setReplacement($replacement)
{
$this->_replacement = $replacement;
return $this;
}
/**
* Get currently set replacement value
*
* @return string
*/
public function getReplacement()
{
return $this->_replacement;
}
/**
* Perform regexp replacement as filter
*
* @param string $value
* @return string
*/
public function filter($value)
{
if ($this->_matchPattern == null) {
require_once 'Zend/Filter/Exception.php';
throw new Zend_Filter_Exception(get_class($this) . ' does not have a valid MatchPattern set.');
}
return preg_replace($this->_matchPattern, $this->_replacement, $value);
}
}
PK (�G[&$�� � Alpha.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Alpha.php 12751 2008-11-21 18:30:48Z yoshida@zend.co.jp $
*/
/**
* @see Zend_Filter_Interface
*/
require_once 'Zend/Filter/Interface.php';
/**
* @see Zend_Locale
*/
require_once 'Zend/Locale.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Alpha implements Zend_Filter_Interface
{
/**
* Whether to allow white space characters; off by default
*
* @var boolean
*/
public $allowWhiteSpace;
/**
* Is PCRE is compiled with UTF-8 and Unicode support
*
* @var mixed
**/
protected static $_unicodeEnabled;
/**
* Locale in browser.
*
* @var Zend_Locale object
*/
protected $_locale;
/**
* The Alphabet means english alphabet.
*
* @var boolean
*/
protected static $_meansEnglishAlphabet;
/**
* Sets default option values for this instance
*
* @param boolean $allowWhiteSpace
* @return void
*/
public function __construct($allowWhiteSpace = false)
{
$this->allowWhiteSpace = (boolean) $allowWhiteSpace;
if (null === self::$_unicodeEnabled) {
self::$_unicodeEnabled = (@preg_match('/\pL/u', 'a')) ? true : false;
}
if (null === self::$_meansEnglishAlphabet) {
$this->_locale = new Zend_Locale('auto');
self::$_meansEnglishAlphabet = in_array($this->_locale->getLanguage(),
array('ja', 'ko', 'zh')
);
}
}
/**
* Defined by Zend_Filter_Interface
*
* Returns the string $value, removing all but alphabetic characters
*
* @param string $value
* @return string
*/
public function filter($value)
{
$whiteSpace = $this->allowWhiteSpace ? '\s' : '';
if (!self::$_unicodeEnabled) {
// POSIX named classes are not supported, use alternative a-zA-Z match
$pattern = '/[^a-zA-Z' . $whiteSpace . ']/';
} else if (self::$_meansEnglishAlphabet) {
//The Alphabet means english alphabet.
$pattern = '/[^a-zA-Z' . $whiteSpace . ']/u';
} else {
//The Alphabet means each language's alphabet.
$pattern = '/[^\p{L}' . $whiteSpace . ']/u';
}
return preg_replace($pattern, '', (string) $value);
}
}
PK (�G[�lӺx x HtmlEntities.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: HtmlEntities.php 11783 2008-10-09 17:38:54Z andries $
*/
/**
* @see Zend_Filter_Interface
*/
require_once 'Zend/Filter/Interface.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_HtmlEntities implements Zend_Filter_Interface
{
/**
* Corresponds to second htmlentities() argument
*
* @var integer
*/
protected $_quoteStyle;
/**
* Corresponds to third htmlentities() argument
*
* @var string
*/
protected $_charSet;
/**
* Sets filter options
*
* @param integer $quoteStyle
* @param string $charSet
* @return void
*/
public function __construct($quoteStyle = ENT_COMPAT, $charSet = 'ISO-8859-1')
{
$this->_quoteStyle = $quoteStyle;
$this->_charSet = $charSet;
}
/**
* Returns the quoteStyle option
*
* @return integer
*/
public function getQuoteStyle()
{
return $this->_quoteStyle;
}
/**
* Sets the quoteStyle option
*
* @param integer $quoteStyle
* @return Zend_Filter_HtmlEntities Provides a fluent interface
*/
public function setQuoteStyle($quoteStyle)
{
$this->_quoteStyle = $quoteStyle;
return $this;
}
/**
* Returns the charSet option
*
* @return string
*/
public function getCharSet()
{
return $this->_charSet;
}
/**
* Sets the charSet option
*
* @param string $charSet
* @return Zend_Filter_HtmlEntities Provides a fluent interface
*/
public function setCharSet($charSet)
{
$this->_charSet = $charSet;
return $this;
}
/**
* Defined by Zend_Filter_Interface
*
* Returns the string $value, converting characters to their corresponding HTML entity
* equivalents where they exist
*
* @param string $value
* @return string
*/
public function filter($value)
{
return htmlentities((string) $value, $this->_quoteStyle, $this->_charSet);
}
}
PK (�G[p$�� � StringTrim.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: StringTrim.php 8064 2008-02-16 10:58:39Z thomas $
*/
/**
* @see Zend_Filter_Interface
*/
require_once 'Zend/Filter/Interface.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_StringTrim implements Zend_Filter_Interface
{
/**
* List of characters provided to the trim() function
*
* If this is null, then trim() is called with no specific character list,
* and its default behavior will be invoked, trimming whitespace.
*
* @var string|null
*/
protected $_charList;
/**
* Sets filter options
*
* @param string $charList
* @return void
*/
public function __construct($charList = null)
{
$this->_charList = $charList;
}
/**
* Returns the charList option
*
* @return string|null
*/
public function getCharList()
{
return $this->_charList;
}
/**
* Sets the charList option
*
* @param string|null $charList
* @return Zend_Filter_StringTrim Provides a fluent interface
*/
public function setCharList($charList)
{
$this->_charList = $charList;
return $this;
}
/**
* Defined by Zend_Filter_Interface
*
* Returns the string $value with characters stripped from the beginning and end
*
* @param string $value
* @return string
*/
public function filter($value)
{
if (null === $this->_charList) {
return trim((string) $value);
} else {
return trim((string) $value, $this->_charList);
}
}
}
PK (�G[�B%�E E
Exception.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Exception.php 8064 2008-02-16 10:58:39Z thomas $
*/
/**
* @see Zend_Exception
*/
require_once 'Zend/Exception.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Exception extends Zend_Exception
{}
PK (�G[���� � Alnum.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Alnum.php 12751 2008-11-21 18:30:48Z yoshida@zend.co.jp $
*/
/**
* @see Zend_Filter_Interface
*/
require_once 'Zend/Filter/Interface.php';
/**
* @see Zend_Locale
*/
require_once 'Zend/Locale.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Alnum implements Zend_Filter_Interface
{
/**
* Whether to allow white space characters; off by default
*
* @var boolean
*/
public $allowWhiteSpace;
/**
* Is PCRE is compiled with UTF-8 and Unicode support
*
* @var mixed
**/
protected static $_unicodeEnabled;
/**
* Locale in browser.
*
* @var Zend_Locale object
*/
protected $_locale;
/**
* The Alphabet means english alphabet.
*
* @var boolean
*/
protected static $_meansEnglishAlphabet;
/**
* Sets default option values for this instance
*
* @param boolean $allowWhiteSpace
* @return void
*/
public function __construct($allowWhiteSpace = false)
{
$this->allowWhiteSpace = (boolean) $allowWhiteSpace;
if (null === self::$_unicodeEnabled) {
self::$_unicodeEnabled = (@preg_match('/\pL/u', 'a')) ? true : false;
}
if (null === self::$_meansEnglishAlphabet) {
$this->_locale = new Zend_Locale('auto');
self::$_meansEnglishAlphabet = in_array($this->_locale->getLanguage(),
array('ja', 'ko', 'zh')
);
}
}
/**
* Defined by Zend_Filter_Interface
*
* Returns the string $value, removing all but alphabetic and digit characters
*
* @param string $value
* @return string
*/
public function filter($value)
{
$whiteSpace = $this->allowWhiteSpace ? '\s' : '';
if (!self::$_unicodeEnabled) {
// POSIX named classes are not supported, use alternative a-zA-Z0-9 match
$pattern = '/[^a-zA-Z0-9' . $whiteSpace . ']/';
} else if (self::$_meansEnglishAlphabet) {
//The Alphabet means english alphabet.
$pattern = '/[^a-zA-Z0-9' . $whiteSpace . ']/u';
} else {
//The Alphabet means each language's alphabet.
$pattern = '/[^\p{L}\p{N}' . $whiteSpace . ']/u';
}
return preg_replace($pattern, '', (string) $value);
}
}
PK (�G[-0�}� �
Digits.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Digits.php 8731 2008-03-10 15:08:03Z darby $
*/
/**
* @see Zend_Filter_Interface
*/
require_once 'Zend/Filter/Interface.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_Digits implements Zend_Filter_Interface
{
/**
* Is PCRE is compiled with UTF-8 and Unicode support
*
* @var mixed
**/
protected static $_unicodeEnabled;
/**
* Class constructor
*
* Checks if PCRE is compiled with UTF-8 and Unicode support
*
* @return void
*/
public function __construct()
{
if (null === self::$_unicodeEnabled) {
self::$_unicodeEnabled = (@preg_match('/\pL/u', 'a')) ? true : false;
}
}
/**
* Defined by Zend_Filter_Interface
*
* Returns the string $value, removing all but digit characters
*
* @param string $value
* @return string
*/
public function filter($value)
{
if (!self::$_unicodeEnabled) {
// POSIX named classes are not supported, use alternative 0-9 match
$pattern = '/[^0-9]/';
} else if (extension_loaded('mbstring')) {
// Filter for the value with mbstring
$pattern = '/[^[:digit:]]/';
} else {
// Filter for the value without mbstring
$pattern = '/[\p{^N}]/';
}
return preg_replace($pattern, '', (string) $value);
}
}
PK (�G[��N� � CustomAlnum.phpnu &1i� <?php
require_once 'Zend/Filter/Alnum.php';
class Zend_Filter_CustomAlnum extends Zend_Filter_Alnum {
public function filter($value)
{
$whiteSpace = $this->allowWhiteSpace ? '\s' : '';
$pattern = '/[^a-zA-Z0-9' . $whiteSpace . '�����������������������������������������������������������]/';
return preg_replace($pattern, '', (string) $value);
}
}
?>PK (�G[#��N N BaseName.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: BaseName.php 8064 2008-02-16 10:58:39Z thomas $
*/
/**
* @see Zend_Filter_Interface
*/
require_once 'Zend/Filter/Interface.php';
/**
* @category Zend
* @package Zend_Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Filter_BaseName implements Zend_Filter_Interface
{
/**
* Defined by Zend_Filter_Interface
*
* Returns basename($value)
*
* @param string $value
* @return string
*/
public function filter($value)
{
return basename((string) $value);
}
}
PK H[�s<�� � Message.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Log
* @subpackage Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Message.php 8064 2008-02-16 10:58:39Z thomas $
*/
/** Zend_Log_Filter_Interface */
require_once 'Zend/Log/Filter/Interface.php';
/**
* @category Zend
* @package Zend_Log
* @subpackage Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Message.php 8064 2008-02-16 10:58:39Z thomas $
*/
class Zend_Log_Filter_Message implements Zend_Log_Filter_Interface
{
/**
* @var string
*/
protected $_regexp;
/**
* Filter out any log messages not matching $regexp.
*
* @param string $regexp Regular expression to test the log message
* @throws Zend_Log_Exception
*/
public function __construct($regexp)
{
if (@preg_match($regexp, '') === false) {
throw new Zend_Log_Exception("Invalid regular expression '$regexp'");
}
$this->_regexp = $regexp;
}
/**
* Returns TRUE to accept the message, FALSE to block it.
*
* @param array $event event data
* @return boolean accepted?
*/
public function accept($event)
{
return preg_match($this->_regexp, $event['message']) > 0;
}
}
PK H[!/F� � Priority.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Log
* @subpackage Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Priority.php 8064 2008-02-16 10:58:39Z thomas $
*/
/** Zend_Log_Filter_Interface */
require_once 'Zend/Log/Filter/Interface.php';
/**
* @category Zend
* @package Zend_Log
* @subpackage Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Priority.php 8064 2008-02-16 10:58:39Z thomas $
*/
class Zend_Log_Filter_Priority implements Zend_Log_Filter_Interface
{
/**
* @var integer
*/
protected $_priority;
/**
* @var string
*/
protected $_operator;
/**
* Filter logging by $priority. By default, it will accept any log
* event whose priority value is less than or equal to $priority.
*
* @param integer $priority Priority
* @param string $operator Comparison operator
* @throws Zend_Log_Exception
*/
public function __construct($priority, $operator = '<=')
{
if (! is_integer($priority)) {
throw new Zend_Log_Exception('Priority must be an integer');
}
$this->_priority = $priority;
$this->_operator = $operator;
}
/**
* Returns TRUE to accept the message, FALSE to block it.
*
* @param array $event event data
* @return boolean accepted?
*/
public function accept($event)
{
return version_compare($event['priority'], $this->_priority, $this->_operator);
}
}
PK H[��|ex x Suppress.phpnu &1i� <?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Log
* @subpackage Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Suppress.php 8064 2008-02-16 10:58:39Z thomas $
*/
/** Zend_Log_Filter_Interface */
require_once 'Zend/Log/Filter/Interface.php';
/**
* @category Zend
* @package Zend_Log
* @subpackage Filter
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Suppress.php 8064 2008-02-16 10:58:39Z thomas $
*/
class Zend_Log_Filter_Suppress implements Zend_Log_Filter_Interface
{
/**
* @var boolean
*/
protected $_accept = true;
/**
* This is a simple boolean filter.
*
* Call suppress(true) to suppress all log events.
* Call suppress(false) to accept all log events.
*
* @param boolean $suppress Should all log events be suppressed?
* @return void
*/
public function suppress($suppress)
{
$this->_accept = (! $suppress);
}
/**
* Returns TRUE to accept the message, FALSE to block it.
*
* @param array $event event data
* @return boolean accepted?
*/
public function accept($event)
{
return $this->_accept;
}
}
PK �G[��"�
�
Compression/Flate.phpnu &1i� PK �G[F;�� � Compression/Lzw.phpnu &1i� PK �G[�L`� � � AsciiHex.phpnu &1i� PK �G[`���B B �% Ascii85.phpnu &1i� PK �G[gC��/ /
T, Interface.phpnu &1i� PK �G[���h�: �: �1 Compression.phpnu &1i� PK (�G[%� �� � �l Word/SeparatorToDash.phpnu &1i� PK (�G[=�> > zr Word/SeparatorToCamelCase.phpnu &1i� PK (�G[
��X X z Word/DashToUnderscore.phpnu &1i� PK (�G[Yj�� � � Word/Separator/Abstract.phpnu &1i� PK (�G[��= = � Word/DashToSeparator.phpnu &1i� PK (�G[$P�� � s� Word/CamelCaseToSeparator.phpnu &1i� PK (�G[�k�0 0 �� Word/CamelCaseToUnderscore.phpnu &1i� PK (�G[g�v� � � Word/UnderscoreToSeparator.phpnu &1i� PK (�G[;���\ \ �� Word/SeparatorToSeparator.phpnu &1i� PK (�G[4�= �� Word/CamelCaseToDash.phpnu &1i� PK (�G[Y{/ � Word/UnderscoreToCamelCase.phpnu &1i� PK (�G[���sW W n� Word/UnderscoreToDash.phpnu &1i� PK (�G[�6� � Word/DashToCamelCase.phpnu &1i� PK (�G[ȁ�N N o� RealPath.phpnu &1i� PK (�G[�D ��% �%
�� StripTags.phpnu &1i� PK (�G[
27( ( #� StringToLower.phpnu &1i� PK (�G[Pbӯ( ( �� StringToUpper.phpnu &1i� PK (�G[Xwy�� � � File/LowerCase.phpnu &1i� PK (�G[�$Y^� � File/UpperCase.phpnu &1i� PK (�G[nUYH�! �!
File/Rename.phpnu &1i� PK (�G[־�? ? 7 Int.phpnu &1i� PK (�G[i�P� � z< CustomAccent.phpnu &1i� PK (�G[�ns�N N T? StripNewlines.phpnu &1i� PK (�G[���!#8 #8
�D Inflector.phpnu &1i� PK (�G[�ͳ�p �p C} Input.phpnu &1i� PK (�G[#vZ6B B S� Dir.phpnu &1i� PK (�G[���a} } �� PregReplace.phpnu &1i� PK (�G[&$�� � � Alpha.phpnu &1i� PK (�G[�lӺx x � HtmlEntities.phpnu &1i� PK (�G[p$�� � G StringTrim.phpnu &1i� PK (�G[�B%�E E
.& Exception.phpnu &1i� PK (�G[���� � �* Alnum.phpnu &1i� PK (�G[-0�}� �
�7 Digits.phpnu &1i� PK (�G[��N� � �@ CustomAlnum.phpnu &1i� PK (�G[#��N N �B BaseName.phpnu &1i� PK H[�s<�� � DH Message.phpnu &1i� PK H[!/F� � HP Priority.phpnu &1i� PK H[��|ex x <Y Suppress.phpnu &1i� PK , , �`