<?php //cek php if ( ! function_exists('is_php')) { function is_php($version = '5.0.0') { static $_is_php; $version = (string)$version; if ( ! isset($_is_php[$version])) { $_is_php[$version] = (version_compare(PHP_VERSION, $version) < 0) ? FALSE : TRUE; } return $_is_php[$version]; } } //cek writable if ( ! function_exists('is_really_writable')) { function is_really_writable($file) { // If we're on a Unix server with safe_mode off we call is_writable if (DIRECTORY_SEPARATOR == '/' AND @ini_get("safe_mode") == FALSE) { return is_writable($file); } // For windows servers and safe_mode "on" installations we'll actually // write a file then read it. Bah... if (is_dir($file)) { $file = rtrim($file, '/').'/'.md5(mt_rand(1,100).mt_rand(1,100)); if (($fp = @fopen($file, FOPEN_WRITE_CREATE)) === FALSE) { return FALSE; } fclose($fp); @chmod($file, DIR_WRITE_MODE); @unlink($file); return TRUE; } elseif ( ! is_file($file) OR ($fp = @fopen($file, FOPEN_WRITE_CREATE)) === FALSE) { return FALSE; } fclose($fp); return TRUE; } } //fungsi load class if ( ! function_exists('load_class')) { function &load_class($class, $directory) { static $_classes = array(); // Does the class exist? If so, we're done... if (isset($_classes[$class])) { return $_classes[$class]; } else { // Note: We use exit() rather then show_error() in order to avoid a // self-referencing loop with the Excptions class exit('Unable to locate the specified class: '.$class.'.php'); } // Keep track of what we just loaded is_loaded($class); $_classes[$class] = new $name(); return $_classes[$class]; } } //fungsi apakah sudah di-load if ( ! function_exists('is_loaded')) { function &is_loaded($class = '') { static $_is_loaded = array(); if ($class != '') { $_is_loaded[strtolower($class)] = $class; } return $_is_loaded; } } ?>