updating include/validate.php structure
[squirrelmail.git] / doc / plugin.txt
index b677a02186f3c9f71bdc938d414c06f07f9f8054..a51e405cb96f2c8d1c11a391fb0e553b74fb463b 100644 (file)
@@ -177,6 +177,7 @@ version is not listed, files are included from v.1.3.2.):
          7.3.2. functions/prefs.php (from 1.5.1)
       7.4. functions/constants.php
       7.5. do_hook('loading_prefs')
+         7.5.1. files loaded by plugins that use 'loading_prefs'
    8. functions/page_header.php
       8.1. functions/strings.php
       8.2. functions/html.php
@@ -185,9 +186,13 @@ version is not listed, files are included from v.1.3.2.):
       8.4. functions/global.php
    9. functions/prefs.php
       9.1. functions/global.php
-      9.2. $prefs_backend (from 1.4.3rc1 and 1.5.0)
+      9.2. $prefs_backend (only in 1.4.3 and 1.5.0)
+           do_hook_function('prefs_backend') (since 1.4.4 and 1.5.1)
            functions/db_prefs.php
            functions/file_prefs.php
+         9.2.1. functions/display_messages.php
+                (loaded only by file_prefs.php)
+         9.2.2. files loaded by plugin that uses 'prefs_backend'
 
 Hook Types:  Parameters and Return Values
 -----------------------------------------
@@ -278,7 +283,7 @@ but may be out of date soon thereafter.  You never know.  ;-)
   get_pref_override              functions/file_prefs.php        hook_func
   get_pref                       functions/file_prefs.php        hook_func
   special_mailbox                functions/imap_mailbox.php      hook_func
-  % rename_or_delete_folder      functions/imap_mailbox.php      hook_func
+% rename_or_delete_folder        functions/imap_mailbox.php      hook_func
   mailbox_index_before           functions/mailbox_display.php   do_hook
   mailbox_form_before            functions/mailbox_display.php   do_hook
   mailbox_index_after            functions/mailbox_display.php   do_hook
@@ -287,12 +292,12 @@ but may be out of date soon thereafter.  You never know.  ;-)
   mailbox_display_buttons        functions/mailbox_display.php   do_hook
   mailbox_display_button_action  functions/mailbox_display.php   hook_func
   message_body                   functions/mime.php              do_hook
-  ^ attachment $type0/$type1     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
+  prefs_backend                  functions/prefs.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
@@ -311,34 +316,34 @@ but may be out of date soon thereafter.  You never know.  ;-)
   login_top                      src/login.php                   do_hook
   login_form                     src/login.php                   do_hook
   login_bottom                   src/login.php                   do_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
-  * optpage_loadhook_highlight   src/options.php                 do_hook
-  * optpage_loadhook_folder      src/options.php                 do_hook
-  * optpage_loadhook_order       src/options.php                 do_hook
-  * options_personal_save        src/options.php                 do_hook
-  * options_display_save         src/options.php                 do_hook
-  * options_folder_save          src/options.php                 do_hook
-  * options_save                 src/options.php                 do_hook
-  * optpage_register_block       src/options.php                 do_hook
-  * options_link_and_description src/options.php                 do_hook
-  * options_personal_inside      src/options.php                 do_hook
-  * options_display_inside       src/options.php                 do_hook
-  * options_highlight_inside     src/options.php                 do_hook
-  * options_folder_inside        src/options.php                 do_hook
-  * options_order_inside         src/options.php                 do_hook
-  * options_personal_bottom      src/options.php                 do_hook
-  * options_display_bottom       src/options.php                 do_hook
-  * options_highlight_bottom     src/options.php                 do_hook
-  * options_folder_bottom        src/options.php                 do_hook
-  * options_order_bottom         src/options.php                 do_hook
-  * options_highlight_bottom     src/options_highlight.php       do_hook
-  & options_identities_process   src/options_identities.php      do_hook
-  & options_identities_top       src/options_identities.php      do_hook
-  &% options_identities_renumber src/options_identities.php      do_hook
-  & options_identities_table     src/options_identities.php      concat_hook
-  & options_identities_buttons   src/options_identities.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
+* optpage_loadhook_highlight     src/options.php                 do_hook
+* optpage_loadhook_folder        src/options.php                 do_hook
+* optpage_loadhook_order         src/options.php                 do_hook
+* options_personal_save          src/options.php                 do_hook
+* options_display_save           src/options.php                 do_hook
+* options_folder_save            src/options.php                 do_hook
+* options_save                   src/options.php                 do_hook
+* optpage_register_block         src/options.php                 do_hook
+* options_link_and_description   src/options.php                 do_hook
+* options_personal_inside        src/options.php                 do_hook
+* options_display_inside         src/options.php                 do_hook
+* options_highlight_inside       src/options.php                 do_hook
+* options_folder_inside          src/options.php                 do_hook
+* options_order_inside           src/options.php                 do_hook
+* options_personal_bottom        src/options.php                 do_hook
+* options_display_bottom         src/options.php                 do_hook
+* options_highlight_bottom       src/options.php                 do_hook
+* options_folder_bottom          src/options.php                 do_hook
+* options_order_bottom           src/options.php                 do_hook
+* options_highlight_bottom       src/options_highlight.php       do_hook
+& options_identities_process     src/options_identities.php      do_hook
+& options_identities_top         src/options_identities.php      do_hook
+&% options_identities_renumber   src/options_identities.php      do_hook
+& options_identities_table       src/options_identities.php      concat_hook
+& options_identities_buttons     src/options_identities.php      concat_hook
   message_body                   src/printer_friendly_bottom.php do_hook
   read_body_header               src/read_body.php               do_hook
   read_body_menu_top             src/read_body.php               hook_func
