Code: Select all
$in = $this->getInput();
$clean = array('txtTitle' => $this->_escape($in->getRaw('txtTitle')) or '',
'selClient' => $in->getInt('selClient') or 0,
'selSubclient' => $in->getInt('selSubclient') or 0,
'fsVideo' => $in->getInt('fsVideo') or true,
'txtUrlStream' => $this->_escape($in->getRaw('txtUrlStream')) or '',
'txtUrlDownload' => $this->_escape($in->getRaw('txtUrlDownload')) or '',
'txtWidth' => $this->getInt('txtWidth') or 0,
'txtHeight' => $this->getInt('txtHeight') or 0,
'txtMsgFeedback' => $this->_escape($in->getRaw('txtMsgFeedback')) or '',
'txtMsgStream' => $this->_escape($in->getRaw('txtMsgStream')) or '',
'txtMsgDownload' => $this->_escape($in->getRaw('txtMsgDownload')) or '',
'fsQuestionnaire' => $this->getInt('fsQuestionnaire') or true,
'txtMsgOnStart' => $this->_escape($in->getRaw('txtMsgOnStart')) or '',
'txtMsgOnceFinished' => $this->_escape($in->getRaw('txtMsgOnceFinished')) or '');
$clean = (object)$clean;However there are a couple of problems:
- The first line ($in = $this->getInput();) can fail, as in return NULL, if the form hasn't been posted in which case $in->getRaw('txtTitle') generates an E_FATAL because $in isn't an object.
- I can't make the assignment of $clean conditional based on $in because then my defaults wouldn't be assigned.