OSDN Git Service

BugTrack2/65: Avoiding AutoLink insertion -- is not needed for size plugin
[pukiwiki/pukiwiki.git] / plugin / size.inc.php
1 <?php
2 // PukiWiki - Yet another WikiWikiWeb clone.
3 // $Id: size.inc.php,v 1.9 2005/05/07 10:05:23 henoheno Exp $
4 //
5 // Text-size changing via CSS plugin
6
7 define('PLUGIN_SIZE_MAX', 60); // px
8 define('PLUGIN_SIZE_MIN',  8); // px
9
10 // ----
11 define('PLUGIN_SIZE_USAGE', '&size(px){Text you want to change};');
12
13 function plugin_size_inline()
14 {
15         if (func_num_args() != 2) return PLUGIN_SIZE_USAGE;
16
17         list($size, $body) = func_get_args();
18
19         // strip_htmltag() just for avoiding AutoLink insertion
20         // -- is not needed for size plugin
21         //$body = strip_htmltag($body);
22         
23         if ($size == '' || $body == '' || ! preg_match('/^\d+$/', $size))
24                 return PLUGIN_SIZE_USAGE;
25
26         $size = max(PLUGIN_SIZE_MIN, min(PLUGIN_SIZE_MAX, $size));
27         return '<span style="font-size:' . $size .
28                 'px;display:inline-block;line-height:130%;text-indent:0px">' .
29                 $body . '</span>';
30 }
31 ?>