Commits

Nick Freear committed 5c89bec

Moving Moodle_rdf_serv::_get_custom_hash() method to Oembed_Provider base class

Comments (0)

Files changed (3)

application/libraries/Oembed_Provider.php

   }
 
 
+  /**
+  * Create the custom hash fragment.
+  *
+  * From: Moodle_rdf_serv
+  *
+  * @return string Eg. "!labspace.open.ac.uk!Learning_to_Learn_1.0!mod/oucontent/view.php?id=1422&section=3!plain-zip!Debug!12"
+  */
+  protected function _get_custom_hash($rdf, $format = 'mode-unknown') {
+    define('SP', TRACKER_PAGE_URL_SEP);
+    $source_url = isset($rdf->source_url) ? $rdf->source_url : $rdf->original_url;
+    $p = parse_url($source_url); #, PHP_URL_HOST);
+    return $custom_arg = SP. $p['host'] .SP. $rdf->identifier .SP. $p['path']. (isset($p['query']) ? '?'. $p['query'] : '') .SP. $format;
+  }
+
+
   #protected function _safe_xml($xml) {..}
   #function _mkdir_safe($base, $path, $perm=0777) {..}
   #protected function _embedly_api_key() {..}

application/libraries/providers/Moodle_rdf_serv.php

     return $rdf;
   }
 
-  /**
-  * Create the custom hash fragment.
-  * @return string Eg. "!labspace.open.ac.uk!Learning_to_Learn_1.0!mod/oucontent/view.php?id=1422&section=3!plain-zip!Debug!12"
-  */
-  protected function _get_custom_hash($rdf, $format = 'mode-unknown') {
-    define('SP', TRACKER_PAGE_URL_SEP);
-    $p = parse_url($rdf->original_url); #, PHP_URL_HOST);
-    return $custom_arg = SP. $p['host'] .SP. $rdf->identifier .SP. $p['path']. (isset($p['query']) ? '?'. $p['query'] : '') .SP. $format;
-  }
-
 }
 

application/libraries/providers/Oercommons_serv.php

     $rdf->_rdf_type = $rdf->type;
     $rdf->type = 'rich';
 
+    $rdf->_custom_path = $this->_get_custom_hash($rdf);
     $rdf = $this->requestNameWikipedia($rdf);
 
     $this->_addStatus('Requesting site name from Wikipedia search... Received OK.');