OSDN Git Service

Added a define PLUGIN_REF_USAGE
authorhenoheno <henoheno>
Thu, 19 Aug 2004 11:55:19 +0000 (20:55 +0900)
committerhenoheno <henoheno>
Thu, 19 Aug 2004 11:55:19 +0000 (20:55 +0900)
plugin/ref.inc.php

index 3d988dc..aeabd96 100644 (file)
@@ -2,7 +2,7 @@
 /////////////////////////////////////////////////
 // PukiWiki - Yet another WikiWikiWeb clone.
 //
-// $Id: ref.inc.php,v 1.26 2004/08/18 13:36:45 henoheno Exp $
+// $Id: ref.inc.php,v 1.27 2004/08/19 11:55:19 henoheno Exp $
 //
 
 /*
@@ -15,13 +15,13 @@ URL
  #ref(filename[,page][,parameters][,title])
 
 * ¥Ñ¥é¥á¡¼¥¿
-- filename~
+- filename
 ÅºÉÕ¥Õ¥¡¥¤¥ë̾¡¢¤¢¤ë¤¤¤ÏURL
 
 '¥Ú¡¼¥¸Ì¾/źÉÕ¥Õ¥¡¥¤¥ë̾'¤ò»ØÄꤹ¤ë¤È¡¢¤½¤Î¥Ú¡¼¥¸¤ÎźÉÕ¥Õ¥¡¥¤¥ë¤ò»²¾È¤¹¤ë
 
-- page~
-¥Õ¥¡¥¤¥ë¤òźÉÕ¤·¤¿¥Ú¡¼¥¸Ì¾(¾Êά²Ä)~
+- page
+¥Õ¥¡¥¤¥ë¤òźÉÕ¤·¤¿¥Ú¡¼¥¸Ì¾(¾Êά²Ä)
 
 - Left|Center|Right
 ²£¤Î°ÌÃÖ¹ç¤ï¤»
@@ -57,6 +57,8 @@ img
 
 */
 
+define('PLUGIN_REF_USAGE', "(attached-file-name[,page][,parameters][,title])");
+
 // File icon image
 if (! defined('FILE_ICON')) {
        define('FILE_ICON',
@@ -65,7 +67,7 @@ if (! defined('FILE_ICON')) {
 }
 
 // Default alignment
-define('REF_DEFAULT_ALIGN', 'left'); // 'left','center','right'
+define('REF_DEFAULT_ALIGN', 'left'); // 'left', 'center', 'right'
 
 // Force wrap on default
 define('REF_WRAP_TABLE', FALSE); // TRUE,FALSE
@@ -76,11 +78,13 @@ define('REF_URL_GETIMAGESIZE', FALSE);
 function plugin_ref_inline()
 {
        // Not reached, because of "$aryargs[] = & $body" at plugin.php
-       // if (! func_num_args()) return '&amp;ref(): No arguments;';
+       // if (! func_num_args())
+       //      return '&amp;ref(): Usage:' . PLUGIN_REF_USAGE . ';';
 
        $params = plugin_ref_body(func_get_args());
 
        if (isset($params['_error']) && $params['_error'] != '') {
+               // Error
                return '&amp;ref(): ' . $params['_error'] . ';';
        } else {
                return $params['_body'];
@@ -89,7 +93,8 @@ function plugin_ref_inline()
 
 function plugin_ref_convert()
 {
-       if (! func_num_args()) return '<p>#ref(): No arguments</p>';
+       if (! func_num_args())
+               return '<p>#ref(): Usage:' . PLUGIN_REF_USAGE . "</p>\n";
 
        $params = plugin_ref_body(func_get_args());
 
@@ -172,11 +177,9 @@ function plugin_ref_body($args)
                '_error' => ''
        );
 
-       if (! empty($args)) {
-               foreach ($args as $arg) {
+       if (! empty($args))
+               foreach ($args as $arg)
                        ref_check_arg($arg, $params);
-               }
-       }
 
 /*
  $name¤ò¤â¤È¤Ë°Ê²¼¤ÎÊÑ¿ô¤òÀßÄê