Skip to content

Instantly share code, notes, and snippets.

@dusta
Last active July 27, 2018 18:50
Show Gist options
  • Save dusta/85d8e638977298ebb3a351b2acb0a9ff to your computer and use it in GitHub Desktop.
Save dusta/85d8e638977298ebb3a351b2acb0a9ff to your computer and use it in GitHub Desktop.
Smarty plugin Dframe/Token
<?php
/*
* Smarty plugin for Dframe\Token
* -------------------------------------------------------------
* File: function.token.php
* Type: function
* Name: token
* Purpose: outputs a token
* -------------------------------------------------------------
*/
/*
* Instalation:
* Put file in to app/Libs/Plugins/smarty/function.token.php
* Usage: {token name='userToken'}
*/
function smarty_function_token($name){
$token = new \Dframe\Token(new \Dframe\Session(APP_NAME));
return $token->generate($name['name'])->get($name['name']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment