Advertisement
Guest User

unzend.com_337

a guest
Jan 11th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.67 KB | None | 0 0
  1. <?php
  2. // ionCube version 9 Decoder unzend.com - Email: unzend@gmail.com
  3. // http://www.unzend.com
  4. /**
  5.  * CTheme class file.
  6.  *
  7.  * @author Qiang Xue <qiang.xue@gmail.com>
  8.  * @link http://www.yiiframework.com/
  9.  * @copyright 2008-2013 Yii Software LLC
  10.  * @license http://www.yiiframework.com/license/
  11.  */
  12.  
  13. /**
  14.  * CTheme represents an application theme.
  15.  *
  16.  * @property string $name Theme name.
  17.  * @property string $baseUrl The relative URL to the theme folder (without ending slash).
  18.  * @property string $basePath The file path to the theme folder.
  19.  * @property string $viewPath The path for controller views. Defaults to 'ThemeRoot/views'.
  20.  * @property string $systemViewPath The path for system views. Defaults to 'ThemeRoot/views/system'.
  21.  * @property string $skinPath The path for widget skins. Defaults to 'ThemeRoot/views/skins'.
  22.  *
  23.  * @author Qiang Xue <qiang.xue@gmail.com>
  24.  * @package system.web
  25.  * @since 1.0
  26.  */
  27. class CTheme extends CComponent
  28. {
  29.     private $_name;
  30.     private $_basePath;
  31.     private $_baseUrl;
  32.  
  33.     /**
  34.      * Constructor.
  35.      * @param string $name name of the theme
  36.      * @param string $basePath base theme path
  37.      * @param string $baseUrl base theme URL
  38.      */
  39.     public function __construct($name,$basePath,$baseUrl)
  40.     {
  41.         $this->_name=$name;
  42.         $this->_baseUrl=$baseUrl;
  43.         $this->_basePath=$basePath;
  44.     }
  45.  
  46.     /**
  47.      * @return string theme name
  48.      */
  49.     public function getName()
  50.     {
  51.         return $this->_name;
  52.     }
  53.  
  54.     /**
  55.      * @return string the relative URL to the theme folder (without ending slash)
  56.      */
  57.     public function getBaseUrl()
  58.     {
  59.         return $this->_baseUrl;
  60.     }
  61.  
  62.     /**
  63.      * @return string the file path to the theme folder
  64.      */
  65.     public function getBasePath()
  66.     {
  67.         return $this->_basePath;
  68.     }
  69.  
  70.     /**
  71.      * @return string the path for controller views. Defaults to 'ThemeRoot/views'.
  72.      */
  73.     public function getViewPath()
  74.     {
  75.         return $this->_basePath.DIRECTORY_SEPARATOR.'views';
  76.     }
  77.  
  78.     /**
  79.      * @return string the path for system views. Defaults to 'ThemeRoot/views/system'.
  80.      */
  81.     public function getSystemViewPath()
  82.     {
  83.         return $this->getViewPath().DIRECTORY_SEPARATOR.'system';
  84.     }
  85.  
  86.     /**
  87.      * @return string the path for widget skins. Defaults to 'ThemeRoot/views/skins'.
  88.      * @since 1.1
  89.      */
  90.     public function getSkinPath()
  91.     {
  92.         return $this->getViewPath().DIRECTORY_SEPARATOR.'skins';
  93.     }
  94.  
  95.     /**
  96.      * Finds the view file for the specified controller's view.
  97.      * @param CController $controller the controller
  98.      * @param string $viewName the view name
  99.      * @return string the view file path. False if the file does not exist.
  100.      */
  101.     public function getViewFile($controller,$viewName)
  102.     {
  103.         $moduleViewPath=$this->getViewPath();
  104.         if(($module=$controller->getModule())!==null)
  105.             $moduleViewPath.='/'.$module->getId();
  106.         return $controller->resolveViewFile($viewName,$this->getViewPath().'/'.$controller->getUniqueId(),$this->getViewPath(),$moduleViewPath);
  107.     }
  108.  
  109.     /**
  110.      * Finds the layout file for the specified controller's layout.
  111.      * @param CController $controller the controller
  112.      * @param string $layoutName the layout name
  113.      * @return string the layout file path. False if the file does not exist.
  114.      */
  115.     public function getLayoutFile($controller,$layoutName)
  116.     {
  117.         $moduleViewPath=$basePath=$this->getViewPath();
  118.         $module=$controller->getModule();
  119.         if(empty($layoutName))
  120.         {
  121.             while($module!==null)
  122.             {
  123.                 if($module->layout===false)
  124.                     return false;
  125.                 if(!empty($module->layout))
  126.                     break;
  127.                 $module=$module->getParentModule();
  128.             }
  129.             if($module===null)
  130.                 $layoutName=Yii::app()->layout;
  131.             else
  132.             {
  133.                 $layoutName=$module->layout;
  134.                 $moduleViewPath.='/'.$module->getId();
  135.             }
  136.         }
  137.         elseif($module!==null)
  138.             $moduleViewPath.='/'.$module->getId();
  139.  
  140.         return $controller->resolveViewFile($layoutName,$moduleViewPath.'/layouts',$basePath,$moduleViewPath);
  141.     }
  142. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement