*/ /** * patTemplate-function required list of vars * * Show content if list of vars is filled * * @version 0.2.0 * @package Wombat * @subpackage patTemplate */ class patTemplate_Function_Require extends patTemplate_Function { /** * name of the function * @access private * @var string */ public $_name = 'Require'; /** * tell that this function has to be executed during runtime * @var string */ public $_type = PATTEMPLATE_FUNCTION_RUNTIME; /** * call the function * * Check all parameters with name prefix "any_". If they are all empty, no content * will be shown. * * @access public * @param array $params parameters of the function (= attributes of the tag) * @param string $content inside tag * @return string content to insert into the template */ public function call($params, $content) { // any foreach ($params as $k => $value) { if (0 != strncmp($k, 'any_', 4)) { continue; } if (!empty($value)) { return $content; } } return ''; } }