You are here

abstract class countries_import_manager in Countries 8

Defines a base class for country import managers.

Hierarchy

Expanded class hierarchy of countries_import_manager

File

modules/countries_import/plugins/countries_import_manager.inc, line 11
Definition of countries_import_manager.

View source
abstract class countries_import_manager {
  public function importSettingsForm($context, &$form_state) {
    return array();
  }
  public function importKey() {
    return 'iso2';
  }

  /**
   * Returns a list of properties that this provider handles.
   *
   * @return array
   *   An array of properties keyed by the entity property and a description
   *   of the data used to construct this.
   */
  public abstract function propertiesProvided();
  public function suggestedImportProperties() {
    return array_keys($this
      ->propertiesProvided());
  }
  public abstract function import($values, $form, $form_state);
  protected function isValidISO2($code) {
    $code = drupal_strtoupper($code);
    return drupal_strlen($code) == 2 && !preg_match('/[^A-Z]/', $code);
  }
  protected function isUserDefinedISO2($code) {
    $code = drupal_strtoupper($code);
    if ($this
      ->isValidISO2($code)) {
      return preg_match('/^(AA)|(Q[M-Z]+)|(X[A-Z]+)|(ZZ)$/', $code);
    }
    return FALSE;
  }

}

Members