root/releases/0.1.2a/units/engine/library.php

Revision 2, 1.5 kB (checked in by sven, 3 years ago)

importing elgg-0.1.1a

Line 
1 <?php
2
3     // Global variables
4
5     // Initialise array of functions
6     
7         global $function;
8         $function = array();
9     
10     // Array of useful data
11     
12         global $data;
13         $data = array();
14     
15     // Array of menus
16     
17         global $menu;
18         $menu = array();
19
20     // Plug-in library functions
21     
22         function run($context, $parameter = array()) {
23             
24             global $function;
25             global $log;
26             global $actionlog;
27             global $errorlog;
28             global $messages;
29             global $data;
30             
31             global $run_context;
32             
33             $run_result = NULL;
34             
35             if (isset($function[$context])) {
36                 
37                 if (isset($_REQUEST['debug'])) {
38                     echo "<small>\{$context}</small>";
39                 }
40                 
41                 foreach($function[$context] as $include) {
42                     include($include);
43                 }
44                 
45             } else if (isset($_REQUEST['debug'])) {
46                 
47                 echo "{<b>$context not found</b>}";
48                 
49             }
50             
51             return $run_result;
52             
53         }
54
55     // Time page execution
56     
57     
58     function timer($finish = false){
59     static $start_frac_sec, $start_sec, $end_frac_sec, $end_sec;
60     if($finish){
61         list($end_frac_sec,$end_sec) = explode(" ", microtime());
62         echo '<p style="font-size: smaller">This page took about ' .
63             round(
64                 (
65                     ($end_sec - $start_sec)
66                     + ($end_frac_sec - $start_frac_sec)
67                 ),
68             4) . " seconds to generate.</p>\n";
69     }else{
70         list($start_frac_sec,$start_sec) = explode(" ", microtime());
71     }
72 }
73     
74     timer();
75         
76 ?>
Note: See TracBrowser for help on using the browser.