Plugin Snarf
This Wiki Plugin replaces itself with the body (HTML) text at the URL given in the url argument. It is similar to the IntegratorArbitrary regex replacement can be done on this content using regex and regexres, which are used as the first and second arguments to preg_replace, respectively, after pulling out just the <body> data.
Usage
To use this plugin in a wiki page, use the syntax:{SNARF(url=>http://www.lojban.org,regex=>;.*(.*).*;, regexres=>$1)}This data is put in a CODE caption.{SNARF}params: url, regex, regexres
Example
{SNARF
(url=>http://www.livejournal.com/users/rlpowell/2418.html, regex=>/.*<!-- Content -->.*?<td>(.*?)<\/td>.*?<\/div>(.*?)<hr.*?<!-- \/Content -->.*/s, regexres=><p>$1</p>$2)}[http://www.livejournal.com/users/rlpowell/2418.html]
{SNARF}To include the content of a Wikipage of another Tiki-installation you can use the following syntax:
{snarf url="http://my.foo.bar/tiki-index_raw.php?page=ExamplePage" wrap="1" ishtml="1" cache="20"}or the longer syntax:
{SNARF(url="http://my.foo.bar/tiki-index_raw.php?page=ExamplePage" wrap="1" ishtml="1" cache="20")}{SNARF}Do NOT type: ".../tiki-index.php?page=..." BUT ".../tiki-index_raw.php?page=..."
This kind of SNARF syntax works in Tiki 5.x and 6.0 and only with Wikipages (not with articles)
Parameters
| Name | Value | Description | Version |
| url | url | url | |
| regex | PCRE compliant regular expression | part to be changed | |
| regexres | PCRE compliant regular expression | change | |
| cache | number | number of minutes the url is cached - if not specified, the default site cache time will be used | tw >=5.0 |
| ajax | string | Displays only the string and when the user clicks on it, fetch the content of snarf with ajax | tw>=6.0 |
Plus all the PluginCode parameters
- Wiki Plugin
- Mods Type Wikiplugins
- http://wikipedia.org/wiki/regex
- PluginInclude
- PluginTransclude
- PluginHTMLfeed
