http://www.mediawiki.org/wiki/Special:Code/MediaWiki/99750
Revision: 99750
Author: catrope
Date: 2011-10-14 00:45:39 +0000 (Fri, 14 Oct 2011)
Log Message:
-----------
Fix comment indentation and kill orphaned replaceRelativeLinks() code
Modified Paths:
--------------
trunk/extensions/Contest/Contest.hooks.php
trunk/extensions/Contest/includes/ContestUtils.php
Modified: trunk/extensions/Contest/Contest.hooks.php
===================================================================
--- trunk/extensions/Contest/Contest.hooks.php 2011-10-14 00:17:06 UTC (rev
99749)
+++ trunk/extensions/Contest/Contest.hooks.php 2011-10-14 00:45:39 UTC (rev
99750)
@@ -162,9 +162,9 @@
}
/**
- * Used when generating internal and interwiki links in Linker::link(),
- * just before the function returns a value.
- * @see https://www.mediawiki.org/wiki/Manual:Hooks/LinkEnd
+ * Used when generating internal and interwiki links in Linker::link(),
+ * just before the function returns a value.
+ * @see https://www.mediawiki.org/wiki/Manual:Hooks/LinkEnd
*
* @since 0.1
*
Modified: trunk/extensions/Contest/includes/ContestUtils.php
===================================================================
--- trunk/extensions/Contest/includes/ContestUtils.php 2011-10-14 00:17:06 UTC
(rev 99749)
+++ trunk/extensions/Contest/includes/ContestUtils.php 2011-10-14 00:45:39 UTC
(rev 99750)
@@ -53,11 +53,6 @@
$article = new Article( $title, 0 );
- // Looks like the LinkEnd hook can be used here instead of
replaceRelativeLinks.
- // The hook could just turn relative urls into absolute ones in
a nice way,
- // but would require setting some global such as
$isContestEmailParse to true
- // before the parse call and to false afterwards, which also is
not very nice.
-
global $wgParser, $wgContestEmailParse;
$wgContestEmailParse = true;
@@ -72,36 +67,4 @@
return $text;
}
-
- /**
- * Returns the provided wikitext with internal (relative) links
replaced by their external equivalents.
- * ie turns [[Foo]] into [someurl/Foo Foo]
- *
- * This replacing is quite evil; if the parser can just do this,
- * we should make use of that instead of doing it here.
- *
- * @since 0.1
- *
- * @param string $wikiText
- *
- * @return string
- */
- public static function replaceRelativeLinks( $wikiText ) {
- $url = substr( Title::newFromText( 'a' )->getFullUrl(), 0, -1 );
-
- $wikiText = preg_replace(
-
'/\[\[(?!(Category|Image|File|[^\s]{2,5}:))([^\|\]]*)\|([^\]]*)\]\]/e',
- "'[" . $url . "'.str_replace(' ', '_', '\\2').' \\3]'",
- $wikiText
- );
-
- $wikiText = preg_replace(
-
'/\[\[((?!(Category|Image|File|[^\s]{2,5}:))[^\]]*)\]\]/e',
- "'[" . $url . "'.str_replace(' ', '_', '\\1').' \\1]'",
- $wikiText
- );
-
- return $wikiText;
- }
-
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs