r104373 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104372‎ | r104373 | r104374 >
Date:23:16, 27 November 2011
Author:bkaempgen
Status:resolved (Comments)
Tags:
Comment:
== SWB - 2011-11-27 ==
* Incoming links work now
* beautifications
* language
* ...
Modified paths:
  • /trunk/extensions/SemanticWebBrowser/SemanticWebBrowser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticWebBrowser/SemanticWebBrowser.php
@@ -2,9 +2,77 @@
33
44 /**
55 * Main entry point for the Semantic Web Browser extension.
6 - * @author Anna Kantorovitch and Benedikt K�mpgen
 6+ * @author Anna Kantorovitch and Benedikt Kämpgen
 7+ * @file SemanticWebBrowser.php
 8+ * @ingroup SWB
79 */
810
911
10 -require_once dirname( __FILE__ ) . '/../SemanticWebBrowser/SWB_Settings.php';
 12+require_once dirname( __FILE__ ) . '/SWB_Settings.php';
1113
 14+/**
 15+ * Global functions used for setting up the Semantic WebBrowser extension.
 16+ *
 17+ */
 18+// include for toolbox
 19+global $swbgToolboxBrowseSemWeb, $wgHooks, $wgAutoloadClasses, $swbgIP,
 20+ $wgFooterIcons, $wgExtensionFunctions, $wgSpecialPageGroups,
 21+ $wgExtensionMessagesFiles, $wgExtensionAliasesFiles, $wgSpecialPages,
 22+ $smwgNamespace, $wgServer, $wgAPIModules, $wgExtensionAliasesFiles;
 23+
 24+$wgExtensionMessagesFiles['SemanticWebBrowser'] = $swbgIP . 'SemanticWebBrowser.i18n.php'; // register messages (requires MW=>1.11)
 25+
 26+// Register special pages aliases file
 27+$wgExtensionAliasesFiles['SemanticWebBrowser'] = $swbgIP . 'SemanticWebBrowser.alias.php';
 28+
 29+/*
 30+ * create Special Page for Browse Wiki
 31+ */
 32+$wgAutoloadClasses['SWBSpecialBrowseWiki'] = $swbgIP . 'specials/SearchTriple/SWB_SpecialBrowseWiki.php';
 33+$wgSpecialPages['BrowseWiki'] = 'SWBSpecialBrowseWiki';
 34+$wgSpecialPageGroups['BrowseWiki'] = 'smw_group';
 35+
 36+// InfoLink
 37+$wgAutoloadClasses['SWBInfolink'] = $swbgIP . 'includes/SWB_Infolink.php';
 38+
 39+// Data values
 40+$wgAutoloadClasses['SWBResolvableUriValue'] = $swbgIP . 'includes/datavalues/SWBResolvableUriValue.php';
 41+
 42+// SWB Search
 43+$wgAutoloadClasses['SWBSearch'] = $swbgIP . 'includes/SWB_Search.php';
 44+
 45+$wgHooks['smwInitProperties'][] = 'registerPropertyTypes';
 46+
 47+
 48+
 49+function registerPropertyTypes() {
 50+ // 5 means uri
 51+ SMWDataValueFactory::registerDatatype( "_rur",
 52+ "SWBResolvableUriValue",
 53+ SMWDataItem::TYPE_URI,
 54+ $label = false );
 55+
 56+ return true;
 57+}
 58+
 59+/**include in toolbox for show the last article in "Browsing Semantic Web"
 60+ *has the same functionality as 'Browse properties' in the toolbox
 61+**/
 62+
 63+if ( $swbgToolboxBrowseSemWeb ) {
 64+ $wgHooks['SkinTemplateToolboxEnd'][] = 'swbfShowBrowseSemWeb';
 65+}
 66+
 67+
 68+ function swbfShowBrowseSemWeb( $skintemplate ) {
 69+ if ( $skintemplate -> data['isarticle'] ) {
 70+ smwfLoadExtensionMessages( 'SemanticWebBrowser' );
 71+ $browselink = SWBInfolink::newBrowsingLink( wfMsg( 'swb_browse_semantic_web' ),
 72+ $skintemplate->data['titleprefixeddbkey'], false );
 73+
 74+ echo '<li id="t-smwbrowselink">' . $browselink->getHTML() . '</li>';
 75+
 76+ }
 77+ return true;
 78+ }
 79+

Follow-up revisions

RevisionCommit summaryAuthorDate
r105525Clean up r104373 and other whitespace fixesnikerabbit09:22, 8 December 2011

Comments

#Comment by Nikerabbit (talk | contribs)   08:39, 29 November 2011

Mixed tabs/spaced indentation. Why is that global statement needed anyway?

#Comment by Jeroen De Dauw (talk | contribs)   03:08, 6 December 2011

It's not needed, but I've seen people do this before. It makes a lot of IDEs not go mad at using "undefined" variables :)

Status & tagging log