summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2008-07-22 05:55:12 +0000
committerScott Ullrich <sullrich@pfsense.org>2008-07-22 05:55:12 +0000
commit7388172140324e50203cfd105e5b5298465bc34e (patch)
tree00247552936409e93d5788db43b4094b8cf4bd8a
parent510e86d1d16640329c500555265bf7a8c3c183ef (diff)
downloadpfsense-7388172140324e50203cfd105e5b5298465bc34e.zip
pfsense-7388172140324e50203cfd105e5b5298465bc34e.tar.gz
Say hello to outputJavaScriptFileInline() and outputCSSFileInline which
can take a css and or javascript file and pass it through the php parser without forking and return the results inline. This is still faster then a round trip back to Lighttpd. Soon I will be changing portions of the webConfigurator to use these functions.
-rw-r--r--etc/inc/functions.inc25
1 files changed, 25 insertions, 0 deletions
diff --git a/etc/inc/functions.inc b/etc/inc/functions.inc
index a9ecbea..113d6f7 100644
--- a/etc/inc/functions.inc
+++ b/etc/inc/functions.inc
@@ -69,6 +69,31 @@ if(!function_exists("pfSenseHeader")) {
}
/* END compatibility goo with HEAD */
+// Return inline javascript file or CSS to minimizie
+// request count going back to server.
+function outputJavaScriptFileInline($javascript) {
+ if(file_exists($javascript)) {
+ echo "<script type=\"text/javascript\">";
+ include($javascript);
+ echo "</script>";
+ } else {
+ echo "<p/>ERROR! COULD NOT LOCATE $javascript";
+ echo "<p/>Please contact webmaster.";
+ exit;
+ }
+}
+function outputCSSFileInline($css) {
+ if(file_exists($css)) {
+ echo "<style type=\"text/css\">";
+ include($css);
+ echo "</style>";
+ } else {
+ echo "<p/>ERROR! COULD NOT LOCATE $css";
+ echo "<p/>Please contact webmaster.";
+ exit;
+ }
+}
+
/* include all configuration functions */
require_once("auth.inc");
require_once("captiveportal.inc");
OpenPOWER on IntegriCloud