Revision [12106]
This is an old revision of WikipediaAction made by RolandStens on 2005-12-05 23:25:24.
Wikipedia Action
This action is meant to automatically incorporate http://wikipedia.org content in your pages.
To use it as a standalone action simply add for instance:
{{wikipedia topic="Workflow"}} in the page body.
Save the code below as actions/wikipedia.php.
The action
Current version: 0.1Changes:
To do:
actions/wikipedia.php
<?php
$topic = $vars['topic'];
$file = file_get_contents('http://en.wikipedia.org/wiki/'.$topic);
$file = str_replace('href="/', 'href="http://en.wikipedia.org/', $file);
preg_match_all('#<!-- start content -->(.*?)<!-- end content -->#es', $file, $ar);
unset($file);
if (is_array($ar[1])) echo $ar[1][0];
else echo '';
?>
$topic = $vars['topic'];
$file = file_get_contents('http://en.wikipedia.org/wiki/'.$topic);
$file = str_replace('href="/', 'href="http://en.wikipedia.org/', $file);
preg_match_all('#<!-- start content -->(.*?)<!-- end content -->#es', $file, $ar);
unset($file);
if (is_array($ar[1])) echo $ar[1][0];
else echo '';
?>