You are here

class MailhandlerFetcher in Mailhandler 6.2

Same name and namespace in other branches
  1. 7.2 plugins/feeds/plugins/MailhandlerFetcher.class.php \MailhandlerFetcher

Hierarchy

Expanded class hierarchy of MailhandlerFetcher

3 string references to 'MailhandlerFetcher'
MailhandlerFetcher.inc in plugins/feeds/plugins/MailhandlerFetcher.inc
mailhandler_default_feeds_importer_default in modules/mailhandler_default/mailhandler_default.feeds_importer_default.inc
Implementation of hook_feeds_importer_default().
mailhandler_update_6203 in ./mailhandler.install
Update filter plugin names.

File

plugins/feeds/plugins/MailhandlerFetcher.class.php, line 37
Checks for new messages in a mailbox (IMAP, POP3, etc...).

View source
class MailhandlerFetcher extends FeedsFetcher {

  /**
   * Implementation of FeedsFetcher::fetch().
   */
  public function fetch(FeedsSource $source) {
    $source_config = $source
      ->getConfigFor($this);
    return new MailhandlerImportBatch($source_config['source'], $this->config['filter']);
  }

  /**
   * Source form.
   */
  public function sourceForm($source_config) {
    include_once drupal_get_path('module', 'mailhandler') . '/mailhandler.module';
    $form = array();
    $form['source'] = array(
      '#type' => 'select',
      '#title' => t('Mailbox'),
      '#description' => t('Select a mailbox to use'),
      '#default_value' => isset($source_config['source']) ? $source_config['source'] : '',
      '#options' => _mailhandler_build_options(mailhandler_mailbox_load_all(FALSE), 'admin_title'),
    );
    return $form;
  }

  /**
   * Define defaults.
   */
  public function sourceDefaults() {
    return array(
      'source' => '',
    );
  }

  /**
   * Override parent::configDefaults().
   */
  public function configDefaults() {
    return array(
      'filter' => 'MailhandlerFilters',
    );
  }

  /**
   * Config form.
   */
  public function configForm(&$form_state) {
    $form = array();

    // Select message filter (to differentiate nodes/comments/etc)
    $form['filter'] = array(
      '#type' => 'select',
      '#title' => t('Message filter'),
      '#description' => t('Select which types of messages to import. This is a heuristic filter, and may fail in some scenarios. For instance, messages from a mailing list will almost always look like comments. Thus, the safest setting is <em>all</em>.'),
      '#default_value' => $this->config['filter'],
      '#options' => _mailhandler_build_options(mailhandler_get_plugins('mailhandler', 'filters')),
    );
    return $form;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FeedsConfigurable::$config protected property
FeedsConfigurable::$disabled protected property CTools export enabled status of this object.
FeedsConfigurable::$export_type protected property
FeedsConfigurable::$id protected property
FeedsConfigurable::addConfig public function Similar to setConfig but adds to existing configuration. 1
FeedsConfigurable::configFormSubmit public function Submission handler for configForm(). 3
FeedsConfigurable::configFormValidate public function Validation handler for configForm(). 3
FeedsConfigurable::copy public function Copy a configuration. 1
FeedsConfigurable::existing public function Determine whether this object is persistent and enabled. I. e. it is defined either in code or in the database and it is enabled. 1
FeedsConfigurable::getConfig public function Implementation of getConfig(). 1
FeedsConfigurable::instance public static function Instantiate a FeedsConfigurable object. 1
FeedsConfigurable::setConfig public function Set configuration. 1
FeedsConfigurable::__get public function Override magic method __get(). Make sure that $this->config goes through getConfig()
FeedsConfigurable::__isset public function Override magic method __isset(). This is needed due to overriding __get().
FeedsFetcher::clear public function Clear all caches for results for given source. 1
FeedsFetcher::importPeriod public function Override import period settings. This can be used to force a certain import interval. 1
FeedsFetcher::menuItem public function Menu item definition for fetchers of this class. Note how the path component in the item definition matches the return value of FeedsFetcher::path();
FeedsFetcher::path public function Construct a path for a concrete fetcher/source combination. The result of this method matches up with the general path definition in FeedsFetcher::menuItem(). For example usage look at FeedsHTTPFetcher.
FeedsFetcher::request public function Request handler invoked if callback URL is requested. Locked down by default. For a example usage see FeedsHTTPFetcher. 1
FeedsFetcher::subscribe public function Subscribe to a source. Only implement if fetcher requires subscription. 1
FeedsFetcher::unsubscribe public function Unsubscribe from a source. Only implement if fetcher requires subscription. 1
FeedsPlugin::hasSourceConfig public function Returns TRUE if $this->sourceForm() returns a form. Overrides FeedsSourceInterface::hasSourceConfig
FeedsPlugin::loadMappers protected static function Loads on-behalf implementations from mappers/ directory.
FeedsPlugin::save public function Save changes to the configuration of this object. Delegate saving to parent (= Feed) which will collect information from this object by way of getConfig() and store it. Overrides FeedsConfigurable::save
FeedsPlugin::sourceDelete public function A source is being deleted. Overrides FeedsSourceInterface::sourceDelete 1
FeedsPlugin::sourceFormValidate public function Validation handler for sourceForm. Overrides FeedsSourceInterface::sourceFormValidate 2
FeedsPlugin::sourceSave public function A source is being saved. Overrides FeedsSourceInterface::sourceSave 1
FeedsPlugin::__construct protected function Constructor. Overrides FeedsConfigurable::__construct
MailhandlerFetcher::configDefaults public function Override parent::configDefaults(). Overrides FeedsConfigurable::configDefaults
MailhandlerFetcher::configForm public function Config form. Overrides FeedsConfigurable::configForm
MailhandlerFetcher::fetch public function Implementation of FeedsFetcher::fetch(). Overrides FeedsFetcher::fetch
MailhandlerFetcher::sourceDefaults public function Define defaults. Overrides FeedsPlugin::sourceDefaults
MailhandlerFetcher::sourceForm public function Source form. Overrides FeedsPlugin::sourceForm