Skip to content

Instantly share code, notes, and snippets.

@johndwells
Created July 22, 2011 13:36
Show Gist options
  • Save johndwells/1099473 to your computer and use it in GitHub Desktop.
Save johndwells/1099473 to your computer and use it in GitHub Desktop.
Allow EE plugin to be called statically from PHP
// Taken from the guts of Stash: https://github.com/croxton/Stash
// is this method being called statically from PHP?
if (func_num_args() > 0 && !(isset($this) && get_class($this) == __CLASS__))
{
$this->EE->TMPL->tagparams['name'] = $name;
$this->EE->TMPL->tagparams['type'] = $type;
$this->EE->TMPL->tagparams['scope'] = $scope;
// as this function is called statically,
// we need to get an instance of this object and run get()
$self = new self();
return $self->get();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment