removed mods directory from the ATutor codebase
[atutor.git] / mods / phpdoc2 / PhpDocumentor / phpDocumentor / Smarty-2.6.0 / libs / plugins / function.math.php
diff --git a/mods/phpdoc2/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/plugins/function.math.php b/mods/phpdoc2/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/plugins/function.math.php
deleted file mode 100644 (file)
index d2b5d82..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php\r
-/**\r
- * Smarty plugin\r
- * @package Smarty\r
- * @subpackage plugins\r
- */\r
-\r
-\r
-/**\r
- * Smarty {math} function plugin\r
- *\r
- * Type:     function<br>\r
- * Name:     math<br>\r
- * Purpose:  handle math computations in template<br>\r
- * @link http://smarty.php.net/manual/en/language.function.math.php {math}\r
- *          (Smarty online manual)\r
- * @param array\r
- * @param Smarty\r
- * @return string\r
- */\r
-function smarty_function_math($params, &$smarty)\r
-{\r
-    // be sure equation parameter is present\r
-    if (empty($params['equation'])) {\r
-        $smarty->trigger_error("math: missing equation parameter");\r
-        return;\r
-    }\r
-\r
-    $equation = $params['equation'];\r
-\r
-    // make sure parenthesis are balanced\r
-    if (substr_count($equation,"(") != substr_count($equation,")")) {\r
-        $smarty->trigger_error("math: unbalanced parenthesis");\r
-        return;\r
-    }\r
-\r
-    // match all vars in equation, make sure all are passed\r
-    preg_match_all("!\!(0x)([a-zA-Z][a-zA-Z0-9_]*)!",$equation, $match);\r
-    $allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10',\r
-                           'max','min','pi','pow','rand','round','sin','sqrt','srand','tan');\r
-    foreach($match[2] as $curr_var) {\r
-        if (!in_array($curr_var,array_keys($params)) && !in_array($curr_var, $allowed_funcs)) {\r
-            $smarty->trigger_error("math: parameter $curr_var not passed as argument");\r
-            return;\r
-        }\r
-    }\r
-\r
-    foreach($params as $key => $val) {\r
-        if ($key != "equation" && $key != "format" && $key != "assign") {\r
-            // make sure value is not empty\r
-            if (strlen($val)==0) {\r
-                $smarty->trigger_error("math: parameter $key is empty");\r
-                return;\r
-            }\r
-            if (!is_numeric($val)) {\r
-                $smarty->trigger_error("math: parameter $key: is not numeric");\r
-                return;\r
-            }\r
-            $equation = preg_replace("/\b$key\b/",$val, $equation);\r
-        }\r
-    }\r
-\r
-    eval("\$smarty_math_result = ".$equation.";");\r
-\r
-    if (empty($params['format'])) {\r
-        if (empty($params['assign'])) {\r
-            return $smarty_math_result;\r
-        } else {\r
-            $smarty->assign($params['assign'],$smarty_math_result);\r
-        }\r
-    } else {\r
-        if (empty($params['assign'])){\r
-            printf($params['format'],$smarty_math_result);\r
-        } else {\r
-            $smarty->assign($params['assign'],sprintf($params['format'],$smarty_math_result));\r
-        }\r
-    }\r
-}\r
-\r
-/* vim: set expandtab: */\r
-\r
-?>\r