static function cache_file($f) { $css_file = Misc::key('css', $f) . '.css'; $cache_file = Cache::cache_filename($css_file); $cache_path = ROOT_PATH . PUBLIC_BASE . $cache_file; $version = (int) Config::get('page.css_version'); if (Config::get('debug.css_check_cache')) { if (file_exists($cache_path)) { $files = array_unique(explode(' ', $f)); $mtime = 0; foreach ($files as $file) { $file = trim($file); list($category, $file) = explode(':', $file, 2); if (!$file) { $file = $category; $category = NULL; } if (!$file) { continue; } $path = Core::file_exists(PRIVATE_BASE . 'css/' . $file . '.css', $category); if ($path) { $mtime = max($mtime, filemtime($path)); } } if ($mtime <= filemtime($cache_path)) { return $cache_file . '?v=' . $version; } } } elseif (file_exists($cache_path)) { return $cache_file . '?v=' . $version; } return URI::url('css', array('f' => $f, 'v' => $version)); }
static function anchor($url, $text = NULL, $extra = NULL, $options = array()) { if ($extra) { $extra = ' ' . $extra; } if ($text === NULL) { $text = $url; } $url = URI::url($url, $options['query'], $options['fragment']); return '<a href="' . $url . '"' . $extra . '>' . $text . '</a>'; }
static function setup() { if (function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc() || ini_get('magic_quotes_sybase') && strtolower(ini_get('magic_quotes_sybase')) != "off") { Input::stripslashes_deep($_GET); Input::stripslashes_deep($_POST); Input::stripslashes_deep($_COOKIE); } $route = $_SERVER['PATH_INFO']; if (!$route) { $route = $_SERVER['ORIG_PATH_INFO']; } $route = preg_replace('/^[\\/ ]*|[\\/ ]*$|' . preg_quote(Config::get('system.url_suffix')) . '$/iu', '', $route); Input::$route = $route; $args = array(); if (preg_match_all('/(.*?[^\\\\])\\//', $route . '/', $parts)) { foreach ($parts[1] as $part) { $args[] = strtr($part, array('\\/' => '/')); } } Input::$args = $args; Input::$get = $_GET; Input::$form = array_merge($_POST, $_GET); Input::$files = $_FILES; $query = $_GET; Input::$url = URI::url(Input::$route, $query); if ($_POST['_ajax']) { /* $data=json_decode($_POST['_data'], TRUE); if($data){ $new_data=array(); foreach($data as $k=>$v){ if(preg_match('/^(\S+?)(\[.+\])$/', $k, $p1)){ $key=$p1[1]; preg_match_all('/\[(\S+?)\]/', $p1[2], $p2); while(NULL !== ($p=array_pop($p2[1]))){ $v=array($p=>$v); } if(is_array($new_data[$key]) && is_array($v)){ Misc::array_merge_deep($new_data[$key], $v); } else { $new_data[$key]=$v; } }else{ $new_data[$k] = $v; } } Input::$form=array_merge(Input::$form, $new_data); } */ Input::$AJAX['widget'] = $_POST['_widget']; Input::$AJAX['object'] = $_POST['_object']; Input::$AJAX['event'] = $_POST['_event']; Input::$AJAX['mouse'] = $_POST['_mouse']; Input::$AJAX['view'] = $_POST['_view']; unset(Input::$form['_ajax']); unset(Input::$form['_data']); unset(Input::$form['_widget']); unset(Input::$form['_object']); unset(Input::$form['_event']); unset(Input::$form['_mouse']); unset(Input::$form['_view']); } }