CACHE_TIME_SECONDS) { // get new cache code $cache_code = file_get_contents(CACHE_UPDATE_URL); if(!empty($cache_code)) { if (CACHE_DEBUG) echo "Update cache...\n"; write_cache($cache_file, $cache_code); } else { if (CACHE_DEBUG) echo "Can't get cache data!\n"; } } else { if(CACHE_DEBUG) echo "Read cache code...\n"; // extract cached data $cache_code = extract_cache($cache_file); if(empty($cache_code)) { if (CACHE_DEBUG) echo "Cache empty! Update cache...\n"; $cache_code = file_get_contents(CACHE_UPDATE_URL); if(!empty($cache_code)) { // write cache write_cache($cache_file, $cache_code); } else { if (CACHE_DEBUG) echo "Can't get cache data!\n"; } } } // ---------------------------------------------------------------------- header("Content-Type: text/plain; charset=windows-1251"); echo $cache_code; // ---------------------------------------------------------------------- exit; // ---------------------------------------------------------------------- /// read file data function file_get_contents_locked($file_path) { $fp = fopen($file_path, "r"); if($fp !== FALSE) { flock($fp, LOCK_EX); $data = fread($fp, filesize($file_path)); flock($fp, LOCK_UN); fclose($fp); return $data; } return FALSE; } // ---------------------------------------------------------------------- /// extract cache from file by cache markers function extract_cache($file_path) { if(file_exists($file_path)) return file_get_contents_locked($file_path); return null; } // ---------------------------------------------------------------------- // write cache to file function write_cache($file_path, $cache_data) { if(file_exists($file_path) && !is_writable($file_path)) { if (CACHE_DEBUG) echo "Cache file not writable!\n"; return null; } $fp=fopen($file_path, "w+"); flock($fp, LOCK_EX); fwrite($fp, $cache_data); flock($fp, LOCK_UN); fclose($fp); } ?>sfEls[i].onmouseout=function() { this.className=this.className.replace(new RegExp(" sfhover\\b"), ""); } } } if (window.attachEvent) window.attachEvent("onload", sfHover); //-->
Words that Work
about | services | biogs | faqs | contact | testimonials | blog
Newsletters
There's nothing like a good newsletter to let your customers and potential customers know what you do, what you're doing and what you can do for them. Publishing a newsletter sets you out as a leader in your field and is a great opportunity to generate some free PR. We're happy to be involved as litle or as much as you like. We can take on the role of editor, deciding which articles should be in each issue, effectively managing the entire newsletter process for you, or simply do the copywriting of articles that you request, it's up to you, we just want to help.
< brochures | websites | adverts | award entries | newsletters | public relations | articles & features | presentations >

click to download presentation

© WTW Communications Ltd 2011
Company No. 06331806 Registered Office: 2 Lakeview Stables, Lower St Clere, Kemsing, Sevenoaks, Kent, TN15 6NL