Extension talk:LaunchExternal
Add topicThank you
[edit]I'm sure this is useful.
Very useful but doesn't work on mozilla v.2.0.0.18 thank you.
Great extension!
Works great on our intranet wiki.
I have a request, is possible to add code to render the color of the link to another color? This will help my users visually see what is local and what is not.
Thanks raudelh@tgce.com
split() deprecated
[edit]Evidently, function split() is deprecated. What would be a good replacement? Tisane 23:30, 11 March 2010 (UTC)
Patches for MW1.21.2
[edit]split() is deprecated from PHP5.3 on, see http://de2.php.net/manual/en/function.split.php and http://de2.php.net/manual/de/function.preg-split.php.
global $wgAddServerName_EXT;
$arrInput = split("::",$input); // use a different display then the file reference...
is changed to
global $wgAddServerName_EXT;
$arrInput = preg_split("::",$input); // use a different display then the file reference...
Image::newFromName() does not exist anymore, see http://stackoverflow.com/questions/11769115/how-to-get-image-in-mediawiki-extension and https://doc.wikimedia.org/mediawiki-core/master/php/html/classFile.html
// wiki uploaded media or image reference
$img = Image::newFromName( $reference );
if($img ->exists() )
needs to be changed to
// wiki uploaded media or image reference
$img = newFromName( $reference );
if( $img && $img->exists() )
changes
[edit]Hello, I made some changes in your code :
< $arrInput = split("::",$input); // use a different display then the file reference... --- > #modified separator of link: using "|" (JPA) > $arrInput = explode("|",$input,2); // use a different display then the file reference... 40a42 > $href = str_replace("'","%27",$reference); 52c54 < return "<a href='" . $reference . "' target='new'>" . ($display == "" ? $reference : $display) . "$server</a>"; --- > return "<a href='" . $href . "' target='new'>" . ($display == "" ? $reference : $display) . "$server</a>";
The first modification use explode instead of split, and pipe as separator (which is more conform to mediawiki style) The second replace apostrophe by urlencode character, otherwise a link with an apostroph causes a syntax error.
JP Ayanidès, 2010-03-15
Add to Custom Buttons
[edit]Hi!
Works great!
But I can´t add it to my custom buttuns:
var button = { "imageFile": "images/buttons/extbutton.jpg", // image to be shown on the button (may be a full URL too), 22x22 pixels "speedTip": "open external", // text shown in a tooltip when hovering the mouse over the button "tagOpen": "<ext>", // the text to use to mark the beginning of the block "tagClose": "</ext>", // the text to use to mark the end of the block (if any) "sampleText": "file:\\Server\Path\file(opt.)" // the sample text to place inside the block }; mwCustomEditButtons.push(button);
When adding this to Common.js, the page fails with Error 500.
The Problem is the tagOpen and TagClose part.
I need to put the last part of the tagOpent to the sample text.
"tagOpen": "<ex", // the text to use to mark the beginning of the block "tagClose": "</ext>", // the text to use to mark the end of the block (if any) "sampleText": "t>file:\\\\Server\\Path\\file(opt.)"
Link hiding
[edit]I have a small issue: although <ext> and </ext> work perfectly, there is a problem with masking long URL's (like certain PHP get commands we use). Is there a way to "mask" the URL into something nice? I have tried the HTML <a href=> but that does not work. Vadra, Dec 6th 2010
Using LaunchExternal in a Templates
[edit]When using this extension in a template, the parameter is not parsed (see Manual:Tag_extensions#Extensions_and_Templates).
I've modified this to work :
function launchExternal ( $input, array $args, Parser $parser, PPFrame $frame ) {
global $wgServer;
global $wgAddServerName_EXT;
$input= $parser->recursiveTagParse( $input, $frame );
newFromName Stopped working
[edit]I have changed Image::newFromName to newFromName. It still gives me error. I am using MediaWiki 1.25.1 Fatal error: Call to undefined function newFromName() in /opt/lampp/apps/media