/var/www/html/wp-content/timber2-upgrade/vendor/twig/twig/src/Loader/FilesystemLoader.php
$this->paths[$namespace] = [];
foreach ($paths as $path) {
$this->addPath($path, $namespace);
}
}
/**
* @param bool $check Whether to check that the directory exists; pass false when the caller already checked it
*
* @throws LoaderError
*/
public function addPath(string $path, string $namespace = self::MAIN_NAMESPACE/* , bool $check = true */): void
{
// invalidate the cache
$this->cache = $this->errorCache = [];
if (\func_num_args() < 3 || func_get_arg(2)) {
$checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path;
if (!is_dir($checkPath)) {
throw new LoaderError(\sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath));
}
}
$this->paths[$namespace][] = rtrim($path, '/\\');
}
/**
* @param bool $check Whether to check that the directory exists; pass false when the caller already checked it
*
* @throws LoaderError
*/
public function prependPath(string $path, string $namespace = self::MAIN_NAMESPACE/* , bool $check = true */): void
{
// invalidate the cache
$this->cache = $this->errorCache = [];
if (\func_num_args() < 3 || func_get_arg(2)) {
$checkPath = $this->isAbsolutePath($path) ? $path : $this->rootPath.$path;
if (!is_dir($checkPath)) {
throw new LoaderError(\sprintf('The "%s" directory does not exist ("%s").', $path, $checkPath));
Arguments
"The "/var/www/html/wp-content/themes/xentum-v3/views" directory does not exist ("/var/www/html/wp-content/themes/xentum-v3/views")."
/var/www/html/wp-content/timber2-upgrade/vendor/timber/timber/src/Loader.php
[$paths],
'2.0.0',
'timber/locations'
);
$open_basedir = \ini_get('open_basedir');
$rootPath = '/';
if ($open_basedir) {
$rootPath = null;
}
$fs = new FilesystemLoader([], $rootPath);
foreach ($paths as $namespace => $path_locations) {
if (\is_array($path_locations)) {
\array_map(function ($path) use ($fs, $namespace) {
if (\is_string($namespace)) {
$fs->addPath($path, $namespace);
} else {
$fs->addPath($path, Loader::MAIN_NAMESPACE);
}
}, $path_locations);
} else {
Helper::deprecated(
'add_filter( \'timber/loader/paths\', [\'path/to/my/templates\'] ) in a non-associative array',
'add_filter( \'timber/loader/paths\', [ 0 => [ \'path/to/my/templates\' ] ] )',
'2.0.0'
);
$fs->addPath($path_locations, self::MAIN_NAMESPACE);
}
}
/**
* Filters …
*
* @todo Add summary, description, example, parameter description
*
* @link https://github.com/timber/timber/pull/1254
* @since 1.1.11
*/
/var/www/html/wp-content/timber2-upgrade/vendor/timber/timber/src/Loader.php
* @param array $paths
*/
$paths = \apply_filters_deprecated(
'timber/loader/paths',
[$paths],
'2.0.0',
'timber/locations'
);
$open_basedir = \ini_get('open_basedir');
$rootPath = '/';
if ($open_basedir) {
$rootPath = null;
}
$fs = new FilesystemLoader([], $rootPath);
foreach ($paths as $namespace => $path_locations) {
if (\is_array($path_locations)) {
\array_map(function ($path) use ($fs, $namespace) {
if (\is_string($namespace)) {
$fs->addPath($path, $namespace);
} else {
$fs->addPath($path, Loader::MAIN_NAMESPACE);
}
}, $path_locations);
} else {
Helper::deprecated(
'add_filter( \'timber/loader/paths\', [\'path/to/my/templates\'] ) in a non-associative array',
'add_filter( \'timber/loader/paths\', [ 0 => [ \'path/to/my/templates\' ] ] )',
'2.0.0'
);
$fs->addPath($path_locations, self::MAIN_NAMESPACE);
}
}
/**
* Filters …
*
* @todo Add summary, description, example, parameter description
/var/www/html/wp-content/timber2-upgrade/vendor/timber/timber/src/Loader.php
protected function render_twig_template($template, $data)
{
return $template->render($data);
}
/**
* Get first existing template.
*
* @param array|string $templates Name(s) of the Twig template(s) to choose from.
* @return string|bool Name of chosen template, otherwise false.
*/
public function choose_template($templates)
{
// Change $templates into array, if needed
if (!\is_array($templates)) {
$templates = (array) $templates;
}
// Get Twig loader
$loader = $this->get_loader();
// Run through template array
foreach ($templates as $template) {
// Remove any whitespace around the template name
$template = \trim((string) $template);
// Use the Twig loader to test for existence
if ($loader->exists($template)) {
// Return name of existing template
return $template;
}
}
// No existing template was found
return false;
}
/**
* @return FilesystemLoader
*/
public function get_loader()
/var/www/html/wp-content/timber2-upgrade/vendor/timber/timber/src/Timber.php
* $team_member = Timber::compile( 'team-member.twig', $data );
* ```
* @param array|string $filenames Name or full path of the Twig file to compile. If this is an array of file
* names or paths, Timber will compile the first file that exists.
* @param array $data Optional. An array of data to use in Twig template.
* @param bool|int|array $expires Optional. In seconds. Use false to disable cache altogether. When passed an
* array, the first value is used for non-logged in visitors, the second for users.
* Default false.
* @param string $cache_mode Optional. Any of the cache mode constants defined in Timber\Loader.
* @param bool $via_render Optional. Whether to apply optional render or compile filters. Default false.
* @return bool|string The returned output.
*/
public static function compile($filenames, $data = [], $expires = false, $cache_mode = Loader::CACHE_USE_DEFAULT, $via_render = false)
{
if (!\defined('TIMBER_LOADED')) {
self::init();
}
$caller = LocationManager::get_calling_script_dir(1);
$loader = new Loader($caller);
$file = $loader->choose_template($filenames);
$caller_file = LocationManager::get_calling_script_file(1);
/**
* Fires after the calling PHP file was determined in Timber’s compile
* function.
*
* This action is used by the Timber Debug Bar extension.
*
* @since 1.1.2
* @since 2.0.0 Switched from filter to action.
*
* @param string|null $caller_file The calling script file.
*/
\do_action('timber/calling_php_file', $caller_file);
if ($via_render) {
/**
* Filters the Twig template that should be rendered.
*
/var/www/html/wp-content/timber2-upgrade/vendor/timber/timber/src/Timber.php
* Passes data to a Twig file and echoes the output.
*
* @api
* @example
* ```php
* $context = Timber::context();
*
* Timber::render( 'index.twig', $context );
* ```
* @param array|string $filenames Name or full path of the Twig file to render. If this is an array of file
* names or paths, Timber will render the first file that exists.
* @param array $data Optional. An array of data to use in Twig template.
* @param bool|int|array $expires Optional. In seconds. Use false to disable cache altogether. When passed an
* array, the first value is used for non-logged in visitors, the second for users.
* Default false.
* @param string $cache_mode Optional. Any of the cache mode constants defined in Timber\Loader.
*/
public static function render($filenames, $data = [], $expires = false, $cache_mode = Loader::CACHE_USE_DEFAULT): void
{
$output = self::compile($filenames, $data, $expires, $cache_mode, true);
echo $output;
}
/**
* Renders a Twig block from a Twig file.
*
* Passes data to a Twig file and echoes the output of a specific block.
*
* @api
* @param string $block_name The name of the block to render.
* @param array|string $filenames Name or full path of the Twig file to render. If this is an array of file
* names or paths, Timber will render the first file that exists.
* @param array $data Optional. An array of data to use in Twig template.
* @param string|array|null $caller Optional. A value produced by a `LocationManager` method to control
* template lookup. Pass either `LocationManager::get_calling_script_dir()`
* (string path) or `LocationManager::get_locations()` (array of search
* locations). When `null`, Timber will default to
* `LocationManager::get_calling_script_dir(1)`.
* @param bool|int|array $expires Optional. In seconds. Use false to disable cache altogether. When passed an
* array, the first value is used for non-logged in visitors, the second for users.
/var/www/html/wp-content/themes/xentum-timber2/archive.php
'hide_empty' => true,
));
$image = get_field('thumbnail', $terms);
if ($image) {
$context['post']['thumbnail']['ID'] = $image;
} else {
$fallbacks = get_field('fallback_images', 'option');
$context['post']['thumbnail']['ID'] = $fallbacks[array_rand($fallbacks)]['image'];
}
$query = Timber::get_posts($args);
$context['posts_total'] = $query->found_posts;
}
$context['posts'] = $query;
Timber::render('template-news.twig', $context );
/var/www/html/wp-includes/template-loader.php
*/
$template = apply_filters( 'template_include', $template );
$is_stringy = is_string( $template ) || ( is_object( $template ) && method_exists( $template, '__toString' ) );
$template = $is_stringy ? realpath( (string) $template ) : null;
if (
is_string( $template ) &&
( str_ends_with( $template, '.php' ) || str_ends_with( $template, '.html' ) ) &&
is_file( $template ) &&
is_readable( $template )
) {
/**
* Fires immediately before including the template.
*
* @since 6.9.0
*
* @param string $template The path of the template about to be included.
*/
do_action( 'wp_before_include_template', $template );
include $template;
} elseif ( current_user_can( 'switch_themes' ) ) {
$theme = wp_get_theme();
if ( $theme->errors() ) {
wp_die( $theme->errors() );
}
}
return;
}
Arguments
"/var/www/html/wp-content/themes/xentum-timber2/archive.php"
/var/www/html/wp-blog-header.php
<?php
/**
* Loads the WordPress environment and template.
*
* @package WordPress
*/
if ( ! isset( $wp_did_header ) ) {
$wp_did_header = true;
// Load the WordPress library.
require_once __DIR__ . '/wp-load.php';
// Set up the WordPress query.
wp();
// Load the theme template.
require_once ABSPATH . WPINC . '/template-loader.php';
}
Arguments
"/var/www/html/wp-includes/template-loader.php"
/var/www/html/index.php
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define( 'WP_USE_THEMES', true );
/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';
Arguments
"/var/www/html/wp-blog-header.php"