storage_path = $path; } public function setContent($content) { global $config; do { $filename = sha1(date('r') . rand(1000, getrandmax())); } while (file_exists(realpath($storage_path . '/' , $filename))); if ($config['short_results_path']) { $urlbase = $config['short_results_path']; } else { $urlbase = $config['site_domain'] . $config['site_path'] . '/' . $config['results_dir']; } $content = $this->prepareContent($filename, $urlbase, $content); $filename = $filename . ".html"; // write content $outfile = realpath($storage_path . '/' , $filename); $fp = fopen($outfile, "w"); fwrite($fp, $content); fclose($fp); return $pasteUrl; } } ?>