2 abstract class Output
{
5 $time = array('start' => 0,'end' => 0);
7 static private $instance = false;
9 static protected function memcacheEnabled () {
10 /// this sucks on so many ways
11 if (extension_loaded ('memcache') && C_USE_MEMCACHE
== true) {
12 $memcache = new Memcache
;
13 if (@$memcache->connect('localhost', 11211)) {
14 memcache_debug (true);
21 public function store () {
26 * static method to return the Output singleton instance
31 static function getInstance ($to) {
32 // we have already initialized the page singleton
33 if (Output
::$instance instanceof Output
) {
34 return Output
::$instance;
36 // the memcache object should also be a singleton
37 // with a static instance I can call wherever.
38 $memcache = Output
::memcacheEnabled ();
40 Output
::$instance = $memcache->get ( Output
::getHash ());
43 if (!(Output
::$instance instanceof Output
)) {
44 Output
::$instance = new $to ();
47 return Output
::$instance;
50 static public function getHash () {
51 return md5($_SERVER['HTTP_HOST'].$_SERVER['QUERY_STRING']);
54 public function getTheme(){
55 // this should most probably be changed to tsPage::getRequest ('theme')
56 if (!empty($_GET['theme']) && isDebug()) {
57 $this->theme
= $_GET['theme'];
58 } elseif (!empty($_POST['theme'])) {
59 $this->theme
= $_POST['theme'];
60 } elseif (!empty($_COOKIE['theme'])) {
61 $this->theme
= $_COOKIE['theme'];
63 if (empty($this->theme
) ||
64 !is_dir(THEME_PATH
.$this->theme
) ||
65 !is_dir(THEME_PATH
.$this->theme
.DIRECTORY_SEPARATOR
."_css") ||
66 !is_dir(THEME_PATH
.$this->theme
.DIRECTORY_SEPARATOR
."_templates")
68 $this->theme
= DEFAULT_THEME
;
74 public function __construct(){}
76 public function __destruct (){}
78 abstract public function dispatch ();