Source for file TemplateFilters.php
Documentation is available at TemplateFilters.php
- 1: <?php
- 3: /**
- 4: * Nette Framework
- 5: *
- 6: * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
- 7: *
- 8: * This source file is subject to the "Nette license" that is bundled
- 9: * with this package in the file license.txt.
- 10: *
- 11: * For more information please see http://nettephp.com
- 12: *
- 18: */
- 22: /**
- 23: * Standard template compile-time filters shipped with Nette Framework.
- 24: *
- 28: */
- 30: {
- 32: /**
- 33: * Static class - cannot be instantiated.
- 34: */
- 36: {
- 38: }
- 42: /********************* Filter removePhp ****************d*g**/
- 46: /**
- 47: * Filters out PHP code.
- 48: *
- 51: */
- 53: {
- 54: return preg_replace('#\x01@php:p\d+@\x02#', '<?php ?>', $s); // NTemplate hides PHP code in these snippets
- 55: }
- 59: /********************* Filter autoConfig ****************d*g**/
- 63: /**
- 64: * NTemplate with configuration (experimental).
- 65: * <?nette filter="LatteFilter::invoke"?>
- 66: *
- 69: */
- 71: {
- 75: }
- 77: }
- 81: /********************* Filter relativeLinks ****************d*g**/
- 85: /**
- 86: * Filter relativeLinks: prepends root to relative links.
- 89: */
- 91: {
- 95: $s
- 97: }
- 101: /********************* Filter netteLinks ****************d*g**/
- 105: /**
- 106: * Filter netteLinks: translates links "nette:...".
- 107: * nette:destination?arg
- 110: */
- 112: {
- 116: $s
- 118: }
- 122: /**
- 123: * Callback for self::netteLinks.
- 124: * Parses a "nette" URI (scheme is 'nette') and converts to real URI
- 125: */
- 127: {
- 133: . "link('"
- 136: . '\'))?>'
- 140: }
- 141: }
- 145: /********************* Filter texyElements ****************d*g**/
- 154: /**
- 155: * Process <texy>...</texy> elements.
- 158: */
- 160: {
- 164: $s
- 166: }
- 170: /**
- 171: * Callback for self::texyBlocks.
- 172: */
- 174: {
- 177: // parse attributes
- 184: PREG_SET_ORDER
- 191: elseif ($val{0} === '\'' || $val{0} === '"') $attrs[$key] = html_entity_decode(substr($val, 1, -1), ENT_QUOTES, 'UTF-8');
- 193: }
- 194: }
- 197: }
- 199: }