<?php
function _advanced_forum_add_files() {
 
// This could get called more than once on a page and we only need to do it once.
 
static $added;
  if (empty(
$added)) {
   
$added = TRUE;
   
$lineage = advanced_forum_style_lineage();
   
$lineage = array_reverse($lineage, TRUE);
   
$theme_path = advanced_forum_path_to_theme();
    foreach (array(
'structure.css', 'style.css', 'images.css') as $css_type) {
     
$css_file = "$theme_path/advanced-forum.$css_type";
      if (
file_exists($css_file)) {
       
// CSS files with no style name in the theme directory trump all
        // to provide a theme specific style override.
       
drupal_add_css($css_file);
      }
      else {
       
// For each style from the current style on up through each parent
        // style, look for the style specific CSS file first in the active
        // theme and then in the style directory.
       
foreach ($lineage AS $key => $path) {
         
$css_file = "/advanced-forum.$key.$css_type";
          if (
file_exists("$theme_path/$css_file")) {
           
// If the style specific file is in the theme, use that.
           
drupal_add_css("$theme_path/$css_file");
          }
          elseif (
file_exists("$path/$css_file")) {
           
// Otherwise look in the style for it.
           
drupal_add_css("$path" . "$css_file");
          }
        }
      }
    }
   
advanced_forum_load_style_includes();
  }
}
?>

"elseif (file_exists("$path/$css_file")) {" This wont happen cos there will be double // cos of $css_file = "/advanced-forum.$key.$css_type";

Comments

Priority:Major» Normal

I am not sure I understand... $theme_path/$css_file and $path/$css_file are different things.

$css_file = "/advanced-forum.$key.$css_type";

$path/$css_file = $path//advanced-forum.$key.$css_type

This is what i mean. There will be double "//"

Status:Active» Closed (works as designed)

Double slashes in file_exists() are ignored.

so this means file_exists accepts double slashes?

If so, what will be in the following case?

drupal_add_css("$theme_path/$css_file");

Why is there "/" between $theme_path and $css_file?

Status:Closed (works as designed)» Closed (fixed)

There is extra "/" because of bug but that bug doesn't change anything sine // is ignored in both file_exists() and CSS @import url.

Above block should look like:

<?php
       
foreach ($lineage AS $key => $path) {
         
$css_file = "advanced-forum.$key.$css_type";
          if (
file_exists("$theme_path/$css_file")) {
           
// If the style specific file is in the theme, use that.
           
drupal_add_css("$theme_path/$css_file");
          }
          elseif (
file_exists("$path/$css_file")) {
           
// Otherwise look in the style for it.
           
drupal_add_css("$path/$css_file");
          }
        }
?>

I will commit change to dev.

Thx