public function not_empty($string = NULL)
{
/* Sample use
---------------------------------------------------------
Check a native stash variable, global variable or snippet is not empty:
{if {exp:stash:not_empty type="snippet" name="title"} }
Yes! {title} is not empty
{/if}
Check any string or variable is not empty even if it's not been Stashed:
{if {exp:stash:not_empty:string}{my_string}{/exp:stash:not_empty:string} }
Yes! {my_string} is not empty
{/if}
--------------------------------------------------------- */
if (!is_null($string)) {
$test = $string;
} elseif ($this->EE->TMPL->tagdata) {
// parse any vars in the string we're testing
$this->_parse_sub_template(FALSE, TRUE);
$test = $this->EE->TMPL->tagdata;
} else {
$test = $this->_run_tag('get', array('name', 'type', 'scope', 'context'));
}
$value = str_replace(array("\t", "\n", "\r", "", "\v"), '', trim($test));
return empty($value) ? 0 : 1;
}