Extension:FileProtocolLinksSMB

Description
This is a modification of the FileProtocolLinks extension. This basically adds the ability for Mac/Linux/Unix users to connect to a server via SMB so they can get to a linked file.

Example
This example of how to use this extension on Macs. I haven't tried or tested this on Linux or Unix yet, but please feel free to try it and let me know how it goes!!

I've found out that for this to work properly, you need to already have the SMB share mounted onto your computer. This is definitely true for Macs running Leopard (good luck with Tiger as there IS a bug with SMB shares mounting on Tiger 10.4!).

Mac
servername/directory/file.extension

It's as simple as that!!

Sourcecode
All you need to do is copy this into a file called FileProtocolLinksSMB.php located in /extensions.

<?php /** * This file contains the main include file for the FileProtocolLinksSMB extension of * MediaWiki. This code is released under the GNU General Public License. * * @author Dan Sinclair * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @package MediaWikiExtensions * @version 0.1 */ /** * Register the FileProtocolLinksSMB extension with MediaWiki */ $wgExtensionFunctions[] = 'registerFileProtocolLinksSMB'; /** * Sets the tag that this extension looks for and the function by which it * operates */ function registerFileProtocolLinksSMB {   global $wgParser; $wgParser->setHook('smb', 'renderFileProtocolLinkSMB'); } /** * Renders an smb file protocol link based on the information provided by $input. * * @param string * The string should be in the following format: *     URI[;link text] * One example for a mac environment would be: *     /servername/directory/something.txt|some nice text * @return string * Returns an anchor tag for the given input. For the example above * the return string would be *      some nice text * The links are rendered in green text color to make it easier to recognize  * them as local shares. */ function renderFileProtocolLinkSMB($input) {    $exploded = explode('|', $input);    $uri = htmlentities($exploded[0], ENT_COMPAT, "UTF-8");    if (!isset($exploded[1]) || empty($exploded[1])) {        // no linktext has been specified ==> use the URI as linktext        $linktext = $uri;    }    else {        $linktext = htmlentities($exploded[1], ENT_COMPAT, "UTF-8");    }    return sprintf('%s',         $uri, $linktext); } $wgExtensionCredits['other'][] = array(        'name' => 'FileProtocolLinksSMB',        'author' => 'Dan Sinclair',        'description' => 'highlights SMB links to local filesystem',        'url' => 'http://www.mediawiki.org/wiki/Extension:FileProtocolLinksSMB'); ?>
 * 1) credits for Special:Version

and then add;

require_once("extensions/FileProtocolLinksSMB.php");

to LocalSettings.php.

NB
Please note that you may need to have FileProtocolLinks already installed on your wiki to get this working (but then again you may not as i haven't tested it so i don't know!!).

Please also note that i only take credit for modifying the original FileProtocolLinks extension. All credit for that goes to EdmundMielach!!