$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;
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);
}