$this->fields['product_tweet'] = array('type' => 'textarea', 'default' => '%short%', 'editable' => true, 'label' => __("Contenu Partage court"), 'hint' => __('Contenu du partagé sur les partages courts'));
$this->forms['product_zoom'] = ['label' => __('Zooms produits'), 'fieldsnames' => array_merge(["product_zoom_references", '|', 'product_zoom_buttons_order'], $f, ['|', 'product_share_enabled', 'product_share_link', 'product_email_title', 'product_email_body', 'product_tweet'])];
- $this->fields['audiodescriptionTexts'] = ['type' => 'freefile', 'default' => '', 'editable' => true, 'label' => __('Contenus textuels pour l\'audiodescription'), 'fileFilter' => $seoFilter];
- $this->fields['audiodescriptionVoice'] = ['type' => 'combo', 'datas' => wsDroits::getTTSVoices(), 'editable' => true, 'default' => true, 'label' => __('Voix pour l\'audiodescription')];
+ $this->fields['audiodescriptionTexts'] = ['type' => 'freefile', 'default' => '', 'editable' => true, 'label' => __('Contenus textuels pour l\'audiodescription ou les lecteurs d\'écran'), 'fileFilter' => $seoFilter];
+ $this->fields['audiodescriptionVoice'] = ['type' => 'combo', 'datas' => wsDroits::getTTSVoices(), 'editable' => true, 'default' => '', 'label' => __('Voix pour l\'audiodescription')];
$this->forms['accessibility'] = ['label' => __('Accessibilité'),
'fieldsnames' => ['audiodescriptionTexts', 'audiodescriptionVoice']
];
$this->forms['downloads'] = array('label' => __('Versions disponibles au téléchargement'),
'fieldsnames' => $fields);
-
-
}
-
}
protected function writeAccessibility()
{
- if ($this->book->parametres->audiodescriptionTexts == '' || $this->book->parametres->audiodescriptionVoice == '') {
+ if (!$this->book->parametres->audiodescriptionTexts) {
return;
}
$file = $this->wdir . '/' . $this->book->parametres->audiodescriptionTexts;
$text = str_replace(array_keys($replace), array_values($replace), $text);
- $hash = hash('sha256', $this->book->parametres->audiodescriptionVoice . '_^_' . $text);
- $fname = $hash . '.mp3';
- $dir = WS_BOOKS . '/audiodescription/';
- if (!file_exists($dir)) {
- mkdir($dir, 0777, true);
- }
+ if( $this->book->parametres->audiodescriptionVoice) {
+ $hash = hash('sha256', $this->book->parametres->audiodescriptionVoice . '_^_' . $text);
+ $fname = $hash . '.mp3';
+ $dir = WS_BOOKS . '/audiodescription/';
+ if (!file_exists($dir)) {
+ mkdir($dir, 0777, true);
+ }
- $file = $dir . $fname;
- if (!file_exists($file)) {
- $e = explode(':', $this->book->parametres->audiodescriptionVoice);
+ $file = $dir . $fname;
+ if (!file_exists($file)) {
+ $e = explode(':', $this->book->parametres->audiodescriptionVoice);
- $engine = $e[0];
- $voice = $e[1];
+ $engine = $e[0];
+ $voice = $e[1];
- if ($engine == 'festival') {
- $tmp = CubeIT_Files::tempnam() . '.wav';
- $tmptext = CubeIT_Files::tempnam() . '.txt';
+ if ($engine == 'festival') {
+ $tmp = CubeIT_Files::tempnam() . '.wav';
+ $tmptext = CubeIT_Files::tempnam() . '.txt';
- file_put_contents($tmptext, $text);
- $cmd = "text2wave -o $tmp $tmptext -eval \"($voice)\"";
- `$cmd`;
+ file_put_contents($tmptext, $text);
+ $cmd = "text2wave -o $tmp $tmptext -eval \"($voice)\"";
+ `$cmd`;
- `lame $tmp $file`;
- unlink($tmp);
- unlink($tmptext);
- } else if ($engine == 'readspeaker') {
- $e = explode('/', $voice);
- $this->_readSpeaker($text, $e[1], $e[0], $file);
+ `lame $tmp $file`;
+ unlink($tmp);
+ unlink($tmptext);
+ } else if ($engine == 'readspeaker') {
+ $e = explode('/', $voice);
+ $this->_readSpeaker($text, $e[1], $e[0], $file);
+ }
}
- }
- $this->config->audiodescription[$page] = $fname;
- $this->vdir->copy($file, 'data/audiodescription/' . $fname);
+ $this->config->audiodescription[$page] = $fname;
+ $this->vdir->copy($file, 'data/audiodescription/' . $fname);
+ }
}
}