| Index: trunk/phase3/maintenance/language/messages.inc |
| — | — | @@ -2489,7 +2489,6 @@ |
| 2490 | 2490 | 'group-bureaucrat.js', |
| 2491 | 2491 | ), |
| 2492 | 2492 | 'metadata_cc' => array( |
| 2493 | | - 'nocreativecommons', |
| 2494 | 2493 | 'notacceptable', |
| 2495 | 2494 | ), |
| 2496 | 2495 | 'attribution' => array( |
| Index: trunk/phase3/includes/OutputPage.php |
| — | — | @@ -2703,7 +2703,6 @@ |
| 2704 | 2704 | global $wgUniversalEditButton, $wgFavicon, $wgAppleTouchIcon, $wgEnableAPI, |
| 2705 | 2705 | $wgSitename, $wgVersion, $wgHtml5, $wgMimeType, |
| 2706 | 2706 | $wgFeed, $wgOverrideSiteFeed, $wgAdvertisedFeedTypes, |
| 2707 | | - $wgEnableCreativeCommonsRdf, |
| 2708 | 2707 | $wgDisableLangConversion, $wgCanonicalLanguageLinks, $wgContLang, |
| 2709 | 2708 | $wgRightsPage, $wgRightsUrl; |
| 2710 | 2709 | |
| — | — | @@ -2828,24 +2827,6 @@ |
| 2829 | 2828 | ) ); |
| 2830 | 2829 | } |
| 2831 | 2830 | |
| 2832 | | - # Metadata links |
| 2833 | | - # - Creative Commons |
| 2834 | | - # See http://wiki.creativecommons.org/Extend_Metadata. |
| 2835 | | - # - Dublin Core |
| 2836 | | - # Use hreflang to specify canonical and alternate links |
| 2837 | | - # See http://www.google.com/support/webmasters/bin/answer.py?answer=189077 |
| 2838 | | - if ( $this->isArticleRelated() ) { |
| 2839 | | - # note: buggy CC software only reads first "meta" link |
| 2840 | | - if ( $wgEnableCreativeCommonsRdf ) { |
| 2841 | | - $tags[] = Html::element( 'link', array( |
| 2842 | | - 'rel' => $this->getMetadataAttribute(), |
| 2843 | | - 'title' => 'Creative Commons', |
| 2844 | | - 'type' => 'application/rdf+xml', |
| 2845 | | - 'href' => $this->getTitle()->getLocalURL( 'action=creativecommons' ) ) |
| 2846 | | - ); |
| 2847 | | - } |
| 2848 | | - } |
| 2849 | | - |
| 2850 | 2831 | # Language variants |
| 2851 | 2832 | if ( !$wgDisableLangConversion && $wgCanonicalLanguageLinks |
| 2852 | 2833 | && $wgContLang->hasVariants() ) { |
| Index: trunk/phase3/includes/AutoLoader.php |
| — | — | @@ -49,7 +49,6 @@ |
| 50 | 50 | 'ConfEditorToken' => 'includes/ConfEditor.php', |
| 51 | 51 | 'Cookie' => 'includes/Cookie.php', |
| 52 | 52 | 'CookieJar' => 'includes/Cookie.php', |
| 53 | | - 'CreativeCommonsRdf' => 'includes/Metadata.php', |
| 54 | 53 | 'DiffHistoryBlob' => 'includes/HistoryBlob.php', |
| 55 | 54 | 'DjVuImage' => 'includes/DjVuImage.php', |
| 56 | 55 | 'DoubleReplacer' => 'includes/StringUtils.php', |
| Index: trunk/phase3/includes/Wiki.php |
| — | — | @@ -406,8 +406,7 @@ |
| 407 | 407 | * @param $article Article |
| 408 | 408 | */ |
| 409 | 409 | private function performAction( $article ) { |
| 410 | | - global $wgSquidMaxage, $wgUseExternalEditor, |
| 411 | | - $wgEnableCreativeCommonsRdf; |
| | 410 | + global $wgSquidMaxage, $wgUseExternalEditor; |
| 412 | 411 | |
| 413 | 412 | wfProfileIn( __METHOD__ ); |
| 414 | 413 | |
| — | — | @@ -450,14 +449,6 @@ |
| 451 | 450 | case 'deletetrackback': |
| 452 | 451 | $article->$act(); |
| 453 | 452 | break; |
| 454 | | - case 'creativecommons': |
| 455 | | - if ( !$wgEnableCreativeCommonsRdf ) { |
| 456 | | - wfHttpError( 403, 'Forbidden', wfMsg( 'nocreativecommons' ) ); |
| 457 | | - } else { |
| 458 | | - $rdf = new CreativeCommonsRdf( $article ); |
| 459 | | - $rdf->show(); |
| 460 | | - } |
| 461 | | - break; |
| 462 | 453 | case 'submit': |
| 463 | 454 | if ( session_id() == '' ) { |
| 464 | 455 | // Send a cookie so anons get talk message notifications |
| Index: trunk/phase3/includes/DefaultSettings.php |
| — | — | @@ -4406,9 +4406,6 @@ |
| 4407 | 4407 | * @{ |
| 4408 | 4408 | */ |
| 4409 | 4409 | |
| 4410 | | -/** RDF metadata toggles */ |
| 4411 | | -$wgEnableCreativeCommonsRdf = false; |
| 4412 | | - |
| 4413 | 4410 | /** Override for copyright metadata. |
| 4414 | 4411 | * TODO: these options need documentation |
| 4415 | 4412 | */ |
| Index: trunk/phase3/includes/Metadata.php |
| — | — | @@ -198,86 +198,3 @@ |
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | | -class CreativeCommonsRdf extends RdfMetaData { |
| 203 | | - |
| 204 | | - public function show(){ |
| 205 | | - if( $this->setup() ){ |
| 206 | | - global $wgRightsUrl; |
| 207 | | - |
| 208 | | - $url = $this->reallyFullUrl(); |
| 209 | | - |
| 210 | | - $this->prologue(); |
| 211 | | - $this->subPrologue('Work', $url); |
| 212 | | - |
| 213 | | - $this->basics(); |
| 214 | | - if( $wgRightsUrl ){ |
| 215 | | - $url = htmlspecialchars( $wgRightsUrl ); |
| 216 | | - print "\t\t<cc:license rdf:resource=\"$url\" />\n"; |
| 217 | | - } |
| 218 | | - |
| 219 | | - $this->subEpilogue('Work'); |
| 220 | | - |
| 221 | | - if( $wgRightsUrl ){ |
| 222 | | - $terms = $this->getTerms( $wgRightsUrl ); |
| 223 | | - if( $terms ){ |
| 224 | | - $this->subPrologue( 'License', $wgRightsUrl ); |
| 225 | | - $this->license( $terms ); |
| 226 | | - $this->subEpilogue( 'License' ); |
| 227 | | - } |
| 228 | | - } |
| 229 | | - } |
| 230 | | - |
| 231 | | - $this->epilogue(); |
| 232 | | - } |
| 233 | | - |
| 234 | | - protected function prologue() { |
| 235 | | - echo <<<PROLOGUE |
| 236 | | -<?xml version='1.0' encoding="UTF-8" ?> |
| 237 | | -<rdf:RDF xmlns:cc="http://web.resource.org/cc/" |
| 238 | | - xmlns:dc="http://purl.org/dc/elements/1.1/" |
| 239 | | - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> |
| 240 | | - |
| 241 | | -PROLOGUE; |
| 242 | | - } |
| 243 | | - |
| 244 | | - protected function subPrologue( $type, $url ){ |
| 245 | | - $url = htmlspecialchars( $url ); |
| 246 | | - echo "\t<cc:{$type} rdf:about=\"{$url}\">\n"; |
| 247 | | - } |
| 248 | | - |
| 249 | | - protected function subEpilogue($type) { |
| 250 | | - echo "\t</cc:{$type}>\n"; |
| 251 | | - } |
| 252 | | - |
| 253 | | - protected function license($terms) { |
| 254 | | - |
| 255 | | - foreach( $terms as $term ){ |
| 256 | | - switch( $term ) { |
| 257 | | - case 're': |
| 258 | | - $this->term('permits', 'Reproduction'); break; |
| 259 | | - case 'di': |
| 260 | | - $this->term('permits', 'Distribution'); break; |
| 261 | | - case 'de': |
| 262 | | - $this->term('permits', 'DerivativeWorks'); break; |
| 263 | | - case 'nc': |
| 264 | | - $this->term('prohibits', 'CommercialUse'); break; |
| 265 | | - case 'no': |
| 266 | | - $this->term('requires', 'Notice'); break; |
| 267 | | - case 'by': |
| 268 | | - $this->term('requires', 'Attribution'); break; |
| 269 | | - case 'sa': |
| 270 | | - $this->term('requires', 'ShareAlike'); break; |
| 271 | | - case 'sc': |
| 272 | | - $this->term('requires', 'SourceCode'); break; |
| 273 | | - } |
| 274 | | - } |
| 275 | | - } |
| 276 | | - |
| 277 | | - protected function term( $term, $name ){ |
| 278 | | - print "\t\t<cc:{$term} rdf:resource=\"http://web.resource.org/cc/{$name}\" />\n"; |
| 279 | | - } |
| 280 | | - |
| 281 | | - protected function epilogue() { |
| 282 | | - echo "</rdf:RDF>\n"; |
| 283 | | - } |
| 284 | | -} |
| Index: trunk/extensions/DublinCoreRdf/DublinCoreRdf.php |
| — | — | @@ -2,16 +2,16 @@ |
| 3 | 3 | |
| 4 | 4 | $wgExtensionCredits['other'][] = array( |
| 5 | 5 | 'path' => __FILE__, |
| 6 | | - 'name' => 'DublinCore', |
| | 6 | + 'name' => 'DublinCoreRdf', |
| 7 | 7 | 'url' => '', |
| 8 | 8 | 'author' => 'Evan Prodromou', |
| 9 | 9 | ); |
| 10 | 10 | |
| 11 | | -$wgHooks['MediaWikiPerformAction'][] = 'efDublinCorePreformAction'; |
| | 11 | +$wgHooks['MediaWikiPerformAction'][] = 'efDublinCorePerformAction'; |
| 12 | 12 | |
| 13 | 13 | $wgAutoloadClasses['DublinCoreRdf'] = $dir . 'DublinCoreRdf_body.php'; |
| 14 | 14 | |
| 15 | | -function efDublinCorePreformAction( $output, $article, $title, $user, $request, $mediaWiki ) { |
| | 15 | +function efDublinCorePerformAction( $output, $article, $title, $user, $request, $mediaWiki ) { |
| 16 | 16 | if ( $mediaWiki->getAction() !== 'dublincore' ) { |
| 17 | 17 | return true; |
| 18 | 18 | } |
| Index: trunk/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php |
| — | — | @@ -65,6 +65,8 @@ |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * Register parser hook |
| | 69 | + * |
| | 70 | + * @param $parser Parser |
| 69 | 71 | */ |
| 70 | 72 | function efSyntaxHighlight_GeSHiSetup( &$parser ) { |
| 71 | 73 | $parser->setHook( 'source', array( 'SyntaxHighlight_GeSHi', 'parserHook' ) ); |
| Index: trunk/extensions/CreativeCommonsRdf/CreativeCommonsRdf.php |
| — | — | @@ -0,0 +1,22 @@ |
| | 2 | +<?php |
| | 3 | + |
| | 4 | +$wgExtensionCredits['other'][] = array( |
| | 5 | + 'path' => __FILE__, |
| | 6 | + 'name' => 'CreativeCoreRdf', |
| | 7 | + 'url' => '', |
| | 8 | + 'author' => 'Evan Prodromou', |
| | 9 | +); |
| | 10 | + |
| | 11 | +$wgHooks['MediaWikiPerformAction'][] = 'efCreativeCoreRdfPreformAction'; |
| | 12 | + |
| | 13 | +$wgAutoloadClasses['CreativeCoreRdf'] = $dir . 'CreativeCoreRdf_body.php'; |
| | 14 | + |
| | 15 | +function efCreativeCoreRdfPreformAction( $output, $article, $title, $user, $request, $mediaWiki ) { |
| | 16 | + if ( $mediaWiki->getAction() !== 'creativecommons' ) { |
| | 17 | + return true; |
| | 18 | + } |
| | 19 | + |
| | 20 | + $rdf = new CreativeCommonsRdf( $article ); |
| | 21 | + $rdf->show(); |
| | 22 | + return false; |
| | 23 | +} |
| \ No newline at end of file |
| Property changes on: trunk/extensions/CreativeCommonsRdf/CreativeCommonsRdf.php |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| 1 | 24 | + native |
| Index: trunk/extensions/CreativeCommonsRdf/CreativeCommonsRdf_body.php |
| — | — | @@ -0,0 +1,283 @@ |
| | 2 | +<?php |
| | 3 | +/** |
| | 4 | + * Provides CreativeCommons metadata |
| | 5 | + * |
| | 6 | + * Copyright 2004, Evan Prodromou <evan@wikitravel.org>. |
| | 7 | + * |
| | 8 | + * This program is free software; you can redistribute it and/or modify |
| | 9 | + * it under the terms of the GNU General Public License as published by |
| | 10 | + * the Free Software Foundation; either version 2 of the License, or |
| | 11 | + * (at your option) any later version. |
| | 12 | + * |
| | 13 | + * This program is distributed in the hope that it will be useful, |
| | 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| | 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| | 16 | + * GNU General Public License for more details. |
| | 17 | + * |
| | 18 | + * You should have received a copy of the GNU General Public License |
| | 19 | + * along with this program; if not, write to the Free Software |
| | 20 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
| | 21 | + * |
| | 22 | + * @author Evan Prodromou <evan@wikitravel.org> |
| | 23 | + * @file |
| | 24 | + */ |
| | 25 | + |
| | 26 | +abstract class RdfMetaData { |
| | 27 | + const RDF_TYPE_PREFS = 'application/rdf+xml,text/xml;q=0.7,application/xml;q=0.5,text/rdf;q=0.1'; |
| | 28 | + |
| | 29 | + /** |
| | 30 | + * Constructor |
| | 31 | + * @param $article Article object |
| | 32 | + */ |
| | 33 | + public function __construct( Article $article ) { |
| | 34 | + $this->mArticle = $article; |
| | 35 | + } |
| | 36 | + |
| | 37 | + public abstract function show(); |
| | 38 | + |
| | 39 | + /** |
| | 40 | + * |
| | 41 | + */ |
| | 42 | + protected function setup() { |
| | 43 | + global $wgOut, $wgRequest; |
| | 44 | + |
| | 45 | + $httpaccept = isset( $_SERVER['HTTP_ACCEPT'] ) ? $_SERVER['HTTP_ACCEPT'] : null; |
| | 46 | + $rdftype = wfNegotiateType( wfAcceptToPrefs( $httpaccept ), wfAcceptToPrefs( self::RDF_TYPE_PREFS ) ); |
| | 47 | + |
| | 48 | + if( !$rdftype ){ |
| | 49 | + wfHttpError( 406, 'Not Acceptable', wfMsg( 'notacceptable' ) ); |
| | 50 | + return false; |
| | 51 | + } else { |
| | 52 | + $wgOut->disable(); |
| | 53 | + $wgRequest->response()->header( "Content-type: {$rdftype}; charset=utf-8" ); |
| | 54 | + $wgOut->sendCacheControl(); |
| | 55 | + return true; |
| | 56 | + } |
| | 57 | + } |
| | 58 | + |
| | 59 | + /** |
| | 60 | + * |
| | 61 | + */ |
| | 62 | + protected function reallyFullUrl() { |
| | 63 | + return $this->mArticle->getTitle()->getFullURL(); |
| | 64 | + } |
| | 65 | + |
| | 66 | + protected function basics() { |
| | 67 | + global $wgLanguageCode, $wgSitename; |
| | 68 | + |
| | 69 | + $this->element( 'title', $this->mArticle->mTitle->getText() ); |
| | 70 | + $this->pageOrString( 'publisher', wfMsg( 'aboutpage' ), $wgSitename ); |
| | 71 | + $this->element( 'language', $wgLanguageCode ); |
| | 72 | + $this->element( 'type', 'Text' ); |
| | 73 | + $this->element( 'format', 'text/html' ); |
| | 74 | + $this->element( 'identifier', $this->reallyFullUrl() ); |
| | 75 | + $this->element( 'date', $this->date( $this->mArticle->getTimestamp() ) ); |
| | 76 | + |
| | 77 | + $lastEditor = User::newFromId( $this->mArticle->getUser() ); |
| | 78 | + $this->person( 'creator', $lastEditor ); |
| | 79 | + |
| | 80 | + foreach( $this->mArticle->getContributors() as $user ){ |
| | 81 | + $this->person( 'contributor', $user ); |
| | 82 | + } |
| | 83 | + |
| | 84 | + $this->rights(); |
| | 85 | + } |
| | 86 | + |
| | 87 | + protected function element( $name, $value ) { |
| | 88 | + $value = htmlspecialchars( $value ); |
| | 89 | + print "\t\t<dc:{$name}>{$value}</dc:{$name}>\n"; |
| | 90 | + } |
| | 91 | + |
| | 92 | + protected function date($timestamp) { |
| | 93 | + return substr($timestamp, 0, 4) . '-' |
| | 94 | + . substr($timestamp, 4, 2) . '-' |
| | 95 | + . substr($timestamp, 6, 2); |
| | 96 | + } |
| | 97 | + |
| | 98 | + protected function pageOrString( $name, $page, $str ) { |
| | 99 | + if( $page instanceof Title ) |
| | 100 | + $nt = $page; |
| | 101 | + else |
| | 102 | + $nt = Title::newFromText( $page ); |
| | 103 | + |
| | 104 | + if( !$nt || $nt->getArticleID() == 0 ){ |
| | 105 | + $this->element( $name, $str ); |
| | 106 | + } else { |
| | 107 | + $this->page( $name, $nt ); |
| | 108 | + } |
| | 109 | + } |
| | 110 | + |
| | 111 | + protected function page( $name, $title ) { |
| | 112 | + $this->url( $name, $title->getFullUrl() ); |
| | 113 | + } |
| | 114 | + |
| | 115 | + protected function url($name, $url) { |
| | 116 | + $url = htmlspecialchars( $url ); |
| | 117 | + print "\t\t<dc:{$name} rdf:resource=\"{$url}\" />\n"; |
| | 118 | + } |
| | 119 | + |
| | 120 | + protected function person( $name, User $user ) { |
| | 121 | + if( $user->isAnon() ){ |
| | 122 | + $this->element( $name, wfMsgExt( 'anonymous', array( 'parsemag' ), 1 ) ); |
| | 123 | + } else { |
| | 124 | + $real = $user->getRealName(); |
| | 125 | + if( $real ) { |
| | 126 | + $this->element( $name, $real ); |
| | 127 | + } else { |
| | 128 | + $userName = $user->getName(); |
| | 129 | + $this->pageOrString( $name, $user->getUserPage(), wfMsgExt( 'siteuser', 'parsemag', $userName, $userName ) ); |
| | 130 | + } |
| | 131 | + } |
| | 132 | + } |
| | 133 | + |
| | 134 | + /** |
| | 135 | + * Takes an arg, for future enhancement with different rights for |
| | 136 | + * different pages. |
| | 137 | + */ |
| | 138 | + protected function rights() { |
| | 139 | + global $wgRightsPage, $wgRightsUrl, $wgRightsText; |
| | 140 | + |
| | 141 | + if( $wgRightsPage && ( $nt = Title::newFromText( $wgRightsPage ) ) |
| | 142 | + && ($nt->getArticleID() != 0)) { |
| | 143 | + $this->page('rights', $nt); |
| | 144 | + } else if( $wgRightsUrl ){ |
| | 145 | + $this->url('rights', $wgRightsUrl); |
| | 146 | + } else if( $wgRightsText ){ |
| | 147 | + $this->element( 'rights', $wgRightsText ); |
| | 148 | + } |
| | 149 | + } |
| | 150 | + |
| | 151 | + protected function getTerms( $url ){ |
| | 152 | + global $wgLicenseTerms; |
| | 153 | + |
| | 154 | + if( $wgLicenseTerms ){ |
| | 155 | + return $wgLicenseTerms; |
| | 156 | + } else { |
| | 157 | + $known = $this->getKnownLicenses(); |
| | 158 | + if( isset( $known[$url] ) ) { |
| | 159 | + return $known[$url]; |
| | 160 | + } else { |
| | 161 | + return array(); |
| | 162 | + } |
| | 163 | + } |
| | 164 | + } |
| | 165 | + |
| | 166 | + protected function getKnownLicenses() { |
| | 167 | + $ccLicenses = array('by', 'by-nd', 'by-nd-nc', 'by-nc', |
| | 168 | + 'by-nc-sa', 'by-sa'); |
| | 169 | + $ccVersions = array('1.0', '2.0'); |
| | 170 | + $knownLicenses = array(); |
| | 171 | + |
| | 172 | + foreach ($ccVersions as $version) { |
| | 173 | + foreach ($ccLicenses as $license) { |
| | 174 | + if( $version == '2.0' && substr( $license, 0, 2) != 'by' ) { |
| | 175 | + # 2.0 dropped the non-attribs licenses |
| | 176 | + continue; |
| | 177 | + } |
| | 178 | + $lurl = "http://creativecommons.org/licenses/{$license}/{$version}/"; |
| | 179 | + $knownLicenses[$lurl] = explode('-', $license); |
| | 180 | + $knownLicenses[$lurl][] = 're'; |
| | 181 | + $knownLicenses[$lurl][] = 'di'; |
| | 182 | + $knownLicenses[$lurl][] = 'no'; |
| | 183 | + if (!in_array('nd', $knownLicenses[$lurl])) { |
| | 184 | + $knownLicenses[$lurl][] = 'de'; |
| | 185 | + } |
| | 186 | + } |
| | 187 | + } |
| | 188 | + |
| | 189 | + /* Handle the GPL and LGPL, too. */ |
| | 190 | + |
| | 191 | + $knownLicenses['http://creativecommons.org/licenses/GPL/2.0/'] = |
| | 192 | + array('de', 're', 'di', 'no', 'sa', 'sc'); |
| | 193 | + $knownLicenses['http://creativecommons.org/licenses/LGPL/2.1/'] = |
| | 194 | + array('de', 're', 'di', 'no', 'sa', 'sc'); |
| | 195 | + $knownLicenses['http://www.gnu.org/copyleft/fdl.html'] = |
| | 196 | + array('de', 're', 'di', 'no', 'sa', 'sc'); |
| | 197 | + |
| | 198 | + return $knownLicenses; |
| | 199 | + } |
| | 200 | +} |
| | 201 | + |
| | 202 | +class CreativeCommonsRdf extends RdfMetaData { |
| | 203 | + |
| | 204 | + public function show(){ |
| | 205 | + if( $this->setup() ){ |
| | 206 | + global $wgRightsUrl; |
| | 207 | + |
| | 208 | + $url = $this->reallyFullUrl(); |
| | 209 | + |
| | 210 | + $this->prologue(); |
| | 211 | + $this->subPrologue('Work', $url); |
| | 212 | + |
| | 213 | + $this->basics(); |
| | 214 | + if( $wgRightsUrl ){ |
| | 215 | + $url = htmlspecialchars( $wgRightsUrl ); |
| | 216 | + print "\t\t<cc:license rdf:resource=\"$url\" />\n"; |
| | 217 | + } |
| | 218 | + |
| | 219 | + $this->subEpilogue('Work'); |
| | 220 | + |
| | 221 | + if( $wgRightsUrl ){ |
| | 222 | + $terms = $this->getTerms( $wgRightsUrl ); |
| | 223 | + if( $terms ){ |
| | 224 | + $this->subPrologue( 'License', $wgRightsUrl ); |
| | 225 | + $this->license( $terms ); |
| | 226 | + $this->subEpilogue( 'License' ); |
| | 227 | + } |
| | 228 | + } |
| | 229 | + } |
| | 230 | + |
| | 231 | + $this->epilogue(); |
| | 232 | + } |
| | 233 | + |
| | 234 | + protected function prologue() { |
| | 235 | + echo <<<PROLOGUE |
| | 236 | +<?xml version='1.0' encoding="UTF-8" ?> |
| | 237 | +<rdf:RDF xmlns:cc="http://web.resource.org/cc/" |
| | 238 | + xmlns:dc="http://purl.org/dc/elements/1.1/" |
| | 239 | + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> |
| | 240 | + |
| | 241 | +PROLOGUE; |
| | 242 | + } |
| | 243 | + |
| | 244 | + protected function subPrologue( $type, $url ){ |
| | 245 | + $url = htmlspecialchars( $url ); |
| | 246 | + echo "\t<cc:{$type} rdf:about=\"{$url}\">\n"; |
| | 247 | + } |
| | 248 | + |
| | 249 | + protected function subEpilogue($type) { |
| | 250 | + echo "\t</cc:{$type}>\n"; |
| | 251 | + } |
| | 252 | + |
| | 253 | + protected function license($terms) { |
| | 254 | + |
| | 255 | + foreach( $terms as $term ){ |
| | 256 | + switch( $term ) { |
| | 257 | + case 're': |
| | 258 | + $this->term('permits', 'Reproduction'); break; |
| | 259 | + case 'di': |
| | 260 | + $this->term('permits', 'Distribution'); break; |
| | 261 | + case 'de': |
| | 262 | + $this->term('permits', 'DerivativeWorks'); break; |
| | 263 | + case 'nc': |
| | 264 | + $this->term('prohibits', 'CommercialUse'); break; |
| | 265 | + case 'no': |
| | 266 | + $this->term('requires', 'Notice'); break; |
| | 267 | + case 'by': |
| | 268 | + $this->term('requires', 'Attribution'); break; |
| | 269 | + case 'sa': |
| | 270 | + $this->term('requires', 'ShareAlike'); break; |
| | 271 | + case 'sc': |
| | 272 | + $this->term('requires', 'SourceCode'); break; |
| | 273 | + } |
| | 274 | + } |
| | 275 | + } |
| | 276 | + |
| | 277 | + protected function term( $term, $name ){ |
| | 278 | + print "\t\t<cc:{$term} rdf:resource=\"http://web.resource.org/cc/{$name}\" />\n"; |
| | 279 | + } |
| | 280 | + |
| | 281 | + protected function epilogue() { |
| | 282 | + echo "</rdf:RDF>\n"; |
| | 283 | + } |
| | 284 | +} |
| Property changes on: trunk/extensions/CreativeCommonsRdf/CreativeCommonsRdf_body.php |
| ___________________________________________________________________ |
| Added: svn:keywords |
| 1 | 285 | + Author Date Id Revision |
| Added: svn:eol-style |
| 2 | 286 | + native |