~chroot64bit/zivios/gentoo-experimental

« back to all changes in this revision

Viewing changes to application/library/Zend/Filter/Word/SeparatorToCamelCase.php

  • Committer: Mustafa A. Hashmi
  • Date: 2008-12-04 13:32:21 UTC
  • Revision ID: mhashmi@zivios.org-20081204133221-0nd1trunwevijj38
Inclusion of new installation framework with ties to zend layout and dojo layout

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * Zend Framework
 
4
 *
 
5
 * LICENSE
 
6
 *
 
7
 * This source file is subject to the new BSD license that is bundled
 
8
 * with this package in the file LICENSE.txt.
 
9
 * It is also available through the world-wide-web at this URL:
 
10
 * http://framework.zend.com/license/new-bsd
 
11
 * If you did not receive a copy of the license and are unable to
 
12
 * obtain it through the world-wide-web, please send an email
 
13
 * to license@zend.com so we can send you a copy immediately.
 
14
 *
 
15
 * @category   Zend
 
16
 * @package    Zend_Filter
 
17
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
18
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
19
 * @version    $Id: CamelCaseToSeparator.php 6779 2007-11-08 15:10:41Z matthew $
 
20
 */
 
21
 
 
22
/**
 
23
 * @see Zend_Filter_PregReplace
 
24
 */
 
25
require_once 'Zend/Filter/Word/Separator/Abstract.php';
 
26
 
 
27
/**
 
28
 * @category   Zend
 
29
 * @package    Zend_Filter
 
30
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
31
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
32
 */
 
33
class Zend_Filter_Word_SeparatorToCamelCase extends Zend_Filter_Word_Separator_Abstract
 
34
{
 
35
 
 
36
    public function filter($value)
 
37
    {
 
38
        // a unicode safe way of converting characters to \x00\x00 notation
 
39
        $pregQuotedSeparator = preg_quote($this->_separator, '#');
 
40
 
 
41
        if (self::isUnicodeSupportEnabled()) {
 
42
            parent::setMatchPattern(array('#('.$pregQuotedSeparator.')(\p{L}{1})#e','#(^\p{Ll}{1})#e'));
 
43
            parent::setReplacement(array("strtoupper('\\2')","strtoupper('\\1')"));
 
44
        } else {
 
45
            parent::setMatchPattern(array('#('.$pregQuotedSeparator.')([A-Z]{1})#e','#(^[a-z]{1})#e'));
 
46
            parent::setReplacement(array("strtoupper('\\2')","strtoupper('\\1')"));
 
47
        }
 
48
 
 
49
        return parent::filter($value);
 
50
    }
 
51
 
 
52
}