Skip to content

Instantly share code, notes, and snippets.

@pmeissner
Last active July 29, 2019 07:54
Show Gist options
  • Save pmeissner/5419398 to your computer and use it in GitHub Desktop.
Save pmeissner/5419398 to your computer and use it in GitHub Desktop.
Stupid simple math plugin. {{ math:calc formula="1 + 1" }}
<?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