X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffunctions.php;h=d5d9226e38b4b6980eefed23818ef2d9daa41882;hp=4469fb25e0f9f2a27e22a4d5cf7d9f3d4fc96909;hb=f40ee6b3fe47308625f3490dedb1c52174ddf9f1;hpb=613b1f8c579e3585ac57a848e2318f33fb2747e7
diff --git a/inc/functions.php b/inc/functions.php
index 4469fb25e0..d5d9226e38 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -11,7 +11,7 @@
* Kurzbeschreibung : Viele Nicht-Datenbank-Funktionen *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
- * Copyright (c) 2009 - 2015 by Mailer Developer Team *
+ * Copyright (c) 2009 - 2016 by Mailer Developer Team *
* For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -2083,7 +2083,7 @@ function encodeUrl ($url, $outputMode = '0') {
} // END - if
// Add {?URL?} ?
- if ((substr($url, 0, strlen(getUrl())) != getUrl()) && (substr($url, 0, 7) != '{?URL?}') && (substr($url, 0, 7) != 'http://') && (substr($url, 0, 8) != 'https://')) {
+ if ((substr($url, 0, strlen(getUrl())) != getUrl()) && (substr($url, 0, 7) != '{?URL?}') && (!isFullQualifiedUrl($url))) {
// Add it
$url = '{?URL?}/' . $url;
} // END - if
@@ -2865,5 +2865,101 @@ function translatePhpExtension ($extension) {
return '{--PHP_EXTENSION_' . strtoupper($extension) . '--}';
}
+// Loads stylesheet files in different ways, depending on output mode
+function loadStyleSheets () {
+ // Default styles
+ $stylesList = array(
+ 'general.css',
+ 'ajax.css',
+ );
+
+ // Add stylesheet for installation
+ if ((isInstaller())) {
+ array_push($stylesList, 'install.css');
+ } // END - if
+
+ // When no CSS output-mode is set, set it to file-output
+ if (!isConfigEntrySet('css_php')) {
+ setConfigEntry('css_php', 'FILE');
+ } // END - if
+
+ // Get current theme
+ $currentTheme = getCurrentTheme();
+
+ // Has the theme changed?
+ if ($currentTheme != getSession('mailer_theme')) {
+ // Then set it
+ setMailerTheme($currentTheme);
+ } // END - if
+
+ // Output CSS files or content or link to css.php ?
+ if ((isCssOutputMode()) || (getCssPhp() == 'DIRECT')) {
+ // Load CSS files
+ $stylesList = merge_array($stylesList, getExtensionCssFiles());
+
+ // Generate base path
+ $basePath = getBasePathFromTheme($currentTheme);
+
+ // Output inclusion lines
+ foreach ($stylesList as $value) {
+ // Only include found CSS files (to reduce 404 requests)
+ $FQFN = $basePath . '/' . $value;
+
+ // Do include only existing files and whose are not empty
+ if ((isFileReadable($FQFN)) && (filesize($FQFN) > 0)) {
+ switch (getCssPhp()) {
+ case 'DIRECT': // Just link them (unsupported)
+ $GLOBALS['__page_header'] .= '';
+ break;
+
+ case 'FILE': // Output contents
+ $GLOBALS['__page_header'] .= removeDeprecatedComment(readFromFile($FQFN));
+ break;
+
+ default: // Invalid mode!
+ reportBug(__FILE__, __LINE__, sprintf('Invalid css_php value %s detected.', getCssPhp()));
+ break;
+ } // END - switch
+ } // END - if
+ } // END - foreach
+ } elseif ((isHtmlOutputMode()) || (getCssPhp() == 'INLINE')) {
+ // Load CSS files
+ $stylesList = merge_array($stylesList, getExtensionCssFiles());
+
+ // Generate base path
+ $basePath = getBasePathFromTheme(getCurrentTheme());
+
+ // Output inclusion lines
+ $OUT = '';
+ foreach ($stylesList as $value) {
+ // Only include found CSS files (to reduce 404 requests)
+ $FQFN = $basePath . '/' . $value;
+
+ // Do include only existing files and whose are not empty
+ if ((isFileReadable($FQFN)) && (filesize($FQFN) > 0)) {
+ // Load CSS content
+ $OUT .= readFromFile($FQFN);
+ } // END - if
+ } // END - foreach
+
+ // Load template
+ $GLOBALS['__page_header'] .= loadTemplate('css_inline', TRUE, removeDeprecatedComment($OUT));
+ } else {
+ // Now we load all CSS files from css.php!
+ $OUT = '';
+ }
+}
+
// [EOF]
?>