@@ -3,15 +3,14 @@
|
||||
namespace MailPoet\Config;
|
||||
|
||||
use MailPoet\Twig;
|
||||
use Twig_Environment as TwigEnv;
|
||||
use Twig_Lexer as TwigLexer;
|
||||
use Twig_Loader_Filesystem as TwigFileSystem;
|
||||
use MailPoetVendor\Twig_Environment as TwigEnv;
|
||||
use MailPoetVendor\Twig_Lexer as TwigLexer;
|
||||
use MailPoetVendor\Twig_Loader_Filesystem as TwigFileSystem;
|
||||
|
||||
use MailPoet\WP\Functions as WPFunctions;
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
|
||||
|
||||
class Renderer {
|
||||
protected $cache_path;
|
||||
protected $caching_enabled;
|
||||
@@ -103,7 +102,7 @@ class Renderer {
|
||||
|
||||
function setupDebug() {
|
||||
if ($this->debugging_enabled) {
|
||||
$this->renderer->addExtension(new \Twig_Extension_Debug());
|
||||
$this->renderer->addExtension(new \MailPoetVendor\Twig_Extension_Debug());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -15,17 +15,11 @@ class RequirementsChecker {
|
||||
const TEST_MBSTRING_EXTENSION = 'MbstringExtension';
|
||||
const TEST_XML_EXTENSION = 'XmlExtension';
|
||||
const TEST_VENDOR_SOURCE = 'VendorSource';
|
||||
const TWIG_SUPPORTED_VERSIONS = '1.26.0-1.34.4';
|
||||
|
||||
public $display_error_notice;
|
||||
public $vendor_classes = array(
|
||||
'\ORM',
|
||||
'\Model',
|
||||
'\Twig_Environment',
|
||||
'\Twig_Loader_Filesystem',
|
||||
'\Twig_Lexer',
|
||||
'\Twig_Extension',
|
||||
'\Twig_SimpleFunction',
|
||||
'\Swift_Mailer',
|
||||
'\Swift_SmtpTransport',
|
||||
'\Swift_Message',
|
||||
@@ -131,30 +125,13 @@ class RequirementsChecker {
|
||||
$dependency_path
|
||||
);
|
||||
|
||||
$return_error = true;
|
||||
|
||||
// if a Twig dependency is loaded by another plugin, check for valid version
|
||||
if (strpos($dependency, '\Twig_') === 0) {
|
||||
$return_error = ($this->isValidTwigVersion()) ? false : $return_error;
|
||||
}
|
||||
|
||||
if ($return_error) return $this->processError($error);
|
||||
return $this->processError($error);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function isValidTwigVersion() {
|
||||
list($minimum_version, $maximum_version) = explode('-', self::TWIG_SUPPORTED_VERSIONS);
|
||||
return (
|
||||
class_exists('\Twig_Environment') &&
|
||||
defined('\Twig_Environment::VERSION') &&
|
||||
version_compare(\Twig_Environment::VERSION, $minimum_version, '>=') &&
|
||||
version_compare(\Twig_Environment::VERSION, $maximum_version, '<=')
|
||||
);
|
||||
}
|
||||
|
||||
private function getDependencyPath($namespaced_class) {
|
||||
try {
|
||||
$reflector = new \ReflectionClass($namespaced_class);
|
||||
|
Reference in New Issue
Block a user