@ -11,7 +11,6 @@
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.6",
|
||||
"twig/twig": "1.*",
|
||||
"cerdic/css-tidy": "^1.6",
|
||||
"tburry/pquery": "^1.1.1",
|
||||
"j4mie/paris": "1.5.6",
|
||||
|
250
composer.lock
generated
250
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "81e44efee9f040a7e302f96ae2265d93",
|
||||
"content-hash": "ace24c4002870bd939be3fc6625f9216",
|
||||
"packages": [
|
||||
{
|
||||
"name": "cerdic/css-tidy",
|
||||
@ -431,64 +431,6 @@
|
||||
},
|
||||
"time": "2018-07-09T16:02:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.10.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19",
|
||||
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-ctype": "For best performance"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.9-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Ctype\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Gert de Pagter",
|
||||
"email": "BackEndTea@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for ctype functions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"ctype",
|
||||
"polyfill",
|
||||
"portable"
|
||||
],
|
||||
"time": "2018-08-06T14:22:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.10.0",
|
||||
@ -718,72 +660,6 @@
|
||||
"php"
|
||||
],
|
||||
"time": "2016-01-14T20:55:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "twig/twig",
|
||||
"version": "v1.38.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/twigphp/Twig.git",
|
||||
"reference": "754b8dfc0026585eb8498ec4bf5ff240b6b34db7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/754b8dfc0026585eb8498ec4bf5ff240b6b34db7",
|
||||
"reference": "754b8dfc0026585eb8498ec4bf5ff240b6b34db7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4.0",
|
||||
"symfony/polyfill-ctype": "^1.8"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/container": "^1.0",
|
||||
"symfony/debug": "^2.7",
|
||||
"symfony/phpunit-bridge": "^3.4.19|^4.1.8"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.38-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Twig_": "lib/"
|
||||
},
|
||||
"psr-4": {
|
||||
"Twig\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com",
|
||||
"homepage": "http://fabien.potencier.org",
|
||||
"role": "Lead Developer"
|
||||
},
|
||||
{
|
||||
"name": "Armin Ronacher",
|
||||
"email": "armin.ronacher@active-4.com",
|
||||
"role": "Project Founder"
|
||||
},
|
||||
{
|
||||
"name": "Twig Team",
|
||||
"homepage": "https://twig.symfony.com/contributors",
|
||||
"role": "Contributors"
|
||||
}
|
||||
],
|
||||
"description": "Twig, the flexible, fast, and secure template language for PHP",
|
||||
"homepage": "https://twig.symfony.com",
|
||||
"keywords": [
|
||||
"templating"
|
||||
],
|
||||
"time": "2019-03-12T12:42:04+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
@ -6153,6 +6029,64 @@
|
||||
],
|
||||
"time": "2018-11-11T11:18:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.11.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "82ebae02209c21113908c229e9883c419720738a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a",
|
||||
"reference": "82ebae02209c21113908c229e9883c419720738a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-ctype": "For best performance"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.11-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Ctype\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Gert de Pagter",
|
||||
"email": "backendtea@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for ctype functions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"ctype",
|
||||
"polyfill",
|
||||
"portable"
|
||||
],
|
||||
"time": "2019-02-06T07:57:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-icu",
|
||||
"version": "v1.10.0",
|
||||
@ -6593,6 +6527,72 @@
|
||||
],
|
||||
"time": "2018-12-05T18:34:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "twig/twig",
|
||||
"version": "v1.38.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/twigphp/Twig.git",
|
||||
"reference": "7732e9e7017d751313811bd118de61302e9c8b35"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/7732e9e7017d751313811bd118de61302e9c8b35",
|
||||
"reference": "7732e9e7017d751313811bd118de61302e9c8b35",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4.0",
|
||||
"symfony/polyfill-ctype": "^1.8"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/container": "^1.0",
|
||||
"symfony/debug": "^2.7",
|
||||
"symfony/phpunit-bridge": "^3.4.19|^4.1.8"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.38-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Twig_": "lib/"
|
||||
},
|
||||
"psr-4": {
|
||||
"Twig\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com",
|
||||
"homepage": "http://fabien.potencier.org",
|
||||
"role": "Lead Developer"
|
||||
},
|
||||
{
|
||||
"name": "Armin Ronacher",
|
||||
"email": "armin.ronacher@active-4.com",
|
||||
"role": "Project Founder"
|
||||
},
|
||||
{
|
||||
"name": "Twig Team",
|
||||
"homepage": "https://twig.symfony.com/contributors",
|
||||
"role": "Contributors"
|
||||
}
|
||||
],
|
||||
"description": "Twig, the flexible, fast, and secure template language for PHP",
|
||||
"homepage": "https://twig.symfony.com",
|
||||
"keywords": [
|
||||
"templating"
|
||||
],
|
||||
"time": "2019-03-23T14:27:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "umpirsky/twig-gettext-extractor",
|
||||
"version": "1.1.5",
|
||||
|
@ -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);
|
||||
|
@ -9,27 +9,27 @@ use MailPoet\WooCommerce\Helper as WooCommerceHelper;
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
|
||||
class Analytics extends \Twig_Extension {
|
||||
class Analytics extends \MailPoetVendor\Twig_Extension {
|
||||
public function getFunctions() {
|
||||
$settings = new SettingsController();
|
||||
$analytics = new AnalyticsGenerator(new Reporter($settings, new WooCommerceHelper), $settings);
|
||||
return array(
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'get_analytics_data',
|
||||
array($analytics, 'generateAnalytics'),
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'is_analytics_enabled',
|
||||
array($analytics, 'isEnabled'),
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'get_analytics_public_id',
|
||||
array($analytics, 'getPublicId'),
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'is_analytics_public_id_new',
|
||||
array($analytics, 'isPublicIdNew'),
|
||||
array('is_safe' => array('all'))
|
||||
|
@ -5,7 +5,7 @@ use MailPoet\WP\Functions as WPFunctions;
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
|
||||
class Assets extends \Twig_Extension {
|
||||
class Assets extends \MailPoetVendor\Twig_Extension {
|
||||
const CDN_URL = 'https://ps.w.org/mailpoet/';
|
||||
private $_globals;
|
||||
|
||||
@ -15,22 +15,22 @@ class Assets extends \Twig_Extension {
|
||||
|
||||
function getFunctions() {
|
||||
return array(
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'stylesheet',
|
||||
array($this, 'generateStylesheet'),
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'javascript',
|
||||
array($this, 'generateJavascript'),
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'image_url',
|
||||
array($this, 'generateImageUrl'),
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'cdn_url',
|
||||
array($this, 'generateCdnUrl'),
|
||||
array('is_safe' => array('all'))
|
||||
|
@ -4,7 +4,7 @@ namespace MailPoet\Twig;
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
|
||||
class Filters extends \Twig_Extension {
|
||||
class Filters extends \MailPoetVendor\Twig_Extension {
|
||||
|
||||
function getName() {
|
||||
return 'filters';
|
||||
@ -12,11 +12,11 @@ class Filters extends \Twig_Extension {
|
||||
|
||||
function getFilters() {
|
||||
return array(
|
||||
new \Twig_SimpleFilter(
|
||||
new \MailPoetVendor\Twig_SimpleFilter(
|
||||
'intval',
|
||||
'intval'
|
||||
),
|
||||
new \Twig_SimpleFilter(
|
||||
new \MailPoetVendor\Twig_SimpleFilter(
|
||||
'replaceLinkTags',
|
||||
'MailPoet\Util\Helpers::replaceLinkTags'
|
||||
)
|
||||
|
@ -10,7 +10,7 @@ use MailPoet\WP\Functions as WPFunctions;
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
|
||||
class Functions extends \Twig_Extension {
|
||||
class Functions extends \MailPoetVendor\Twig_Extension {
|
||||
|
||||
/** @var SettingsController */
|
||||
private $settings;
|
||||
@ -21,97 +21,97 @@ class Functions extends \Twig_Extension {
|
||||
|
||||
function getFunctions() {
|
||||
return array(
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'json_encode',
|
||||
'json_encode',
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'json_decode',
|
||||
'json_decode',
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'wp_nonce_field',
|
||||
'wp_nonce_field',
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'params',
|
||||
array($this, 'params'),
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'admin_url',
|
||||
'admin_url',
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'get_option',
|
||||
'get_option',
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'get_option',
|
||||
'get_option',
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'sending_frequency',
|
||||
array($this, 'getSendingFrequency'),
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'wp_date_format',
|
||||
array($this, 'getWPDateFormat'),
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'mailpoet_version',
|
||||
array($this, 'getMailPoetVersion'),
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'mailpoet_premium_version',
|
||||
array($this, 'getMailPoetPremiumVersion'),
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'mailpoet_has_valid_premium_key',
|
||||
array($this, 'hasValidPremiumKey'),
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'wp_time_format',
|
||||
array($this, 'getWPTimeFormat'),
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'wp_datetime_format',
|
||||
array($this, 'getWPDateTimeFormat'),
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'do_action',
|
||||
'do_action',
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'is_rtl',
|
||||
array($this, 'isRtl'),
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'number_format_i18n',
|
||||
'number_format_i18n',
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'mailpoet_locale',
|
||||
array($this, 'getTwoLettersLocale'),
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'mailpoet_free_domains',
|
||||
array($this, 'getFreeDomains'),
|
||||
array('is_safe' => array('all'))
|
||||
|
@ -4,10 +4,10 @@ namespace MailPoet\Twig;
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
|
||||
class Handlebars extends \Twig_Extension {
|
||||
class Handlebars extends \MailPoetVendor\Twig_Extension {
|
||||
public function getFunctions() {
|
||||
return array(
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'partial',
|
||||
array(
|
||||
$this,
|
||||
@ -41,7 +41,7 @@ class Handlebars extends \Twig_Extension {
|
||||
return;
|
||||
}
|
||||
|
||||
$rendered_template = twig_include($env, $context, $file);
|
||||
$rendered_template = \MailPoetVendor\twig_include($env, $context, $file);
|
||||
|
||||
$output = <<<EOL
|
||||
<script id="$id" type="text/x-handlebars-template">
|
||||
|
@ -4,10 +4,10 @@ namespace MailPoet\Twig;
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
|
||||
class Helpscout extends \Twig_Extension {
|
||||
class Helpscout extends \MailPoetVendor\Twig_Extension {
|
||||
public function getFunctions() {
|
||||
return array(
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'get_helpscout_data',
|
||||
'\MailPoet\Helpscout\Beacon::getData',
|
||||
array('is_safe' => array('all'))
|
||||
|
@ -7,7 +7,7 @@ use MailPoet\WP\Functions as WPFunctions;
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
|
||||
class I18n extends \Twig_Extension {
|
||||
class I18n extends \MailPoetVendor\Twig_Extension {
|
||||
|
||||
private $_text_domain;
|
||||
|
||||
@ -30,7 +30,7 @@ class I18n extends \Twig_Extension {
|
||||
);
|
||||
|
||||
foreach ($functions as $twig_function => $function) {
|
||||
$twig_functions[] = new \Twig_SimpleFunction(
|
||||
$twig_functions[] = new \MailPoetVendor\Twig_SimpleFunction(
|
||||
$twig_function,
|
||||
array($this, $function),
|
||||
array('is_safe' => array('all'))
|
||||
|
@ -6,7 +6,7 @@ use MailPoet\Settings\SettingsController;
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
|
||||
class Polls extends \Twig_Extension {
|
||||
class Polls extends \MailPoetVendor\Twig_Extension {
|
||||
|
||||
/** @var SettingsController */
|
||||
private $settings;
|
||||
@ -17,12 +17,12 @@ class Polls extends \Twig_Extension {
|
||||
|
||||
public function getFunctions() {
|
||||
return array(
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'get_polls_data',
|
||||
array($this, 'getPollsData'),
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
new \MailPoetVendor\Twig_SimpleFunction(
|
||||
'get_polls_visiblity',
|
||||
array($this, 'getPollsVisibility'),
|
||||
array('is_safe' => array('all'))
|
||||
|
@ -3,7 +3,8 @@
|
||||
"php": ">=5.6",
|
||||
"symfony/dependency-injection": "3.4.22",
|
||||
"monolog/monolog": "^1.23",
|
||||
"sabberworm/php-css-parser": "^8.1"
|
||||
"sabberworm/php-css-parser": "^8.1",
|
||||
"twig/twig": "1.38.4"
|
||||
},
|
||||
"scripts": {
|
||||
"post-update-cmd": "@process",
|
||||
@ -12,7 +13,8 @@
|
||||
"rm -rf ../vendor-prefixed",
|
||||
"mkdir ../vendor-prefixed",
|
||||
"../php-scoper.phar add-prefix",
|
||||
"mv ./build/* ../vendor-prefixed"
|
||||
"mv ./build/* ../vendor-prefixed",
|
||||
"php fix-twig.php"
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
|
126
prefixer/composer.lock
generated
126
prefixer/composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "5adf957548a314d23d716c2e5959e24b",
|
||||
"content-hash": "0a85a5163c915ee5e4c5e546973aa767",
|
||||
"packages": [
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
@ -294,6 +294,130 @@
|
||||
"description": "Symfony DependencyInjection Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2019-01-30T17:48:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.11.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "82ebae02209c21113908c229e9883c419720738a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a",
|
||||
"reference": "82ebae02209c21113908c229e9883c419720738a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-ctype": "For best performance"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.11-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Ctype\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Gert de Pagter",
|
||||
"email": "backendtea@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill for ctype functions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"ctype",
|
||||
"polyfill",
|
||||
"portable"
|
||||
],
|
||||
"time": "2019-02-06T07:57:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "twig/twig",
|
||||
"version": "v1.38.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/twigphp/Twig.git",
|
||||
"reference": "7732e9e7017d751313811bd118de61302e9c8b35"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/7732e9e7017d751313811bd118de61302e9c8b35",
|
||||
"reference": "7732e9e7017d751313811bd118de61302e9c8b35",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4.0",
|
||||
"symfony/polyfill-ctype": "^1.8"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/container": "^1.0",
|
||||
"symfony/debug": "^2.7",
|
||||
"symfony/phpunit-bridge": "^3.4.19|^4.1.8"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.38-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Twig_": "lib/"
|
||||
},
|
||||
"psr-4": {
|
||||
"Twig\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com",
|
||||
"homepage": "http://fabien.potencier.org",
|
||||
"role": "Lead Developer"
|
||||
},
|
||||
{
|
||||
"name": "Armin Ronacher",
|
||||
"email": "armin.ronacher@active-4.com",
|
||||
"role": "Project Founder"
|
||||
},
|
||||
{
|
||||
"name": "Twig Team",
|
||||
"homepage": "https://twig.symfony.com/contributors",
|
||||
"role": "Contributors"
|
||||
}
|
||||
],
|
||||
"description": "Twig, the flexible, fast, and secure template language for PHP",
|
||||
"homepage": "https://twig.symfony.com",
|
||||
"keywords": [
|
||||
"templating"
|
||||
],
|
||||
"time": "2019-03-23T14:27:19+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
|
238
prefixer/fix-twig.php
Executable file
238
prefixer/fix-twig.php
Executable file
@ -0,0 +1,238 @@
|
||||
<?php
|
||||
|
||||
$replacements = [
|
||||
[
|
||||
'file' => '../vendor-prefixed/twig/twig/src/ExpressionParser.php',
|
||||
'find' => [
|
||||
'\'Twig\\\\Node\\\\Expression\\\\TestExpression\'',
|
||||
'\'Twig\\\\Node\\\\Expression\\\\FunctionExpression\'',
|
||||
'\'Twig\\\\Node\\\\Expression\\\\FilterExpression\'',
|
||||
],
|
||||
'replace' => [
|
||||
'\'MailPoetVendor\\\\Twig\\\\Node\\\\Expression\\\\TestExpression\'',
|
||||
'\'MailPoetVendor\\\\Twig\\\\Node\\\\Expression\\\\FunctionExpression\'',
|
||||
'\'MailPoetVendor\\\\Twig\\\\Node\\\\Expression\\\\FilterExpression\'',
|
||||
],
|
||||
],
|
||||
[
|
||||
'file' => '../vendor-prefixed/twig/twig/src/TwigFilter.php',
|
||||
'find' => [
|
||||
'\'\\\\Twig\\\\Node\\\\Expression\\\\FilterExpression\'',
|
||||
],
|
||||
'replace' => [
|
||||
'\'\\\\MailPoetVendor\\\\Twig\\\\Node\\\\Expression\\\\FilterExpression\'',
|
||||
],
|
||||
],
|
||||
[
|
||||
'file' => '../vendor-prefixed/twig/twig/src/TwigFunction.php',
|
||||
'find' => [
|
||||
'\'\\\\Twig\\\\Node\\\\Expression\\\\FunctionExpression\'',
|
||||
],
|
||||
'replace' => [
|
||||
'\'\\\\MailPoetVendor\\\\Twig\\\\Node\\\\Expression\\\\FunctionExpression\'',
|
||||
],
|
||||
],
|
||||
[
|
||||
'file' => '../vendor-prefixed/twig/twig/src/TwigTest.php',
|
||||
'find' => [
|
||||
'\'\\\\Twig\\\\Node\\\\Expression\\\\TestExpression\'',
|
||||
],
|
||||
'replace' => [
|
||||
'\'\\\\MailPoetVendor\\\\Twig\\\\Node\\\\Expression\\\\TestExpression\'',
|
||||
],
|
||||
],
|
||||
[
|
||||
'file' => '../vendor-prefixed/twig/twig/src/Node/Expression/Binary/NotInBinary.php',
|
||||
'find' => [
|
||||
'\'!twig_in_filter(\''
|
||||
],
|
||||
'replace' => [
|
||||
'\'!\\\\MailPoetVendor\\\\twig_in_filter(\'',
|
||||
],
|
||||
],
|
||||
[
|
||||
'file' => '../vendor-prefixed/twig/twig/src/Node/Expression/Binary/InBinary.php',
|
||||
'find' => [
|
||||
'\'twig_in_filter(\''
|
||||
],
|
||||
'replace' => [
|
||||
'\'\\\\MailPoetVendor\\\\twig_in_filter(\'',
|
||||
],
|
||||
],
|
||||
[
|
||||
'file' => '../vendor-prefixed/twig/twig/src/Extension/CoreExtension.php',
|
||||
'find' => [
|
||||
'\'twig_date_format_filter\'',
|
||||
'\'twig_date_modify_filter\'',
|
||||
'\'twig_replace_filter\'',
|
||||
'\'twig_number_format_filter\'',
|
||||
'\'twig_round\'',
|
||||
'\'twig_urlencode_filter\'',
|
||||
'\'twig_jsonencode_filter\'',
|
||||
'\'twig_convert_encoding\'',
|
||||
'\'twig_title_string_filter\'',
|
||||
'\'twig_capitalize_string_filter\'',
|
||||
'\'twig_trim_filter\'',
|
||||
'\'twig_spaceless\'',
|
||||
'\'twig_join_filter\'',
|
||||
'\'twig_split_filter\'',
|
||||
'\'twig_sort_filter\'',
|
||||
'\'twig_sort_filter\'',
|
||||
'\'twig_array_batch\'',
|
||||
'\'twig_reverse_filter\'',
|
||||
'\'twig_length_filter\'',
|
||||
'\'twig_slice\'',
|
||||
'\'twig_first\'',
|
||||
'\'twig_last\'',
|
||||
'\'_twig_default_filter\'',
|
||||
'\'twig_get_array_keys_filter\'',
|
||||
'\'twig_escape_filter\'',
|
||||
'\'twig_upper_filter\'',
|
||||
'\'twig_lower_filter\'',
|
||||
'\'twig_escape_filter_is_safe\'',
|
||||
'\'_twig_escape_js_callback\'',
|
||||
'\'_twig_escape_css_callback\'',
|
||||
'\'_twig_escape_html_attr_callback\'',
|
||||
'\'twig_source\'',
|
||||
'\'twig_test_empty\'',
|
||||
'\'_twig_markup2string\'',
|
||||
'\'twig_test_iterable\'',
|
||||
'\'twig_random\'',
|
||||
'\'twig_date_converter\'',
|
||||
'\'twig_cycle\'',
|
||||
'\'twig_constant\'',
|
||||
],
|
||||
'replace' => [
|
||||
'\'\\\\MailPoetVendor\\\\twig_date_format_filter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_date_modify_filter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_replace_filter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_number_format_filter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_round\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_urlencode_filter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_jsonencode_filter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_convert_encoding\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_title_string_filter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_capitalize_string_filter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_trim_filter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_spaceless\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_join_filter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_split_filter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_sort_filter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_array_merge\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_array_batch\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_reverse_filter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_length_filter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_slice\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_first\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_last\'',
|
||||
'\'\\\\MailPoetVendor\\\\_twig_default_filter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_get_array_keys_filter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_escape_filter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_upper_filter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_lower_filter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_escape_filter_is_safe\'',
|
||||
'\'\\\\MailPoetVendor\\\\_twig_escape_js_callback\'',
|
||||
'\'\\\\MailPoetVendor\\\\_twig_escape_css_callback\'',
|
||||
'\'\\\\MailPoetVendor\\\\_twig_escape_html_attr_callback\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_source\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_test_empty\'',
|
||||
'\'\\\\MailPoetVendor\\\\_twig_markup2string\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_test_iterable\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_random\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_date_converter\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_cycle\'',
|
||||
'\'\\\\MailPoetVendor\\\\twig_constant\'',
|
||||
],
|
||||
],
|
||||
[
|
||||
'file' => '../vendor-prefixed/twig/twig/src/Node/ForNode.php',
|
||||
'find' => [
|
||||
'= twig_ensure_traversable("',
|
||||
],
|
||||
'replace' => [
|
||||
'= \\\\MailPoetVendor\\\\twig_ensure_traversable("',
|
||||
],
|
||||
],
|
||||
[
|
||||
'file' => '../vendor-prefixed/twig/twig/src/Node/CheckSecurityNode.php',
|
||||
'find' => [
|
||||
'\'\\\\Twig\\\\Extension\\\\SandboxExtension\'',
|
||||
],
|
||||
'replace' => [
|
||||
'\'\\\\MailPoetVendor\\\\Twig\\\\Extension\\\\SandboxExtension\'',
|
||||
],
|
||||
],
|
||||
[
|
||||
'file' => '../vendor-prefixed/twig/twig/src/Node/SandboxedPrintNode.php',
|
||||
'find' => [
|
||||
'\'\\\\Twig\\\\Extension\\\\SandboxExtension',
|
||||
],
|
||||
'replace' => [
|
||||
'\'\\\\MailPoetVendor\\\\Twig\\\\Extension\\\\SandboxExtension',
|
||||
],
|
||||
],
|
||||
[
|
||||
'file' => '../vendor-prefixed/twig/twig/src/Environment.php',
|
||||
'find' => [
|
||||
'\'\\\\Twig\\\\Template\'',
|
||||
'\'Twig_Extension\'',
|
||||
'\'Twig\\\\Extension\\\\AbstractExtension\'',
|
||||
],
|
||||
'replace' => [
|
||||
'\'\\\\MailPoetVendor\\\\Twig\\\\Template\'',
|
||||
'\'MailPoetVendor\\\\Twig_Extension\'',
|
||||
'\'MailPoetVendor\\\\Twig\\\\Extension\\\\AbstractExtension\'',
|
||||
],
|
||||
],
|
||||
[
|
||||
'file' => '../vendor-prefixed/twig/twig/src/Token.php',
|
||||
'find' => [
|
||||
'\'Twig\\\\Token::\'',
|
||||
],
|
||||
'replace' => [
|
||||
'\'MailPoetVendor\\\\Twig\\\\Token::\'',
|
||||
],
|
||||
],
|
||||
[
|
||||
'file' => '../vendor-prefixed/twig/twig/src/Profiler/Node/EnterProfileNode.php',
|
||||
'find' => [
|
||||
'\\\\Twig\\\\Profiler\\\\Profile',
|
||||
],
|
||||
'replace' => [
|
||||
'\\\\MailPoetVendor\\\\Twig\\\\Profiler\\\\Profile',
|
||||
],
|
||||
],
|
||||
[
|
||||
'file' => '../vendor-prefixed/twig/twig/src/Node/ModuleNode.php',
|
||||
'find' => [
|
||||
'"use Twig\\\\Environment;',
|
||||
'"use Twig\\\\Markup;',
|
||||
'"use Twig\\\\Source;',
|
||||
'"use Twig\\\\Template;',
|
||||
'"use Twig\\\\Error\\\\LoaderError;',
|
||||
'"use Twig\\\\Error\\\\RuntimeError;',
|
||||
'"use Twig\\\\Sandbox\\\\SecurityError;',
|
||||
'"use Twig\\\\Sandbox\\\\SecurityNotAllowedTagError;',
|
||||
'"use Twig\\\\Sandbox\\\\SecurityNotAllowedFilterError;',
|
||||
'"use Twig\\\\Sandbox\\\\SecurityNotAllowedFunctionError;',
|
||||
],
|
||||
'replace' => [
|
||||
'"use MailPoetVendor\\\\Twig\\\\Environment;',
|
||||
'"use MailPoetVendor\\\\Twig\\\\Markup;',
|
||||
'"use MailPoetVendor\\\\Twig\\\\Source;',
|
||||
'"use MailPoetVendor\\\\Twig\\\\Template;',
|
||||
'"use MailPoetVendor\\\\Twig\\\\Error\\\\LoaderError;',
|
||||
'"use MailPoetVendor\\\\Twig\\\\Error\\\\RuntimeError;',
|
||||
'"use MailPoetVendor\\\\Twig\\\\Sandbox\\\\SecurityError;',
|
||||
'"use MailPoetVendor\\\\Twig\\\\Sandbox\\\\SecurityNotAllowedTagError;',
|
||||
'"use MailPoetVendor\\\\Twig\\\\Sandbox\\\\SecurityNotAllowedFilterError;',
|
||||
'"use MailPoetVendor\\\\Twig\\\\Sandbox\\\\SecurityNotAllowedFunctionError;',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($replacements as $single_file) {
|
||||
$data = file_get_contents($single_file['file']);
|
||||
$data = str_replace($single_file['find'], $single_file['replace'], $data);
|
||||
file_put_contents($single_file['file'], $data);
|
||||
}
|
@ -5,6 +5,7 @@ use Codeception\Stub;
|
||||
use Codeception\Stub\Expected;
|
||||
use MailPoet\Config\Env;
|
||||
use MailPoet\Config\Renderer;
|
||||
use MailPoetVendor\Twig_Environment;
|
||||
|
||||
class RendererTest extends \MailPoetTest {
|
||||
function _before() {
|
||||
@ -75,7 +76,7 @@ class RendererTest extends \MailPoetTest {
|
||||
$this->renderer,
|
||||
array(),
|
||||
array(
|
||||
'renderer' => Stub::makeEmpty('Twig_Environment',
|
||||
'renderer' => Stub::makeEmpty(Twig_Environment::class,
|
||||
array(
|
||||
'render' => Expected::atLeastOnce(function() {
|
||||
return 'test render';
|
||||
@ -95,7 +96,7 @@ class RendererTest extends \MailPoetTest {
|
||||
$this->renderer,
|
||||
array(true, false),
|
||||
array(
|
||||
'renderer' => Stub::makeEmpty('Twig_Environment',
|
||||
'renderer' => Stub::makeEmpty(Twig_Environment::class,
|
||||
array(
|
||||
'render' => Expected::atLeastOnce(function() use ($exception_message) {
|
||||
throw new \RuntimeException($exception_message);
|
||||
|
@ -9,7 +9,7 @@ use MailPoet\WP\Functions as WPFunctions;
|
||||
class FunctionsTest extends \MailPoetTest {
|
||||
function testItExecutesIsRtlFunction() {
|
||||
$template = array('template' => '{% if is_rtl() %}rtl{% endif %}');
|
||||
$twig = new \Twig_Environment(new \Twig_Loader_Array($template));
|
||||
$twig = new \MailPoetVendor\Twig_Environment(new \MailPoetVendor\Twig_Loader_Array($template));
|
||||
$twig->addExtension(new Functions());
|
||||
|
||||
WPFunctions::set(Stub::make(new WPFunctions, [
|
||||
|
Reference in New Issue
Block a user