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 8class Math_Formula_Function_Str extends Math_Formula_Function 9{ 10 function evaluate($element) 11 { 12 $out = []; 13 14 foreach ($element as $child) { 15 if ($child instanceof Math_Formula_InternalString) { 16 $out[] = $child->getContent(); 17 } elseif ($child instanceof Math_Formula_Element) { 18 $out[] = $this->evaluateChild($child); 19 } else { 20 $out[] = str_replace("~nl~", "\n", $child); 21 } 22 } 23 24 return implode(' ', $out); 25 } 26} 27