diff options
| author | polo <contact@ordipolo.fr> | 2025-12-31 00:38:37 +0100 |
|---|---|---|
| committer | polo <contact@ordipolo.fr> | 2025-12-31 00:38:37 +0100 |
| commit | dfed030ca6edf832397d273fbb0ad4b0b5d35877 (patch) | |
| tree | 5122705902ea1040c3cdc79bc7e94a45b7d846c1 | |
| parent | d04bbb05fb2c7f256163aa6fb5b78a670a890401 (diff) | |
| download | cms-dfed030ca6edf832397d273fbb0ad4b0b5d35877.tar.gz cms-dfed030ca6edf832397d273fbb0ad4b0b5d35877.tar.bz2 cms-dfed030ca6edf832397d273fbb0ad4b0b5d35877.zip | |
installation tinymce-i18n (langues) avec composer
| -rw-r--r-- | bin/install_tinymce_lang.php | 36 | ||||
| -rw-r--r-- | composer.json | 7 |
2 files changed, 4 insertions, 39 deletions
diff --git a/bin/install_tinymce_lang.php b/bin/install_tinymce_lang.php deleted file mode 100644 index e76ec91..0000000 --- a/bin/install_tinymce_lang.php +++ /dev/null | |||
| @@ -1,36 +0,0 @@ | |||
| 1 | <?php | ||
| 2 | // bin/install_tinymce_lang.php | ||
| 3 | function installTinymceLang(string $lang = 'fr_FR'): void | ||
| 4 | { | ||
| 5 | $path = 'public/js/tinymce-langs'; | ||
| 6 | $dest = $lang . '.js'; | ||
| 7 | $link = "https://cdn.jsdelivr.net/npm/tinymce-lang/langs/" . $lang . ".min.js"; | ||
| 8 | |||
| 9 | $curl = curl_init($link); | ||
| 10 | if(!$curl){ // lien non valide | ||
| 11 | echo "Erreur : Impossible d'initialiser cURL.\n"; | ||
| 12 | return; | ||
| 13 | } | ||
| 14 | |||
| 15 | if(!is_dir($path)){ | ||
| 16 | mkdir($path, 0755, true); | ||
| 17 | } | ||
| 18 | |||
| 19 | $file = @fopen($path . '/' . $dest, 'w+'); // @masque l'erreur pour la traiter soi-même | ||
| 20 | if(!$file){ // erreur écriture fichier | ||
| 21 | echo "Erreur : Impossible d'ouvrir le fichier $dest pour l'écriture.\n"; | ||
| 22 | return; | ||
| 23 | } | ||
| 24 | |||
| 25 | curl_setopt($curl, CURLOPT_FILE, $file); | ||
| 26 | curl_setopt($curl, CURLOPT_HEADER, 0); | ||
| 27 | |||
| 28 | $response = curl_exec($curl); | ||
| 29 | if(!$response){ // erreur téléchargement | ||
| 30 | echo "Erreur : Le téléchargement a échoué. cURL Error: " . curl_error($curl) . "\n"; | ||
| 31 | } | ||
| 32 | |||
| 33 | fclose($file); | ||
| 34 | curl_close($curl); | ||
| 35 | } | ||
| 36 | installTinymceLang($argv[1]); \ No newline at end of file | ||
diff --git a/composer.json b/composer.json index 8eaccb0..dd8aa9c 100644 --- a/composer.json +++ b/composer.json | |||
| @@ -11,18 +11,19 @@ | |||
| 11 | "phpmailer/phpmailer": "^7.0", | 11 | "phpmailer/phpmailer": "^7.0", |
| 12 | "symfony/http-foundation": "^7.3", | 12 | "symfony/http-foundation": "^7.3", |
| 13 | "twbs/bootstrap-icons": "^1.13", | 13 | "twbs/bootstrap-icons": "^1.13", |
| 14 | "symfony/var-exporter": "^7.0" | 14 | "symfony/var-exporter": "^7.0", |
| 15 | "mklkj/tinymce-i18n": "^25.11" | ||
| 15 | }, | 16 | }, |
| 16 | "scripts": { | 17 | "scripts": { |
| 17 | "post-install-cmd": [ | 18 | "post-install-cmd": [ |
| 18 | "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/copy_directory.php vendor/tinymce/tinymce public/js/tinymce", | 19 | "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/copy_directory.php vendor/tinymce/tinymce public/js/tinymce", |
| 19 | "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/install_tinymce_lang.php fr_FR", | 20 | "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/copy_directory.php vendor/mklkj/tinymce-i18n/langs public/js/tinymce-langs", |
| 20 | "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/install_fullcalendar.php", | 21 | "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/install_fullcalendar.php", |
| 21 | "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/copy_directory.php vendor/twbs/bootstrap-icons/icons public/icons" | 22 | "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/copy_directory.php vendor/twbs/bootstrap-icons/icons public/icons" |
| 22 | ], | 23 | ], |
| 23 | "post-update-cmd": [ | 24 | "post-update-cmd": [ |
| 24 | "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/copy_directory.php vendor/tinymce/tinymce public/js/tinymce", | 25 | "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/copy_directory.php vendor/tinymce/tinymce public/js/tinymce", |
| 25 | "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/install_tinymce_lang.php fr_FR", | 26 | "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/copy_directory.php vendor/mklkj/tinymce-i18n/langs public/js/tinymce-langs", |
| 26 | "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/install_fullcalendar.php", | 27 | "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/install_fullcalendar.php", |
| 27 | "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/copy_directory.php vendor/twbs/bootstrap-icons/icons public/icons" | 28 | "PHP_PATH=${PHP_PATH:-php} && $PHP_PATH bin/copy_directory.php vendor/twbs/bootstrap-icons/icons public/icons" |
| 28 | ] | 29 | ] |
