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) {
$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[] = "<div id=\"fb-root\"></div>
+<script>(function(d, s, id) {
+ var js, fjs = d.getElementsByTagName(s)[0];
+ if (d.getElementById(id)) return;
+ js = d.createElement(s); js.id = id;
+ js.src = 'https://connect.facebook.net/" . $lang . "/sdk.js#xfbml=1&version=v2.11&appId=132006430233560';
+ fjs.parentNode.insertBefore(js, fjs);
+}(document, 'script', 'facebook-jssdk'));</script>";
+ $this->securityPolicyWhitelist[] = '*.facebook.net';
+ $this->securityPolicyWhitelist[] = 'data:';
+ }
+
public function addPageLabel($page, $label) {
$this->pageLabels[$label] = $page;
}
$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)) {
}
}
+ $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 . ' -->', $$v, $html);
}