[ [self::class, 'renderJs'], ], 'style' => [ [self::class, 'renderCss'], ], 'raw' => [], ]; /** * Output htmlentities instead of utf8. */ public static bool $disable_utf8 = false; public static bool $needs_pre_render = true; public static bool $always_pre_render = false; protected bool $force_pre_render = false; public function __construct() { parent::__construct(); self::$theme ??= 'plain.css'; $this->setForcePreRender(self::$always_pre_render); } public function setCallInfo(array $info): void { parent::setCallInfo($info); if (\in_array('@', $info['modifiers'], true)) { $this->setForcePreRender(true); } } public function setStatics(array $statics): void { parent::setStatics($statics); if (!empty($statics['return'])) { $this->setForcePreRender(true); } } public function setForcePreRender(bool $force_pre_render): void { $this->force_pre_render = $force_pre_render; } public function getForcePreRender(): bool { return $this->force_pre_render; } public function shouldPreRender(): bool { return $this->getForcePreRender() || self::$needs_pre_render; } public function colorValue(string $string): string { return ''.$string.''; } public function colorType(string $string): string { return ''.$string.''; } public function colorTitle(string $string): string { return ''.$string.''; } public function renderTitle(AbstractValue $v): string { if (self::$disable_utf8) { return $this->utf8ToHtmlentity(parent::renderTitle($v)); } return parent::renderTitle($v); } public function preRender(): string { $output = ''; if ($this->shouldPreRender()) { foreach (self::$pre_render_sources as $type => $values) { $contents = ''; foreach ($values as $v) { $contents .= \call_user_func($v, $this); } if (!\strlen($contents)) { continue; } switch ($type) { case 'script': $output .= '