Add smarty modifer in_array
This commit is contained in:
parent
3311363c27
commit
dbb3e90ace
|
|
@ -44,6 +44,7 @@
|
||||||
$this->object->setTemplateDir($this->template_dir);
|
$this->object->setTemplateDir($this->template_dir);
|
||||||
$this->object->setCompileDir($this->cache_dir);
|
$this->object->setCompileDir($this->cache_dir);
|
||||||
$this->object->setCacheDir($this->cache_dir);
|
$this->object->setCacheDir($this->cache_dir);
|
||||||
|
$this->object->registerPlugin("modifier","in_array", "in_array");
|
||||||
}
|
}
|
||||||
if ($this->engine === 'raintpl') {
|
if ($this->engine === 'raintpl') {
|
||||||
require_once "resources/templates/engine/raintpl/rain.tpl.class.php";
|
require_once "resources/templates/engine/raintpl/rain.tpl.class.php";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Smarty plugin
|
||||||
|
*
|
||||||
|
* @package Smarty
|
||||||
|
* @subpackage PluginsModifier
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Smarty in_array modifier plugin
|
||||||
|
* Type: modifier
|
||||||
|
* Name: in_array
|
||||||
|
* Purpose: Checks if a value exists in an array
|
||||||
|
*
|
||||||
|
* @param string $needle
|
||||||
|
* @param array $haystack
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function smarty_modifier_in_array($needle, $haystack)
|
||||||
|
{
|
||||||
|
return in_array($needle, $haystack);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue