diff --git a/core/html_api.php b/core/html_api.php index 607ee50fd4..03ac243258 100644 --- a/core/html_api.php +++ b/core/html_api.php @@ -208,11 +208,16 @@ function require_css( $p_stylesheet_path ) { */ function html_css() { global $g_stylesheets_included; - html_css_link( config_get_global( 'css_include_file' ) ); + + $t_cache_key = helper_generate_cache_key(); + + html_css_link( config_get_global( 'css_include_file' ), $t_cache_key ); + # Add right-to-left css if needed if( lang_get( 'directionality' ) == 'rtl' ) { - html_css_link( config_get_global( 'css_rtl_include_file' ) ); + html_css_link( config_get_global( 'css_rtl_include_file' ), $t_cache_key ); } + foreach( $g_stylesheets_included as $t_stylesheet_path ) { # status_config.php is a special css file, dynamically generated. # Add a hash to the query string to differentiate content based on its @@ -224,6 +229,7 @@ function html_css() { 'cache_key=' . helper_generate_cache_key( array( 'user' ) ) ); } + html_css_link( $t_stylesheet_path ); } @@ -238,14 +244,23 @@ function html_css() { /** * Prints a CSS link * @param string $p_filename Filename. + * @param string $p_cache_key The cache key to put on query string or empty string. * @return void */ -function html_css_link( $p_filename ) { +function html_css_link( $p_filename, $p_cache_key = '' ) { + $t_filename = $p_filename; + # If no path is specified, look for CSS files in default directory - if( $p_filename == basename( $p_filename ) ) { - $p_filename = 'css/' . $p_filename; + if( $t_filename == basename( $t_filename ) ) { + $t_filename = 'css/' . $t_filename; + } + + $t_url = helper_mantis_url( $t_filename ); + if ( !empty( $p_cache_key ) ) { + $t_url = helper_url_combine( $t_url, 'cache_key=' . $p_cache_key ); } - echo "\t", '', "\n"; + + echo "\t", '', "\n"; } /** diff --git a/core/layout_api.php b/core/layout_api.php index f2f20f9e0e..e179ab88d0 100644 --- a/core/layout_api.php +++ b/core/layout_api.php @@ -251,6 +251,8 @@ function layout_head_meta() { * @return void */ function layout_head_css() { + $t_cache_key = helper_generate_cache_key(); + # bootstrap & fontawesome if ( config_get_global( 'cdn_enabled' ) == ON ) { html_css_cdn_link( 'https://stackpath.bootstrapcdn.com/bootstrap/' . BOOTSTRAP_VERSION . '/css/bootstrap.min.css',BOOTSTRAP_HASH_CSS ); @@ -267,7 +269,7 @@ function layout_head_css() { html_css_link( 'font-awesome-' . FONT_AWESOME_VERSION . '.min.css' ); # theme text fonts - html_css_link( 'fonts.css' ); + html_css_link( 'fonts.css', $t_cache_key ); # datetimepicker html_css_link( 'bootstrap-datetimepicker-' . DATETIME_PICKER_VERSION . '.min.css' ); @@ -276,12 +278,12 @@ function layout_head_css() { # page specific plugin styles # theme styles - html_css_link( 'ace.min.css' ); - html_css_link( 'ace-mantis.css' ); - html_css_link( 'ace-skins.min.css' ); + html_css_link( 'ace.min.css', $t_cache_key ); + html_css_link( 'ace-mantis.css', $t_cache_key ); + html_css_link( 'ace-skins.min.css', $t_cache_key ); if( layout_is_rtl() ) { - html_css_link( 'ace-rtl.min.css' ); + html_css_link( 'ace-rtl.min.css', $t_cache_key ); } echo "\n";