Esempio n. 1
0
 function __construct($sac_newcolltitle)
 {
     // Store the title
     $this->sac_colltitle = sac_clean($sac_newcolltitle);
     // Create the accepts arrays
     $sac_accept = array();
     $sac_acceptpackaging = array();
 }
Esempio n. 2
0
 function buildhierarchy($sac_colls, $sac_ns)
 {
     // Build the collections
     foreach ($sac_colls as $sac_collection) {
         // Create the new collection object
         $sac_newcollection = new Collection(sac_clean($sac_collection->children($sac_ns['atom'])->title));
         // The location of the service document
         $href = $sac_collection->xpath("@href");
         $sac_newcollection->sac_href = $href[0]['href'];
         // An array of the accepted deposit types
         foreach ($sac_collection->accept as $sac_accept) {
             if ($sac_accept->attributes()->alternate == 'multipart-related') {
                 $sac_newcollection->sac_acceptalternative[] = $sac_accept;
             } else {
                 $sac_newcollection->sac_accept[] = $sac_accept;
             }
         }
         // An array of the accepted packages
         $sac_collection->registerXPathNamespace('sword', 'http://purl.org/net/sword/terms/');
         foreach ($sac_collection->xpath("sword:acceptPackaging") as $sac_acceptpackaging) {
             $sac_newcollection->addAcceptPackaging($sac_acceptpackaging[0]);
         }
         // Add the collection policy
         $sac_newcollection->sac_collpolicy = sac_clean($sac_collection->children($sac_ns['sword'])->collectionPolicy);
         // Add the collection abstract
         // Check if dcterms is in the known namespaces. If not, might not be an abstract
         if (array_key_exists('dcterms', $sac_ns)) {
             $sac_newcollection->sac_abstract = sac_clean($sac_collection->children($sac_ns['dcterms'])->abstract);
         }
         // Find out if mediation is allowed
         if ($sac_collection->children($sac_ns['sword'])->mediation == 'true') {
             $sac_newcollection->sac_mediation = true;
         } else {
             $sac_newcollection->sac_mediation = false;
         }
         // Add a nested service document if there is one
         $sac_newcollection->sac_service = sac_clean($sac_collection->children($sac_ns['sword'])->service);
         // Add to the  collections in this workspace
         $this->sac_collections[] = $sac_newcollection;
     }
 }
Esempio n. 3
0
 function buildhierarchy($sac_dr, $sac_ns)
 {
     // Set the default namespace
     $sac_dr->registerXPathNamespace('atom', 'http://www.w3.org/2005/Atom');
     // Parse the results
     $this->sac_id = $sac_dr->children($sac_ns['atom'])->id;
     $sac_contentbits = $sac_dr->xpath("atom:content");
     if (!empty($sac_contentbits)) {
         $this->sac_content_src = $sac_contentbits[0]['src'];
         $this->sac_content_type = $sac_contentbits[0]['type'];
     }
     // Store the authors
     foreach ($sac_dr->children($sac_ns['atom'])->author as $sac_author) {
         $sac_theauthor = $sac_author->children($sac_ns['atom'])->name . "";
         $this->sac_authors[] = $sac_theauthor;
     }
     // Store the contributors
     foreach ($sac_dr->children($sac_ns['atom'])->contributor as $sac_contributor) {
         $sac_thecontributor = $sac_contributor->children($sac_ns['atom'])->name . "";
         $this->sac_contributors[] = $sac_thecontributor;
     }
     // Store the links
     foreach ($sac_dr->xpath("atom:link") as $sac_link) {
         $this->sac_links[] = sac_clean($sac_link[0]['href']);
     }
     // Store the title and summary
     $this->sac_title = sac_clean($sac_dr->children($sac_ns['atom'])->title);
     $this->sac_summary = sac_clean($sac_dr->children($sac_ns['atom'])->summary);
     // Store the updated date
     $this->sac_updated = $sac_dr->children($sac_ns['atom'])->updated;
     // Store the rights
     $this->sac_rights = sac_clean($sac_dr->children($sac_ns['atom'])->rights);
     // Store the format namespace
     $this->sac_packaging = $sac_dr->children($sac_ns['sword'])->packaging;
     // Store the generator
     $this->sac_generator = sac_clean($sac_dr->children($sac_ns['atom'])->generator);
     $sac_gen = $sac_dr->xpath("atom:generator");
     if (!empty($sac_gen)) {
         $this->sac_generator_uri = $sac_gen[0]['uri'];
     }
     // Store the user agent
     $this->sac_useragent = sac_clean($sac_dr->children($sac_ns['sword'])->userAgent);
     // Store the noOp status
     if (strtolower((string) $sac_dr->children($sac_ns['sword'])->noOp) == 'true') {
         $this->sac_noOp = true;
     }
 }
