Source for file TemplateFilters.php
Documentation is available at TemplateFilters.php
- 1: <?php
- 3: /**
- 4: * Nette Framework
- 5: *
- 11: */
- 15: /**
- 16: * Standard template compile-time filters shipped with Nette Framework.
- 17: *
- 20: */
- 22: {
- 24: /**
- 25: * Static class - cannot be instantiated.
- 26: */
- 28: {
- 30: }
- 34: /********************* Filter removePhp ****************d*g**/
- 38: /**
- 39: * Filters out PHP code.
- 40: *
- 43: */
- 45: {
- 46: return preg_replace('#\x01@php:p\d+@\x02#', '<?php ?>', $s); // Template hides PHP code in these snippets
- 47: }
- 51: /********************* Filter relativeLinks ****************d*g**/
- 55: /**
- 56: * Filter relativeLinks: prepends root to relative links.
- 59: */
- 61: {
- 65: $s
- 67: }
- 71: /********************* Filter netteLinks ****************d*g**/
- 75: /**
- 76: * Filter netteLinks: translates links "nette:...".
- 77: * nette:destination?arg
- 80: */
- 82: {
- 86: $s
- 88: }
- 92: /**
- 93: * Callback for self::netteLinks.
- 94: * Parses a "nette" URI (scheme is 'nette') and converts to real URI
- 95: */
- 97: {
- 103: . "link('"
- 106: . '\'))?>'
- 110: }
- 111: }
- 115: /********************* Filter texyElements ****************d*g**/
- 124: /**
- 125: * Process <texy>...</texy> elements.
- 128: */
- 130: {
- 134: $s
- 136: }
- 140: /**
- 141: * Callback for self::texyBlocks.
- 142: */
- 144: {
- 147: // parse attributes
- 154: PREG_SET_ORDER
- 161: elseif ($val{0} === '\'' || $val{0} === '"') $attrs[$key] = html_entity_decode(substr($val, 1, -1), ENT_QUOTES, 'UTF-8');
- 163: }
- 164: }
- 167: }
- 169: }