original_string: function validate($value, $options = null) {
          global $CFG;
          if (is_array($value) && array_key_exists('text', $value)) {
              $value = $value['text'];
          }
          if (is_array($value)) {
              // nasty guess - there has to be something in the array, hopefully nobody invents arrays in arrays
              $value = implode('', $value);
          }
          $stripvalues = array(
              '#</?(?!img|canvas|hr).*?>#im', // all tags except img, canvas and hr
              '#(\xc2\xa0|\s|&nbsp;)#', // Any whitespaces actually.
          );
          if (!empty($CFG->strictformsrequired)) {
              $value = preg_replace($stripvalues, '', (string)$value);
          }
          if ((string)$value == '') {
              return false;
          }
          return true;
      }
code: function validate($value, $options = null) {
          global $CFG;
          if (is_array($value) && array_key_exists('text', $value)) {
              $value = $value['text'];
          }
          if (is_array($value)) {
              // nasty guess - there has to be something in the array, hopefully nobody invents arrays in arrays
              $value = implode('', $value);
          }
          $stripvalues = array(
              '#</?(?!img|canvas|hr).*?>#im', // all tags except img, canvas and hr
              '#(\xc2\xa0|\s|&nbsp;)#', // Any whitespaces actually.
          );
          if (!empty($CFG->strictformsrequired)) {
              $value = preg_replace($stripvalues, '', (string)$value);
          }
          if ((string)$value == '') {
              return false;
          }
          return true;
      }
code_tokens: function validate ( $ value , $ options = null ) { global $ CFG ; if ( is_array ( $ value ) && array_key_exists ( 'text' , $ value ) ) { $ value = $ value [ 'text' ] ; } if ( is_array ( $ value ) ) { // nasty guess - there has to be something in the array, hopefully nobody invents arrays in arrays $ value = implode ( '' , $ value ) ; } $ stripvalues = array ( '#</?(?!img|canvas|hr).*?>#im' , // all tags except img, canvas and hr '#(\xc2\xa0|\s|&nbsp;)#' , // Any whitespaces actually. ) ; if ( ! empty ( $ CFG -> strictformsrequired ) ) { $ value = preg_replace ( $ stripvalues , '' , ( string ) $ value ) ; } if ( ( string ) $ value == '' ) { return false ; } return true ; }
docstring: Checks if an element is not empty.
  This is a server-side validation, it works for both text fields and editor fields
  
  @param string $value Value to check
  @param int|string|array $options Not used yet
  @return bool true if value is not empty
docstring_tokens: Checks if an element is not empty . This is a server - side validation it works for both text fields and editor fields