private static function _reset() { self::$_prefs = null; }
/** * 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; }
/** * Sets the given site perference with the given value. * * @since 0.6 * @param string The preference name * @param mixed The preference value (will be stored as a string) * @return void */ function set_site_preference($prefname, $value) { return cms_siteprefs::set($prefname, $value); }
/** * @ignore */ private static function _save_cache() { $cache_key = 'c' . md5(__CLASS__); \cms_siteprefs::set($cache_key, serialize(self::$_cache)); }