Quick Search:

View

Revision:

Diff

Diff from 325 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/osCommerce/branches/hpdl/oscommerce/includes/classes/services.php

Annotated File View

hpdl
1
1 <?php
2 /*
hpdl
153
3   $Id: services.php 325 2005-12-05 03:28:21Z hpdl $
hpdl
1
4
5   osCommerce, Open Source E-Commerce Solutions
6   http://www.oscommerce.com
7
8   Copyright (c) 2004 osCommerce
9
10   Released under the GNU General Public License
11 */
12
13   class osC_Services {
14     var $services,
hpdl
325
15         $started_services,
16         $call_before_page_content = array(),
17         $call_after_page_content = array();
hpdl
1
18
19     function osC_Services() {
20       $this->services = explode(';', MODULE_SERVICES_INSTALLED);
21     }
22
23     function startServices() {
24       $this->started_services = array();
25
26       foreach ($this->services as $service) {
27         $this->startService($service);
28       }
29     }
30
31     function stopServices() {
32 /*
33   ugly workaround to force the output_compression/GZIP service module to be stopped last
34   to make sure all content in the buffer is compressed and sent to the client
35 */
36       if ($this->isStarted('output_compression')) {
37         $key = array_search('output_compression', $this->started_services);
38         unset($this->started_services[$key]);
39
40         $this->started_services[] = 'output_compression';
41       }
42
43       foreach ($this->started_services as $service) {
44         $this->stopService($service);
45       }
46     }
47
48     function startService($service) {
hpdl
293
49       include('includes/services/' . $service . '.php');
hpdl
1
50
51       if (@call_user_func(array('osC_Services_' . $service, 'start'))) {
52         $this->started_services[] = $service;
53       }
54     }
55
56     function stopService($service) {
57       @call_user_func(array('osC_Services_' . $service, 'stop'));
58     }
59
60
61     function isStarted($service) {
62       return in_array($service, $this->started_services);
63     }
hpdl
325
64
65     function addCallBeforePageContent($object, $method) {
66       $this->call_before_page_content[] = array($object, $method);
67     }
68
69     function addCallAfterPageContent($object, $method) {
70       $this->call_after_page_content[] = array($object, $method);
71     }
72
73     function hasBeforePageContentCalls() {
74       return !empty($this->call_before_page_content);
75     }
76
77     function hasAfterPageContentCalls() {
78       return !empty($this->call_after_page_content);
79     }
80
81     function getCallBeforePageContent() {
82       return $this->call_before_page_content;
83     }
84
85     function getCallAfterPageContent() {
86       return $this->call_after_page_content;
87     }
hpdl
1
88   }
89 ?>