Extension:StockQuote

This extension allows you to have (delayed) stock quotes on your site by using the tags (SYMBOL).

Although it will perform a number of other functions as well, which you can perform by appending what you want after the part of the tag (such as GOOG ).

Code
Add this line to LocalSettings.php.;

require_once('extensions/StockQuote.php');

The following code should be added to the extensions folder as StockQuote.php

 'StockQuote', 'url' => 'http://www.mediawiki.org/wiki/Extension:StockQuote', 'author' => 'Olipro' ); function wfStockQuote { global $wgParser; $wgParser->setHook('stock', 'StockQuote'); }

function StockQuote($input, $argv, $parser) { global $wgParser; $wgParser->disableCache; //ATTENTION; DISABLE THIS LINE IF YOU ARE ON HIGH LOAD! $info = file_get_contents("http://finance.yahoo.com/d/quotes.csv?s=$input&f=sl1d1t1c1ohgv&e=csv"); $info = str_ireplace('"', '', $info);	$info = explode(',', $info);	if($info[1] == '0.00') { return 'ERROR'; }	if($argv['quote']) {		return $info[1];	} elseif($argv['change']) {		return $info[4];	} elseif($argv['high']) {		return $info[6];	} elseif($argv['low']) {		return $info[7];	} elseif($argv['open']) {		return $info[5];	} elseif($argv['volume']) {		return number_format($info[8]);	} else {		return $info[1];	} } ?>

Arguments
the following can be appended to to get the relevant data:
 * quote - does the same as providing no arguments (current stock price)
 * change - gives the change, in points of the stock price.
 * high - the most recent high price of the stock.
 * low - the most recent low price of the stock.
 * open - the price of the stock at market open
 * volume - the trading volume (in shares exchanged) of the stock.

Licensing
This is licensed under the GNU/GPL V2, and as such, all modifications should be made public, cheers!

Where used

 * Capital Market Wiki: Used as an alternative to Yahoo interwiki links. Has help page.