/** * Force a CSS file to be cached. * * @param string The CSS file required * @param ?ID_TEXT The name of the theme (NULL: current theme) * @param ?boolean Whether to minify (NULL: read from environment) * @return string The path to the CSS file in the cache (blank: no file) */ function css_enforce($c, $theme = NULL, $minify = NULL) { $text_only = get_param_integer('keep_textonly', 0) == 1; if ($text_only) { $c .= '_textonly'; } if ($minify === NULL) { $minify = get_param_integer('keep_no_minify', 0) == 0; } global $SITE_INFO; // Make sure the CSS file exists if ($theme === NULL) { $theme = @method_exists($GLOBALS['FORUM_DRIVER'], 'get_theme') ? $GLOBALS['FORUM_DRIVER']->get_theme() : 'default'; } $active_theme = $theme; $dir = get_custom_file_base() . '/themes/' . $theme . '/templates_cached/' . filter_naughty(user_lang()); if (!isset($SITE_INFO['no_disk_sanity_checks']) || $SITE_INFO['no_disk_sanity_checks'] == '0') { if (!is_dir($dir)) { if (@mkdir($dir, 0777) === false) { warn_exit(do_lang_tempcode('WRITE_ERROR_DIRECTORY_REPAIR', escape_html($dir))); } fix_permissions($dir, 0777); sync_file($dir); } } $css_cache_path = $dir . '/' . filter_naughty_harsh($c); if (!$minify) { $css_cache_path .= '_non_minified'; } if (get_option('enable_https', true) == '1' && function_exists('is_page_https') && function_exists('get_zone_name') && (tacit_https() || is_page_https(get_zone_name(), get_page_name()))) { $css_cache_path .= '_ssl'; } if (is_mobile()) { $css_cache_path .= '_mobile'; } $css_cache_path .= '.css'; global $CACHE_TEMPLATES; $support_smart_decaching = !isset($SITE_INFO['disable_smart_decaching']) || $SITE_INFO['disable_smart_decaching'] == '0'; $is_cached = ($CACHE_TEMPLATES || !running_script('index')) && @(filesize($css_cache_path) != 0) && !is_browser_decacheing() && !in_safe_mode(); if ($support_smart_decaching || !$is_cached || $text_only) { $found = find_template_place($c, '', $theme, '.css', 'css'); if ($found === NULL) { return ''; } $theme = $found[0]; $fullpath = get_custom_file_base() . '/themes/' . $theme . $found[1] . $c . '.css'; if (!is_file($fullpath)) { $fullpath = get_file_base() . '/themes/' . $theme . $found[1] . $c . '.css'; } if ($text_only && !is_file($fullpath)) { return ''; } } if (!$is_cached || $support_smart_decaching && (@(filemtime($css_cache_path) < filemtime($fullpath)) && @filemtime($fullpath) < time())) { require_code('css_and_js'); css_compile($active_theme, $theme, $c, $fullpath, $css_cache_path, $minify); } if (@filesize($css_cache_path) == 0) { return ''; } return $css_cache_path; }
/* Javascript Compilier */ echo "Including Libraries..."; include "lib.php"; include "../../lib/jsoncheck.php"; echo "Updating Version File..."; $v = update_versions(); echo "Generating HTML..."; $html = gen_html(file_get_contents("../../../html/ajaxanimator.htm")); file_put_contents("../../../build/index.htm", $html); echo "Generating NoHotlink HTML..."; //crap! another typo file_put_contents("../../../build/nohotlink.htm", nohotlink($html)); echo "Compressing Javascript..."; $js = js_compile("../../../html/ajaxanimator.htm", array("../js/misc/files.js" => "../js/misc/alt/files.js")); file_put_contents("../../../build/ajaxanimator-all.js", $js); exec("dos2unix ../../../build/ajaxanimator-all.js"); echo "Compressing CSS..."; $css = css_compile("../../../html/ajaxanimator.htm"); file_put_contents("../../../build/ajaxanimator-all.css", str_replace("../", "http://ajaxanimator.googlecode.com/svn-history/r444/trunk/ajaxanimator/", $css)); exec("dos2unix ../../../build/ajaxanimator-all.css"); //echo "Archiving Release..."; //file_put_contents("../../../build/archive/ajaxanimator-all-$v.js",$js); //exec("dos2unix ../../../build/archive/ajaxanimator-all-$v.js"); //file_put_contents("../../../build/archive/ajaxanimator-all-$v.css",$css); //exec("dos2unix ../../../build/archive/ajaxanimator-all-$v.js"); //file_put_contents("../../../build/archive/ajaxanimator-$v.htm", //crap! i had a typo here!!! //str_replace("ajaxanimator-all.css","ajaxanimator-all-$v.css", //str_replace("ajaxanimator-all.js","ajaxanimator-all-$v.js",$html))); echo "DONE";