[cvs] [Wiki] changed: Doc/Dev/Registry

Jan Schneider jan at horde.org
Mon Aug 8 12:31:01 PDT 2005


jan  Mon, 08 Aug 2005 12:31:01 -0700

Modified page: http://wiki.horde.org/Doc/Dev/Registry
New Revision:  1.3
Change log:  Add registry description

@@ -1,77 +1,28 @@
 + The Registry
 
-Horde's Registry is the glue that holds different applications together
-
-<code type="php">
-require_once HORDE_BASE . 'Horde/Registry.php';
-
-// The Registry has a singleton method that should be used to ensure
-// that there is only ever one instance of the Registry during a request.
-$registry = &Registry::singleton();
-
-// All applications should put themselves on the application stack when they start running
-// This also takes care of reading the application's configuration file.
-$registry->pushApp('curapp');
-
-// When an app is finished, pop it off the application stack
-// This also returns the global $conf variable to that of the previous application.
-$registry->popApp();
-
-// Routines can determine the current app:
-$curapp = $registry->getApp();
-
-// Find out if an application allows access for the current user (may be a guest user)
-if ($registry->hasPermission('app')) {
-    // access allowed
-}
-</code>
+Horde's Registry is the glue that holds different applications together.
 
 * The Registry system keeps track of Horde's application stack, and which app is currently running.
-* When you switch applications, the registry will take care of switching the gettext textdomain correctly.
+* When you switch applications, the registry will take care of correctly switching the gettext textdomain, loading the application configuration, and loading the user's application preferences.
 * It also lets you determine configuration information about installed applications.
+* The Registry lets you generate links to other apps.
+ * Links will be to the application that provides the functionality.
+ * Any arguments that the target script needs (headers for an email, for instance) will be filled out of the second argument to link().
+* The Registry also lets you invoke methods in other applications
+ * The registry.php config file defines where to find the code necessary to execute the method, and what application implements it.
+ * Any application can be integrated this way; all you need to do is map it to the registry interface.
 
-The Registry lets you generate links to other apps
-
-<code type="php">
-require_once HORDE_BASE . 'Horde/Registry.php';
-$registry = &Registry::singleton();
-
-// Check to see if the functionality we want is there
-if (!$registry->hasMethod('mail/compose')) {
-    echo 'no mail/compose method defined';
-    exit;
-}
-
-// Generate the link
-echo $registry->link('mail/compose', array('to' => 'foo at example.com', 'subject' => 'bar'));
-</code>
-
-* Links will be to the application that provides the functionality.
-* Any arguments that the target script needs (headers for an email, for instance) will be filled out of the second argument to link().
-
-The Registry also lets you invoke methods in other applications
-
-<code type="php">
-require_once HORDE_BASE . 'Horde/Registry.php';
-$registry = &Registry::singleton();
-
-// Check to see if the functionality we want is there
-if (!$registry->hasMethod('contacts/search')) {
-    echo 'no contacts/search method defined';
-    exit;
-}
-
-// The contacts/search method takes two arrays; one of names, one of addressbooks
-$args = array('sources' => array('myldap'),
-                         'names' => array('Chuck'),
-                          'fields' => array('name', 'email'));
-$results = $registry->call('contacts/search', $args);
-</code>
+Things the Registry does when being instantiated:
 
-* The registry config file defines where to find the code necessary to execute the method, and what application implements it.
-* Any application can be integrated this way; all you need to do is map it to the registry interface.
+# Importing the global configuration
+# Setting up the session handler and starting the session
+# Setting the language and gettext domain
+# Restoring the registry information from cache or loading and parsing the registry configuration from {{config/registry.php}}
+# Instantiating the global ((Doc/Dev/PackagePerms|Permission)) object
+# Attaching a javascript notification listener
 
+((Doc/Dev/FrameworkPackage|Click here)) for Registry usage examples.
 
 ++ registry.php
 
 Here's an application's registry.php entry:


More information about the cvs mailing list