/home/techb158/public_html/wp-content/plugins/kirki/libraries/framework/View
NameSizeModeActions
layout-wrapper.php10150644editdlrm
TemplateEngine.php83940644editdlrm
View.php28540644editdlrm
ViewContext.php55550644editdlrm
Edit: /home/techb158/public_html/wp-content/plugins/kirki/libraries/framework/View/ViewContext.php (5555B)
get_template(); $data = \array_merge($engine->get_shared(), $view->get_data()); $this->push(['template' => $template, 'route_name' => $route_name, 'resolved_path' => $this->normalize_path($resolved_path), 'data' => $data]); return $data; } /** * Push a context frame onto the stack. * * @param array $context Context payload with template, route_name, resolved_path, data. * * @return void * * @since 2.1.2 */ public function push(array $context) { if (isset($context['resolved_path'])) { $context['resolved_path'] = $this->normalize_path((string) $context['resolved_path']); } $this->stack[] = $context; $this->ensure_shutdown_registered(); } /** * Pop the top context frame from the stack. * * @return array|null The removed frame, or null when the stack is empty. * * @since 2.1.2 */ public function pop() { if ($this->stack === []) { return null; } return \array_pop($this->stack); } /** * Read a value from the innermost authorized context. * * Supports dot notation for nested keys (e.g. `product.name`). * * @param string|null $key Data key, or null for the full array. * @param mixed $default Default when missing or unauthorized. * * @return mixed * * @since 2.1.2 */ public function get($key = null, $default = null) { $frame = $this->authorized_frame(); if ($frame === null) { return $key === null ? [] : $default; } if ($key === null) { return $frame['data']; } return Arr::get($frame['data'], $key, $default); } /** * Clear the entire context stack. * * @return void * * @since 2.1.2 */ public function clear() { $this->stack = []; } /** * Get the top context frame, or null when the stack is empty. * * @return array|null * * @since 2.1.2 */ public function get_active() { if ($this->stack === []) { return null; } return $this->stack[\count($this->stack) - 1]; } /** * Find the innermost stack frame that authorizes the current caller. * * @return array|null * * @since 2.1.2 */ protected function authorized_frame() { if ($this->stack === []) { return null; } $trace_files = $this->trace_files(); for ($index = \count($this->stack) - 1; $index >= 0; $index--) { $frame = $this->stack[$index]; if (empty($frame['resolved_path'])) { continue; } if (isset($trace_files[$frame['resolved_path']])) { return $frame; } } return null; } /** * Collect normalized file paths from the current backtrace. * * @return array Map of normalized path => true. * * @since 2.1.2 */ protected function trace_files() { $files = []; $trace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS); foreach ($trace as $frame) { if (empty($frame['file'])) { continue; } $files[$this->normalize_path($frame['file'])] = \true; } return $files; } /** * Register a shutdown callback to clear the stack once. * * @return void * * @since 2.1.2 */ protected function ensure_shutdown_registered() { if ($this->shutdown_registered) { return; } $this->shutdown_registered = \true; add_action('shutdown', function () { $this->clear(); }, 999); } /** * Normalize a filesystem path for comparison. * * @param string $path Absolute path. * * @return string * * @since 2.1.2 */ protected function normalize_path(string $path) { $real = \realpath($path); if ($real !== \false) { return $real; } return \str_replace('\\', '/', $path); } }