Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/markup/PhabricatorMarkupEngine.php
Show All 40 Lines | final class PhabricatorMarkupEngine extends Phobject { | ||||
private $objects = array(); | private $objects = array(); | ||||
private $viewer; | private $viewer; | ||||
private $contextObject; | private $contextObject; | ||||
private $version = 21; | private $version = 21; | ||||
private $engineCaches = array(); | private $engineCaches = array(); | ||||
private $auxiliaryConfig = array(); | private $auxiliaryConfig = array(); | ||||
private static $engineStack = array(); | |||||
/* -( Markup Pipeline )---------------------------------------------------- */ | /* -( Markup Pipeline )---------------------------------------------------- */ | ||||
/** | /** | ||||
* Convenience method for pushing a single object through the markup | * Convenience method for pushing a single object through the markup | ||||
* pipeline. | * pipeline. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | /* -( Markup Pipeline )---------------------------------------------------- */ | ||||
/** | /** | ||||
* Process objects queued with @{method:addObject}. You can then retrieve | * Process objects queued with @{method:addObject}. You can then retrieve | ||||
* the output with @{method:getOutput}. | * the output with @{method:getOutput}. | ||||
* | * | ||||
* @return this | * @return this | ||||
* @task markup | * @task markup | ||||
*/ | */ | ||||
public function process() { | public function process() { | ||||
self::$engineStack[] = $this; | |||||
try { | |||||
$result = $this->execute(); | |||||
} finally { | |||||
array_pop(self::$engineStack); | |||||
} | |||||
return $result; | |||||
} | |||||
public static function isRenderingEmbeddedContent() { | |||||
// See T13678. This prevents cycles when rendering embedded content that | |||||
// itself has remarkup fields. | |||||
return (count(self::$engineStack) > 1); | |||||
} | |||||
private function execute() { | |||||
$keys = array(); | $keys = array(); | ||||
foreach ($this->objects as $key => $info) { | foreach ($this->objects as $key => $info) { | ||||
if (!isset($info['markup'])) { | if (!isset($info['markup'])) { | ||||
$keys[] = $key; | $keys[] = $key; | ||||
} | } | ||||
} | } | ||||
if (!$keys) { | if (!$keys) { | ||||
▲ Show 20 Lines • Show All 610 Lines • Show Last 20 Lines |