/** * Constructor * * Initialize internal memory objects and date keys. * * @param Ai1ec_Memory_Utility $memory Optionally inject memory to use * * @return void Constructor does not return */ public function __construct(Ai1ec_Memory_Utility $memory = NULL) { if (NULL === $memory) { $memory = new Ai1ec_Memory_Utility(120); // 30 * 4 } $this->_memory = $memory; $this->_transf = Ai1ec_Memory_Utility::instance(__CLASS__); $this->_keys = $this->_initialize_keys(); $this->_skeys = $this->_initialize_keys($this->_separator, $this->_separator); $this->_format = implode($this->_separator, $this->_keys); }
/** * Constructor * * Initialize properties to default values, that may result in better * performance, than delaying this until actual usage. * * @return void Constructor does not return */ protected function __construct() { $this->_timezones = Ai1ec_Memory_Utility::instance(__CLASS__ . '/timezones'); $this->_gmt_offsets = Ai1ec_Memory_Utility::instance(__CLASS__ . '/gmt_offsets'); $this->_gmtdates = Ai1ec_Memory_Utility::instance(__CLASS__ . '/gmt_dates'); $this->_current_time = array((int) $_SERVER['REQUEST_TIME'], gmmktime()); $this->_time_i18n = new Ai1ec_Time_I18n_Utility(); }
/** * get_category_color function * * Returns the color of the Event Category having the given term ID. * * @param int $term_id The ID of the Event Category * * @return string Color to use * * @staticvar Ai1ec_Memory_Utility $colors Cached entries instance */ function get_category_color($term_id) { static $colors = NULL; if (!isset($colors)) { $colors = Ai1ec_Memory_Utility::instance(__METHOD__); } $term_id = (int) $term_id; if (NULL === ($color = $colors->get($term_id))) { global $wpdb; $color = (string) $wpdb->get_var('SELECT term_color FROM ' . $wpdb->prefix . 'ai1ec_event_category_colors' . ' WHERE term_id = ' . $term_id); $colors->set($term_id, $color); } return $color; }
/** * Constructor * * Initialize properties to default values, that may result in better * performance, than delaying this until actual usage. * * @return void Constructor does not return */ protected function __construct() { $this->_timezones = Ai1ec_Memory_Utility::instance(__CLASS__ . '/timezones'); $this->_gmt_offsets = Ai1ec_Memory_Utility::instance(__CLASS__ . '/gmt_offsets'); $this->_gmtdates = Ai1ec_Memory_Utility::instance(__CLASS__ . '/gmt_dates'); $this->_timezone_offsets = Ai1ec_Memory_Utility::instance(__CLASS__ . '/timezone_offset'); $this->_dst_differences = Ai1ec_Memory_Utility::instance(__CLASS__ . '/timezone_offset'); // we require PHP v.5.2.0 minimum, but let's leave this // check in place, for the sake of general truthfulness $gmt_time = version_compare(PHP_VERSION, '5.1.0') >= 0 ? time() : gmmktime(); $this->_current_time = array((int) $_SERVER['REQUEST_TIME'], $gmt_time); $this->_time_i18n = new Ai1ec_Time_I18n_Utility(); }
/** * __construct function * * Default constructor - calendar initialization **/ private function __construct() { $this->_exact_dates = Ai1ec_Memory_Utility::instance(__CLASS__ . '/get_exact_date'); }