1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-17 12:10:45 +02:00

Depreciate TemplateFile globals options per processwire/processwire-issues#61

This commit is contained in:
Ryan Cramer
2016-10-31 10:03:21 -04:00
parent ce037f06da
commit 3705d55177

View File

@@ -86,7 +86,7 @@ class TemplateFile extends WireData {
protected $profiler = null; protected $profiler = null;
/** /**
* Variables that will be applied globally to this and all other TemplateFile instances * DEPRECATED: Variables that will be applied globally to this and all other TemplateFile instances
* *
*/ */
static protected $globals = array(); static protected $globals = array();
@@ -179,13 +179,16 @@ class TemplateFile extends WireData {
} }
/** /**
* Sets a variable to be globally accessable to all other TemplateFile instances * Sets a variable to be globally accessable to all other TemplateFile instances (deprecated)
* *
* Note, to set a variable for just this instance, use the set() as inherted from WireData. * Note, to set a variable for just this instance, use the set() as inherted from WireData.
*
* #pw-internal
* *
* @param string $name * @param string $name
* @param mixed $value * @param mixed $value
* @param bool $overwrite Should the value be overwritten if it already exists? (default true) * @param bool $overwrite Should the value be overwritten if it already exists? (default true)
* @deprecated
* *
*/ */
public function setGlobal($name, $value, $overwrite = true) { public function setGlobal($name, $value, $overwrite = true) {
@@ -252,17 +255,24 @@ class TemplateFile extends WireData {
foreach($this->prependFilename as $_filename) { foreach($this->prependFilename as $_filename) {
if($this->halt) break; if($this->halt) break;
if($this->profiler) $this->start($_filename); if($this->profiler) $this->start($_filename);
/** @noinspection PhpIncludeInspection */
require($_filename); require($_filename);
if($this->profiler) $this->stop(); if($this->profiler) $this->stop();
} }
if($this->profiler) $this->start($this->filename); if($this->profiler) $this->start($this->filename);
if(!$this->halt) $returnValue = require($this->filename); if($this->halt) {
$returnValue = 0;
} else {
/** @noinspection PhpIncludeInspection */
$returnValue = require($this->filename);
}
if($this->profiler) $this->stop(); if($this->profiler) $this->stop();
foreach($this->appendFilename as $_filename) { foreach($this->appendFilename as $_filename) {
if($this->halt) break; if($this->halt) break;
if($this->profiler) $this->start($_filename); if($this->profiler) $this->start($_filename);
/** @noinspection PhpIncludeInspection */
require($_filename); require($_filename);
if($this->profiler) $this->stop(); if($this->profiler) $this->stop();
} }
@@ -344,6 +354,7 @@ class TemplateFile extends WireData {
* USAGE from template file is: return $this->halt(); * USAGE from template file is: return $this->halt();
* *
* @param bool $halt * @param bool $halt
* @return $this
* *
*/ */
protected function halt($halt = true) { protected function halt($halt = true) {