Browse Source

adding two hooks that allow integrating third party address book backends

tokul 21 năm trước cách đây
mục cha
commit
c5ba519e85
3 tập tin đã thay đổi với 21 bổ sung2 xóa
  1. 1 0
      ChangeLog
  2. 4 2
      doc/plugin.txt
  3. 16 0
      functions/addressbook.php

+ 1 - 0
ChangeLog

@@ -34,6 +34,7 @@ Version 1.5.1 -- CVS
   - Add functions for building HTML forms (functions/forms.php).
   - Moved javascript_on to session (from prefs). Centralized javascript detection
     in prefs.php method checkForJavascript.
+  - Added abook_init and abook_add_class hooks
 
 Version 1.5.0
 --------------------

+ 4 - 2
doc/plugin.txt

@@ -233,6 +233,8 @@ but may be out of date soon thereafter.  You never know.  ;-)
 
   Hook Name                      Found In                        Called With(#)
   ---------                      --------                        --------------
+  abook_init                     functions/addressbook.php       do_hook
+  abook_add_class                functions/addressbook.php       do_hook
   loading_constants              functions/constants.php         do_hook
   logout_error                   functions/display_messages.php  do_hook
   error_box                      functions/display_messages.php  concat_hook
@@ -1092,10 +1094,10 @@ files.
 
          # Copyright (c) 1999-2003 The Squirrelmail Development Team
          # Roland Bauerschmidt <rb@debian.org>, 1999.
+         # $Id$
          msgid ""
          msgstr ""
-         "Project-Id-Version: $Id: squirrelmail.po,v 1.10 2003/06/04 15:01:59
-         philippe_mingo Exp $\n"
+         "Project-Id-Version: plugin-name version\n"
          "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"

+ 16 - 0
functions/addressbook.php

@@ -97,6 +97,15 @@ function addressbook_init($showerr = true, $onlylocal = false) {
 				     'table' => $addrbook_global_table));
     }
 
+    /*
+     * hook allows to include different address book backends.
+     * plugins should extract $abook and $r from arguments
+     * and use same add_backend commands as above functions.
+     */
+    $hookReturn = do_hook('abook_init', $abook, $r);
+    $abook = $hookReturn[1];
+    $r = $hookReturn[2];
+    
     if ($onlylocal) {
         return $abook;
     }
@@ -568,5 +577,12 @@ if((isset($addrbook_dsn) && !empty($addrbook_dsn)) ||
   include_once(SM_PATH . 'functions/abook_database.php');
 }
 
+/*
+ * hook allows adding different address book classes.
+ * class must follow address book class coding standards.
+ *
+ * see addressbook_backend class and functions/abook_*.php files.
+ */
+do_hook('abook_add_class');
 
 ?>