/** */ public function process($css, $cacheid) { global $injector; if (!empty($this->_params['filemtime'])) { foreach ($css as &$val) { $val['mtime'] = @filemtime($val['fs']); } } $cache = $injector->getInstance('Horde_Cache'); $sig = hash(version_compare(PHP_VERSION, '5.4', '>=') ? 'fnv164' : 'sha1', json_encode($css) . $cacheid); // Do lifetime checking here, not on cache display page. if (!$cache->exists($sig, empty($this->_params['lifetime']) ? 0 : $this->_params['lifetime'])) { $compress = new Horde_Themes_Css_Compress(); $cache->set($sig, $compress->compress($css)); } return array(Horde::getCacheUrl('css', array('cid' => $sig))); }
/** */ public function process($css, $cacheid) { global $registry; if (!empty($this->_params['filemtime'])) { foreach ($css as &$val) { $val['mtime'] = @filemtime($val['fs']); } } $sig = hash(PHP_MINOR_VERSION >= 4 ? 'fnv164' : 'sha1', json_encode($css) . $cacheid); $filename = $sig . '.css'; $path = $registry->get('staticfs', 'horde') . '/' . $filename; if (!file_exists($path)) { $compress = new Horde_Themes_Css_Compress(); if (!file_put_contents($path, $compress->compress($css))) { Horde::log('Could not write cached CSS file to disk.', 'EMERG'); return array(); } } return array(Horde::url($registry->get('staticuri', 'horde') . '/' . $filename, true, array('append_session' => -1))); }
/** */ public function process($css, $cacheid) { global $registry; if (!empty($this->_params['filemtime'])) { foreach ($css as &$val) { $val['mtime'] = @filemtime($val['fs']); } } $sig = hash(version_compare(PHP_VERSION, '5.4', '>=') ? 'fnv164' : 'sha1', json_encode($css) . $cacheid); $filename = $sig . '.css'; $js_fs = $registry->get('staticfs', 'horde'); $path = $js_fs . '/' . $filename; if (!file_exists($path)) { $compress = new Horde_Themes_Css_Compress(); $temp = Horde_Util::getTempFile('staticcss', true, $js_fs); if (!file_put_contents($temp, $compress->compress($css), LOCK_EX) || !chmod($temp, 0777 & ~umask()) || !rename($temp, $path)) { Horde::log('Could not write cached CSS file to disk.', 'EMERG'); return array(); } } return array(Horde::url($registry->get('staticuri', 'horde') . '/' . $filename, true, array('append_session' => -1))); }
/** * Loads CSS files, cleans up the input, and concatenates to a string. * * @deprecated Use Horde_Themes_Css_Compress instead. * * @param array $files List of CSS files as returned from * getStylesheets(). * * @return string CSS data. */ public function loadCssFiles($files) { $compress = new Horde_Themes_Css_Compress(); return $compress->compress($files); }