File: /home/f/r/e/frenchy/www/french-american.org/current/app/functions/timber.inc.php
<?php
/**
* Timber starter-theme
* https://github.com/timber/starter-theme
*
* @package WordPress
* @subpackage Timber
* @since Timber 0.1
*/
if (!class_exists('Timber')) {
add_action('admin_notices', function () {
echo '<div class="error"><p>Timber n\'est pas activé. Veuillez l\'activer : <a href="' . esc_url(admin_url('plugins.php#timber')) . '">' . esc_url(admin_url('plugins.php')) . '</a></p></div>';
});
add_filter('template_include', function ($template) {
return get_stylesheet_directory() . '/no-timber/index.html';
});
return;
}
/**
* Sets the directories (inside your theme) to find .twig files
*/
Timber::$dirname = array('templates', 'views');
/**
* By default, Timber does NOT autoescape values. Want to enable Twig's autoescape?
* No prob! Just set this value to true
*/
Timber::$autoescape = false;
/**
* We're going to configure our theme inside of a subclass of Timber\Site
* You can move this to its own file and include here via php's include("MySite.php")
*/
class StarterSite extends Timber\Site
{
/** Add timber support. */
public function __construct()
{
add_filter('timber/context', array($this, 'add_to_context'));
parent::__construct();
}
/** This is where you add some context
*
* @param string $context context['this'] Being the Twig's {{ this }}.
*/
public function add_to_context($context)
{
$context['menu'] = new Timber\Menu();
$context['site'] = $this;
$context['admin_ajax'] = admin_url('admin-ajax.php');
$context['is_front_page'] = is_front_page();
$context['is_home'] = is_home();
// Déclarations des menus
$context['menu_principal'] = new Timber\Menu(2);
$context['menu_footer'] = new Timber\Menu(3);
// cookie
$context['cookies'] = isset($_COOKIE['FAFFR-COOKIE-ACCEPT']) ? $_COOKIE['FAFFR-COOKIE-ACCEPT'] : false;
return $context;
}
}
new StarterSite();