Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.756.2.96
diff -u -F '^f' -r1.756.2.96 common.inc
--- includes/common.inc 11 Aug 2010 20:35:47 -0000 1.756.2.96
+++ includes/common.inc 22 Aug 2010 17:03:31 -0000
@@ -1880,15 +1880,15 @@ function drupal_get_css($css = NULL) {
// If a CSS file is not to be preprocessed and it's a module CSS file, it needs to *always* appear at the *top*,
// regardless of whether preprocessing is on or off.
if (!$preprocess && $type == 'module') {
- $no_module_preprocess .= ''."\n";
+ $no_module_preprocess .= ''."\n";
}
// If a CSS file is not to be preprocessed and it's a theme CSS file, it needs to *always* appear at the *bottom*,
// regardless of whether preprocessing is on or off.
else if (!$preprocess && $type == 'theme') {
- $no_theme_preprocess .= ''."\n";
+ $no_theme_preprocess .= ''."\n";
}
else {
- $output .= ''."\n";
+ $output .= ''."\n";
}
}
}
@@ -1900,7 +1900,7 @@ function drupal_get_css($css = NULL) {
// starting with "ad*".
$filename = 'css_'. md5(serialize($types) . $query_string) .'.css';
$preprocess_file = drupal_build_css_cache($types, $filename);
- $output .= ''."\n";
+ $output .= ''."\n";
}
}
@@ -2288,7 +2288,7 @@ function drupal_get_js($scope = 'header'
// Additionally, go through any remaining scripts if JS preprocessing is on and output the non-cached ones.
foreach ($data as $path => $info) {
if (!$info['preprocess'] || !$is_writable || !$preprocess_js) {
- $no_preprocess[$type] .= '\n";
+ $no_preprocess[$type] .= '\n";
}
else {
$files[$path] = $info;
@@ -2303,7 +2303,7 @@ function drupal_get_js($scope = 'header'
// starting with "ad*".
$filename = 'js_'. md5(serialize($files) . $query_string) .'.js';
$preprocess_file = drupal_build_js_cache($files, $filename);
- $preprocessed .= ''."\n";
+ $preprocessed .= ''."\n";
}
// Keep the order of JS files consistent as some are preprocessed and others are not.
Index: includes/file.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/file.inc,v
retrieving revision 1.121.2.13
diff -u -F '^f' -r1.121.2.13 file.inc
--- includes/file.inc 11 Aug 2010 17:40:55 -0000 1.121.2.13
+++ includes/file.inc 22 Aug 2010 17:03:35 -0000
@@ -35,19 +35,52 @@
/**
* Create the download path to a file.
*
- * @param $path A string containing the path of the file to generate URL for.
- * @return A string containing a URL that can be used to download the file.
+ * There are two kinds of local files:
+ * - "created files", i.e. those in the files directory (which is stored in
+ * the file_directory_path variable and can be retrieved using
+ * file_directory_path()). These are files that have either been uploaded by
+ * users or were generated automatically (for example through CSS
+ * aggregation).
+ * - "shipped files", i.e. those outside of the files directory, which ship as
+ * part of Drupal core or contributed modules or themes.
+ *
+ * @param $path
+ * A string containing the Drupal path (i.e. path relative to the Drupal
+ * root directory) of the file to generate the URL for.
+ * @return
+ * A string containing a URL that can be used to access the file.
*/
function file_create_url($path) {
- // Strip file_directory_path from $path. We only include relative paths in urls.
- if (strpos($path, file_directory_path() .'/') === 0) {
- $path = trim(substr($path, strlen(file_directory_path())), '\\/');
- }
- switch (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) {
- case FILE_DOWNLOADS_PUBLIC:
- return $GLOBALS['base_url'] .'/'. file_directory_path() .'/'. str_replace('\\', '/', $path);
- case FILE_DOWNLOADS_PRIVATE:
- return url('system/files/'. $path, array('absolute' => TRUE));
+ // Clean up Windows paths.
+ $old_path = $path = str_replace('\\', '/', $path);
+
+ drupal_alter('file_url', $path);
+
+ // Return path if it was altered by any module, or if it already is a
+ // root-relative or a protocol-relative URL.
+ if ($path != $old_path || drupal_substr($path, 0, 1) == '/' || drupal_substr($path, 0, 2) == '//') {
+ return $path;
+ }
+
+ // Shipped files.
+ if (preg_match("#^(/?)(misc|modules|sites|themes)/#i", $path) && (strpos($path, file_directory_path() . '/') !== 0)) {
+ return base_path() . $path;
+ }
+ // Created files.
+ else {
+ switch (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) {
+ case FILE_DOWNLOADS_PUBLIC:
+ return $GLOBALS['base_url'] . '/' . $path;
+ case FILE_DOWNLOADS_PRIVATE:
+ // Strip file_directory_path from $path. Private downloads' URLs are
+ // rewritten to be served relatively to system/files (which is a menu
+ // callback that streams the file) instead of relatively to the file
+ // directory path.
+ if (strpos($path, file_directory_path() . '/') === 0) {
+ $path = trim(substr($path, strlen(file_directory_path())), '\\/');
+ }
+ return url('system/files/' . $path, array('absolute' => TRUE));
+ }
}
}
Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.265.2.34
diff -u -F '^f' -r1.265.2.34 form.inc
--- includes/form.inc 6 Aug 2010 11:02:49 -0000 1.265.2.34
+++ includes/form.inc 22 Aug 2010 17:03:38 -0000
@@ -1991,7 +1991,7 @@ function theme_image_button($element) {
(!empty($element['#value']) ? ('value="'. check_plain($element['#value']) .'" ') : '') .
'id="'. $element['#id'] .'" '.
drupal_attributes($element['#attributes']) .
- ' src="'. base_path() . $element['#src'] .'" '.
+ ' src="'. file_create_url($element['#src']) .'" '.
(!empty($element['#title']) ? 'alt="'. check_plain($element['#title']) .'" title="'. check_plain($element['#title']) .'" ' : '' ) .
"/>\n";
}
Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.415.2.27
diff -u -F '^f' -r1.415.2.27 theme.inc
--- includes/theme.inc 1 Mar 2010 10:02:01 -0000 1.415.2.27
+++ includes/theme.inc 22 Aug 2010 17:03:39 -0000
@@ -1020,24 +1020,24 @@ function theme_get_setting($setting_name
if ($settings['toggle_logo']) {
if ($settings['default_logo']) {
- $settings['logo'] = base_path() . dirname($theme_object->filename) .'/logo.png';
+ $settings['logo'] = file_create_url(dirname($theme_object->filename) .'/logo.png');
}
elseif ($settings['logo_path']) {
- $settings['logo'] = base_path() . $settings['logo_path'];
+ $settings['logo'] = file_create_url($settings['logo_path']);
}
}
if ($settings['toggle_favicon']) {
if ($settings['default_favicon']) {
if (file_exists($favicon = dirname($theme_object->filename) .'/favicon.ico')) {
- $settings['favicon'] = base_path() . $favicon;
+ $settings['favicon'] = file_create_url($favicon);
}
else {
- $settings['favicon'] = base_path() .'misc/favicon.ico';
+ $settings['favicon'] = file_create_url('misc/favicon.ico');
}
}
elseif ($settings['favicon_path']) {
- $settings['favicon'] = base_path() . $settings['favicon_path'];
+ $settings['favicon'] = file_create_url($settings['favicon_path']);
}
else {
$settings['toggle_favicon'] = FALSE;
@@ -1258,7 +1258,7 @@ function theme_links($links, $attributes
function theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) {
if (!$getsize || (is_file($path) && (list($width, $height, $type, $image_attributes) = @getimagesize($path)))) {
$attributes = drupal_attributes($attributes);
- $url = (url($path) == $path) ? $path : (base_path() . $path);
+ $url = (url($path) == $path) ? $path : file_create_url($path);
return '';
}
}
Index: themes/garland/template.php
===================================================================
RCS file: /cvs/drupal/drupal/themes/garland/template.php,v
retrieving revision 1.16.2.3
diff -u -F '^f' -r1.16.2.3 template.php
--- themes/garland/template.php 11 May 2010 09:41:22 -0000 1.16.2.3
+++ themes/garland/template.php 22 Aug 2010 17:03:40 -0000
@@ -96,9 +96,9 @@ function phptemplate_node_submitted($nod
function phptemplate_get_ie_styles() {
global $language;
- $iecss = '';
+ $iecss = '@import "'. base_path() . path_to_theme() .'/fix-ie-rtl.css";';
+ $iecss .= '';
}
return $iecss;