$res .= '<meta name="google" value="notranslate">';
$res .= '<style type="text/css" media="print">*{ visibility: hidden; display: none }</style>';
// EntĂȘtes Facebook
- $meta['og:title'] = ($book->parametres->facebook_title == '') ? $book->parametres->title : $book->parametres->facebook_title;
- if ($book->parametres->facebook_description != '') {
- $meta['og:description'] = $book->parametres->facebook_description;
- }
- $meta['og:image'] = 'https://workshop.fluidbook.com/services/facebook_thumbnail?id=' . $book->book_id . '&j=' . TIME;
+ $meta['og:title'] = ($book->parametres->facebook_title == '') ? $book->parametres->title : $book->parametres->facebook_title;
+ if ($book->parametres->facebook_description != '') {
+ $meta['og:description'] = $book->parametres->facebook_description;
+ }
+ $meta['og:image'] = 'https://workshop.fluidbook.com/services/facebook_thumbnail?id=' . $book->book_id . '&j=' . TIME;
$redirectPDF = 'window.location="data/document.pdf"';
$robots = '<meta name="robots" content="noindex, nofollow">';
}
- $description = '';
- if ($this->book->parametres->seoDescription) {
- $description = '<meta name="description" content="' . self::escape($this->book->parametres->seoDescription) . '">';
- }
$keywords = '';
if ($this->book->parametres->seoKeywords) {
$keywords = '<meta name="keywords" content="' . self::escape($this->book->parametres->seoKeywords) . '">';
}
$html5priority = CubeIT_Util_Bool::boolval($this->book->parametres->html5priority, false, true);
+
// Stuffs to replace in html
$toReplace = array('lang' => strtolower($this->book->lang),
'ga' => $ga,
'redirectMobile' => $redirectMobile,
'redirectPDF' => $redirectPDF,
'junk' => TIME,
- 'description' => $description,
'robots' => $robots,
'favicon' => $favicon,
'flashversion' => $this->getMinFlashVersion(),
$html = CubeIT_Util_Gzip::file_get_contents($htmlfile);
$alt .= "\n" . $html . "\n";
-
if ($page == 1) {
$alt .= $nav1;
} else {
}
}
-
$alt .= $footer;
$base = '';
$base = '<base href="' . $this->book->parametres->baseUrl . '" />';
}
+ if ($page == 1 && $this->book->parametres->seoDescription) {
+ $description = $this->book->parametres->seoDescription;
+ } else {
+ $textfile = wsDocument::getDir($infos['document_id']) . 'ph' . $infos['document_page'] . '.txt';
+ if (file_exists($textfile)) {
+ $description = mb_substr(file_get_contents($textfile), 0, 150);
+ } else {
+ $description = '';
+ }
+ }
+
$data = str_replace('$alt', $alt, $this->origHTML);
$data = str_replace('$base', $base, $data);
$data = str_replace('$pathToIndex', $pathToIndex, $data);
$data = str_replace('$redirectScript', $redirectScript, $data);
$data = str_replace('$sp', $sp, $data);
$data = str_replace('$index_ext', $this->_ext, $data);
+ $data = str_replace('$description', '<meta name="description" content="' . self::escape($description, true) . '">', $data);
file_put_contents($this->vdir . $dest, $data);
return 1;
}
- protected function escape($txt) {
- return htmlentities($txt, ENT_COMPAT, 'UTF-8');
+ protected function escape($txt, $replaceNewLines = false) {
+ $res = htmlentities($txt, ENT_COMPAT, 'UTF-8');
+ if ($replaceNewLines) {
+ $res = str_replace("\n", ' ', $res);
+ $res = str_replace("\r", '', $res);
+ }
+ return $res;
}
protected function makeHTMLFooter() {