From: vincent@cubedesigners.com Date: Mon, 20 Nov 2017 17:58:47 +0000 (+0000) Subject: #1802 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=fd0a3731c217881f4163b0907adcfc56b81da777;p=cubeextranet.git #1802 --- diff --git a/inc/ws/Util/html5/socialarticles/class.ws.html5.compiler.php b/inc/ws/Util/html5/socialarticles/class.ws.html5.compiler.php index 5363ab4c4..0aa3ba708 100644 --- a/inc/ws/Util/html5/socialarticles/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/socialarticles/class.ws.html5.compiler.php @@ -156,7 +156,9 @@ class wsHTML5Compiler { protected $stylesheets = array(); protected $logfp = null; protected $logtime = null; + protected $beginBody = array(); protected $seoArticles = []; + protected $securityPolicyWhitelist = ['*.google-analytics.com', '*.youtube.com', '*.ytimg.com']; function __construct($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false) { @@ -260,6 +262,25 @@ class wsHTML5Compiler { $this->logtime = $currenttime; } + public function addFacebookSDK() { + $lang = str_replace('-', '_', $this->book->lang); + $e = explode('_', $lang); + if (count($e) > 1) { + $e[1] = mb_strtoupper($lang); + } + $lang = implode('_', $e); + $this->beginBody[] = "
+"; + $this->securityPolicyWhitelist[] = '*.facebook.net'; + $this->securityPolicyWhitelist[] = 'data:'; + } + public function addPageLabel($page, $label) { $this->pageLabels[$label] = $page; } @@ -474,11 +495,9 @@ class wsHTML5Compiler { $style = implode("\n\t\t", $style); $pagesContents = ''; - $cache = ''; - if ($this->appcache) { - $cache = ' manifest="cache.appcache"'; - } + + $beginbody = implode("\n", array_unique($this->beginBody)); $iscript = ''; if (count($this->htmlmultimedia)) { @@ -532,8 +551,9 @@ class wsHTML5Compiler { } } + $securitypolicywhitelist = implode(' ', array_unique($this->securityPolicyWhitelist)); - $vars = array('titre', 'credits', 'statsfooter', 'ga', 'style', 'script', 'pagesContents', 'description', 'print', 'hiddenContents', 'splash', 'cache', 'bgcolor', 'message', 'favicon', 'svg'); + $vars = array('titre', 'credits', 'statsfooter', 'ga', 'style', 'script', 'pagesContents', 'description', 'print', 'hiddenContents', 'splash', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'securitypolicywhitelist'); foreach ($vars as $v) { $html = str_replace('', $$v, $html); } diff --git a/inc/ws/Util/html5/socialarticles/class.ws.html5.links.php b/inc/ws/Util/html5/socialarticles/class.ws.html5.links.php index a82a41555..ada28e3ab 100644 --- a/inc/ws/Util/html5/socialarticles/class.ws.html5.links.php +++ b/inc/ws/Util/html5/socialarticles/class.ws.html5.links.php @@ -128,6 +128,9 @@ class wsHTML5Link { case 27: return new eventOverlayLink($id, $init, $compiler); break; + case 29: + return new facebookLikeLink($id, $init, $compiler); + break; default: return null; } @@ -816,6 +819,13 @@ class fileLink extends normalLink { } +class facebookLikeLink extends wsHTML5Link { + public function getHTMLContent() { + $this->compiler->addFacebookSDK(); + return '
'; + } +} + class htmlMultimediaLink extends wsHTML5Link { protected $_config = null;