コード例 #1
0
 /**
  * Implementation of FeedsParser::parse().
  */
 public function parse(FeedsSource $source, FeedsFetcherResult $fetcher_result)
 {
     $fetched = $fetcher_result->getRaw();
     $mailbox = $fetched['mailbox'];
     $result = new FeedsParserResult();
     if (!empty($fetched['messages'])) {
         foreach ($fetched['messages'] as $mid => &$message) {
             $this->authenticate($message, $mailbox);
             if ($class = mailhandler_plugin_load_class('mailhandler', $mailbox->settings['retrieve'], 'retrieve', 'handler')) {
                 $class->purge_message($mailbox, $message);
             }
             if ($message['authenticated_uid'] == 0) {
                 // User was not authenticated
                 module_invoke_all('mailhandler_auth_failed', $message);
                 $source_config = $source->getConfigFor($this);
                 if ($source_config['auth_required']) {
                     mailhandler_report('warning', 'User could not be authenticated. Please check your Mailhandler authentication plugin settings.');
                     continue;
                 }
             }
             $this->commands($message, $source);
             $result->items[] = $message;
         }
     }
     return $result;
 }
 public function parse(FeedsSource $source, FeedsFetcherResult $fetcher_result)
 {
     //grab the raw data from the batch
     $raw_data = $fetcher_result->getRaw();
     $file_path = $fetcher_result->getFilePath();
     //parses the extension correctly
     $file_path = pathinfo($file_path);
     $file_type = $file_path['extension'];
     //declares new variables
     $parser_result = new FeedsParserResult();
     $items = array();
     //switches based on file type. data within the files are then passed over to the handlers
     switch ($file_type) {
         case 'ris':
             $items = $this->_getty_bib_ris_handler($raw_data);
             break;
         case 'rdf':
             $items = $this->_getty_bib_rdf_handler($raw_data);
             break;
     }
     $parser_result->items = $items;
     return $parser_result;
 }
コード例 #3
0
 /**
  * Constructor.
  */
 public function __construct($mailbox, $filter)
 {
     $this->mailbox = $mailbox;
     $this->filter = $filter;
     parent::__construct('');
 }
コード例 #4
0
 /**
  * Constructor.
  */
 public function __construct($mailbox_name, $filter)
 {
     parent::__construct('');
     $this->mailbox_name = $mailbox_name;
     $this->filter = $filter;
 }