original_string: public function validation($data, $files) {
          global $CFG;
  
          $errors = parent::validation($data, $files);
  
          require_once($CFG->libdir . '/simplepie/moodle_simplepie.php');
  
          $rss = new moodle_simplepie();
          $rssfile = $rss->registry->create('File', array($data['url']));
          $filetest = $rss->registry->create('Locator', array($rssfile));
  
          if (!$filetest->is_feed($rssfile)) {
              $errors['url'] = get_string('feedisinvalid', 'blog');
          } else {
              $rss->set_feed_url($data['url']);
              if (!$rss->init()) {
                  $errors['url'] = get_string('emptyrssfeed', 'blog');
              }
          }
  
          return $errors;
      }
code: public function validation($data, $files) {
          global $CFG;
  
          $errors = parent::validation($data, $files);
  
          require_once($CFG->libdir . '/simplepie/moodle_simplepie.php');
  
          $rss = new moodle_simplepie();
          $rssfile = $rss->registry->create('File', array($data['url']));
          $filetest = $rss->registry->create('Locator', array($rssfile));
  
          if (!$filetest->is_feed($rssfile)) {
              $errors['url'] = get_string('feedisinvalid', 'blog');
          } else {
              $rss->set_feed_url($data['url']);
              if (!$rss->init()) {
                  $errors['url'] = get_string('emptyrssfeed', 'blog');
              }
          }
  
          return $errors;
      }
code_tokens: public function validation ( $ data , $ files ) { global $ CFG ; $ errors = parent :: validation ( $ data , $ files ) ; require_once ( $ CFG -> libdir . '/simplepie/moodle_simplepie.php' ) ; $ rss = new moodle_simplepie ( ) ; $ rssfile = $ rss -> registry -> create ( 'File' , array ( $ data [ 'url' ] ) ) ; $ filetest = $ rss -> registry -> create ( 'Locator' , array ( $ rssfile ) ) ; if ( ! $ filetest -> is_feed ( $ rssfile ) ) { $ errors [ 'url' ] = get_string ( 'feedisinvalid' , 'blog' ) ; } else { $ rss -> set_feed_url ( $ data [ 'url' ] ) ; if ( ! $ rss -> init ( ) ) { $ errors [ 'url' ] = get_string ( 'emptyrssfeed' , 'blog' ) ; } } return $ errors ; }
docstring: Additional validation includes checking URL and tags
docstring_tokens: Additional validation includes checking URL and tags