From 3d4b5ebc09fc226295f8e8f14e4444420f7308c8 Mon Sep 17 00:00:00 2001 From: nate Date: Sun, 18 Jun 2006 05:16:23 +0000 Subject: [PATCH] Enabling global loading of JavaScript and CSS files thru vendors folder git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3128 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/bootstrap.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/cake/bootstrap.php b/cake/bootstrap.php index fa6c8a653..03c2559d6 100644 --- a/cake/bootstrap.php +++ b/cake/bootstrap.php @@ -34,7 +34,7 @@ require APP_PATH . 'config' . DS . 'core.php'; require CORE_PATH . 'cake' . DS . 'config' . DS . 'paths.php'; } - $TIME_START=getMicrotime(); + $TIME_START = getMicrotime(); require LIBS . 'object.php'; require LIBS . 'session.php'; require LIBS . 'security.php'; @@ -54,7 +54,7 @@ } else { if (strpos($uri, 'index.php') !== false) { $uri = r('?', '', $uri); - $elements=explode('/index.php', $uri); + $elements = explode('/index.php', $uri); } else { $elements = explode('/?', $uri); } @@ -77,7 +77,18 @@ if (strpos($url, 'ccss/') === 0) { include WWW_ROOT . DS . 'css.php'; - die(); + exit(); + } + + $folders = array('js' => 'text/javascript', 'css' => 'text/css'); + $requestPath = explode('/', $url); + + if (in_array($requestPath[0], array_keys($folders))) { + if (file_exists(VENDORS . join(DS, $requestPath))) { + header('Content-type: ' . $folders[$requestPath[0]]); + e(file_get_contents(VENDORS . join(DS, $requestPath))); + exit(); + } } if (DEBUG) { @@ -89,6 +100,7 @@ } else { error_reporting(0); } + require CAKE . 'dispatcher.php'; require LIBS . 'model' . DS . 'connection_manager.php'; config('database'); @@ -101,7 +113,7 @@ if (empty($uri)) { $uri = setUri(); } - $filename=CACHE . 'views' . DS . convertSlash($uri) . '.php'; + $filename = CACHE . 'views' . DS . convertSlash($uri) . '.php'; if (file_exists($filename)) { uses(DS . 'controller' . DS . 'component', DS . 'view' . DS . 'view');