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); // Template hides PHP code in these snippets
- 55: }
- 59: /********************* Filter relativeLinks ****************d*g**/
- 63: /**
- 64: * Filter relativeLinks: prepends root to relative links.
- 67: */
- 69: {
- 73: $s
- 75: }
- 79: /********************* Filter netteLinks ****************d*g**/
- 83: /**
- 84: * Filter netteLinks: translates links "nette:...".
- 85: * nette:destination?arg
- 88: */
- 90: {
- 94: $s
- 96: }
- 100: /**
- 101: * Callback for self::netteLinks.
- 102: * Parses a "nette" URI (scheme is 'nette') and converts to real URI
- 103: */
- 105: {
- 111: . "link('"
- 114: . '\'))?>'
- 118: }
- 119: }
- 123: /********************* Filter texyElements ****************d*g**/
- 132: /**
- 133: * Process <texy>...</texy> elements.
- 136: */
- 138: {
- 142: $s
- 144: }
- 148: /**
- 149: * Callback for self::texyBlocks.
- 150: */
- 152: {
- 155: // parse attributes
- 162: PREG_SET_ORDER
- 169: elseif ($val{0} === '\'' || $val{0} === '"') $attrs[$key] = html_entity_decode(substr($val, 1, -1), ENT_QUOTES, 'UTF-8');
- 171: }
- 172: }
- 175: }
- 177: }