original_string: function exportValue(&$submitValues, $assoc = false) {
          global $USER;
  
          $draftitemid = $this->_findValue($submitValues);
          if (null === $draftitemid) {
              $draftitemid = $this->getValue();
          }
  
          // make sure max one file is present and it is not too big
          if (!is_null($draftitemid)) {
              $fs = get_file_storage();
              $usercontext = context_user::instance($USER->id);
              if ($files = $fs->get_area_files($usercontext->id, 'user', 'draft', $draftitemid, 'id DESC', false)) {
                  $file = array_shift($files);
                  if ($this->_options['maxbytes']
                      and $this->_options['maxbytes'] !== USER_CAN_IGNORE_FILE_SIZE_LIMITS
                      and $file->get_filesize() > $this->_options['maxbytes']) {
  
                      // bad luck, somebody tries to sneak in oversized file
                      $file->delete();
                  }
                  foreach ($files as $file) {
                      // only one file expected
                      $file->delete();
                  }
              }
          }
  
          return $this->_prepareValue($draftitemid, true);
      }
code: function exportValue(&$submitValues, $assoc = false) {
          global $USER;
  
          $draftitemid = $this->_findValue($submitValues);
          if (null === $draftitemid) {
              $draftitemid = $this->getValue();
          }
  
          // make sure max one file is present and it is not too big
          if (!is_null($draftitemid)) {
              $fs = get_file_storage();
              $usercontext = context_user::instance($USER->id);
              if ($files = $fs->get_area_files($usercontext->id, 'user', 'draft', $draftitemid, 'id DESC', false)) {
                  $file = array_shift($files);
                  if ($this->_options['maxbytes']
                      and $this->_options['maxbytes'] !== USER_CAN_IGNORE_FILE_SIZE_LIMITS
                      and $file->get_filesize() > $this->_options['maxbytes']) {
  
                      // bad luck, somebody tries to sneak in oversized file
                      $file->delete();
                  }
                  foreach ($files as $file) {
                      // only one file expected
                      $file->delete();
                  }
              }
          }
  
          return $this->_prepareValue($draftitemid, true);
      }
code_tokens: function exportValue ( & $ submitValues , $ assoc = false ) { global $ USER ; $ draftitemid = $ this -> _findValue ( $ submitValues ) ; if ( null === $ draftitemid ) { $ draftitemid = $ this -> getValue ( ) ; } // make sure max one file is present and it is not too big if ( ! is_null ( $ draftitemid ) ) { $ fs = get_file_storage ( ) ; $ usercontext = context_user :: instance ( $ USER -> id ) ; if ( $ files = $ fs -> get_area_files ( $ usercontext -> id , 'user' , 'draft' , $ draftitemid , 'id DESC' , false ) ) { $ file = array_shift ( $ files ) ; if ( $ this -> _options [ 'maxbytes' ] and $ this -> _options [ 'maxbytes' ] !== USER_CAN_IGNORE_FILE_SIZE_LIMITS and $ file -> get_filesize ( ) > $ this -> _options [ 'maxbytes' ] ) { // bad luck, somebody tries to sneak in oversized file $ file -> delete ( ) ; } foreach ( $ files as $ file ) { // only one file expected $ file -> delete ( ) ; } } } return $ this -> _prepareValue ( $ draftitemid , true ) ; }
docstring: export uploaded file
  
  @param array $submitValues values submitted.
  @param bool $assoc specifies if returned array is associative
  @return array
docstring_tokens: export uploaded file