function __construct($sac_theurl, $sac_newstatus, $sac_thexml = '') { // Store the URL $this->sac_url = $sac_theurl; // Store the status $this->sac_status = $sac_newstatus; // Store the raw xml $this->sac_xml = $sac_thexml; // Store the status message switch ($this->sac_status) { case 200: $this->sac_statusmessage = "OK"; break; case 401: $this->sac_statusmessage = "Unauthorized"; break; case 404: $this->sac_statusmessage = "Service document not found"; break; default: $this->sac_statusmessage = "Unknown error (status code " . $this->sac_status . ")"; break; } // Parse the xml if there is some if ($sac_thexml != '') { $sac_xml = @new SimpleXMLElement($sac_thexml); $sac_ns = $sac_xml->getNamespaces(true); if (!isset($sac_ns['sword'])) { $sac_ns['sword'] = 'http://purl.org/net/sword/terms/'; } $this->sac_version = $sac_xml->children($sac_ns['sword'])->version; $this->sac_verbose = $sac_xml->children($sac_ns['sword'])->verbose; $this->sac_noop = $sac_xml->children($sac_ns['sword'])->noOp; $this->sac_maxuploadsize = $sac_xml->children($sac_ns['sword'])->maxUploadSize; // Build the workspaces $sac_ws = @$sac_xml->children($sac_ns['app'])->workspace; foreach ($sac_ws as $sac_workspace) { $sac_newworkspace = new Workspace($sac_workspace->children($sac_ns['atom'])->title); $sac_newworkspace->buildhierarchy(@$sac_workspace->children($sac_ns['app']), $sac_ns); $this->sac_workspaces[] = $sac_newworkspace; } } }