$this->fields['seoDescription'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('Meta tag Description'));
$this->fields['seoKeywords'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('Meta tag Keywords'));
$this->fields['seoAdvanced'] = ['type' => 'freefile', 'default' => '', 'editable' => true, 'label' => __('Données SEO par page'), 'grade' => 5, 'fileFilter' => $seoFilter];
+ $this->fields['seoBaseURL'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('URL de base'), 'grade' => 5, 'hint' => __("Si l'authentification échoue, redirection vers cette adresse"));
$this->forms['seo'] = array('label' => __('Optimisation pour les moteurs de recherche'),
- 'fieldsnames' => array('seoVersion', 'seoRobots', 'seoDescription', "seoKeywords", '|', 'seoAdvanced'));
+ 'fieldsnames' => array('seoVersion', 'seoRobots', 'seoDescription', "seoKeywords", '|', 'seoBaseURL', 'seoAdvanced'));
$this->fields['home'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Accueil de l'interface multibrochure"), 'grade' => 5);
$this->fields['multilang'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('Langues'), 'hint' => __('Code langue') . ',' . __('Code pays') . ',' . __('URL'));
$this->log('Langs written');
$this->writeSEO();
$this->writeIndex();
+ $this->writeWidget();
$this->log('Index written');
$this->writeSounds();
$this->log('Sound written');
$this->vdir->copyDirectory(WS_SOUNDS . '/' . $this->book->parametres->soundTheme, 'data/sounds');
}
- protected function writeIndex()
+ protected function _writeIndex($page)
{
global $core;
- $html = $this->seo->pages[1]->getHTML();
- $uhtml = $html;
+ $seo = $this->seo->pages[$page];
+ $html = $seo->getHTML();
$titre = $this->book->parametres->title;
$iscript .= '</script>' . "\n";
}
- $script = '';
+ $script = '<script type="text/javascript">var FLUIDBOOK_START_PAGE="' . $page . '";</script>' . "\n";
$script .= '<script type="text/javascript" charset="utf-8" src="data/datas.js"></script>' . "\n";
$script .= '<script type="text/javascript" charset="utf-8" src="data/fluidbook.js"></script>' . "\n";
if ($this->book->parametres->scorm_enable) {
}
}
- $scripts = array();
- foreach ($this->debugJsFiles as $js) {
- $scripts[] = '<script type="text/javascript" charset="utf-8" src="' . $js . '"></script>';
- }
- foreach ($this->jsFiles as $js) {
- $scripts[] = '<script type="text/javascript" charset="utf-8" src="' . $js . '"></script>';
- }
- foreach ($this->pluginJs as $js) {
- $scripts[] = '<script type="text/javascript" charset="utf-8" src="' . $js . '"></script>';
- }
-
- $scripts[] = '<script type="text/javascript" charset="utf-8" src="data/datas.js"></script>';
- $scripts[] = $iscript;
- $script = implode("\n\t\t", $scripts);
-
- $scripts = array();
- foreach ($this->testJsFiles as $js) {
- $scripts[] = '<script type="text/javascript" charset="utf-8" src="' . $js . '"></script>';
- }
- $scripts[] = '<script type="text/javascript" charset="utf-8" src="data/datas.js"></script>';
- $script_test = implode("\n\t\t", $scripts);
-
- $thtml = $uhtml;
-
- $vars = array('credits', 'style', 'script', 'pagesContents', 'print', 'hiddenContents', 'splash', 'cache', 'bgcolor', 'message', 'favicon');
- foreach ($vars as $v) {
- $uhtml = str_replace('<!-- $' . $v . ' -->', $$v, $uhtml);
+ $seo->writePage($html, $this->vdir);
+ if ($page == 1) {
+ $seo->writePage($html, $this->vdir, 'index.html');
}
+ }
- $script .= "\n\t\t" . '<script type="text/javascript" charset="utf-8">window.tester = true;</script>';
- $vars = array('credits', 'style', 'script', 'print', 'hiddenContents', 'splash', 'message');
- foreach ($vars as $v) {
- $thtml = str_replace('<!-- $' . $v . ' -->', $$v, $thtml);
+ protected function writeIndex()
+ {
+ foreach ($this->pages as $page => $infos) {
+ $this->_writeIndex($page);
}
+ }
- $this->vdir->file_put_contents('index.html', $html);
- $this->vdir->file_put_contents('indexu.html', $uhtml);
- $this->vdir->file_put_contents('indext.html', $thtml);
-
+ protected function writeWidget()
+ {
// Write widget html
if ($this->widget) {
$whtml = file_get_contents($this->assets . '/widget.html');
$compiler = $this->_container->compiler;\r
$html = file_get_contents($this->_container->compiler->assets . '/_index.html');\r
\r
-\r
$vars = ['description' => $this->description ? '<meta name="description" content="' . $this->description . '">' : '',\r
'keywords' => $this->keywords ? '<meta name="keywords" content="' . $this->keywords . '">' : '',\r
'titre' => $this->title,\r
public function getURL()\r
{\r
if (null === $this->url) {\r
- return $this->page . '-' . CubeIT_Text::str2URL($this->title);\r
+ return $this->page . '-' . CubeIT_Text::str2URL($this->title) . '.html';\r
}\r
return $this->url;\r
}\r
+\r
+ public function getHTMLRelativePath()\r
+ {\r
+ $url = $this->getURL();\r
+ if (null == $this->url) {\r
+ $res = 'p/' . $url;\r
+ }\r
+\r
+ if ($this->_container->compiler->book->parametres->seoBaseURL == '') {\r
+ $res = $url;\r
+ } else {\r
+ $res = str_replace($this->_container->compiler->book->parametres->seoBaseURL, '', $url);\r
+ }\r
+\r
+ return ltrim($res, '/');\r
+ }\r
+\r
+ /**\r
+ * @param string $html\r
+ * @param CubeIT_Files_VirtualDirectory $vdir\r
+ * @param null|string $path\r
+ */\r
+ public function writePage($html, $vdir, $path = null)\r
+ {\r
+ if ($path == null) {\r
+ $path = $this->getHTMLRelativePath();\r
+ }\r
+ $relativeLevel = count(explode('/', rtrim($path, "/"))) - 1;\r
+ $base = '';\r
+ if ($relativeLevel > 0) {\r
+ $base = '<base href="' . str_repeat('../', $relativeLevel) . '" >';\r
+ }\r
+ $html = str_replace('<!-- $base -->', $base, $html);\r
+\r
+ $vdir->file_put_contents($path, $html);\r
+ }\r
}
\ No newline at end of file