DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:mathoperation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:mathoperation [2008-08-08 21:25] aerojustplugin:mathoperation [2018-05-30 17:57] (current) Aleksandr
Line 1: Line 1:
 +====== mathoperation Plugin ======
 +
 +---- plugin ----
 +description: Allows math operations to be performed within a wiki page
 +author     : Justus Stull
 +email      : aerojust@gmail.com
 +type       : Syntax
 +lastupdate : 2008-07-08
 +compatible : 2008-05-05 
 +depends    : 
 +conflicts 
 +similar    : 
 +tags       : math
 +
 +downloadurl: 
 +bugtracker : 
 +sourcerepo : 
 +donationurl: 
 +
 +screenshot_img: 
 +----
 +
 +**Version 1.1**
 +
 +**DISCLAIMER.** This plugin uses php ''eval()'' to evaluate the math string you provide. The following check is performed prior to the ''eval()'' method being called. This should ensure that only numeric and numeric operators are present in the string. //Note that trig functions currently are not supported because of this preg_match call.// If you can improve my checking method please feel free to drop me an email and let me know and take a stab at it yourself. I claim no responsibility for this plugin. 
 +
 +<code php>
 + if (!preg_match("/^[^a-zA-Z\!\@\#\$\%\&\{\}\[\]\?\>\<\,\"\:\;\~\'\`]+$/", $match))
 + {
 +   $renderer->doc .= '{{mathop>}} ERROR - Not A Valid Entry, only numeric and operators are allowed';
 +   return true;
 + }
 +</code>
 +
 +^Download|{{http://media.justusstull.com/dokuWikiPlugins/dokuWikiPlugins-mathoperation.tar.gz|mathoperation.tar.gz}}|  
 +
 +===== Description =====
 +
 +This plugin reads in a string of math operations and renderers the result of the operations. Any math operation should be valid as the plugin makes use of PHP eval() on the entered string. //Note: Trig functions will not work in version 1.1 due to the way the string is checked for malicious code.//
 + 
 +===== Syntax =====
 +
 +  {{mathop>[math_string]&[round_number]}}
 +
 +  - ''math_string'' contains the string to be evaluated (ex. 2 + 4 * 10 / 34)
 +  - ''round_number'' is **optional**, it is the number of digits display on the right side of the decimal point. Setting this will round off to the specified precision. 
 +
 +===== Discussion =====
 +
 +===== Version =====
 +
 +^Version  ^Description  ^
 +|1.1  |Fixed important security issue  |
 +|1.0  |Initial  |
  

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki