aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2025-10-30 17:25:32 +0100
committerpolo <ordipolo@gmx.fr>2025-10-30 17:25:32 +0100
commitf33135c5d36d0e747d07773919ae0bc84cbceac1 (patch)
tree35e7e72ab7bdc857346678270030640e561a37e6
parent07f4cf1635795a90dbd8f83e0668543b9a3ad59b (diff)
downloadcms-f33135c5d36d0e747d07773919ae0bc84cbceac1.tar.gz
cms-f33135c5d36d0e747d07773919ae0bc84cbceac1.tar.bz2
cms-f33135c5d36d0e747d07773919ae0bc84cbceac1.zip
fichier de langue à jour téléchargé avec php-cli
-rw-r--r--.gitignore3
-rw-r--r--bin/install_tinymce_lang.php31
-rw-r--r--composer.json6
-rw-r--r--public/js/tinymce.js4
4 files changed, 37 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index 0d17bbc..e612f8c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,7 @@
1vendor/ 1vendor/
2node_modules/ 2config/config.ini
3public/js/tinymce/ 3public/js/tinymce/
4public/js/tinymce-langs/ 4public/js/tinymce-langs/
5config/config.ini
6public/user_data/ 5public/user_data/
7public/images/ 6public/images/
8public/images-mini/ 7public/images-mini/
diff --git a/bin/install_tinymce_lang.php b/bin/install_tinymce_lang.php
new file mode 100644
index 0000000..4950cc1
--- /dev/null
+++ b/bin/install_tinymce_lang.php
@@ -0,0 +1,31 @@
1<?php
2// bin/install_tinymce_lang.php
3function installTinymceLang(string $lang = 'fr_FR'): void
4{
5 $dest = 'public/js/tinymce-langs/' . $lang . '.js';
6 $link = "https://cdn.jsdelivr.net/npm/tinymce-lang/langs/" . $lang . ".min.js";
7
8 $curl = curl_init($link);
9 if(!$curl){ // lien non valide
10 echo "Erreur : Impossible d'initialiser cURL.\n";
11 return;
12 }
13
14 $file = @fopen($dest, 'w+'); // @masque l'erreur pour la traiter soi-même
15 if(!$file){ // erreur écriture fichier
16 echo "Erreur : Impossible d'ouvrir le fichier $dest pour l'écriture.\n";
17 return;
18 }
19
20 curl_setopt($curl, CURLOPT_FILE, $file);
21 curl_setopt($curl, CURLOPT_HEADER, 0);
22
23 $response = curl_exec($curl);
24 if(!$response){ // erreur téléchargement
25 echo "Erreur : Le téléchargement a échoué. cURL Error: " . curl_error($curl) . "\n";
26 }
27
28 fclose($file);
29 curl_close($curl);
30}
31installTinymceLang($argv[1]); \ No newline at end of file
diff --git a/composer.json b/composer.json
index 8e8a6e8..5435c0e 100644
--- a/composer.json
+++ b/composer.json
@@ -8,18 +8,18 @@
8 "composer": "*", 8 "composer": "*",
9 "htmlawed/htmlawed": "^1.2", 9 "htmlawed/htmlawed": "^1.2",
10 "tinymce/tinymce": "^7.7", 10 "tinymce/tinymce": "^7.7",
11 "tweeb/tinymce-i18n": "^2.0",
12 "phpmailer/phpmailer": "^6.10", 11 "phpmailer/phpmailer": "^6.10",
13 "symfony/http-foundation": "^7.3" 12 "symfony/http-foundation": "^7.3"
14 }, 13 },
15 "scripts": { 14 "scripts": {
16 "post-install-cmd": [ 15 "post-install-cmd": [
17 "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/copy_directory.php vendor/tinymce/tinymce public/js/tinymce", 16 "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/copy_directory.php vendor/tinymce/tinymce public/js/tinymce",
18 "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/copy_directory.php vendor/tweeb/tinymce-i18n/langs public/js/tinymce-langs" 17 "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/install_tinymce_lang.php fr_FR"
18
19 ], 19 ],
20 "post-update-cmd": [ 20 "post-update-cmd": [
21 "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/copy_directory.php vendor/tinymce/tinymce public/js/tinymce", 21 "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/copy_directory.php vendor/tinymce/tinymce public/js/tinymce",
22 "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/copy_directory.php vendor/tweeb/tinymce-i18n/langs public/js/tinymce-langs" 22 "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/install_tinymce_lang.php fr_FR"
23 ] 23 ]
24 }, 24 },
25 "authors": [ 25 "authors": [
diff --git a/public/js/tinymce.js b/public/js/tinymce.js
index d2f9c46..a187189 100644
--- a/public/js/tinymce.js
+++ b/public/js/tinymce.js
@@ -107,8 +107,8 @@ class Editor
107 init(){ 107 init(){
108 tinymce.init({ 108 tinymce.init({
109 selector: `[id="${this.id}"]`, // écrire [id="246"] au lieu de #246 parce que l'id commence par un chiffre 109 selector: `[id="${this.id}"]`, // écrire [id="246"] au lieu de #246 parce que l'id commence par un chiffre
110 language: 'fr_FR', // téléchargement ici: https://www.tiny.cloud/get-tiny/language-packages/ 110 language: 'fr_FR',
111 language_url: 'js/tinymce-langs/fr_FR.js', // ou installer tweeb/tinymce-i18n avec composer 111 language_url: 'js/tinymce-langs/fr_FR.js', // téléchargement ici: https://cdn.jsdelivr.net/npm/tinymce-lang/langs/fr_FR.min.js
112 license_key: 'gpl', 112 license_key: 'gpl',
113 branding: false, 113 branding: false,
114 plugins: 'lists link autolink table image media autoresize help', 114 plugins: 'lists link autolink table image media autoresize help',