array to string comparision. sqimap_retrieve_imap_response function, that
[squirrelmail.git] / doc / plugin.txt
index 19e0cd38b9110f25fba0f12900f652bc66d51a6e..4530e580ef177e7c9bd0ebecaaf64201029f3fd9 100644 (file)
@@ -200,10 +200,14 @@ but may be out of date soon thereafter.  You never know.  ;-)
   mailbox_index_after            functions/mailbox_display.php   do_hook
   check_handleAsSent_result      functions/mailbox_display.php   do_hook
   subject_link                   functions/mailbox_display.php   concat_hook
+  mailbox_display_buttons        functions/mailbox_display.php   do_hook
   message_body                   functions/mime.php              do_hook
   ^ attachment $type0/$type1     functions/mime.php              do_hook
+  attachments_bottom             functions/mime.php              hook_func
+  decode_body                    functions/mime.php              hook_func
   generic_header                 functions/page_header.php       do_hook
   menuline                       functions/page_header.php       do_hook
+  internal_link                  functions/page_header.php       hook_func
   loading_prefs                  include/load_prefs.php          do_hook
   addrbook_html_search_below     src/addrbook_search_html.php    do_hook
   addressbook_bottom             src/addressbook.php             do_hook
@@ -215,13 +219,16 @@ but may be out of date soon thereafter.  You never know.  ;-)
   help_top                       src/help.php                    do_hook
   help_chapter                   src/help.php                    do_hook
   help_bottom                    src/help.php                    do_hook
+  left_main_after_each_folder    src/left_main.php               concat_hook
   left_main_before               src/left_main.php               do_hook
   left_main_after                src/left_main.php               do_hook
+  create_collapse_link           src/left_main.php               hook_func
   login_cookie                   src/login.php                   do_hook
   login_top                      src/login.php                   do_hook
   login_form                     src/login.php                   do_hook
   login_bottom                   src/login.php                   do_hook
   move_before_move               src/move_messages.php           do_hook
+  move_messages_button_action    src/move_messages.php           concat_hook
   * optpage_set_loadinfo         src/options.php                 do_hook
   * optpage_loadhook_personal    src/options.php                 do_hook
   * optpage_loadhook_display     src/options.php                 do_hook
@@ -540,52 +547,58 @@ for you.  This is the preferred method of building options lists going forward.
       The array that you use to specify each plugin option has the following
       possible attributes:
 