@@ -358,14 +363,14 @@ but may be out of date soon thereafter.  You never know.  ;-)
   webmail_top                    src/webmail.php                 do_hook
   webmail_bottom                 src/webmail.php                 concat_hook
   logout_above_text              src/signout.php                 concat_hook
-  O info_bottom                  plugins/info/options.php        do_hook
+O info_bottom                    plugins/info/options.php        do_hook
 
 % = This hook is used in multiple places in the given file
 # = Called with hook type (see below)
 & = Special identity hooks (see below)
 ^ = Special attachments hook (see below)
 * = Special options hooks (see below)
-O = optional hook used by plugin
+O = Optional hook provided by a particular plugin
 
 
 (#) Called With
@@ -472,10 +477,15 @@ To set up links for actions, you assign them like this:
 
   $Args[1]['<plugin_name>']['href'] = 'URL to link to';
   $Args[1]['<plugin_name>']['text'] = _("What to display");
+  $Args[1]['<plugin_name>']['extra'] = 'extra stuff, such as an <img ...> tag';
 
 Note: _("What to display") is explained in the section about
 internationalization.
 
+You can leave the 'text' empty and put an image tag in 'extra' to show an
+image-only link for the attachment, or do the opposite (leave 'extra' empty)
+to display a text-only link.
+
 It's also possible to specify a hook as "attachment type0/*",
 for example "attachment text/*". This hook will be executed whenever there's
 no more specific rule available for that type.
@@ -687,6 +697,9 @@ for you.  This is the preferred method of building options lists going forward.
                         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.
+         htmlencoded    disables html sanitizing. WARNING - don't use it, if user
+                        input is possible in option or use own sanitizing functions.
+                        Currently works only with SMOPT_TYPE_STRLIST.
 
       Note that you do not have to create a whole new section on the options
       page if you merely want to add a simple input item or two to an options
@@ -1036,6 +1049,19 @@ files.
 
          echo _("This is what I want to eat before noon: ") . $fruitName;
 
+      Note:
+      Support for single quotes in gettext was added somewhere along gettext
+      0.11.x (release dates 2002-01-31--08-06). This means that strings could
+      be written as:
+
+      echo _('Hello');
+
+      However, gettext 0.10.40 is currently the oldest version available at the
+      GNU site. It's still used in some Linux and BSD distributions/versions.
+      Since it's still in common use and it doesn't support single quoted
+      strings, double quoted strings are the preferred way when writing a
+      plugin.
+
   2.  By default, the SquirrelMail gettext domain is always in use.  That
       means that any text in the format described above will be translated
       using the locale files found in the main SquirrelMail locale directory.
@@ -1134,7 +1160,7 @@ files.
 
       You should change the header to look something more like:
 
-         # Copyright (c) 1999-2003 The Squirrelmail Development Team
+         # Copyright (c) 1999-2005 The SquirrelMail Project Team
          # Roland Bauerschmidt <rb@debian.org>, 1999.
          # $Id$
          msgid ""
@@ -1143,7 +1169,7 @@ files.
          "POT-Creation-Date: 2003-01-21 19:21+0100\n"
          "PO-Revision-Date: 2003-01-21 21:01+0100\n"
          "Last-Translator: Juergen Edner <juergen.edner@epost.de>\n"
-         "Language-Team: German <squirrelmail-i18n@lists.squirrelmail.net>\n"
+         "Language-Team: German <squirrelmail-i18n@lists.sourceforge.net>\n"
          "MIME-Version: 1.0\n"
          "Content-Type: text/plain; charset=ISO-8859-1\n"
          "Content-Transfer-Encoding: 8bit\n"
@@ -1178,16 +1204,16 @@ 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 &
+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
+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>
+ * Copyright (c) 2005 My Name <my-email-address>
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * @package plugins
@@ -1197,7 +1223,7 @@ name of your plugin. For instance:
 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.
+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: