]> _ Git - cubeextranet.git/commitdiff
done #1977 #1978 @2
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 13 Mar 2018 11:20:11 +0000 (11:20 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 13 Mar 2018 11:20:11 +0000 (11:20 +0000)
inc/ws/Util/html5/master/class.ws.html5.compiler.php

index 9047081dafe0496757835aba0f6106eebc12736c..faa1dd462400edf4538b69d9cf67d44596286019 100644 (file)
@@ -536,6 +536,23 @@ class wsHTML5Compiler {
                $script .= $iscript;
                $description = '<meta name="description" content="' . html::escapeHTML(isset($this->book->parametres->seoDescription) && $this->book->parametres->seoDescription ? $this->book->parametres->seoDescription : $titre . ' - Powered by Fluidbook') . '">';
 
+               $socialTitle = $this->book->parametres->facebook_title ? $this->book->parametres->facebook_title : $titre;
+               $socialDescription = $this->book->parametres->seoDescription ? $this->book->parametres->seoDescription : $this->book->parametres->seoDescription;
+               $socialImage = 'https://workshop.fluidbook.com/services/facebook_thumbnail?id=' . $this->book_id . '&j=' . time();
+               $dim = getimagesize($socialImage);
+               $socialImageWidth = $dim[0];
+               $socialImageHeight = $dim[1];
+
+               $twittercard = '<meta name="twitter:title" content="' . html::escapeHTML($socialTitle) . '">
+       <meta name="twitter:description" content="' . html::escapeHTML($socialDescription) . '">
+       <meta name="twitter:image" content="' . $socialImage . '">
+       <meta name="twitter:site" content="@Fluidbook">
+       <meta name="twitter:card" content="summary_large_image">';
+               $opengraph = '<meta property="og:title" content="' . html::escapeHTML($socialTitle) . '"/>
+       <meta property="og:title" content="' . html::escapeHTML($socialDescription) . '"/>
+       <meta property="og:image" content="' . $socialImage . '"/>
+       <meta property="og:image:width" content="' . $socialImageWidth . '"/>
+       <meta property="og:image:height" content="' . $socialImageHeight . '"/>';
 
                $favicon = '';
                $hasIos = false;
@@ -596,7 +613,7 @@ class wsHTML5Compiler {
                if ($this->phonegap) {
                        $csp = "<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'self' data: gap: 'unsafe-inline' *; style-src 'self' 'unsafe-inline'; font-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' " . implode(' ', array_unique($this->securityPolicyWhitelist)) . "; img-src * data:\">";
                }
-               $vars = array('titre', 'credits', 'statsfooter', 'ga', 'style', 'script', 'pagesContents', 'description', 'print', 'hiddenContents', 'splash', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'csp');
+               $vars = array('titre', 'credits', 'statsfooter', 'ga', 'style', 'script', 'pagesContents', 'description', 'print', 'hiddenContents', 'splash', 'cache', 'bgcolor', 'message', 'favicon', 'svg', 'beginbody', 'csp', 'opengraph', 'twittercard');
                foreach ($vars as $v) {
                        $html = str_replace('<!-- $' . $v . ' -->', $$v, $html);
                }