Files
piratepoet/lib/Twig/Functions.php
Jonathan Labreuille 7562ac22ee Edit newsletter
- added custom item_actions to listings
- added special function in order to register pages that aren't present in the menu
- removed useless test.hbs
- added wp_nonce_field & params functions to Twig
- created a separate "newsletter/form.html" (copy of editor.html) but properly formatted
2015-09-25 10:25:50 +02:00

46 lines
904 B
PHP

<?php
namespace MailPoet\Twig;
class Functions extends \Twig_Extension {
function __construct() {
}
function getName() {
return 'functions';
}
function getFunctions() {
return array(
new \Twig_SimpleFunction(
'json_encode',
'json_encode',
array('is_safe' => array('all'))
),
new \Twig_SimpleFunction(
'json_decode',
'json_decode',
array('is_safe' => array('all'))
),
new \Twig_SimpleFunction(
'wp_nonce_field',
'wp_nonce_field',
array('is_safe' => array('all'))
),
new \Twig_SimpleFunction(
'params',
array($this, 'params'),
array('is_safe' => array('all'))
)
);
}
function params($key = null) {
$args = stripslashes_deep($_GET);
if(array_key_exists($key, $args)) {
return $args[$key];
}
return null;
}
}