1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8//this script may only be included - so its better to die if called directly.
9if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) {
10	header("location: index.php");
11	exit;
12}
13
14/**
15 * Smarty parse modifier plugin
16 * Type:     modifier
17 * Name:     parse
18 * Purpose:  Parse code in Tiki syntax
19 *
20 * @param boolean $simple true for less parsing, false for normal parsing
21 *
22 * @return string Parsed string
23 */
24function smarty_modifier_parse($string, $simple = false)
25{
26	$parserlib = TikiLib::lib('parser');
27	if ($simple) {
28		$string = htmlentities($string, ENT_QUOTES, 'UTF-8'); // Surely this should not be done here, if it is necessary. Chealer 2017-12-29
29		return $parserlib->parse_data_simple($string);
30	} else {
31		return $parserlib->parse_data($string);
32	}
33}
34