Last active
July 29, 2019 07:54
-
-
Save pmeissner/5419398 to your computer and use it in GitHub Desktop.
Stupid simple math plugin. {{ math:calc formula="1 + 1" }}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Plugin_Math extends Plugin { | |
var $meta = array( | |
'name' => 'Math', | |
'version' => '0.1', | |
'author' => 'Philip Meissner of Creative Loupe', | |
'author_url' => 'http://lou.pe' | |
); | |
public function calc() | |
{ | |
$formula = $this->fetchParam('formula', 0); | |
html_entity_decode($formula); | |
@eval("\$result = $formula;"); | |
return $result; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment