* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
* @author Evan Prodromou <evan@wikitravel.org>
- * @package MediaWiki
*/
/**
- *
+ * TODO: Perhaps make this file into a Metadata class, with static methods (declared
+ * as private where indicated), to move these functions out of the global namespace?
*/
define('RDF_TYPE_PREFS', "application/rdf+xml,text/xml;q=0.7,application/xml;q=0.5,text/rdf;q=0.1");
}
/**
- * @access private
+ * @private
*/
function rdfSetup() {
global $wgOut, $_SERVER;
- $rdftype = wfNegotiateType(wfAcceptToPrefs($_SERVER['HTTP_ACCEPT']), wfAcceptToPrefs(RDF_TYPE_PREFS));
+ $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null;
+
+ $rdftype = wfNegotiateType(wfAcceptToPrefs($httpaccept), wfAcceptToPrefs(RDF_TYPE_PREFS));
if (!$rdftype) {
wfHttpError(406, "Not Acceptable", wfMsg("notacceptable"));
return false;
} else {
$wgOut->disable();
- header( "Content-type: {$rdftype}" );
+ header( "Content-type: {$rdftype}; charset=utf-8" );
$wgOut->sendCacheControl();
return true;
}
}
/**
- * @access private
+ * @private
*/
function dcPrologue($url) {
global $wgOutputEncoding;
}
/**
- * @access private
+ * @private
*/
function dcEpilogue() {
print "
}
/**
- * @access private
+ * @private
*/
function dcBasics($article) {
global $wgContLanguageCode, $wgSitename;
dcPerson('contributor', $user_parts[0], $user_parts[1], $user_parts[2]);
}
- dcRights($article);
+ dcRights();
}
/**
- * @access private
+ * @private
*/
function ccPrologue() {
global $wgOutputEncoding;
}
/**
- * @access private
+ * @private
*/
function ccSubPrologue($type, $url) {
$url = htmlspecialchars( $url );
}
/**
- * @access private
+ * @private
*/
function ccSubEpilogue($type) {
echo " </cc:{$type}>\n";
}
/**
- * @access private
+ * @private
*/
function ccLicense($terms) {
}
/**
- * @access private
+ * @private
*/
function ccTerm($term, $name) {
print " <cc:{$term} rdf:resource=\"http://web.resource.org/cc/{$name}\" />\n";
}
/**
- * @access private
+ * @private
*/
function ccEpilogue() {
echo "</rdf:RDF>\n";
}
/**
- * @access private
+ * @private
*/
function dcElement($name, $value) {
$value = htmlspecialchars( $value );
}
/**
- * @access private
+ * @private
*/
function dcDate($timestamp) {
return substr($timestamp, 0, 4) . '-'
}
/**
- * @access private
+ * @private
*/
function dcReallyFullUrl($title) {
return $title->getFullURL();
}
/**
- * @access private
+ * @private
*/
function dcPageOrString($name, $page, $str) {
$nt = Title::newFromText($page);
}
/**
- * @access private
+ * @private
*/
function dcPage($name, $title) {
dcUrl($name, dcReallyFullUrl($title));
}
/**
- * @access private
+ * @private
*/
function dcUrl($name, $url) {
$url = htmlspecialchars( $url );
}
/**
- * @access private
+ * @private
*/
function dcPerson($name, $id, $user_name='', $user_real_name='') {
global $wgContLang;
/**
* Takes an arg, for future enhancement with different rights for
* different pages.
- * @access private
+ * @private
*/
-function dcRights($article) {
+function dcRights() {
global $wgRightsPage, $wgRightsUrl, $wgRightsText;
}
/**
- * @access private
+ * @private
*/
function ccGetTerms($url) {
global $wgLicenseTerms;
return $wgLicenseTerms;
} else {
$known = getKnownLicenses();
- return $known[$url];
+ if( isset( $known[$url] ) ) {
+ return $known[$url];
+ } else {
+ return array();
+ }
}
}
/**
- * @access private
+ * @private
*/
function getKnownLicenses() {