/** * @ignore */ private static function _load_cache() { class_exists('\\CGExtensions\\jsloader\\libdefn'); if (!is_array(self::$_cache)) { $cache = array(); $cache_key = 'c' . md5(__CLASS__); $tmp = \cms_siteprefs::get($cache_key); if ($tmp) { $cache = unserialize($tmp); } self::$_cache = $cache; } }
/** * Gets the given site prefernce * * @since 0.6 * @param string The preference name * @param mixed The default value if the preference does not exist * @return mixed */ function get_site_preference($prefname, $defaultvalue = '') { return cms_siteprefs::get($prefname, $defaultvalue); }
/** * A convenience function to assist in doing certain tasks only once per day. * This method will convert the key into a preference, and then check the value of that preference * if it is more than 24 hours since the last time this method was called for this preference * then the value of the preference is updated to the current time and FALSE is returned. * Otherwise TRUE is returned. * * @param string $key * @return bool */ public static function done_today($key) { $key = md5(__METHOD__ . $key); $val = \cms_siteprefs::get($key); if (time() - $val < 24 * 3600) { return TRUE; } \cms_siteprefs::set($key, time()); return FALSE; }