\documentclass{article}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage{hyperref}
\pagestyle{headings}
\begin{document}
\part{The Registry}
\textbf{This information is valid for Horde 3 only. See <a href="https://wiki.horde.org/Doc/Dev/Registry">Doc/Dev/Registry</a> for Horde 4 and later.}

Horde's Registry is the glue that holds different applications together.

\begin{itemize}
\item The Registry system keeps track of Horde's application stack, and which app is currently running.


\item 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.


\item It also lets you determine configuration information about installed applications.


\item The Registry lets you generate links to other apps.
\begin{itemize}
\item Links will be to the application that provides the functionality.


\item Any arguments that the target script needs (headers for an email, for instance) will be filled out of the second argument to link().


\end{itemize}

\item The Registry also lets you invoke methods in other applications
\begin{itemize}
\item The registry.php config file defines where to find the code necessary to execute the method, and what application implements it.


\item Any application can be integrated this way; all you need to do is map it to the registry interface.


\end{itemize}

\end{itemize}
Things the Registry does when being instantiated:

\begin{itemize}
\item Importing the global configuration


\item Setting up the session handler and starting the session


\item Setting the language and gettext domain


\item Restoring the registry information from cache or loading and parsing the registry configuration from \texttt{config/registry.php}


\item Instantiating the global <a href="https://wiki.horde.org/Doc/Dev/PermsPackage">Permission</a> object


\item Attaching a javascript notification listener<br />
<a href="https://wiki.horde.org/Doc/Dev/FrameworkPackage">Click here</a> for Registry usage examples. <a href="https://wiki.horde.org/Doc/Dev/LegacyApps">Click here</a> for examples how to use the Registry from outside of Horde.


\end{itemize}
\section{registry.php}
Here's an application's registry.php entry:

<pre><code class="language-php">
\$this->applications['whups'] = array(
    'fileroot' => dirname(\_\_FILE\_\_) . '/../whups',
    'webroot' => \$this->applications['horde']['webroot'] . '/whups',
    'name' => \_("Tickets"),
    'status' => 'active',
    'provides' => 'tickets',
    'menu\_parent' => 'devel',
);
</code></pre>
\subsection{fileroot}
<pre><code class="language-php">
    'fileroot' => dirname(\_\_FILE\_\_) . '/../whups',
</code></pre>
The \texttt{fileroot} setting tells Horde where the application - in this case Whups - lives on the filesystem. The \texttt{<u>FILE</u>} constant is the current file; \texttt{dirname()} strips off the filename and turns it into just a directory.<br />
This means that the location is by default relative to \texttt{registry.php} - under the \texttt{horde/} directory - which is almost always right. But it's configurable just in case.

\subsection{webroot}
<pre><code class="language-php">
    'webroot' => \$this->applications['horde']['webroot'] . '/whups',
</code></pre>
The \texttt{webroot} setting tells Horde where the application lives relative to the webserver's document root. Usually this is predictable as well, but you might want to give an application its own domain - for example, \texttt{http://cvs.php.net/}, which is powered by Horde and Chora.

\subsection{name}
<pre><code class="language-php">
    'name' => \_("Tickets"),
</code></pre>
The \texttt{name} setting surprisingly sets the human-readable name of the application. The \texttt{\_()} is an alias for \texttt{gettext()}, which translates the name into other languages.

\subsection{status}
<pre><code class="language-php">
    'status' => 'active',
</code></pre>
The \texttt{status} setting tells Horde what kind of application this is. Possible statuses are:

\begin{itemize}
\item inactive


\item hidden


\item notoolbar


\item heading


\item block


\item admin


\item active


\end{itemize}
\subsection{provides}
<pre><code class="language-php">
    'provides' => 'tickets',
</code></pre>
The \texttt{provides} setting tells Horde if the application provides any APIs. In this case Whups provides the tickets API, which allows for adding and listing tickets. In turn, Horde knows that if it gets a request for a \texttt{tickets/search} method, it should pass it along to Whups.

\subsection{menu\_parent}
<pre><code class="language-php">
    'menu\_parent' => 'devel',
</code></pre>
The \texttt{menu\_parent} setting is just for the sidebar - it tells Horde what item to make the application of a child of. This lets you customize the menu to your heart's content. This can be left out or set to null for top-level items.

\end{document}
