public function twitter() { $this->use_layout = false; if (!cache_valid("twitter/charlesmarshall")) { $xml = $this->get_xml("http://twitter.com/statuses/user_timeline/15094632.xml"); if ($xml) { $this->twitter = $xml->xpath("status[position() < 6]"); } if (!is_array($this->twitter)) { cache_reset("twitter/charlesmarshall"); $this->use_view = false; } } }
function endcache($store = TRUE, $send_output = TRUE) { global $cache_pbufferlen, $cache_absfile, $cache_data, $cache_variables, $cache_headers, $cache_ob_handler, $cache_output_buffer; cache_debug(__LINE__ . ': $cache_absfile -> ' . $cache_absfile); if (!CACHE_ON) { cache_debug('Not caching, CACHE_ON is off'); return 0; } /* else */ if ($GLOBALS[CACHE_HAS]['ob_start']) { $content = ob_get_contents(); if (cache_iftype($cache_pbufferlen, FALSE)) { /* Output buffering was off before this, we just need to turn it off again */ /* JK's fix */ if ($send_output) { ob_end_flush(); cache_debug(__LINE__ . ': Content sent. flush()'); } else { ob_end_clean(); cache_debug(__LINE__ . ': Content ignored. clean()'); } cache_debug(__LINE__ . ': $cache_absfile -> ' . $cache_absfile); } else { /* Output buffering was already on, so get our chunk of data for caching */ $content = substr($content, $cache_pbufferlen); } } else { $content = $cache_output_buffer; } if (!$store) { $cache_absfile = NULL; } if ($cache_absfile != NULL) { $cache_data['content'] = $content; $variables = array(); foreach ($cache_variables as $vn) { //while(list(,$vn)=each($cache_variables)) { cache_debug(__LINE__ . ': Found variable: <b>' . $vn . '</b>'); if (isset($GLOBALS[$vn])) { $val = $GLOBALS[$vn]; cache_debug(__LINE__ . ': Setting variable ' . $vn . ' to ' . $val); $variables[$vn] = $val; } } $cache_data['cache_object'] = $cache_absfile; $cache_data['variables'] = $variables; $cache_data['headers'] = $cache_headers; $datas = serialize($cache_data); cache_write($cache_absfile, $datas); } else { cache_debug(__LINE__ . ': no variables found'); cache_debug($cache_variables[0]); cache_debug(__LINE__ . ': $cache_absfile -> ' . $cache_absfile); } /* casues probs on win32 */ cache_lock($cache_absfile, FALSE); /* */ cache_reset(); cache_debug(__LINE__ . ': $cache_absfile -> ' . $cache_absfile); cache_debug(__LINE__ . ': <b>Caching is done!</b><br>'); }