You are here

function ARC_api::__construct in Taxonomy import/export via XML 6

Same name and namespace in other branches
  1. 5.2 arc/ARC_api.php \ARC_api::__construct()
  2. 5 arc/ARC_api.php \ARC_api::__construct()
  3. 6.2 arc/ARC_api.php \ARC_api::__construct()
1 call to ARC_api::__construct()
ARC_api::ARC_api in arc/ARC_api.php

File

arc/ARC_api.php, line 36

Class

ARC_api

Code

function __construct($args = "") {

  /* config_path, inc_path, log_path */
  $this->args = is_array($args) ? $args : array();

  /* inc path */
  $this->inc_path = isset($this->args["inc_path"]) ? $this->args["inc_path"] : "";
  $this->inc_path .= strlen($this->inc_path) && substr($this->inc_path, -1) != "/" ? "/" : "";

  /* log path */
  $this->log_path = isset($this->args["log_path"]) ? $this->args["log_path"] : "";
  $this->log_path .= strlen($this->log_path) && substr($this->log_path, -1) != "/" ? "/" : "";

  /* config */
  if (isset($this->args["config_path"]) && $this->args["config_path"] !== false) {
    if (!file_exists($this->args["config_path"])) {
      $this
        ->error("could not find configuration file at '" . $this->args["config_path"] . "'.");
      exit;
    }
    include_once $this->args["config_path"];
    $this->config = arc_get_api_config();
  }
  elseif (isset($this->args["config"])) {
    $this->config = $this->args["config"];
  }
  else {
    $this
      ->error("missing parameter 'config_path' or 'config' in ARC_api.php.");
    exit;
  }

  /* defaults */
  $this->api_val2id_cache_size = isset($this->config["api_val2id_cache_size"]) ? $this->config["api_val2id_cache_size"] : 1000;
}