*prechod na novsiu verziu ZF
[sport-group.git] / library / Zend / Filter / StringToUpper.php
blob3b6f8d0daa420c434303440d82ebbeb32f020983
1 <?php
3 /**
4 * Zend Framework
6 * LICENSE
8 * This source file is subject to the new BSD license that is bundled
9 * with this package in the file LICENSE.txt.
10 * It is also available through the world-wide-web at this URL:
11 * http://framework.zend.com/license/new-bsd
12 * If you did not receive a copy of the license and are unable to
13 * obtain it through the world-wide-web, please send an email
14 * to license@zend.com so we can send you a copy immediately.
16 * @category Zend
17 * @package Zend_Filter
18 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: StringToUpper.php 16217 2009-06-21 19:39:00Z thomas $
24 /**
25 * @see Zend_Filter_Interface
27 require_once 'Zend/Filter/Interface.php';
30 /**
31 * @category Zend
32 * @package Zend_Filter
33 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
34 * @license http://framework.zend.com/license/new-bsd New BSD License
36 class Zend_Filter_StringToUpper implements Zend_Filter_Interface
38 /**
39 * Encoding for the input string
41 * @var string
43 protected $_encoding = null;
45 /**
46 * Set the input encoding for the given string
48 * @param string $encoding
49 * @throws Zend_Filter_Exception
51 public function setEncoding($encoding = null)
53 if (!function_exists('mb_strtoupper')) {
54 require_once 'Zend/Filter/Exception.php';
55 throw new Zend_Filter_Exception('mbstring is required for this feature');
57 $this->_encoding = $encoding;
60 /**
61 * Defined by Zend_Filter_Interface
63 * Returns the string $value, converting characters to uppercase as necessary
65 * @param string $value
66 * @return string
68 public function filter($value)
70 if ($this->_encoding) {
71 return mb_strtoupper((string) $value, $this->_encoding);
74 return strtoupper((string) $value);