| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Old Sites/robotics/wp-content/plugins/types/application/models/helper/ |
Upload File : |
<?php
/**
* Types_Helper_Twig
*
* @since 2.0
*/
class Types_Helper_Twig {
private $filesystem;
private $twig;
public function __construct() {
// backwards compatibility for php5.2
if ( ! defined( 'E_DEPRECATED' ) )
define( 'E_DEPRECATED', 8192 );
if ( ! defined( 'E_USER_DEPRECATED' ) )
define( 'E_USER_DEPRECATED', 16384 );
$this->filesystem = new Twig_Loader_Filesystem();
$this->filesystem->addPath( TYPES_ABSPATH . '/application/views' );
$this->twig = new Twig_Environment( $this->filesystem );
$this->twig->addFunction( '__', new Twig_SimpleFunction( '__', array( $this, 'translate' ) ) );
}
public function translate( $text, $domain = 'types' ) {
return __( $text, $domain );
}
public function render( $file, $data ) {
if( $this->filesystem->exists( $file ) )
return $this->twig->render( $file, $data );
return false;
}
}