return $twig;
}
/**
* Return renderer.
*
* @return Environment
*/
public function renderer()
{
if (!$this->renderer) {
$gantry = static::gantry();
/** @var Config $global */
$global = $gantry['global'];
$cachePath = $global->get('compile_twig', 1) ? $this->getCachePath('twig') : null;
if ($cachePath) {
/** @phpstan-ignore-next-line */
if (Environment::VERSION_ID > 3) {
// Twig 3 support.
$cache = new FilesystemCache($cachePath, FilesystemCache::FORCE_BYTECODE_INVALIDATION);
/** @phpstan-ignore-next-line */
} else {
$cache = new TwigCacheFilesystem($cachePath, FilesystemCache::FORCE_BYTECODE_INVALIDATION);
}
} else {
$cache = null;
}
$debug = $gantry->debug();
$production = (bool) $global->get('production', 1);
$loader = new FilesystemLoader();
$params = [
'cache' => $cache,
'debug' => $debug,
'auto_reload' => !$production,
'autoescape' => 'html'
];
$twig = new Environment($loader, $params);
* Convert all stream uris into proper links.
*/
public function postProcessOutput($html)
{
$gantry = Gantry::instance();
/** @var Document $document */
$document = $gantry['document'];
// Only filter our streams. If there's an error (bad UTF8), fallback with original output.
return $document::urlFilter($html, false, 0, true) ?: $html;
}
/**
* @see AbstractTheme::renderer()
*/
public function renderer()
{
if (!$this->renderer) {
$twig = parent::renderer();
$twig = \apply_filters('twig_apply_filters', $twig);
$twig = \apply_filters('timber/twig/filters', $twig);
$twig = \apply_filters('timber/twig/functions', $twig);
$twig = \apply_filters('timber/twig/escapers', $twig);
$twig = \apply_filters('timber/loader/twig', $twig);
$this->renderer = $twig;
}
return $this->renderer;
}
/**
* @see AbstractTheme::render()
*
* @param string $file
* @param array $context
* @return string
*/
public function render($file, array $context = [])
{
/**
* @see AbstractTheme::render()
*
* @param string $file
* @param array $context
* @return string
*/
public function render($file, array $context = [])
{
static $timberContext;
if (!isset($timberContext)) {
$timberContext = Timber::get_context();
}
// Include Gantry specific things to the context.
$context = array_replace($timberContext, $context);
return $this->renderer()->render($file, $context);
}
public function set_template_layout()
{
$assignments = new Assignments();
$selected = $assignments->select();
if (\GANTRY_DEBUGGER) {
Debugger::addMessage('Selecting outline (rules, matches, scores):', 'debug');
Debugger::addMessage($assignments->getPage(), 'debug');
Debugger::addMessage($assignments->matches(), 'debug');
Debugger::addMessage($assignments->scores(), 'debug');
}
$this->setLayout($selected);
}
public function widgets_init()
{
$gantry = Gantry::instance();
* @author RocketTheme http://www.rockettheme.com
* @copyright Copyright (C) 2007 - 2020 RocketTheme, LLC
* @license GNU/GPLv2 and later
*
* http://www.gnu.org/licenses/gpl-2.0.html
*/
defined('ABSPATH') or die;
/*
* Third party plugins that hijack the theme will call wp_head() to get the header template.
* We use this to start our output buffer and render into the views/page-plugin.html.twig template in footer.php
*/
$gantry = Gantry\Framework\Gantry::instance();
$theme = $gantry['theme'];
// We need to render contents of <head> before plugin content gets added.
$context = Timber::get_context();
$context['page_head'] = $theme->render('partials/page_head.html.twig', $context);
$GLOBALS['timberContext'] = $context;
ob_start();
extract( $wp_query->query_vars, EXTR_SKIP );
}
if ( isset( $s ) ) {
$s = esc_attr( $s );
}
/**
* Fires before a template file is loaded.
*
* @since 6.1.0
*
* @param string $_template_file The full path to the template file.
* @param bool $load_once Whether to require_once or require.
* @param array $args Additional arguments passed to the template.
*/
do_action( 'wp_before_load_template', $_template_file, $load_once, $args );
if ( $load_once ) {
require_once $_template_file;
} else {
require $_template_file;
}
/**
* Fires after a template file is loaded.
*
* @since 6.1.0
*
* @param string $_template_file The full path to the template file.
* @param bool $load_once Whether to require_once or require.
* @param array $args Additional arguments passed to the template.
*/
do_action( 'wp_after_load_template', $_template_file, $load_once, $args );
}
$located = '';
foreach ( (array) $template_names as $template_name ) {
if ( ! $template_name ) {
continue;
}
if ( file_exists( $wp_stylesheet_path . '/' . $template_name ) ) {
$located = $wp_stylesheet_path . '/' . $template_name;
break;
} elseif ( $is_child_theme && file_exists( $wp_template_path . '/' . $template_name ) ) {
$located = $wp_template_path . '/' . $template_name;
break;
} elseif ( file_exists( ABSPATH . WPINC . '/theme-compat/' . $template_name ) ) {
$located = ABSPATH . WPINC . '/theme-compat/' . $template_name;
break;
}
}
if ( $load && '' !== $located ) {
load_template( $located, $load_once, $args );
}
return $located;
}
/**
* Requires the template file with WordPress environment.
*
* The globals are set up for the template file to ensure that the WordPress
* environment is available from within the function. The query variables are
* also available.
*
* @since 1.5.0
* @since 5.5.0 The `$args` parameter was added.
*
* @global array $posts
* @global WP_Post $post Global post object.
* @global bool $wp_did_header
* @global WP_Query $wp_query WordPress Query object.
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
* Fires before the header template file is loaded.
*
* @since 2.1.0
* @since 2.8.0 The `$name` parameter was added.
* @since 5.5.0 The `$args` parameter was added.
*
* @param string|null $name Name of the specific header file to use. Null for the default header.
* @param array $args Additional arguments passed to the header template.
*/
do_action( 'get_header', $name, $args );
$templates = array();
$name = (string) $name;
if ( '' !== $name ) {
$templates[] = "header-{$name}.php";
}
$templates[] = 'header.php';
if ( ! locate_template( $templates, true, true, $args ) ) {
return false;
}
}
/**
* Loads footer template.
*
* Includes the footer template for a theme or if a name is specified then a
* specialized footer will be included.
*
* For the parameter, if the file is called "footer-special.php" then specify
* "special".
*
* @since 1.5.0
* @since 5.5.0 A return value was added.
* @since 5.5.0 The `$args` parameter was added.
*
* @param string|null $name The name of the specialized footer. Default null.
* @param array $args Optional. Additional arguments passed to the footer template.
* Default empty array.
<?php
/**
* The template for displaying all single posts
* This template can be overridden by copying it to yourtheme/bdp_templates/single/single.php.
*
* @link https://www.solwininfotech.com/
* @since 2.4
*
* @package Blog_Designer_PRO
* @subpackage Blog_Designer_PRO/admin
* @author Solwin Infotech <info@solwininfotech.com>
*/
get_header();
Bdp_Posts::set_post_views( get_the_ID() );
global $wpdb;
$bdp_settings = Bdp_Template::get_single_template_setting_front_end();
$alter_class = '';
$style = '';
$bdp_theme = apply_filters( 'bdp_filter_template', $bdp_settings['template_name'] );
$bdp_template_name_changed = get_option( 'bdp_template_name_changed', 1 );
if ( 1 == $bdp_template_name_changed ) { //phpcs:ignore
if ( 'classical' === $bdp_theme ) {
$bdp_theme = 'nicy';
} elseif ( 'lightbreeze' === $bdp_theme ) {
$bdp_theme = 'sharpen';
} elseif ( 'spektrum' === $bdp_theme ) {
$bdp_theme = 'hub';
}
} else {
update_option( 'bdp_template_name_changed', 0 );
}
$main_container_class = ( isset( $bdp_settings['main_container_class'] ) && '' != $bdp_settings['main_container_class'] ) ? $bdp_settings['main_container_class'] : ''; //phpcs:ignore
$bdads_to_show_after = (isset($bdp_settings['bdads_to_show_after'])) ? $bdp_settings['bdads_to_show_after'] : 'main_content'; //phpcs:ignore
$bdp_display_related_post = isset( $bdp_settings['bdp_display_related_post'] ) ? $bdp_settings['bdp_display_related_post'] : 'bottom';
if ( has_post_thumbnail() && 'overlay_horizontal' === $bdp_theme ) {
$url = wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) );
$style = 'style=background-image:url(' . $url . ')';
}
if ( 'overlay_horizontal' === $bdp_theme || 'cool_horizontal' === $bdp_theme ) {
}
break;
}
}
if ( ! $template ) {
$template = get_index_template();
}
/**
* Filters the path of the current template before including it.
*
* @since 3.0.0
*
* @param string $template The path of the template to include.
*/
$template = apply_filters( 'template_include', $template );
if ( $template ) {
include $template;
} elseif ( current_user_can( 'switch_themes' ) ) {
$theme = wp_get_theme();
if ( $theme->errors() ) {
wp_die( $theme->errors() );
}
}
return;
}
<?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';
}
<?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';