OSDN Git Service

add block style('#aname') routine.
[pukiwiki/pukiwiki.git] / plugin / aname.inc.php
1 <?php
2 /////////////////////////////////////////////////
3 // PukiWiki - Yet another WikiWikiWeb clone.
4 //
5 // $Id: aname.inc.php,v 1.8 2003/03/02 02:38:21 panda Exp $
6 //
7
8 function plugin_aname_inline()
9 {
10         $args = func_get_args();
11         return call_user_func_array('plugin_aname_convert',$args);
12 }
13 function plugin_aname_convert()
14 {
15         if (func_num_args() < 1) {
16                 return FALSE;
17         }
18         
19         $args = func_get_args();
20         $id = $args[0];
21         $body = (func_num_args() > 1) ? $args[1] : '';
22         
23         if (!preg_match('/[A-Za-z][\w\-]*/',$id)) {
24                 return FALSE;
25         }
26         
27         $s_body = htmlspecialchars($body);
28         
29         return "<a id=\"$id\">$s_body</a>";
30 }
31 ?>