Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationLatte
      • ApplicationTracy
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsLatte
      • Framework
      • HttpTracy
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Drivers
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
    • Reflection
    • Security
    • Templating
    • Utils
  • NetteModule
  • none
  • Tracy

Classes

  • FileTemplate
  • Helpers
  • Template

Interfaces

  • IFileTemplate
  • ITemplate
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases
  • Nette homepage
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (https://nette.org)
 5:  * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
 6:  */
 7: 
 8: namespace Nette\Templating;
 9: 
10: use Nette;
11: use Latte;
12: use Nette\Utils\Strings;
13: 
14: 
15: /**
16:  * @deprecated
17:  */
18: class Helpers extends Latte\Runtime\Filters
19: {
20:     private static $helpers = array(
21:         'normalize' => 'Nette\Utils\Strings::normalize',
22:         'toascii' => 'Nette\Utils\Strings::toAscii',
23:         'webalize' => 'Nette\Utils\Strings::webalize',
24:         'padleft' => 'Nette\Utils\Strings::padLeft',
25:         'padright' => 'Nette\Utils\Strings::padRight',
26:         'reverse' => 'Nette\Utils\Strings::reverse',
27:         'url' => 'rawurlencode',
28:     );
29: 
30: 
31:     /**
32:      * Try to load the requested helper.
33:      * @param  string  helper name
34:      * @return callable
35:      */
36:     public static function loader($helper)
37:     {
38:         if (method_exists(__CLASS__, $helper)) {
39:             return array(__CLASS__, $helper);
40:         } elseif (isset(self::$helpers[$helper])) {
41:             return self::$helpers[$helper];
42:         }
43:     }
44: 
45: 
46:     /**
47:      * Date/time modification.
48:      * @param  string|int|\DateTime
49:      * @param  string|int
50:      * @param  string
51:      * @return Nette\Utils\DateTime
52:      */
53:     public static function modifyDate($time, $delta, $unit = NULL)
54:     {
55:         return $time == NULL // intentionally ==
56:             ? NULL
57:             : Nette\Utils\DateTime::from($time)->modify($delta . $unit);
58:     }
59: 
60: 
61:     /**
62:      * Returns array of string length.
63:      * @param  mixed
64:      * @return int
65:      */
66:     public static function length($var)
67:     {
68:         return is_string($var) ? Strings::length($var) : count($var);
69:     }
70: 
71: 
72:     /**
73:      * /dev/null.
74:      * @param  mixed
75:      * @return string
76:      */
77:     public static function null()
78:     {
79:         return '';
80:     }
81: 
82: 
83:     public static function optimizePhp($source, $lineLength = 80)
84:     {
85:         return Latte\Helpers::optimizePhp($source, $lineLength);
86:     }
87: 
88: }
89: 
Nette 2.2 API documentation generated by ApiGen 2.8.0