Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
/*
4
 * This file is part of the symfony package.
5
 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
 
11
/**
12
 * Abstract output escaping decorator class for "getter" objects.
13
 *
14
 * @see        sfOutputEscaper
15
 * @package    symfony
16
 * @subpackage view
17
 * @author     Mike Squire <mike@somosis.co.uk>
18
 * @version    SVN: $Id: sfOutputEscaperGetterDecorator.class.php 9047 2008-05-19 08:43:05Z FabianLange $
19
 */
20
abstract class sfOutputEscaperGetterDecorator extends sfOutputEscaper
21
{
22
  /**
23
   * Returns the raw, unescaped value associated with the key supplied.
24
   *
25
   * The key might be an index into an array or a value to be passed to the
26
   * decorated object's get() method.
27
   *
28
   * @param  string $key  The key to retrieve
29
   *
30
   * @return mixed The value
31
   */
32
  public abstract function getRaw($key);
33
 
34
  /**
35
   * Returns the escaped value associated with the key supplied.
36
   *
37
   * Typically (using this implementation) the raw value is obtained using the
38
   * {@link getRaw()} method, escaped and the result returned.
39
   *
40
   * @param  string $key             The key to retieve
41
   * @param  string $escapingMethod  The escaping method (a PHP function) to use
42
   *
43
   * @return mixed The escaped value
44
   */
45
  public function get($key, $escapingMethod = null)
46
  {
47
    if (!$escapingMethod)
48
    {
49
      $escapingMethod = $this->escapingMethod;
50
    }
51
 
52
    return sfOutputEscaper::escape($escapingMethod, $this->getRaw($key));
53
  }
54
}