/**
  * Filter method
  *
  * @author Atul Atri
  *
  * @param mixed  $_data    data to be filtered
  * @param string $_id      filter name
  * @param int    $_flags   flags
  * @param int    $_type    filter type
  * @param array  $_options options array
  *
  * @return mixed true|false if this is a validation method of  sanitized mixed $_data if this is sanitization method
  */
 public static function Filter($_data, $_id, $_flags = 0, array $_options = array(), $_type = self::FILTER_TYPE_VALIDATE)
 {
     $_instance = SWIFT_FilterManager::GetInstance();
     if ($_type !== self::FILTER_TYPE_VALIDATE) {
         throw new SWIFT_Filter_Exception("Only validation filters are supported yet.");
     }
     return $_instance->ValidateFilter($_data, $_id, $_flags, $_options);
 }
 /**
  * Handle the add comment form submit
  *
  * @author Atul Atri
  *
  * @return String view
  */
 public function AddCommentSubmit()
 {
     $_error = '';
     $_ticketId = $_POST['todo_ticketid'];
     //if this ticket id is already linked throw exception
     $_todoInfo = SWIFT_TodoTicketLink::getTodoInfo($_ticketId);
     if ($_todoInfo === false) {
         $_error = $this->Language->Get('basecamp_todo_not_linked');
         return $this->View->RenderAddCommentsForm($_ticketId, '', $_error);
     }
     $_filters = array('todocomment' => array(array('string', 'error' => 'basecamp_empty_comment')));
     $_isValid = SWIFT_FilterManager::GetInstance()->Validate($_POST, $_filters, true);
     if ($_isValid !== true) {
         $_error = array_pop($_isValid);
         return $this->View->RenderAddCommentsForm($_ticketId, '', $_error);
     }
     try {
         $_files = array();
         if (isset($_POST['todo_files'])) {
             $_files = $_POST['todo_files'];
         }
         $this->PostTodoComment($_ticketId, $_todoInfo['projectid'], $_todoInfo['todoid'], $_POST['todocomment'], $_files);
         return $this->View->TodoCommentPostSuccess();
     } catch (Exception $_e) {
         $_error = $_e->getMessage();
     }
     $this->View->RenderAddCommentsForm($_ticketId, '', $_error);
 }