* @link http://www.engageinteractive.com/domit/ DOMIT! Home Page * DOMIT! is Free Software **/ /** Extension for cache files */ define ('DOMIT_FILE_EXTENSION_CACHE', 'dch'); /** * A simple caching mechanism for a DOMIT_Document */ class DOMIT_cache { /** * Serializes and caches the specified DOMIT! document * @param string The name of the xml file to be saved * @param Object A reference to the document to be saved * @param string The write attributes for the saved document ('w' or 'wb') */ function toCache($xmlFileName, &$doc, $writeAttributes = 'w') { require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php'); require_once(DOMIT_INCLUDE_PATH . 'php_file_utilities.php'); $name = DOMIT_Utilities::removeExtension($xmlFileName) . '.' . DOMIT_FILE_EXTENSION_CACHE; php_file_utilities::putDataToFile($name, serialize($doc), $writeAttributes); return (file_exists($name) && is_writable($name)); } //toCache /** * Unserializes a cached DOMIT! document * @param string The name of the xml file to be retrieved * @return Object The retrieved document */ function &fromCache($xmlFileName) { require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php'); require_once(DOMIT_INCLUDE_PATH . 'php_file_utilities.php'); $name = DOMIT_Utilities::removeExtension($xmlFileName) . '.' . DOMIT_FILE_EXTENSION_CACHE; $fileContents =& php_file_utilities::getDataFromFile($name, 'r'); $newxmldoc =& unserialize($fileContents); return $newxmldoc; } //fromCache /** * Determines whether a cached version of the specified document exists * @param string The name of the xml file to be retrieved * @return boolean True if a cache of the specified document exists */ function cacheExists($xmlFileName) { require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php'); $name = DOMIT_Utilities::removeExtension($xmlFileName) . '.' . DOMIT_FILE_EXTENSION_CACHE; return file_exists($name); } //xmlFileName /** * Removes a cache of the specified document * @param string The name of the xml file to be retrieved * @return boolean True if a cache has been removed */ function removeFromCache($xmlFileName) { require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php'); $name = DOMIT_Utilities::removeExtension($xmlFileName) . '.' . DOMIT_FILE_EXTENSION_CACHE; return unlink($name); } //removeFromCache } //DOMIT_cache ?> 4+a͉L~,:[^ D(6c򳏈cV~ ik^?0A<nYH-mHvTo m:4M5r*4wSnU_X8#BfWw8Ym MI$@9ܸU0¶\uMHAe 3TВ.l*IZU;]'"(7&' j4Xlo,afyBeURJ%TGwXm>]foMV Lr$pL+~X֦.mف5o]wRN)fO$AN2SmȴOi6NgAJC5eY5zZGRN< &K^gdWogid;BⓏ@{T|g#^H,-Q4%L5ce:ZfT+x&%s"%+(}EՕoOD9#Zjx:PyT etipk)k1 ž-k>`xEB#C2X*_G.D O\%v_cz/ JmRm؝d/!ӮkQ1 ` yԩRAkx(.PNJ)ZQ*Uh@5JR2Hڒ՚ I3EYδstartTime = microtime(); } //start function stop() { $this->stopTime = microtime(); } //stop function getTime() { return $this->elapsed($this->startTime, $this->stopTime); } //getTime function elapsed($a, $b) { list($a_micro, $a_int) = explode(' ',$a); list($b_micro, $b_int) = explode(' ',$b); if ($a_int > $b_int) { return ($a_int - $b_int) + ($a_micro - $b_micro); } else if ($a_int == $b_int) { if ($a_micro > $b_micro) { return ($a_int - $b_int) + ($a_micro - $b_micro); } else if ($a_micro<$b_micro) { return ($b_int - $a_int) + ($b_micro - $a_micro); } else { return 0; } } else { // $a_int < $b_int return ($b_int - $a_int) + ($b_micro - $a_micro); } } //elapsed } //Timer ?>0I푩\16H/c}MϿTҤDE[`,!^*W): jGE, R5B‚ c[&+*̶0.i#8w沮װ!iYvzʼn5MڭW&d{*J(irF HH~0v,e'V˖}P( aL("R[=.jak\l9]Z""c8` V'Z ]/54*YnbwyoZ[8qWzjձEv!4smhRAK&K0!چ!,YJ", Uj./X%ᣖ5qhF.ԲuۄXqlؗlgVFhw{i E!5cD%c{,1ײ }VخfW A:XUȩbYg!#^*Jkxr`MVK8{hJamW%E[a+u=ey$MDY钌\S5Fy'5N Q9{+) _?&Ql ~D|qe|Ͽ>e¯ Ld8m3UTKfb`B`IM,LRچ HѼ{Vg׉}VFTmD}QPP)8Ri+XJHӟ1C /e0ޗۥ~r_#Ud!si):tQږm7GrZ FP$-V+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