Grabs the current listed product, price, and image from the popular woot.com
Compatible with DokuWiki
No compatibility info given!
This plugin allows you to insert woot.com's current product information into your wiki. woot.com is a popular site which offers a single product a day at a (usually) low price. While they do offer an RSS feed, it's very minimal and doesn't directly relate to their current product. This plugin displays the product description, the price (+ shipping), and the product image. It does all this by using screen scraping methods, so if it's the case the plugin ever breaks, it's probably due to a site design change on their part. Oh well.
Update 5/19/2008:
Update 3/27/2008:
Usage is as simple as :
{{woot}}
Place the following code into lib/plugins/woot/syntax.php
<?php /** * Woot Plugin * * woot.com is a fun little website which offers a single deal on * some techie gadget daily. Sometimes the deals are great, but * generally it's crap. This plugin screen scraps woot and grabs * the current product price, title, and image. * * @author Russ Meyerriecks <datachomper@gmail.com> * */ // must be run within DokuWiki if(!defined('DOKU_INC')) die(); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'syntax.php'); class syntax_plugin_woot extends DokuWiki_Syntax_Plugin { /** * return some info */ function getInfo(){ return array( 'author' => 'Russ Meyerriecks', 'email' => 'datachomper@gmail.com', 'date' => '2008-2-6', 'name' => 'Woot Plugin', 'desc' => 'Grabs the current woot.com product name, price, and image', 'url' => 'http://www.dokuwiki.org/plugin:woot', ); } /** * What kind of syntax are we? */ function getType(){ return 'substition'; } /** * What about paragraphs? */ function getPType(){ return 'block'; } /** * Where to sort in? */ function getSort(){ return 188; } /** * Connect pattern to lexer */ function connectTo($mode) { $this->Lexer->addSpecialPattern('\{\{woot\}\}', $mode, 'plugin_woot'); } /** * Handle the match */ function handle($match, $state, $pos, &$handler){ return array(); } /** * Create output */ function render($format, &$renderer, $data) { if($format == 'xhtml'){ //handle various info stuff $woot = file_get_contents('http://www.woot.com'); preg_match("/TitleHeader\">(.+)<\/h3>/", $woot, $matches); $title = $matches[1]; preg_match("/PriceSpan\">(.+)<\/span>/", $woot, $matches); $price = $matches[1]; preg_match("/shipping\">(.+)<\/span>/", $woot, $matches); $shipping = $matches[1]; preg_match("/<img id=\"ctl00_ContentPlaceHolder_SaleImage\".+src=\"(.+)\" alt/", $woot, $matches); $img = $matches[1]; $renderer->doc .= $title . '<br>'; $renderer->doc .= "Price : $price $shipping <br>"; if(preg_match("/WootOffPanel/", $woot) > 0){ $renderer->doc .= "<b><blink>WOOT OFF ZOMG!!!!!</blink></b><br>"; } $renderer->doc .= "<a href='http://www.woot.com'><img src='$img'></a>"; return true; } return false; } }