From 0171a5cbe8cd8a98be3204511120f27fee98da6e Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 16 Dec 2000 09:57:21 +0000 Subject: [PATCH] - small fixes/updates --- includes/function.inc | 2 +- modules/documentation.module | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/function.inc b/includes/function.inc index 87fb0ee37ab..90a1179db6e 100644 --- a/includes/function.inc +++ b/includes/function.inc @@ -75,7 +75,7 @@ function format_interval($timestamp) { $timestamp = $timestamp % 60; } if ($timestamp > 0) { - $output .= floor($timestamp / 86400) ." sec"; + $output .= "$timestamp sec"; } return $output; } diff --git a/modules/documentation.module b/modules/documentation.module index 268e49347ba..d30cfbbc110 100644 --- a/modules/documentation.module +++ b/modules/documentation.module @@ -52,13 +52,13 @@ function documentation_page() {

Modules

When developing drop.org it became clear that we wanted to have a system which is as modular as possible. A modular design will provide flexibility, adaptability, and continuity which in turn allows people to customize the site to their needs and likings.

-

A drop module is simply a file containing a set of routines written in PHP. When used, the module code executes entirely within the context of the site. Hence it can use all the functions and access all variables and structures of the main egine. In fact, a module is not any different from any other PHP file: it is more of a notion that automatically leads to good design principles and a good development model. Modularity better suits the open-source development model, because otherwise you can't easily have people working in parallel without risk of interference.

+

A drop module is simply a file containing a set of routines written in PHP. When used, the module code executes entirely within the context of the site. Hence it can use all the functions and access all variables and structures of the main engine. In fact, a module is not any different from any other PHP file: it is more of a notion that automatically leads to good design principles and a good development model. Modularity better suits the open-source development model, because otherwise you can't easily have people working in parallel without risk of interference.

The idea is to be able to run random code at given places in the engine. This random code should then be able to do whatever needed to enhance the functionality. The places where code can be executed are called "hooks" and are defined by a fixed interface.

Even though we aim towards modularity, a basic rule is to avoid defined interfaces. We are exceptionally careful when it comes down to adding interfaces because once you give an interface to developers they will start coding to it and once somebody starts coding to it you are stuck with it.

-

In places where hooks are made available, the engine calls each module's exported functions. This is done by iterating through the ./modules directory where all modules must reside. If your module is named foo (i.e. ./modules/foo.module) and if there was a hook called bar, the engine will call foo_bar() if this was exported by your module.

-

Each module has to declare a associative array named $module that serves as the list of hooks that a module wants to export or carry out. Each entry in the array contains the name of a hook and an export function.

-

In our above example, $module would look like:

+

In places where hooks are made available, the engine calls each module's exported functions. This is done by iterating through the ./modules directory where all modules must reside. Say your module is named foo (i.e. ./modules/foo.module) and if there was a hook called bar, the engine will call foo_bar() if this was exported by your module.

+

Each module has to declare an associative array named $module that serves as the list of hooks that a module wants to export or carry out. Each entry in the array contains the name of a hook followed by the name of the exported function.

+

In our above example, our associative array $module would look like:

     $module = array("bar" => "foo_bar");