OSDN Git Service

BugTrack/2256 edit: Handle template loading button
[pukiwiki/pukiwiki.git] / plugin / aname.inc.php
index 5aa796a..3d62f37 100644 (file)
@@ -1,18 +1,17 @@
 <?php
 // PukiWiki - Yet another WikiWikiWeb clone
-// $Id: aname.inc.php,v 1.26 2005/08/22 14:59:24 henoheno Exp $
+// $Id: aname.inc.php,v 1.28 2011/01/25 15:01:01 henoheno Exp $
 // Copyright (C)
 //   2002-2005 PukiWiki Developers Team
 //   2001-2002 Originally written by yu-ji
 // License: GPL v2 or (at your option) any later version
 //
-// aname plugin - Set various anchor tag
-//   * A simple anchor <a id="key"></a>
-//   * A clickable link to the anchor <a href="#key">string</a>
-//   * Clickable anchor with the key itself <a id="key" href="#key">string</a>
+// aname plugin - Set various anchor tags
+//   * With just an anchor id: <a id="key"></a>
+//   * With a hyperlink to the anchor id: <a href="#key">string</a>
+//   * With an anchor id and a link to the id itself: <a id="key" href="#key">string</a>
 //
-// NOTE:
-//   Use 'id="key"' instead of 'name="key"' at XHTML 1.1
+// NOTE: Use 'id="key"' instead of 'name="key"' at XHTML 1.1
 
 // Check ID is unique or not (compatible: no-check)
 define('PLUGIN_ANAME_ID_MUST_UNIQUE', 0);
@@ -95,15 +94,15 @@ function plugin_aname_tag($args = array(), $convert = TRUE)
                        return plugin_aname_usage($convert, 'ID too long');
                if (! preg_match(PLUGIN_ANAME_ID_REGEX, $id))
                        return plugin_aname_usage($convert, 'Invalid ID string: ' .
-                               htmlspecialchars($id));
+                               htmlsc($id));
                $_id[$id] = TRUE; // Set
        }
 
-       if ($convert) $body = htmlspecialchars($body);
-       $id = htmlspecialchars($id); // Insurance
+       if ($convert) $body = htmlsc($body);
+       $id = htmlsc($id); // Insurance
        $class   = $f_super ? 'anchor_super' : 'anchor';
        $attr_id = $f_noid  ? '' : ' id="' . $id . '"';
-       $url     = $f_full  ? get_script_uri() . '?' . rawurlencode($vars['page']) : '';
+       $url     = $f_full  ? get_script_uri() . '?' . pagename_urlencode($vars['page']) : '';
        if ($body != '') {
                $href  = ' href="' . $url . '#' . $id . '"';
                $title = ' title="' . $id . '"';
@@ -114,4 +113,4 @@ function plugin_aname_tag($args = array(), $convert = TRUE)
        return '<a class="' . $class . '"' . $attr_id . $href . $title . '>' .
                $body . '</a>';
 }
-?>
+