public $cssfont = [];
public $lessVariables = [];
protected $_indexVars = null;
+ public $accessibleTexts = [];
public $_signature;
/**
$this->log('Widget written');
$this->writeSounds();
$this->log('Sound written');
- $this->writeAccessibility();
- $this->log('Accessibility writter');
$this->writeTexts();
$this->log('Texts written');
+ $this->writeAccessibility();
+ $this->log('Accessibility writter');
$this->writeExtras();
$this->log('Extras written');
$this->populateConfig();
$this->config->audiodescription[$page] = $fname;
$this->vdir->copy($file, 'data/audiodescription/' . $fname);
}
+ $this->accessibleTexts[$page] = $text;
+ }
+
+
+ if (count($this->accessibleTexts) > 0) {
+ // Overwrite SEO version
+ $this->seo = new wsHTML5Seo($this);
}
}
{\r
$this->compiler = $compiler;\r
// Define default seo contents\r
- $this->pages = [];\r
-\r
- foreach ($compiler->pages as $page => $infos) {\r
- $p = new wsHTML5SeoPage($this);\r
- $p->page = $page;\r
- $p->title = ($page == 1) ? $this->compiler->book->parametres->title : $this->_getPageLabel($page);\r
- $p->text = $this->getTextContent($infos);\r
- $p->description = $this->compiler->book->parametres->seoDescription ? $this->compiler->book->parametres->seoDescription : $this->compiler->book->parametres->title . ' - Powered by Fluidbook';\r
- $p->socialDescription = $this->compiler->book->parametres->facebook_description || $this->compiler->book->parametres->seoDescription;\r
- $p->keywords = $this->compiler->book->parametres->seoKeywords;\r
- $p->robots = $this->compiler->book->parametres->seoRobots ? 'index,follow' : 'noindex,nofollow';\r
-\r
- // Google analytics\r
- $p->ua = '';\r
- if ($this->compiler->book->parametres->googleAnalytics != '') {\r
- $codes = explode(',', $this->compiler->book->parametres->googleAnalytics);\r
- $p->ua .= "<script async src=\"https://www.googletagmanager.com/gtag/js?id=" . $codes[0] . "\"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}</script>";\r
- }\r
- if ($this->compiler->book->parametres->googleAnalyticsCustom != '') {\r
- $p->ua .= $this->compiler->book->parametres->googleAnalyticsCustom;\r
- }\r
-\r
- if ($this->compiler->book->parametres->statsCustom != '') {\r
- $p->footer = $this->compiler->book->parametres->statsCustom;\r
- }\r
-\r
- $this->pages[$page] = $p;\r
- }\r
-\r
+ $this->createPages();\r
\r
if ($compiler->book->parametres->seoAdvanced) {\r
$sheets = wsUtil::excelToArray($compiler->wdir . '/' . $compiler->book->parametres->seoAdvanced, true);\r
$this->html = file_get_contents($this->compiler->assets . '/_index.html');\r
}\r
\r
+ public function createPages()\r
+ {\r
+ $this->pages = [];\r
+ if (isset($this->compiler->accessibleTexts) && count($this->compiler->accessibleTexts) > 0) {\r
+ foreach ($this->compiler->accessibleTexts as $page => $accessibleText) {\r
+ if ($page == 0) {\r
+ $page = 1;\r
+ }\r
+ $this->createPage($page, $accessibleText);\r
+ }\r
+ if (!isset($this->pages[1])) {\r
+ $this->createPage(1, $this->compiler->pages[1]);\r
+ }\r
+ return;\r
+ }\r
+ foreach ($this->compiler->pages as $page => $infos) {\r
+ $this->createPage($page, $this->getTextContent($infos));\r
+ }\r
+ }\r
+\r
+ public function createPage($page, $content)\r
+ {\r
+ $p = new wsHTML5SeoPage($this);\r
+ $p->page = $page;\r
+ $p->title = ($page == 1) ? $this->compiler->book->parametres->title : $this->_getPageLabel($page);\r
+ $p->text = $content;\r
+ $p->description = $this->compiler->book->parametres->seoDescription ? $this->compiler->book->parametres->seoDescription : $this->compiler->book->parametres->title . ' - Powered by Fluidbook';\r
+ $p->socialDescription = $this->compiler->book->parametres->facebook_description || $this->compiler->book->parametres->seoDescription;\r
+ $p->keywords = $this->compiler->book->parametres->seoKeywords;\r
+ $p->robots = $this->compiler->book->parametres->seoRobots ? 'index,follow' : 'noindex,nofollow';\r
+\r
+ // Google analytics\r
+ $p->ua = '';\r
+ if ($this->compiler->book->parametres->googleAnalytics != '') {\r
+ $codes = explode(',', $this->compiler->book->parametres->googleAnalytics);\r
+ $p->ua .= "<script async src=\"https://www.googletagmanager.com/gtag/js?id=" . $codes[0] . "\"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}</script>";\r
+ }\r
+ if ($this->compiler->book->parametres->googleAnalyticsCustom != '') {\r
+ $p->ua .= $this->compiler->book->parametres->googleAnalyticsCustom;\r
+ }\r
+\r
+ if ($this->compiler->book->parametres->statsCustom != '') {\r
+ $p->footer = $this->compiler->book->parametres->statsCustom;\r
+ }\r
+\r
+ $this->pages[$page] = $p;\r
+ }\r
+\r
public function getTextContent($infos)\r
{\r
switch ($this->compiler->book->parametres->textExtraction) {\r