public static function get_last_modify() { if (!isset(self::$__last_modified)) { self::$__last_modified = app::get('site')->getConf('widgets_css_last_modify'); } return self::$__last_modified; }
function clear_by_theme($theme) { if (empty($theme)) { return false; } site_widgets::set_last_modify(); app::get('site')->model('widgets')->delete(array('theme' => $theme)); }
function clear_by_app($app_id) { if (!$app_id) { return false; } site_widgets::set_last_modify(); app::get('site')->model('widgets')->delete(array('app' => $app_id)); }
function post_update($params) { $dbver = $params['dbver']; if (version_compare($dbver, '1.0.6', '<')) { //更新widgets css最后更新时间 site_widgets::set_last_modify(); //重新创建module sitemap kernel::single('site_module_base')->create_site_config(); //缓存全部更新, 改造了缓存机制 cachemgr::clean($msg); } }
public function get_css() { $params = $this->_request->get_params(true); $theme = $params[0]; $tmpl = base64_decode($params[1]); $widgets_css_last_modified = site_widgets::get_last_modify(); if (!site_widgets::fetch_widgets_css($tmpl, $widgets_css, $cache_last_modified) || intval($cache_last_modified) < intval($widgets_css_last_modified)) { $this->set_theme($theme); $content = $this->display_tmpl($tmpl, true); $style = ''; $__widgets_css = array(); preg_match_all('/<\\s*style.*?>(.*?)<\\s*\\/\\s*style\\s*>/is', $content, $matchs); if (isset($matchs[0][0]) && !empty($matchs[0][0])) { $__widgets_css = array_merge($__widgets_css, $matchs[1]); } $style .= implode("\r\n", array_unique($__widgets_css)); site_widgets::store_widgets_css($tmpl, $style); } else { $style = $widgets_css; } $this->_response->set_body($style); $this->_response->set_header('Content-type', 'text/css'); }
public function cache_version() { $theme = $this->_request->get_get('theme'); if (!$this->check($theme, $msg)) { $this->_error($msg); } $this->begin(); site_widgets::set_last_modify(); $this->end(kernel::single('site_theme_tmpl')->touch_theme_tmpl($theme)); }