Ejemplo n.º 1
0
 /**
  * Validate widget input
  * 
  * @access public
  * @return Mixed
  */
 function validate($args, $options, $preview)
 {
     $output = $this->textarea->validate($args, $options, $preview);
     if (empty($output)) {
         return NULL;
     }
     return $output;
 }
Ejemplo n.º 2
0
 /**
  * Validate widget input
  * 
  * @access public
  * @return Mixed
  */
 function validate($args, $options, $preview)
 {
     if (!$options['title-enable'] && !$options['text-enable']) {
         return "";
     }
     extract($args);
     $output = "";
     if (TDOMF_Widget::isEditForm($mode, $tdomf_form_id)) {
         // when it goes to validation, the tdomf_post_id will be the
         // real post id
         $post =& get_post($tdomf_post_id);
         // set default texts to the original post contents
         $options['content-text-default-text'] = $post->post_content;
         $options['content-title-default-text'] = $post->post_title;
     }
     if ($options['title-enable']) {
         $tf_output = $this->textfield->validate($args, $options, $preview, 'content_title');
         if (!empty($tf_output)) {
             if ($output != "") {
                 $output .= "<br/>";
             }
             $output .= $tf_output;
         }
     }
     if ($options['text-enable']) {
         $ta_output = $this->textarea->validate($args, $options, $preview, 'content_content');
         if (!empty($ta_output)) {
             if ($output != "") {
                 $output .= "<br/>";
             }
             $output .= $ta_output;
         }
     }
     // return output if any
     if ($output != "") {
         return $output;
     } else {
         return NULL;
     }
 }