Browse Source

script WIP

tags/2.0.0-beta
Qiang Xue 12 years ago
parent
commit
428d912811
  1. 27
      framework/base/Application.php
  2. 17
      framework/base/ViewContent.php

27
framework/base/Application.php

@ -87,7 +87,6 @@ class Application extends Module
*/ */
public $layout = 'main'; public $layout = 'main';
private $_runtimePath;
private $_ended = false; private $_ended = false;
/** /**
@ -224,6 +223,8 @@ class Application extends Module
return 0; return 0;
} }
private $_runtimePath;
/** /**
* Returns the directory that stores runtime files. * Returns the directory that stores runtime files.
* @return string the directory that stores runtime files. Defaults to 'protected/runtime'. * @return string the directory that stores runtime files. Defaults to 'protected/runtime'.
@ -251,6 +252,30 @@ class Application extends Module
} }
} }
private $_vendorPath;
/**
* Returns the directory that stores vendor files.
* @return string the directory that stores vendor files. Defaults to 'protected/vendor'.
*/
public function getVendorPath()
{
if ($this->_vendorPath !== null) {
$this->setVendorPath($this->getBasePath() . DIRECTORY_SEPARATOR . 'vendor');
}
return $this->_vendorPath;
}
/**
* Sets the directory that stores vendor files.
* @param string $path the directory that stores vendor files.
* @throws InvalidConfigException if the directory does not exist
*/
public function setVendorPath($path)
{
$this->_vendorPath = FileHelper::ensureDirectory($path);
}
/** /**
* Returns the time zone used by this application. * Returns the time zone used by this application.
* This is a simple wrapper of PHP function date_default_timezone_get(). * This is a simple wrapper of PHP function date_default_timezone_get().

17
framework/base/ViewContent.php

@ -7,6 +7,8 @@
namespace yii\base; namespace yii\base;
use Yii;
/** /**
* @author Qiang Xue <qiang.xue@gmail.com> * @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0 * @since 2.0
@ -43,7 +45,6 @@ class ViewContent extends Component
* ~~~ * ~~~
*/ */
public $bundles; public $bundles;
public $title; public $title;
public $metaTags; public $metaTags;
public $linkTags; public $linkTags;
@ -68,9 +69,21 @@ class ViewContent extends Component
$this->jsFiles = null; $this->jsFiles = null;
} }
public function registerBundle($name) public function renderScripts($pos)
{ {
}
public function registerBundle($name)
{
if (!isset($this->bundles[$name])) {
$am = Yii::$app->assets;
$bundle = $am->getBundle($name);
if ($bundle !== null) {
$this->bundles[$name] = $bundle;
} else {
throw new InvalidConfigException("Asset bundle does not exist: $name");
}
}
} }
public function getMetaTag($key) public function getMetaTag($key)

Loading…
Cancel
Save