function __construct($spec) { DataTransclusionSource::__construct($spec); $this->url = $spec['url']; $this->dataPath = @$spec['dataPath']; $this->errorPath = @$spec['errorPath']; $this->dataFormat = @$spec['dataFormat']; $this->fieldPathes = @$spec['fieldPathes']; $this->httpOptions = @$spec['httpOptions']; $this->timeout = @$spec['timeout']; if (!$this->dataFormat) { $this->dataFormat = 'php'; } if ($this->dataFormat == 'xml') { if (!$this->transformer) { throw new MWException("XML-Based formats require a record transformer"); } } if (!$this->timeout) { $this->timeout =& $this->httpOptions['timeout']; } if (!$this->timeout) { $this->timeout = 5; } }
/** * Initializes the DBDataTransclusionSource from the given parameter array. * @param $spec associative array of options. See class-level documentation for details. */ function __construct($spec) { if (!isset($spec['fieldNames']) && isset($spec['fieldInfo'])) { $spec['fieldNames'] = array_keys($spec['fieldInfo']); } DataTransclusionSource::__construct($spec); $this->query = $spec['query']; $this->querySuffix = @$spec['querySuffix']; }
/** * Initializes the CachingDataTransclusionSource * * @param $spec an associative array of options. See class-level * documentation of DataTransclusionSource for details. * * @param $data an array containing a list of records. Records from * this list can be accessed via fetchRecord() using the key fields specified * by $spec['keyFields']. If $data is not given, $spec['data'] must contain the data array. */ function __construct($spec, $data = null) { DataTransclusionSource::__construct($spec); if ($data === null) { $data = $spec['data']; } $this->lookup = array(); foreach ($data as $rec) { $this->putRecord($rec); } }