diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php index f83e0ca7ffd..f5ac9a63a87 100644 --- a/lib/Cake/Core/App.php +++ b/lib/Cake/Core/App.php @@ -387,11 +387,11 @@ public static function pluginPath($plugin) { * * `App::themePath('MyTheme'); will return the full path to the 'MyTheme' theme` * - * @param string $theme lower_cased theme name to find the path of. + * @param string $theme theme name to find the path of. * @return string full path to the theme. */ public static function themePath($theme) { - $themeDir = 'themed' . DS . Inflector::underscore($theme); + $themeDir = 'Themed' . DS . Inflector::camelize($theme); foreach (self::$__packages['View'] as $path) { if (is_dir($path . $themeDir)) { return $path . $themeDir . DS ; diff --git a/lib/Cake/Test/Case/Core/AppTest.php b/lib/Cake/Test/Case/Core/AppTest.php index 6087d8884f6..d2c7bbf18f3 100644 --- a/lib/Cake/Test/Case/Core/AppTest.php +++ b/lib/Cake/Test/Case/Core/AppTest.php @@ -393,11 +393,11 @@ function testThemePath() { 'View' => array(LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS) )); $path = App::themePath('test_theme'); - $expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS; + $expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS; $this->assertEqual($path, $expected); $path = App::themePath('TestTheme'); - $expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS; + $expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS; $this->assertEqual($path, $expected); App::build(); diff --git a/lib/Cake/Test/Case/Routing/DispatcherTest.php b/lib/Cake/Test/Case/Routing/DispatcherTest.php index d2838286c4d..e4da9ee47a4 100644 --- a/lib/Cake/Test/Case/Routing/DispatcherTest.php +++ b/lib/Cake/Test/Case/Routing/DispatcherTest.php @@ -1227,21 +1227,21 @@ public function testAssets() { $Dispatcher->dispatch(new CakeRequest('theme/test_theme/flash/theme_test.swf')); $result = ob_get_clean(); - $file = file_get_contents(LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS . 'webroot' . DS . 'flash' . DS . 'theme_test.swf'); + $file = file_get_contents(LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'webroot' . DS . 'flash' . DS . 'theme_test.swf'); $this->assertEqual($file, $result); $this->assertEqual('this is just a test to load swf file from the theme.', $result); ob_start(); $Dispatcher->dispatch(new CakeRequest('theme/test_theme/pdfs/theme_test.pdf')); $result = ob_get_clean(); - $file = file_get_contents(LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS . 'webroot' . DS . 'pdfs' . DS . 'theme_test.pdf'); + $file = file_get_contents(LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'webroot' . DS . 'pdfs' . DS . 'theme_test.pdf'); $this->assertEqual($file, $result); $this->assertEqual('this is just a test to load pdf file from the theme.', $result); ob_start(); $Dispatcher->dispatch(new CakeRequest('theme/test_theme/img/test.jpg')); $result = ob_get_clean(); - $file = file_get_contents(LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS . 'webroot' . DS . 'img' . DS . 'test.jpg'); + $file = file_get_contents(LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'webroot' . DS . 'img' . DS . 'test.jpg'); $this->assertEqual($file, $result); ob_start(); diff --git a/lib/Cake/Test/Case/View/ThemeViewTest.php b/lib/Cake/Test/Case/View/ThemeViewTest.php index 8ae0f78d522..3ca49982faf 100644 --- a/lib/Cake/Test/Case/View/ThemeViewTest.php +++ b/lib/Cake/Test/Case/View/ThemeViewTest.php @@ -149,18 +149,18 @@ function testPluginThemedGetTemplate() { $this->Controller->name = 'TestPlugin'; $this->Controller->viewPath = 'Tests'; $this->Controller->action = 'index'; - $this->Controller->theme = 'test_theme'; + $this->Controller->theme = 'TestTheme'; $ThemeView = new TestThemeView($this->Controller); - $expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS . 'Plugins' . DS . 'TestPlugin' . DS . 'Tests' . DS .'index.ctp'; + $expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Plugins' . DS . 'TestPlugin' . DS . 'Tests' . DS .'index.ctp'; $result = $ThemeView->getViewFileName('index'); $this->assertEqual($result, $expected); - $expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS . 'Plugins' . DS . 'TestPlugin' . DS . 'Layouts' . DS .'plugin_default.ctp'; + $expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Plugins' . DS . 'TestPlugin' . DS . 'Layouts' . DS .'plugin_default.ctp'; $result = $ThemeView->getLayoutFileName('plugin_default'); $this->assertEqual($result, $expected); - $expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS . 'Layouts' . DS .'default.ctp'; + $expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Layouts' . DS .'default.ctp'; $result = $ThemeView->getLayoutFileName('default'); $this->assertEqual($result, $expected); } @@ -179,16 +179,16 @@ function testGetTemplate() { $this->Controller->params['pass'] = array('home'); $ThemeView = new TestThemeView($this->Controller); - $ThemeView->theme = 'test_theme'; + $ThemeView->theme = 'TestTheme'; $expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS .'Pages' . DS .'home.ctp'; $result = $ThemeView->getViewFileName('home'); $this->assertEqual($result, $expected); - $expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS . 'Posts' . DS .'index.ctp'; + $expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Posts' . DS .'index.ctp'; $result = $ThemeView->getViewFileName('/Posts/index'); $this->assertEqual($result, $expected); - $expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'test_theme' . DS . 'Layouts' . DS .'default.ctp'; + $expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Layouts' . DS .'default.ctp'; $result = $ThemeView->getLayoutFileName(); $this->assertEqual($result, $expected); @@ -259,7 +259,7 @@ function testMemoryLeakInPaths() { $this->Controller->name = 'Posts'; $this->Controller->viewPath = 'posts'; $this->Controller->layout = 'whatever'; - $this->Controller->theme = 'test_theme'; + $this->Controller->theme = 'TestTheme'; $View = new ThemeView($this->Controller); $View->element('test_element'); diff --git a/lib/Cake/Test/Case/View/ViewTest.php b/lib/Cake/Test/Case/View/ViewTest.php index 0f0801eb2f1..eac6401fc6e 100644 --- a/lib/Cake/Test/Case/View/ViewTest.php +++ b/lib/Cake/Test/Case/View/ViewTest.php @@ -753,14 +753,14 @@ function testViewFileName() { $result = $View->getViewFileName('index'); $this->assertPattern('/posts(\/|\\\)index.ctp/', $result); - $result = $View->getViewFileName('/pages/home'); - $this->assertPattern('/pages(\/|\\\)home.ctp/', $result); + $result = $View->getViewFileName('/Pages/home'); + $this->assertPattern('/Pages(\/|\\\)home.ctp/', $result); - $result = $View->getViewFileName('../elements/test_element'); - $this->assertPattern('/elements(\/|\\\)test_element.ctp/', $result); + $result = $View->getViewFileName('../Elements/test_element'); + $this->assertPattern('/Elements(\/|\\\)test_element.ctp/', $result); - $result = $View->getViewFileName('../themed/test_theme/posts/index'); - $this->assertPattern('/themed(\/|\\\)test_theme(\/|\\\)posts(\/|\\\)index.ctp/', $result); + $result = $View->getViewFileName('../Themed/TestTheme/Posts/index'); + $this->assertPattern('/Themed(\/|\\\)TestTheme(\/|\\\)Posts(\/|\\\)index.ctp/', $result); $expected = LIBS . 'Test' . DS . 'test_app' . DS . 'View' . DS .'Posts' . DS .'index.ctp'; $result = $View->getViewFileName('../Posts/index'); diff --git a/lib/Cake/Test/test_app/View/Themed/test_theme/Elements/test_element.ctp b/lib/Cake/Test/test_app/View/Themed/TestTheme/Elements/test_element.ctp similarity index 100% rename from lib/Cake/Test/test_app/View/Themed/test_theme/Elements/test_element.ctp rename to lib/Cake/Test/test_app/View/Themed/TestTheme/Elements/test_element.ctp diff --git a/lib/Cake/Test/test_app/View/Themed/test_theme/Layouts/default.ctp b/lib/Cake/Test/test_app/View/Themed/TestTheme/Layouts/default.ctp similarity index 100% rename from lib/Cake/Test/test_app/View/Themed/test_theme/Layouts/default.ctp rename to lib/Cake/Test/test_app/View/Themed/TestTheme/Layouts/default.ctp diff --git a/lib/Cake/Test/test_app/View/Themed/test_theme/Posts/index.ctp b/lib/Cake/Test/test_app/View/Themed/TestTheme/Posts/index.ctp similarity index 100% rename from lib/Cake/Test/test_app/View/Themed/test_theme/Posts/index.ctp rename to lib/Cake/Test/test_app/View/Themed/TestTheme/Posts/index.ctp diff --git a/lib/Cake/Test/test_app/View/Themed/test_theme/Posts/scaffold.index.ctp b/lib/Cake/Test/test_app/View/Themed/TestTheme/Posts/scaffold.index.ctp similarity index 100% rename from lib/Cake/Test/test_app/View/Themed/test_theme/Posts/scaffold.index.ctp rename to lib/Cake/Test/test_app/View/Themed/TestTheme/Posts/scaffold.index.ctp diff --git a/lib/Cake/Test/test_app/View/Themed/test_theme/plugins/TestPlugin/Layouts/plugin_default.ctp b/lib/Cake/Test/test_app/View/Themed/TestTheme/plugins/TestPlugin/Layouts/plugin_default.ctp similarity index 100% rename from lib/Cake/Test/test_app/View/Themed/test_theme/plugins/TestPlugin/Layouts/plugin_default.ctp rename to lib/Cake/Test/test_app/View/Themed/TestTheme/plugins/TestPlugin/Layouts/plugin_default.ctp diff --git a/lib/Cake/Test/test_app/View/Themed/test_theme/plugins/TestPlugin/tests/index.ctp b/lib/Cake/Test/test_app/View/Themed/TestTheme/plugins/TestPlugin/tests/index.ctp similarity index 100% rename from lib/Cake/Test/test_app/View/Themed/test_theme/plugins/TestPlugin/tests/index.ctp rename to lib/Cake/Test/test_app/View/Themed/TestTheme/plugins/TestPlugin/tests/index.ctp diff --git a/lib/Cake/Test/test_app/View/Themed/test_theme/webroot/css/test_asset.css b/lib/Cake/Test/test_app/View/Themed/TestTheme/webroot/css/test_asset.css similarity index 100% rename from lib/Cake/Test/test_app/View/Themed/test_theme/webroot/css/test_asset.css rename to lib/Cake/Test/test_app/View/Themed/TestTheme/webroot/css/test_asset.css diff --git a/lib/Cake/Test/test_app/View/Themed/test_theme/webroot/css/theme_webroot.css b/lib/Cake/Test/test_app/View/Themed/TestTheme/webroot/css/theme_webroot.css similarity index 100% rename from lib/Cake/Test/test_app/View/Themed/test_theme/webroot/css/theme_webroot.css rename to lib/Cake/Test/test_app/View/Themed/TestTheme/webroot/css/theme_webroot.css diff --git a/lib/Cake/Test/test_app/View/Themed/test_theme/webroot/flash/theme_test.swf b/lib/Cake/Test/test_app/View/Themed/TestTheme/webroot/flash/theme_test.swf similarity index 100% rename from lib/Cake/Test/test_app/View/Themed/test_theme/webroot/flash/theme_test.swf rename to lib/Cake/Test/test_app/View/Themed/TestTheme/webroot/flash/theme_test.swf diff --git a/lib/Cake/Test/test_app/View/Themed/test_theme/webroot/img/cake.power.gif b/lib/Cake/Test/test_app/View/Themed/TestTheme/webroot/img/cake.power.gif similarity index 100% rename from lib/Cake/Test/test_app/View/Themed/test_theme/webroot/img/cake.power.gif rename to lib/Cake/Test/test_app/View/Themed/TestTheme/webroot/img/cake.power.gif diff --git a/lib/Cake/Test/test_app/View/Themed/test_theme/webroot/img/test.jpg b/lib/Cake/Test/test_app/View/Themed/TestTheme/webroot/img/test.jpg similarity index 100% rename from lib/Cake/Test/test_app/View/Themed/test_theme/webroot/img/test.jpg rename to lib/Cake/Test/test_app/View/Themed/TestTheme/webroot/img/test.jpg diff --git a/lib/Cake/Test/test_app/View/Themed/test_theme/webroot/js/one/theme_one.js b/lib/Cake/Test/test_app/View/Themed/TestTheme/webroot/js/one/theme_one.js similarity index 100% rename from lib/Cake/Test/test_app/View/Themed/test_theme/webroot/js/one/theme_one.js rename to lib/Cake/Test/test_app/View/Themed/TestTheme/webroot/js/one/theme_one.js diff --git a/lib/Cake/Test/test_app/View/Themed/test_theme/webroot/js/theme.js b/lib/Cake/Test/test_app/View/Themed/TestTheme/webroot/js/theme.js similarity index 100% rename from lib/Cake/Test/test_app/View/Themed/test_theme/webroot/js/theme.js rename to lib/Cake/Test/test_app/View/Themed/TestTheme/webroot/js/theme.js diff --git a/lib/Cake/Test/test_app/View/Themed/test_theme/webroot/pdfs/theme_test.pdf b/lib/Cake/Test/test_app/View/Themed/TestTheme/webroot/pdfs/theme_test.pdf similarity index 100% rename from lib/Cake/Test/test_app/View/Themed/test_theme/webroot/pdfs/theme_test.pdf rename to lib/Cake/Test/test_app/View/Themed/TestTheme/webroot/pdfs/theme_test.pdf diff --git a/lib/Cake/View/Helper.php b/lib/Cake/View/Helper.php index 6fa3c37f046..a292a02eebf 100644 --- a/lib/Cake/View/Helper.php +++ b/lib/Cake/View/Helper.php @@ -211,15 +211,10 @@ public function webroot($file) { if (file_exists(Configure::read('App.www_root') . 'theme' . DS . $this->theme . DS . $file)) { $webPath = "{$this->request->webroot}theme/" . $theme . $asset[0]; } else { - $viewPaths = App::path('views'); - - foreach ($viewPaths as $viewPath) { - $path = $viewPath . 'themed'. DS . $this->theme . DS . 'webroot' . DS . $file; - - if (file_exists($path)) { - $webPath = "{$this->request->webroot}theme/" . $theme . $asset[0]; - break; - } + $themePath = App::themePath($this->theme); + $path = $themePath . 'webroot' . DS . $file; + if (file_exists($path)) { + $webPath = "{$this->request->webroot}theme/" . $theme . $asset[0]; } } }