JezK
Edit File: TF.Helper.class.php
<?php /******************************************************************************/ /******************************************************************************/ class TFHelper { /**************************************************************************/ static function removeUIndex(&$data) { $argument=array_slice(func_get_args(),1); $data=(array)$data; foreach($argument as $index) { if(!is_array($index)) { if(!array_key_exists($index,$data)) $data[$index]=''; } else { if(!array_key_exists($index[0],$data)) $data[$index[0]]=$index[1]; } } } /**************************************************************************/ static function stripslashesPOST($value) { return(stripslashes_deep($value)); } /**************************************************************************/ static function displayIf($value,$testValue,$text,$display=true) { if(is_array($value)) { foreach($value as $v) { if(strcmp($v,$testValue)==0) { if($display) echo $text; else return($text); return; } } } else { if(strcmp($value,$testValue)==0) { if($display) echo $text; else return($text); } } } /**************************************************************************/ static function disabledIf($value,$testValue,$display=true) { return(TFHelper::displayIf($value,$testValue,' disabled ',$display)); } /**************************************************************************/ static function checkedIf($value,$testValue=1,$display=true) { return(TFHelper::displayIf($value,$testValue,' checked ',$display)); } /**************************************************************************/ static function selectedIf($value,$testValue=1,$display=true) { return(TFHelper::displayIf($value,$testValue,' selected ',$display)); } /**************************************************************************/ } /******************************************************************************/ /******************************************************************************/