diff --git a/assets/js/src/helpscout.js b/assets/js/src/helpscout.js deleted file mode 100644 index e6d64223c1..0000000000 --- a/assets/js/src/helpscout.js +++ /dev/null @@ -1,3 +0,0 @@ -define([], function() { - !function(e, o, n){window.HSCW=o, window.HS=n, n.beacon=n.beacon||{};var t=n.beacon;t.userConfig={}, t.readyQueue=[], t.config=function(e){this.userConfig=e}, t.ready=function(e){this.readyQueue.push(e)}, o.config={docs:{enabled:!0, baseUrl:"//mailpoet3.helpscoutdocs.com/"}, contact:{enabled:!0, formId:"aa21ca80-a4f5-11e6-91aa-0a5fecc78a4d"}};var r=e.getElementsByTagName("script")[0], c=e.createElement("script");c.type="text/javascript", c.async=!0, c.src="https://djtflbt20bdde.cloudfront.net/", r.parentNode.insertBefore(c, r)}(document, window.HSCW||{}, window.HS||{}); -}); diff --git a/lib/Twig/Functions.php b/lib/Twig/Functions.php index e50fe2844f..f39041c87c 100644 --- a/lib/Twig/Functions.php +++ b/lib/Twig/Functions.php @@ -1,5 +1,6 @@ array('all')) ), + new \Twig_SimpleFunction( + 'mailpoet_has_valid_premium_key', + array($this, 'hasValidPremiumKey'), + array('is_safe' => array('all')) + ), new \Twig_SimpleFunction( 'wp_time_format', array($this, 'getWPTimeFormat'), @@ -151,4 +157,9 @@ class Functions extends \Twig_Extension { } return null; } -} \ No newline at end of file + + function hasValidPremiumKey() { + $checker = new ServicesChecker(); + return $checker->isPremiumKeyValid(false); + } +} diff --git a/views/layout.html b/views/layout.html index 58693c5668..656a11f39c 100644 --- a/views/layout.html +++ b/views/layout.html @@ -75,6 +75,12 @@ jQuery('.toplevel_page_mailpoet-newsletters.menu-top-last') <%= javascript('lib/analytics.js') %> +<% if mailpoet_has_valid_premium_key() %> + +<% else %> + +<% endif %> +