OSDN Git Service

Please use abstruct method $vars instead of $get or $post
[pukiwiki/pukiwiki.git] / plugin / aname.inc.php
1 <?php
2 /////////////////////////////////////////////////
3 // PukiWiki - Yet another WikiWikiWeb clone.
4 //
5 // $Id: aname.inc.php,v 1.14 2003/07/03 05:09:34 arino 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         global $script,$vars;
16         
17         if (func_num_args() < 1)
18         {
19                 return FALSE;
20         }
21         
22         $args = func_get_args();
23         $id = array_shift($args);
24         
25         if (!preg_match('/^[A-Za-z][\w\-]*$/',$id))
26         {
27                 return FALSE;
28         }
29         
30         $body = count($args) ? preg_replace('/<\/?a[^>]*>/','',array_pop($args)) : '';
31         
32         $class   = in_array('super',$args) ? 'anchor_super' : 'anchor';
33         $url     = in_array('full',$args)  ? "$script?".rawurlencode($vars['page']) : '';
34         $attr_id = in_array('noid',$args)  ? '' : " id=\"$id\"";
35         
36         return "<a class=\"$class\"$attr_id href=\"$url#$id\" title=\"$id\">$body</a>";
37 }
38 ?>