2 // PukiWiki - Yet another WikiWikiWeb clone.
3 // $Id: img.inc.php,v 1.13 2005/01/06 12:40:56 henoheno Exp $
7 define('PLUGIN_IMG_USAGE', '#img(): Usage: (URI-to-image[,right[,clear]])<br />' . "\n");
8 define('PLUGIN_IMG_CLEAR', '<div style="clear:both"></div>' . "\n"); // Stop word-wrapping
10 // ²èÁü¤ò¥¤¥ó¥é¥¤¥óɽ¼¨
11 function plugin_img_convert()
13 $args = func_get_args();
15 // Check the 2nd argument first, for compatibility
16 $arg = isset($args[1]) ? strtoupper($args[1]) : '';
17 if ($arg == '' || $arg == 'L' || $arg == 'LEFT') {
19 } else if ($arg == 'R' || $arg == 'RIGHT') {
22 // Stop word-wrapping only (Ugly but compatible)
23 // Short usage: #img(,clear)
24 return PLUGIN_IMG_CLEAR;
27 $url = isset($args[0]) ? $args[0] : '';
28 if (! is_url($url) || ! preg_match('/\.(jpe?g|gif|png)$/i', $url))
29 return PLUGIN_IMG_USAGE;
31 $arg = isset($args[2]) ? strtoupper($args[2]) : '';
32 $clear = ($arg == 'C' || $arg == 'CLEAR') ? PLUGIN_IMG_CLEAR : '';
35 <div style="float:$align;padding:.5em 1.5em .5em 1.5em">
36 <img src="$url" alt="" />