mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
4c0e06c451
Conflicts: cake/bootstrap.php cake/libs/view/helpers/js.php lib/Cake/Model/AclNode.php lib/Cake/Model/ConnectionManager.php lib/Cake/bootstrap.php lib/Cake/tests/cases/libs/controller/controller.test.php
72 lines
2.3 KiB
PHP
72 lines
2.3 KiB
PHP
<?php
|
|
/**
|
|
* A custom view class that is used for themeing
|
|
*
|
|
* PHP 5
|
|
*
|
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
|
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
|
*
|
|
* Licensed under The MIT License
|
|
* Redistributions of files must retain the above copyright notice.
|
|
*
|
|
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
|
* @link http://cakephp.org CakePHP(tm) Project
|
|
* @package cake.libs.view
|
|
* @since CakePHP(tm) v 0.10.0.1076
|
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
|
*/
|
|
App::uses('View', 'View');
|
|
|
|
/**
|
|
* Theme view class
|
|
*
|
|
* Allows the creation of multiple themes to be used in an app. Theme views are regular view files
|
|
* that can provide unique HTML and static assets. If theme views are not found for the current view
|
|
* the default app view files will be used. You can set `$this->theme` and `$this->view = 'Theme'`
|
|
* in your Controller to use the ThemeView.
|
|
*
|
|
* Example of theme path with `$this->theme = 'super_hot';` Would be `app/views/themed/super_hot/posts`
|
|
*
|
|
* @package cake.libs.view
|
|
*/
|
|
class ThemeView extends View {
|
|
/**
|
|
* Constructor for ThemeView sets $this->theme.
|
|
*
|
|
* @param Controller $controller Controller object to be rendered.
|
|
*/
|
|
function __construct($controller) {
|
|
parent::__construct($controller);
|
|
$this->theme = $controller->theme;
|
|
}
|
|
|
|
/**
|
|
* Return all possible paths to find view files in order
|
|
*
|
|
* @param string $plugin The name of the plugin views are being found for.
|
|
* @param boolean $cached Set to true to force dir scan.
|
|
* @return array paths
|
|
* @access protected
|
|
* @todo Make theme path building respect $cached parameter.
|
|
*/
|
|
function _paths($plugin = null, $cached = true) {
|
|
$paths = parent::_paths($plugin, $cached);
|
|
$themePaths = array();
|
|
|
|
if (!empty($this->theme)) {
|
|
$count = count($paths);
|
|
for ($i = 0; $i < $count; $i++) {
|
|
if (strpos($paths[$i], DS . 'plugins' . DS) === false
|
|
&& strpos($paths[$i], DS . 'Cake' . DS . 'View') === false) {
|
|
if ($plugin) {
|
|
$themePaths[] = $paths[$i] . 'themed'. DS . $this->theme . DS . 'plugins' . DS . $plugin . DS;
|
|
}
|
|
$themePaths[] = $paths[$i] . 'themed'. DS . $this->theme . DS;
|
|
}
|
|
}
|
|
$paths = array_merge($themePaths, $paths);
|
|
}
|
|
return $paths;
|
|
}
|
|
}
|