-         name       The name of this setting, which is used not only for
-                    the INPUT tag name, but also for the name of this
-                    setting in the user's preferences
-         caption    The text that prefaces this setting on the preferences page
-         type       The type of INPUT element, which should be one of:
-                       SMOPT_TYPE_STRING     String/text input
-                       SMOPT_TYPE_STRLIST    Select list input
-                       SMOPT_TYPE_TEXTAREA   Text area input
-                       SMOPT_TYPE_INTEGER    Integer input
-                       SMOPT_TYPE_FLOAT      Floating point number input
-                       SMOPT_TYPE_BOOLEAN    Boolean (yes/no radio buttons) 
-                                             input
-                       SMOPT_TYPE_HIDDEN     Hidden input (not actually shown
-                                             on preferences page)
-                       SMOPT_TYPE_COMMENT    Text is shown (specified by the 
-                                             'comment' attribute), but no user
-                                             input is needed
-                       SMOPT_TYPE_FLDRLIST   Select list of IMAP folders
-         refresh    Indicates if a link should be shown to refresh part or all
-                    of the window (optional).  Possible values are:
-                       SMOPT_REFRESH_NONE         No refresh link is shown
-                       SMOPT_REFRESH_FOLDERLIST   Link is shown to refresh
-                                                  only the folder list
-                       SMOPT_REFRESH_ALL          Link is shown to refresh
-                                                  the entire window
-         posvals    For select lists, this should be an associative array,
-                    where each key is an actual input value and the
-                    corresponding value is what is displayed to the user
-                    for that list item in the drop-down list
-         value      Specify the default/preselected value for this option input
-         save       You may indicate that special functionality needs to be
-                    used instead of just saving this setting by giving the 
-                    name of a function to call when this value would otherwise
-                    just be saved in the user's preferences
-         size       Specifies the size of certain input items (typically
-                    textual inputs).  Possible values are:
-                       SMOPT_SIZE_TINY
-                       SMOPT_SIZE_SMALL
-                       SMOPT_SIZE_MEDIUM
-                       SMOPT_SIZE_LARGE
-                       SMOPT_SIZE_HUGE
-                       SMOPT_SIZE_NORMAL
-         comment    For SMOPT_TYPE_COMMENT type options, this is the text
-                    displayed to the user
-         script     This is where you may add any additional javascript 
-                    or other code to the user input
+         name           The name of this setting, which is used not only for
+                        the INPUT tag name, but also for the name of this
+                        setting in the user's preferences
+         caption        The text that prefaces this setting on the preferences
+                        page
+         type           The type of INPUT element, which should be one of:
+                           SMOPT_TYPE_STRING     String/text input
+                           SMOPT_TYPE_STRLIST    Select list input
+                           SMOPT_TYPE_TEXTAREA   Text area input
+                           SMOPT_TYPE_INTEGER    Integer input
+                           SMOPT_TYPE_FLOAT      Floating point number input
+                           SMOPT_TYPE_BOOLEAN    Boolean (yes/no radio buttons)
+                                                   input
+                           SMOPT_TYPE_HIDDEN     Hidden input (not actually
+                                                 shown on preferences page)
+                           SMOPT_TYPE_COMMENT    Text is shown (specified by the
+                                                 'comment' attribute), but no
+                                                 user input is needed
+                           SMOPT_TYPE_FLDRLIST   Select list of IMAP folders
+         refresh        Indicates if a link should be shown to refresh part or
+                        all of the window (optional).  Possible values are:
+                           SMOPT_REFRESH_NONE         No refresh link is shown
+                           SMOPT_REFRESH_FOLDERLIST   Link is shown to refresh
+                                                      only the folder list
+                           SMOPT_REFRESH_ALL          Link is shown to refresh
+                                                    the entire window
+         initial_value  The value that should initially be placed in this 
+                        INPUT element
+         posvals        For select lists, this should be an associative array,
+                        where each key is an actual input value and the
+                        corresponding value is what is displayed to the user
+                        for that list item in the drop-down list
+         value          Specify the default/preselected value for this option
+                        input
+         save           You may indicate that special functionality needs to be
+                        used instead of just saving this setting by giving the
+                        name of a function to call when this value would 
+                        otherwise just be saved in the user's preferences
+         size           Specifies the size of certain input items (typically
+                        textual inputs).  Possible values are:
+                           SMOPT_SIZE_TINY
+                           SMOPT_SIZE_SMALL
+                           SMOPT_SIZE_MEDIUM
+                           SMOPT_SIZE_LARGE
+                           SMOPT_SIZE_HUGE
+                           SMOPT_SIZE_NORMAL
+         comment        For SMOPT_TYPE_COMMENT type options, this is the text
+                        displayed to the user
+         script         This is where you may add any additional javascript 
+                        or other code to the user input
+         post_script    You may specify some script (usually Javascript) that
+                        will be placed after (outside of) the INPUT tag.
 
   3.  If you indicated a 'save' attribute for any of your options, you must
       create that function (you'll only need to do this if you need to do
@@ -1032,11 +1045,11 @@ files.
       After you're done translating, you can create the .mo file very simply 
       by running the following command (available on most linux systems):
 
-         msgfmt -0 <plugin name>.mo <plugin name>.po
+         msgfmt -o <plugin name>.mo <plugin name>.po
 
       In the case of the "demo" plugin:
 
-         msgfmt -0 demo.mo demo.po
+         msgfmt -o demo.mo demo.po
 
       Please be sure that the .po and .mo files both are named exactly the
       same as the domain you bound in step 2 above and everything else works
@@ -1044,6 +1057,41 @@ files.
       and change your Language setting to see the translations in action!
 
 
+
+Documenting the Code (Optional)
+-------------------------------
+
+If you wish, you can use phpdoc (Javadoc-style) comments, when documenting your
+code.
+
+If you follow the standards that are followed between Squirrelmail core &
+plugin developers, the resulted documentation can be included with the rest of
+the Squirrelmail code & API documentation. Specifically, in the page-level
+docblock, declare the package to be 'plugins', and the subpackage to be the
+name of your plugin. For instance:
+  
+/**
+ * demo.php
+ *
+ * Copyright (c) 2003 My Name <my-email-address>
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * @package plugins
+ * @subpackage demo
+ */
+
+The rest is up to you. Try to follow some common sense and document what is
+really needed. Documenting the code properly can be a big help not only to
+yourself, but to those who will take a look at your code, fix the bugs and even
+improve it, in the true open-source spirit that Squirrelmail was built upon.
+
+For more information about phpdocumentor and how to write proper-tagged
+comments, you are directed at:
+
+http://phpdocu.sourceforge.net/
+
+
+
 PLUGIN STANDARDS AND REQUIREMENTS
 =================================
 
@@ -1065,7 +1113,7 @@ Small setup.php
 
 In order for SquirrelMail to remain fast and lean, we are now asking
 that all plugin authors remove all unnecessary functionality from setup.php
-and refactoring it into another file.  There are a few ways to accomplish
+and refactor it into another file.  There are a few ways to accomplish
 this, none of which are difficult.  At a minimum, you'll want to have the
 squirrelmail_plugin_init_<plugin name>() function in setup.php, and naturally,
 you'll need functions that are merely stubs for each hook that you are using.
@@ -1104,7 +1152,7 @@ When you are developing your plugin, you should always have error reporting
 turned all the way up.  You can do this by changing two settings in your
 php.ini and restarting your web server:
 
-   display_errors = Off
+   display_errors = On
    error_reporting  =  E_ALL
 
 This way, you'll be sure to see all Notices, Warnings and Errors that your
@@ -1112,6 +1160,22 @@ code generates (it's OK, really, it happens to the best of us... except me!).
 Please make sure to fix them all before you release the plugin.
 
 
+Compatibility with register_globals=Off
+---------------------------------------
+
+Most sensible systems administrators now run their PHP systems with the
+setting "register_globals" as OFF.  This is a prudent security setting,
+and as the SquirrelMail core code has long since been upgraded to work
+in such an environment, we are now requiring that all plugins do the same.
+Compatibility with this setting amounts to little more than explicitly
+gathering any and all variables you sent from a <form> tag as GET or POST
+values instead of just assuming that they will be placed in the global
+scope automatically.  There is nothing more to do than this:
+
+   global $favorite_color;
+   sqgetGlobalVar('favorite_color', $favorite_color, SQ_FORM);
+
+
 Extra Blank Lines
 -----------------
 
@@ -1207,8 +1271,12 @@ strongly encouraged to make use of.  Using them also makes your job easier.
 
   4.  To remove a variable from the session:
 
+         global $favorite_color;
          sqsession_unregister('favorite_color');
 
+      Strictly speaking, globalizing the variable shouldn't be necessary,
+      but certain versions of PHP seem to behave more predictably if you do.
+
 
 Form Variables
 --------------