Esempio n. 4
0
 function buildhierarchy($sac_dr, $sac_ns)
 {
     // Set the default namespace
     $sac_dr->registerXPathNamespace('atom', 'http://www.w3.org/2005/Atom');
     if (!isset($sac_ns['atom'])) {
         $sac_ns['atom'] = 'http://www.w3.org/2005/Atom';
     }
     if (!isset($sac_ns['dcterms'])) {
         $sac_ns['dcterms'] = 'http://purl.org/dc/terms/';
     }
     if (!isset($sac_ns['sword'])) {
         $sac_ns['sword'] = 'http://purl.org/net/sword/';
     }
     // Parse the results
     $this->sac_id = $sac_dr->children($sac_ns['atom'])->id;
     $sac_contentbits = $sac_dr->xpath("atom:content");
     if (!empty($sac_contentbits)) {
         $this->sac_content_src = $sac_contentbits[0]->attributes()->src;
         $this->sac_content_type = $sac_contentbits[0]->attributes()->type;
     }
     // Store the authors
     foreach ($sac_dr->children($sac_ns['atom'])->author as $sac_author) {
         $sac_theauthor = $sac_author->children($sac_ns['atom'])->name . "";
         $this->sac_authors[] = $sac_theauthor;
     }
     // Store the contributors
     foreach ($sac_dr->children($sac_ns['atom'])->contributor as $sac_contributor) {
         $sac_thecontributor = $sac_contributor->children($sac_ns['atom'])->name . "";
         $this->sac_contributors[] = $sac_thecontributor;
     }
     // Store the links
     foreach ($sac_dr->xpath("atom:link") as $sac_link) {
         $sac_linkobject = new SWORDAPPLink($sac_link->attributes()->rel, $sac_link->attributes()->href, $sac_link->attributes()->type);
         array_push($this->sac_links, $sac_linkobject);
         // Store the Edit IRI
         if ($sac_linkobject->sac_linkrel == 'edit') {
             $this->sac_edit_iri = $sac_linkobject->sac_linkhref;
         }
         // Store the SE-IRI
         if ($sac_linkobject->sac_linkrel == 'http://purl.org/net/sword/terms/add') {
             $this->sac_se_iri = $sac_linkobject->sac_linkhref;
         }
         // Store the Statement IRIs
         if ($sac_linkobject->sac_linkrel == 'http://purl.org/net/sword/terms/statement') {
             if ($sac_linkobject->sac_linktype == 'application/atom+xml;type=feed' || $sac_linkobject->sac_linktype == 'application/atom+xml; type=feed') {
                 $this->sac_state_iri_atom = $sac_linkobject->sac_linkhref;
             } else {
                 if ($sac_linkobject->sac_linktype == 'application/rdf+xml') {
                     $this->sac_state_iri_ore = $sac_linkobject->sac_linkhref;
                 }
             }
         }
         // Store the Edit Media IRIs
         if ($sac_linkobject->sac_linkrel == 'edit-media') {
             // Edit media IRI as Atom feed
             if ($sac_linkobject->sac_linktype == 'application/atom+xml;type=feed' || $sac_linkobject->sac_linktype == 'application/atom+xml; type=feed') {
                 $this->sac_edit_media_iri_atom = $sac_linkobject->sac_linkhref;
             } else {
                 // Edit media IRI
                 $this->sac_edit_media_iri = $sac_linkobject->sac_linkhref;
             }
         }
     }
     // Store the title and summary
     $this->sac_title = sac_clean($sac_dr->children($sac_ns['atom'])->title);
     $this->sac_summary = sac_clean($sac_dr->children($sac_ns['atom'])->summary);
     // Store the updated date
     $this->sac_updated = $sac_dr->children($sac_ns['atom'])->updated;
     // Store the rights
     $this->sac_rights = sac_clean($sac_dr->children($sac_ns['atom'])->rights);
     // Store the treatment
     $this->sac_treatment = sac_clean($sac_dr->children($sac_ns['sword'])->treatment);
     // Store the verboseDescription
     $this->sac_verbose_treatment = sac_clean($sac_dr->children($sac_ns['sword'])->verboseDescription);
     // Store the format namespace
     $this->sac_packaging = $sac_dr->children($sac_ns['sword'])->packaging;
     // Store the generator
     $this->sac_generator = sac_clean($sac_dr->children($sac_ns['atom'])->generator);
     $sac_gen = $sac_dr->xpath("atom:generator");
     if (!empty($sac_gen)) {
         $this->sac_generator_uri = $sac_gen[0]->attributes()->uri;
     }
     // Store the user agent
     $this->sac_useragent = sac_clean($sac_dr->children($sac_ns['sword'])->userAgent);
     // Store any embedded metadata
     foreach ($sac_dr->children($sac_ns['dcterms']) as $sac_dcterm) {
         if (!isset($this->sac_dcterms[$sac_dcterm->getName()])) {
             $this->sac_dcterms[$sac_dcterm->getName()] = array();
         }
         array_push($this->sac_dcterms[$sac_dcterm->getName()], $sac_dcterm);
     }
     // Store the noOp status
     if (strtolower((string) $sac_dr->children($sac_ns['sword'])->noOp) == 'true') {
         $this->sac_noOp = true;
     }
 }