function __construct(Site $site)
 {
     $this->cacheDir = new TemporaryFolder();
     $templates = array(APP_ROOT_DIR . DIRECTORY_SEPARATOR . 'theme' . DIRECTORY_SEPARATOR . $site->getConfig()->theme . DIRECTORY_SEPARATOR . 'templates');
     $siteTemplates = $site->getDir() . DIRECTORY_SEPARATOR . 'theme' . DIRECTORY_SEPARATOR . 'templates';
     if (file_exists($siteTemplates) && is_dir($siteTemplates)) {
         array_unshift($templates, $siteTemplates);
     }
     $loader = new Twig_Loader_Filesystem($templates);
     $this->twig = new Twig_Environment($loader, array('cache' => $this->cacheDir->get()));
     $this->twig->addExtension(new InternalLinkHelper($site->getConfig()));
     $this->twig->addExtension(new \JMBTechnologyLimited\Twig\Extensions\LinkifyExtension());
     $this->twig->addExtension(new \JMBTechnologyLimited\Twig\Extensions\SameDayExtension());
     $this->twig->addExtension(new \JMBTechnologyLimited\Twig\Extensions\TimeZoneExtension());
     $this->twig->addExtension(new \JMBTechnologyLimited\Twig\Extensions\LinkInfoExtension());
     $this->twig->addExtension(new TruncateExtension());
 }
function setConfig(\openacalendar\staticweb\Site $site, $opts)
{
    if (isset($opts['baseurl']) && $opts['baseurl']) {
        $site->getConfig()->baseURL = $opts['baseurl'];
    }
}