[MediaWiki-commits] [Gerrit] Several tweaks to the extension - change (mediawiki...SemanticWebBrowser)
bkaempgen has submitted this change and it was merged. Change subject: Several tweaks to the extension .. Several tweaks to the extension * added check for the call of the extension * changed extension's URL to https Change-Id: I1a53a7b45815f057a6e3bf2b4f849ccc5d01faff --- M SWB_Settings.php M SemanticWebBrowser.php 2 files changed, 15 insertions(+), 5 deletions(-) Approvals: bkaempgen: Verified; Looks good to me, approved diff --git a/SWB_Settings.php b/SWB_Settings.php index d8ed203..c332836 100644 --- a/SWB_Settings.php +++ b/SWB_Settings.php @@ -21,10 +21,14 @@ $wgExtensionCredits['semantic'][] = array( 'path'= __FILE__, 'name'= 'Semantic Web Browser', - 'version' = '0.4', - 'author' = array( '[http://www.b-kaempgen.de Benedikt#160;Kämpgen]', 'Anna Kantorovitch', 'Andreas Adler' ), - 'url' = 'http://www.mediawiki.org/wiki/Extension:Semantic_Web_Browser', - 'descriptionmsg' = 'swb_desc' + 'version' = '0.4', + 'author' = array( + '[http://www.b-kaempgen.de Benedikt#160;Kämpgen]', + 'Anna Kantorovitch', + 'Andreas Adler' + ), + 'url' = 'https://www.mediawiki.org/wiki/Extension:Semantic_Web_Browser', + 'descriptionmsg' = 'swb_desc' ); /** @@ -34,4 +38,4 @@ $swbgToolboxBrowseSemWeb = true; // load global constants and setup functions -require_once( $swbgIP . 'SemanticWebBrowser.php' ); \ No newline at end of file +require_once( $swbgIP . 'SemanticWebBrowser.php' ); diff --git a/SemanticWebBrowser.php b/SemanticWebBrowser.php index 136d2c1..cd8a79a 100644 --- a/SemanticWebBrowser.php +++ b/SemanticWebBrowser.php @@ -6,6 +6,12 @@ * @ingroup SWB */ +// ask if we are being called directly +if ( !defined( 'MEDIAWIKI' ) ) { +die( 'Not an entry point.' ); +} + +// load settings file require_once dirname( __FILE__ ) . '/SWB_Settings.php'; /** -- To view, visit https://gerrit.wikimedia.org/r/97745 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1a53a7b45815f057a6e3bf2b4f849ccc5d01faff Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/SemanticWebBrowser Gerrit-Branch: master Gerrit-Owner: Kghbln mediaw...@kghoffmeyer.de Gerrit-Reviewer: bkaempgen benedikt.kaemp...@kit.edu ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Update from the main repository - change (mediawiki...SemanticWebBrowser)
bkaempgen has submitted this change and it was merged. Change subject: Update from the main repository .. Update from the main repository Partial changelog: == SWB - migrated to Git 2013-02-04 == URI: https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticWebBrowser.git == SWB - commit 2012-03-27 == In front of host, we had // before, but those seem not needed, any more. //(!isset( $info['host']) ) ? $host = : $host = //.$info['host']; Change-Id: I3ba6af3fb9485b0baa1851404161b29345b7e13d --- M SemanticWebBrowser.php M includes/SWB_Infolink.php M specials/SearchTriple/SWB_SpecialBrowseWiki.php 3 files changed, 25 insertions(+), 8 deletions(-) Approvals: bkaempgen: Verified; Looks good to me, approved diff --git a/SemanticWebBrowser.php b/SemanticWebBrowser.php index 450dbe5..7a194c0 100644 --- a/SemanticWebBrowser.php +++ b/SemanticWebBrowser.php @@ -57,7 +57,7 @@ function swbfShowBrowseSemWeb( $skintemplate ) { if ( $skintemplate-data['isarticle'] ) { - $browselink = SWBInfolink::newBrowsingLink( wfMsg( 'swb_browse_semantic_web' ), + $browselink = SWBInfolink::newBrowsingLink( wfMsg( 'browsewiki' ), $skintemplate-data['titleprefixeddbkey'], false ); echo 'li id=t-smwbrowselink' . $browselink-getHTML() . '/li'; } diff --git a/includes/SWB_Infolink.php b/includes/SWB_Infolink.php index 555639f..3ea76fe 100644 --- a/includes/SWB_Infolink.php +++ b/includes/SWB_Infolink.php @@ -19,7 +19,7 @@ return new SWBInfolink( true, $caption, - $wgContLang-getNsText( NS_SPECIAL ) . ':BrowseWiki', + $wgContLang-getNsText( NS_SPECIAL ) . ':BrowseSW', $style, array( $titleText ) ); diff --git a/specials/SearchTriple/SWB_SpecialBrowseWiki.php b/specials/SearchTriple/SWB_SpecialBrowseWiki.php index 764f637..59e3e15 100644 --- a/specials/SearchTriple/SWB_SpecialBrowseWiki.php +++ b/specials/SearchTriple/SWB_SpecialBrowseWiki.php @@ -70,7 +70,7 @@ // get the GET parameters $this-articletext = $wgRequest-getVal( 'article' ); -$this-title = $wgOut-getTitle(); +$this-title = $wgOut-getTitle(); // no GET parameters? Then try the URL if ( $this-articletext == '' ) { $params = SMWInfolink::decodeParameters( $query, false ); @@ -150,7 +150,7 @@ $info = parse_url($this-articletext); (!isset( $info['scheme']) ) ? $scheme = : $scheme = $info['scheme']; // Info: In front of host, we had // before, but those seem not needed, any more. -//(!isset( $info['host'])) ? $host = : $host = //.$info['host']; +//(!isset( $info['host'])) ? $host = : $host = //.$info['host']; (!isset( $info['host'])) ? $host = : $host = $info['host']; (!isset( $info['path'])) ? $path = : $path = $info['path']; (!isset( $info['query']) ) ? $query= : $query= $info['query']; @@ -197,7 +197,8 @@ $html .= $this-displaySemanticHead( $uri-getURI() ); if ( $this-showoutgoing ) { // should be: $data is of type SMWSemanticData - $swdata = $this-getSemanticWebData( $graph, $uri-getURI() ); + +$swdata = $this-getSemanticWebData( $graph, $uri-getURI() ); // %swData contains only DataItems $html .= $this-displaySemanticWebData( $swdata, $leftside ); $html .= $this-displayCenter(); } @@ -353,7 +354,23 @@ foreach ( $theOutgoingProperties as $outProp ) { $outPropResult = $this-getArrayObjects( $graph, $theResource, $outProp ); // now, we have the subject, the property, the object (uri/literal) - foreach ( $outPropResult as $outPropObject ) { + +// replace blacklisted rdf(s) and owl properties +$uri_blacklist = explode(\n, wfMessage('smw_uri_blacklist')-inContentLanguage()-text()); +foreach ($uri_blacklist as $uri) { +$uri = trim($uri); +if ($uri == mb_substr($outProp, 0, mb_strlen($uri))) { // disallowed URI! +if (strcmp($uri, http://www.w3.org/1999/02/22-rdf-syntax-ns#;) == 0) { +$outProp =
[MediaWiki-commits] [Gerrit] * Patch by Sebastian Richer Change-Id: I3ba6af3fb9485b0baa1... - change (mediawiki...SemanticWebBrowser)
bkaempgen has uploaded a new change for review. https://gerrit.wikimedia.org/r/69402 Change subject: * Patch by Sebastian Richer Change-Id: I3ba6af3fb9485b0baa1851404161b29345b7e13d .. * Patch by Sebastian Richer Change-Id: I3ba6af3fb9485b0baa1851404161b29345b7e13d Change-Id: I3ba6af3fb9485b0baa1851404161b29345b7e13d --- M SemanticWebBrowser.php M includes/SWB_Infolink.php M specials/SearchTriple/SWB_SpecialBrowseWiki.php 3 files changed, 25 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticWebBrowser refs/changes/02/69402/1 diff --git a/SemanticWebBrowser.php b/SemanticWebBrowser.php index 450dbe5..7a194c0 100644 --- a/SemanticWebBrowser.php +++ b/SemanticWebBrowser.php @@ -57,7 +57,7 @@ function swbfShowBrowseSemWeb( $skintemplate ) { if ( $skintemplate-data['isarticle'] ) { - $browselink = SWBInfolink::newBrowsingLink( wfMsg( 'swb_browse_semantic_web' ), + $browselink = SWBInfolink::newBrowsingLink( wfMsg( 'browsewiki' ), $skintemplate-data['titleprefixeddbkey'], false ); echo 'li id=t-smwbrowselink' . $browselink-getHTML() . '/li'; } diff --git a/includes/SWB_Infolink.php b/includes/SWB_Infolink.php index 555639f..3ea76fe 100644 --- a/includes/SWB_Infolink.php +++ b/includes/SWB_Infolink.php @@ -19,7 +19,7 @@ return new SWBInfolink( true, $caption, - $wgContLang-getNsText( NS_SPECIAL ) . ':BrowseWiki', + $wgContLang-getNsText( NS_SPECIAL ) . ':BrowseSW', $style, array( $titleText ) ); diff --git a/specials/SearchTriple/SWB_SpecialBrowseWiki.php b/specials/SearchTriple/SWB_SpecialBrowseWiki.php index 764f637..59e3e15 100644 --- a/specials/SearchTriple/SWB_SpecialBrowseWiki.php +++ b/specials/SearchTriple/SWB_SpecialBrowseWiki.php @@ -70,7 +70,7 @@ // get the GET parameters $this-articletext = $wgRequest-getVal( 'article' ); -$this-title = $wgOut-getTitle(); +$this-title = $wgOut-getTitle(); // no GET parameters? Then try the URL if ( $this-articletext == '' ) { $params = SMWInfolink::decodeParameters( $query, false ); @@ -150,7 +150,7 @@ $info = parse_url($this-articletext); (!isset( $info['scheme']) ) ? $scheme = : $scheme = $info['scheme']; // Info: In front of host, we had // before, but those seem not needed, any more. -//(!isset( $info['host'])) ? $host = : $host = //.$info['host']; +//(!isset( $info['host'])) ? $host = : $host = //.$info['host']; (!isset( $info['host'])) ? $host = : $host = $info['host']; (!isset( $info['path'])) ? $path = : $path = $info['path']; (!isset( $info['query']) ) ? $query= : $query= $info['query']; @@ -197,7 +197,8 @@ $html .= $this-displaySemanticHead( $uri-getURI() ); if ( $this-showoutgoing ) { // should be: $data is of type SMWSemanticData - $swdata = $this-getSemanticWebData( $graph, $uri-getURI() ); + +$swdata = $this-getSemanticWebData( $graph, $uri-getURI() ); // %swData contains only DataItems $html .= $this-displaySemanticWebData( $swdata, $leftside ); $html .= $this-displayCenter(); } @@ -353,7 +354,23 @@ foreach ( $theOutgoingProperties as $outProp ) { $outPropResult = $this-getArrayObjects( $graph, $theResource, $outProp ); // now, we have the subject, the property, the object (uri/literal) - foreach ( $outPropResult as $outPropObject ) { + +// replace blacklisted rdf(s) and owl properties +$uri_blacklist = explode(\n, wfMessage('smw_uri_blacklist')-inContentLanguage()-text()); +foreach ($uri_blacklist as $uri) { +$uri = trim($uri); +if ($uri == mb_substr($outProp, 0, mb_strlen($uri))) { // disallowed URI! +if (strcmp($uri, http://www.w3.org/1999/02/22-rdf-syntax-ns#;) == 0) { +$outProp = str_replace($uri, rdf:, $outProp); +} else if (strcmp($uri, http://www.w3.org/2000/01/rdf-schema#;) == 0) { +