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 https://nette.org
- 12: *
- 19: */
- 23: /**
- 24: * Standard template filters shipped with Nette Framework.
- 25: *
- 29: */
- 31: {
- 33: /**
- 34: * Static class - cannot be instantiated.
- 35: */
- 37: {
- 39: }
- 43: /********************* Filter curlyBrackets ****************d*g**/
- 53: {
- 54: trigger_error(__METHOD__ . '() is deprecated; use $template->registerFilter(\'CurlyBracketsFilter::invoke\') instead', E_USER_WARNING);
- 56: }
- 60: /********************* Filter fragments ****************d*g**/
- 66: {
- 68: }
- 72: /********************* Filter removePhp ****************d*g**/
- 76: /**
- 77: * Filters out PHP code.
- 78: *
- 81: */
- 83: {
- 84: return preg_replace('#\x01@php:p\d+@\x02#', '<?php ?>', $s); // Template hides PHP code in these snippets
- 85: }
- 89: /********************* Filter autoConfig ****************d*g**/
- 93: /**
- 94: * Template with configuration (experimental).
- 95: * <?nette filter="CurlyBracketsFilter::invoke"?>
- 96: *
- 99: */
- 101: {
- 105: }
- 107: }
- 111: /********************* Filter relativeLinks ****************d*g**/
- 115: /**
- 116: * Filter relativeLinks: prepends root to relative links.
- 119: */
- 121: {
- 125: $s
- 127: }
- 131: /********************* Filter netteLinks ****************d*g**/
- 135: /**
- 136: * Filter netteLinks: translates links "nette:...".
- 137: * nette:destination?arg
- 140: */
- 142: {
- 147: ;
- 148: }
- 152: /**
- 153: * Callback for self::netteLinks.
- 154: * Parses a "nette" URI (scheme is 'nette') and converts to real URI
- 155: */
- 157: {
- 164: . '(\''
- 167: . '\'))?>'
- 171: }
- 172: }
- 176: /********************* Filter texyElements ****************d*g**/
- 185: /**
- 186: * Process <texy>...</texy> elements.
- 189: */
- 191: {
- 195: $s
- 197: }
- 201: /**
- 202: * Callback for self::texyBlocks.
- 203: */
- 205: {
- 208: // parse attributes
- 215: PREG_SET_ORDER
- 222: elseif ($val{0} === '\'' || $val{0} === '"') $attrs[$key] = html_entity_decode(substr($val, 1, -1), ENT_QUOTES, 'UTF-8');
- 224: }
- 225: }
- 228: }
- 230: }
- 233: // back compatiblity: