5 Commits
V2 ... v2.1

Author SHA1 Message Date
db9f05f6f6 installation de motranslator
via Composer
2024-12-13 06:44:07 +01:00
3ee1a9eaf6 Mise à jour des localisations
-spanish, german, french
2024-12-13 06:42:00 +01:00
f056c8a9a0 Bugfix
-bugfix
-use ngettext for plurals
2024-12-12 10:16:51 +01:00
9665a355be bugfix 2024-12-12 08:09:34 +01:00
4c22f27eb6 delete.php
-efface des fichiers dans la base et les fichiers sur le serveur.
2024-12-11 18:03:53 +01:00
267 changed files with 32936 additions and 1192 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
.

Binary file not shown.

View File

@@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: sur-le-sentier.fr\n" "Project-Id-Version: sur-le-sentier.fr\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-10 10:29+0100\n" "POT-Creation-Date: 2024-12-12 16:31+0100\n"
"PO-Revision-Date: 2024-12-10 10:29+0100\n" "PO-Revision-Date: 2024-12-12 16:32+0100\n"
"Last-Translator: Bruno <bruno@clicclac.info>\n" "Last-Translator: Bruno <bruno@clicclac.info>\n"
"Language-Team: French <bruno@clicclac.info>\n" "Language-Team: French <bruno@clicclac.info>\n"
"Language: fr\n" "Language: fr\n"
@@ -17,7 +17,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Poedit 3.5\n" "X-Generator: Poedit 3.5\n"
"X-Poedit-KeywordsList: gettext;_\n" "X-Poedit-KeywordsList: gettext;_;__\n"
"X-Poedit-Basepath: ../../..\n" "X-Poedit-Basepath: ../../..\n"
"X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-SearchPath-0: .\n" "X-Poedit-SearchPath-0: .\n"
@@ -47,29 +47,29 @@ msgid "Sign In"
msgstr "Se connecter" msgstr "Se connecter"
#: 1-login.php:33 admin.php:69 avif/avif.php:167 clean_bdd.php:721 #: 1-login.php:33 admin.php:69 avif/avif.php:167 clean_bdd.php:721
#: edit_bdd.php:141 insert_bdd.php:527 insert_bdd.php:710 maps.php:186 #: delete_bdd.php:214 edit_bdd.php:135 insert_bdd.php:527 insert_bdd.php:710
#: modify_bdd.php:240 photo-du-mois.php:321 requests.php:230 view_bdd.php:231 #: maps.php:186 modify_bdd.php:240 photo-du-mois.php:321 requests.php:230
#: view_bdd2.php:429 #: view_bdd.php:236 view_bdd2.php:434
msgid "Home" msgid "Home"
msgstr "Accueil" msgstr "Accueil"
#: 1-login.php:33 admin.php:69 avif/avif.php:14 avif/avif.php:27 #: 1-login.php:33 admin.php:69 avif/avif.php:14 avif/avif.php:27
#: clean_bdd.php:721 edit_bdd.php:141 insert_bdd.php:527 insert_bdd.php:710 #: clean_bdd.php:721 delete_bdd.php:214 edit_bdd.php:135 insert_bdd.php:527
#: maps.php:186 modify_bdd.php:240 photo-du-mois.php:29 requests.php:230 #: insert_bdd.php:710 maps.php:186 modify_bdd.php:240 photo-du-mois.php:29
#: view_bdd.php:231 view_bdd2.php:429 #: requests.php:230 view_bdd.php:236 view_bdd2.php:434
msgid "Picture of the month" msgid "Picture of the month"
msgstr "Photo du mois" msgstr "Photo du mois"
#: 1-login.php:33 admin.php:69 avif/avif.php:167 clean_bdd.php:721 #: 1-login.php:33 admin.php:69 avif/avif.php:167 clean_bdd.php:721
#: edit_bdd.php:141 insert_bdd.php:527 insert_bdd.php:710 maps.php:14 #: delete_bdd.php:214 edit_bdd.php:135 insert_bdd.php:527 insert_bdd.php:710
#: maps.php:39 modify_bdd.php:240 photo-du-mois.php:321 requests.php:230 #: maps.php:14 maps.php:39 modify_bdd.php:240 photo-du-mois.php:321
#: view_bdd.php:231 view_bdd2.php:429 #: requests.php:230 view_bdd.php:236 view_bdd2.php:434
msgid "Maps" msgid "Maps"
msgstr "Carte" msgstr "Carte"
#: 1-login.php:33 admin.php:69 clean_bdd.php:721 edit_bdd.php:141 #: 1-login.php:33 admin.php:69 clean_bdd.php:721 delete_bdd.php:214
#: insert_bdd.php:710 modify_bdd.php:240 requests.php:230 view_bdd.php:231 #: edit_bdd.php:135 insert_bdd.php:710 modify_bdd.php:240 requests.php:230
#: view_bdd2.php:429 #: view_bdd.php:236 view_bdd2.php:434
msgid "Admin page" msgid "Admin page"
msgstr "Page administrateur" msgstr "Page administrateur"
@@ -89,32 +89,32 @@ msgstr "Page: "
#: _test/photo-du-mois _2.php:328 _test/photo-du-mois-lc-lite.php:253 #: _test/photo-du-mois _2.php:328 _test/photo-du-mois-lc-lite.php:253
#: _test/photo-du-mois-ng.php:196 _test/photo-du-mois-ps.php:241 #: _test/photo-du-mois-ng.php:196 _test/photo-du-mois-ps.php:241
#: ovh/ce-mois.php:665 photo-du-mois.php:308 view_bdd2.php:413 #: ovh/ce-mois.php:665 photo-du-mois.php:308 view_bdd2.php:418
msgid "Previous Page" msgid "Previous Page"
msgstr "Page précédente" msgstr "Page précédente"
#: _test/photo-du-mois _2.php:328 _test/photo-du-mois-lc-lite.php:253 #: _test/photo-du-mois _2.php:328 _test/photo-du-mois-lc-lite.php:253
#: _test/photo-du-mois-ng.php:196 _test/photo-du-mois-ps.php:241 #: _test/photo-du-mois-ng.php:196 _test/photo-du-mois-ps.php:241
#: ovh/ce-mois.php:665 photo-du-mois.php:308 view_bdd2.php:413 #: ovh/ce-mois.php:665 photo-du-mois.php:308 view_bdd2.php:418
msgid "prev" msgid "prev"
msgstr "prec" msgstr "prec"
#: _test/photo-du-mois _2.php:331 _test/photo-du-mois-lc-lite.php:256 #: _test/photo-du-mois _2.php:331 _test/photo-du-mois-lc-lite.php:256
#: _test/photo-du-mois-ng.php:199 _test/photo-du-mois-ps.php:244 #: _test/photo-du-mois-ng.php:199 _test/photo-du-mois-ps.php:244
#: ovh/ce-mois.php:668 photo-du-mois.php:307 photo-du-mois.php:311 #: ovh/ce-mois.php:668 photo-du-mois.php:307 photo-du-mois.php:311
#: view_bdd2.php:412 view_bdd2.php:416 #: view_bdd2.php:417 view_bdd2.php:421
msgid "Page" msgid "Page"
msgstr "Page" msgstr "Page"
#: _test/photo-du-mois _2.php:337 _test/photo-du-mois-lc-lite.php:262 #: _test/photo-du-mois _2.php:337 _test/photo-du-mois-lc-lite.php:262
#: _test/photo-du-mois-ng.php:205 _test/photo-du-mois-ps.php:250 #: _test/photo-du-mois-ng.php:205 _test/photo-du-mois-ps.php:250
#: ovh/ce-mois.php:674 photo-du-mois.php:317 view_bdd2.php:422 #: ovh/ce-mois.php:674 photo-du-mois.php:317 view_bdd2.php:427
msgid "Next Page" msgid "Next Page"
msgstr "Page suivante" msgstr "Page suivante"
#: _test/photo-du-mois _2.php:337 _test/photo-du-mois-lc-lite.php:262 #: _test/photo-du-mois _2.php:337 _test/photo-du-mois-lc-lite.php:262
#: _test/photo-du-mois-ng.php:205 _test/photo-du-mois-ps.php:250 #: _test/photo-du-mois-ng.php:205 _test/photo-du-mois-ps.php:250
#: ovh/ce-mois.php:674 photo-du-mois.php:317 view_bdd2.php:422 #: ovh/ce-mois.php:674 photo-du-mois.php:317 view_bdd2.php:427
msgid "next" msgid "next"
msgstr "suiv" msgstr "suiv"
@@ -130,8 +130,37 @@ msgstr "Etat: "
msgid " logged in" msgid " logged in"
msgstr " connecté" msgstr " connecté"
#: avif/picture.php:18 edit_bdd.php:55 modify_bdd.php:157 requests.php:14 #: admin.php:45 view_bdd.php:119 view_bdd.php:173 view_bdd2.php:298
#: view_bdd.php:52 view_bdd2.php:98 #: view_bdd2.php:324
msgid "Edit"
msgstr "Editer"
#: admin.php:46
msgid "Insert"
msgstr "Insérer"
#: admin.php:47
msgid "Modify"
msgstr "Modifier"
#: admin.php:48
msgid "View (Ajax)"
msgstr "Voir (Ajax)"
#: admin.php:49
msgid "View"
msgstr "Voir"
#: admin.php:50
msgid "Clean"
msgstr "Nettoyer"
#: admin.php:56 view_bdd.php:234 view_bdd2.php:432
msgid "Log out"
msgstr "Déconnexion"
#: avif/picture.php:18 delete_bdd.php:117 edit_bdd.php:49 modify_bdd.php:157
#: requests.php:14 view_bdd.php:55 view_bdd2.php:98
msgid "View photos in Sqlite base" msgid "View photos in Sqlite base"
msgstr "Voir les photos dans la base Sqlite" msgstr "Voir les photos dans la base Sqlite"
@@ -277,8 +306,8 @@ msgstr "Lumière tungstène"
msgid "Fluorescent" msgid "Fluorescent"
msgstr "Lumière fluo blanche" msgstr "Lumière fluo blanche"
#: clean_bdd.php:399 clean_bdd.php:692 edit_bdd.php:94 functions.php:459 #: clean_bdd.php:399 clean_bdd.php:692 delete_bdd.php:154 edit_bdd.php:88
#: insert_bdd.php:322 modify_bdd.php:196 view_bdd2.php:302 #: functions.php:459 insert_bdd.php:322 modify_bdd.php:196 view_bdd2.php:306
msgid "Flash" msgid "Flash"
msgstr "Utilisation du flash" msgstr "Utilisation du flash"
@@ -302,12 +331,12 @@ msgstr "Température de couleur (Kelvin)"
msgid "Manual" msgid "Manual"
msgstr "Exposition manuelle" msgstr "Exposition manuelle"
#: clean_bdd.php:423 clean_bdd.php:693 edit_bdd.php:92 functions.php:455 #: clean_bdd.php:423 clean_bdd.php:693 delete_bdd.php:152 edit_bdd.php:86
#: insert_bdd.php:285 modify_bdd.php:194 view_bdd2.php:302 #: functions.php:455 insert_bdd.php:285 modify_bdd.php:194 view_bdd2.php:306
msgid "Program" msgid "Program"
msgstr "Programme" msgstr "Programme"
#: clean_bdd.php:425 #: clean_bdd.php:425 translator.php:28 translator_gettext.php:16
msgid "Aperture Priority" msgid "Aperture Priority"
msgstr "Priorité ouverture" msgstr "Priorité ouverture"
@@ -335,13 +364,13 @@ msgstr "Paysage"
msgid "Reading added photos" msgid "Reading added photos"
msgstr "Lecture des photos ajoutées" msgstr "Lecture des photos ajoutées"
#: clean_bdd.php:692 edit_bdd.php:91 modify_bdd.php:193 view_bdd.php:148 #: clean_bdd.php:692 delete_bdd.php:151 edit_bdd.php:85 modify_bdd.php:193
#: view_bdd2.php:300 #: view_bdd.php:152 view_bdd2.php:304
msgid "Thumb" msgid "Thumb"
msgstr "Vignette" msgstr "Vignette"
#: clean_bdd.php:692 edit_bdd.php:91 modify_bdd.php:193 view_bdd.php:149 #: clean_bdd.php:692 delete_bdd.php:151 edit_bdd.php:85 modify_bdd.php:193
#: view_bdd2.php:300 #: view_bdd.php:153 view_bdd2.php:304
msgid "Filename" msgid "Filename"
msgstr "Fichier" msgstr "Fichier"
@@ -349,23 +378,23 @@ msgstr "Fichier"
msgid "File size" msgid "File size"
msgstr "Taille fichier" msgstr "Taille fichier"
#: clean_bdd.php:692 edit_bdd.php:91 functions.php:446 modify_bdd.php:193 #: clean_bdd.php:692 delete_bdd.php:151 edit_bdd.php:85 functions.php:446
#: view_bdd2.php:300 #: modify_bdd.php:193 view_bdd2.php:304
msgid "Date" msgid "Date"
msgstr "Date" msgstr "Date"
#: clean_bdd.php:692 edit_bdd.php:92 functions.php:451 modify_bdd.php:194 #: clean_bdd.php:692 delete_bdd.php:152 edit_bdd.php:86 functions.php:451
#: view_bdd.php:156 view_bdd2.php:300 #: modify_bdd.php:194 view_bdd.php:160 view_bdd2.php:304
msgid "Lens" msgid "Lens"
msgstr "Objectif" msgstr "Objectif"
#: clean_bdd.php:692 edit_bdd.php:91 functions.php:447 modify_bdd.php:193 #: clean_bdd.php:692 delete_bdd.php:151 edit_bdd.php:85 functions.php:447
#: view_bdd.php:151 view_bdd2.php:300 #: modify_bdd.php:193 view_bdd.php:155 view_bdd2.php:304
msgid "Speed" msgid "Speed"
msgstr "Vitesse" msgstr "Vitesse"
#: clean_bdd.php:692 edit_bdd.php:91 functions.php:448 modify_bdd.php:193 #: clean_bdd.php:692 delete_bdd.php:151 edit_bdd.php:85 functions.php:448
#: view_bdd.php:153 view_bdd2.php:300 #: modify_bdd.php:193 view_bdd.php:157 view_bdd2.php:304
msgid "Aperture" msgid "Aperture"
msgstr "Ouverture" msgstr "Ouverture"
@@ -373,23 +402,23 @@ msgstr "Ouverture"
msgid "Exposure Corr." msgid "Exposure Corr."
msgstr "Correction dexpo." msgstr "Correction dexpo."
#: clean_bdd.php:692 edit_bdd.php:91 functions.php:449 modify_bdd.php:193 #: clean_bdd.php:692 delete_bdd.php:151 edit_bdd.php:85 functions.php:449
#: view_bdd2.php:300 #: modify_bdd.php:193 view_bdd2.php:304
msgid "Iso" msgid "Iso"
msgstr "ISO" msgstr "ISO"
#: clean_bdd.php:692 edit_bdd.php:92 functions.php:450 modify_bdd.php:194 #: clean_bdd.php:692 delete_bdd.php:152 edit_bdd.php:86 functions.php:450
#: view_bdd.php:155 view_bdd2.php:301 #: modify_bdd.php:194 view_bdd.php:159 view_bdd2.php:305
msgid "Model" msgid "Model"
msgstr "APN" msgstr "APN"
#: clean_bdd.php:692 edit_bdd.php:92 functions.php:454 modify_bdd.php:194 #: clean_bdd.php:692 delete_bdd.php:152 edit_bdd.php:86 functions.php:454
#: view_bdd.php:158 view_bdd2.php:302 #: modify_bdd.php:194 view_bdd.php:162 view_bdd2.php:306
msgid "Metering" msgid "Metering"
msgstr "Mesure" msgstr "Mesure"
#: clean_bdd.php:693 edit_bdd.php:92 functions.php:452 modify_bdd.php:194 #: clean_bdd.php:693 delete_bdd.php:152 edit_bdd.php:86 functions.php:452
#: view_bdd.php:157 view_bdd2.php:302 #: modify_bdd.php:194 view_bdd.php:161 view_bdd2.php:306
msgid "Focal" msgid "Focal"
msgstr "Focale" msgstr "Focale"
@@ -401,41 +430,45 @@ msgstr "Balance des blancs"
msgid "Mode" msgid "Mode"
msgstr "Mode" msgstr "Mode"
#: clean_bdd.php:693 edit_bdd.php:94 functions.php:461 modify_bdd.php:196 #: clean_bdd.php:693 delete_bdd.php:154 edit_bdd.php:88 functions.php:461
#: view_bdd.php:161 #: modify_bdd.php:196 view_bdd.php:165
msgid "Software" msgid "Software"
msgstr "Logiciel" msgstr "Logiciel"
#: clean_bdd.php:693 view_bdd2.php:301 #: clean_bdd.php:693 view_bdd2.php:305
msgid "Latitude" msgid "Latitude"
msgstr "Latitude" msgstr "Latitude"
#: clean_bdd.php:693 view_bdd2.php:301 #: clean_bdd.php:693 view_bdd2.php:305
msgid "Longitude" msgid "Longitude"
msgstr "Longitude" msgstr "Longitude"
#: clean_bdd.php:693 view_bdd2.php:301 #: clean_bdd.php:693 view_bdd2.php:305
msgid "Alttitude" msgid "Alttitude"
msgstr "Alttitude" msgstr "Alttitude"
#: clean_bdd.php:693 edit_bdd.php:94 functions.php:462 modify_bdd.php:196 #: clean_bdd.php:693 delete_bdd.php:154 edit_bdd.php:88 functions.php:462
#: view_bdd2.php:302 #: modify_bdd.php:196 view_bdd2.php:306
msgid "Keywords" msgid "Keywords"
msgstr "Mots-clés" msgstr "Mots-clés"
#: clean_bdd.php:693 edit_bdd.php:94 modify_bdd.php:196 view_bdd2.php:301 #: clean_bdd.php:693 delete_bdd.php:154 edit_bdd.php:88 modify_bdd.php:196
#: view_bdd2.php:305
msgid "Title" msgid "Title"
msgstr "Titre" msgstr "Titre"
#: clean_bdd.php:693 edit_bdd.php:94 modify_bdd.php:196 view_bdd2.php:302 #: clean_bdd.php:693 delete_bdd.php:154 edit_bdd.php:88 modify_bdd.php:196
#: view_bdd2.php:306
msgid "Creator" msgid "Creator"
msgstr "Créateur" msgstr "Créateur"
#: clean_bdd.php:694 edit_bdd.php:94 functions.php:465 modify_bdd.php:196 #: clean_bdd.php:694 delete_bdd.php:154 edit_bdd.php:88 functions.php:465
#: modify_bdd.php:196
msgid "City" msgid "City"
msgstr "Ville" msgstr "Ville"
#: clean_bdd.php:694 edit_bdd.php:94 functions.php:466 modify_bdd.php:196 #: clean_bdd.php:694 delete_bdd.php:154 edit_bdd.php:88 functions.php:466
#: modify_bdd.php:196
msgid "Department" msgid "Department"
msgstr "Departement" msgstr "Departement"
@@ -443,48 +476,90 @@ msgstr "Departement"
msgid "CP" msgid "CP"
msgstr "CP" msgstr "CP"
#: clean_bdd.php:694 edit_bdd.php:94 functions.php:468 modify_bdd.php:196 #: clean_bdd.php:694 delete_bdd.php:154 edit_bdd.php:88 functions.php:468
#: modify_bdd.php:196
msgid "Country" msgid "Country"
msgstr "Etat" msgstr "Etat"
#: clean_bdd.php:694 edit_bdd.php:94 functions.php:463 modify_bdd.php:196 #: clean_bdd.php:694 delete_bdd.php:154 edit_bdd.php:88 functions.php:463
#: view_bdd2.php:301 #: modify_bdd.php:196 view_bdd2.php:305
msgid "Copyright" msgid "Copyright"
msgstr "Copyright" msgstr "Copyright"
#: clean_bdd.php:694 edit_bdd.php:94 modify_bdd.php:196 view_bdd2.php:301 #: clean_bdd.php:694 delete_bdd.php:154 edit_bdd.php:88 modify_bdd.php:196
#: view_bdd2.php:305
msgid "Legende" msgid "Legende"
msgstr "Légende" msgstr "Légende"
#: edit_bdd.php:27 edit_bdd.php:32 #: delete_bdd.php:39 delete_bdd.php:93 delete_bdd.php:100 edit_bdd.php:27
#: edit_bdd.php:32
msgid "No images select !" msgid "No images select !"
msgstr "Aucune image sélectionnée !" msgstr "Aucune image sélectionnée !"
#: edit_bdd.php:37 #: delete_bdd.php:68
#, php-format
msgid "File %s doesn't exist !"
msgstr "Fichier: %s supprimé !"
#: delete_bdd.php:85
#, php-format
msgid "File: %s deleted!"
msgstr "Fichier: %s supprimé!"
#: delete_bdd.php:105 edit_bdd.php:37
msgid "Please log in !" msgid "Please log in !"
msgstr "Veuillez-vous connecter !" msgstr "Veuillez-vous connecter !"
#: edit_bdd.php:76 #: delete_bdd.php:136
msgid "Edit database" msgid "Suppress images "
msgstr "Editer la base" msgstr "Supprimer images "
#: edit_bdd.php:91 modify_bdd.php:193 view_bdd2.php:300 #: delete_bdd.php:151 edit_bdd.php:85 modify_bdd.php:193 view_bdd2.php:304
msgid "Id" msgid "Id"
msgstr "Id" msgstr "Id"
#: edit_bdd.php:91 modify_bdd.php:193 #: delete_bdd.php:151 edit_bdd.php:85 modify_bdd.php:193
msgid "Expo. correct" msgid "Expo. correct"
msgstr "Correction dexpo." msgstr "Correction dexpo."
#: edit_bdd.php:92 modify_bdd.php:194 view_bdd2.php:302 #: delete_bdd.php:152 edit_bdd.php:86 modify_bdd.php:194 view_bdd2.php:306
msgid "Wb" msgid "Wb"
msgstr "BdB" msgstr "BdB"
#: edit_bdd.php:94 modify_bdd.php:196 #: delete_bdd.php:154 edit_bdd.php:88 modify_bdd.php:196
msgid "Code" msgid "Code"
msgstr "Code" msgstr "Code"
#: edit_bdd.php:130 #: delete_bdd.php:190
msgid ""
"Clic on <b>Delete</b> button will delete the image in the database and the "
"file on the server."
msgid_plural ""
"Clic on <b>Delete</b> button will delete the images in the database and the "
"files on the server."
msgstr[0] ""
"Cliquer sur le bouton <b>Effacer</b> effacera limages dans la base et le "
"fichier sur le serveur."
msgstr[1] ""
"Cliquer sur le bouton <b>Effacer</b> effacera les images dans la base et les "
"fichiers sur le serveur."
#: delete_bdd.php:191
msgid "Delete"
msgstr "Supprimer"
#: delete_bdd.php:205
#, php-format
msgid "%d row deleted and the following file:"
msgid_plural "%d rows deleted and the following files:"
msgstr[0] "%d ligne supprimée et le fichier suivant:"
msgstr[1] "%d lignes supprimées et les fichiers suivants:"
#: edit_bdd.php:70
msgid "Edit database"
msgstr "Editer la base"
#: edit_bdd.php:124
msgid "Update" msgid "Update"
msgstr "Mise-à-jour" msgstr "Mise-à-jour"
@@ -504,39 +579,39 @@ msgstr "Commentaire"
msgid "User comment" msgid "User comment"
msgstr "Commentaire utilis." msgstr "Commentaire utilis."
#: index.php:125 ovh/ce-mois.php:348 vegas/index.php:102 #: index.php:126 ovh/ce-mois.php:348 vegas/index.php:102
msgid "Blog" msgid "Blog"
msgstr "Blog" msgstr "Blog"
#: index.php:125 vegas/index.php:102 #: index.php:126 vegas/index.php:102
msgid "Go to the <span class=\"green\">blog...</span>" msgid "Go to the <span class=\"green\">blog...</span>"
msgstr "Aller sur le <span class=\"green\">blog...</span>" msgstr "Aller sur le <span class=\"green\">blog...</span>"
#: index.php:127 ovh/ce-mois.php:349 vegas/index.php:104 #: index.php:128 ovh/ce-mois.php:349 vegas/index.php:104
msgid "Gallery" msgid "Gallery"
msgstr "Portfolio" msgstr "Portfolio"
#: index.php:127 vegas/index.php:104 #: index.php:128 vegas/index.php:104
msgid "Visit the <span class=\"green\">gallery...</span>" msgid "Visit the <span class=\"green\">gallery...</span>"
msgstr "Visiter la <span class=\"green\">galerie...</span>" msgstr "Visiter la <span class=\"green\">galerie...</span>"
#: index.php:129 #: index.php:130
msgid "Piwigo" msgid "Piwigo"
msgstr "Piwigo" msgstr "Piwigo"
#: index.php:129 #: index.php:130
msgid "Visit the <span class=\"green\">Piwigo gallery...</span>" msgid "Visit the <span class=\"green\">Piwigo gallery...</span>"
msgstr "Visiter la <span class=\"green\">galerie Piwigo…</span>" msgstr "Visiter la <span class=\"green\">galerie Piwigo…</span>"
#: index.php:131 vegas/index.php:106 #: index.php:132 vegas/index.php:106
msgid "This month" msgid "This month"
msgstr "Ce mois-çi" msgstr "Ce mois-çi"
#: index.php:131 #: index.php:132
msgid "Picture of the <span class=\"green\">month</span> ..." msgid "Picture of the <span class=\"green\">month</span> ..."
msgstr "Photo du <span class=\"green\">mois</span> …" msgstr "Photo du <span class=\"green\">mois</span> …"
#: index.php:153 vegas/index.php:113 #: index.php:154 vegas/index.php:113
msgid "Powered by" msgid "Powered by"
msgstr "Propulsé par" msgstr "Propulsé par"
@@ -544,7 +619,7 @@ msgstr "Propulsé par"
msgid "Insert images in " msgid "Insert images in "
msgstr "Insérer images dans " msgstr "Insérer images dans "
#: insert_bdd.php:43 view_bdd2.php:182 #: insert_bdd.php:43 view_bdd2.php:183
msgid " images found in folder" msgid " images found in folder"
msgstr " images trouvées dans le dossier" msgstr " images trouvées dans le dossier"
@@ -620,19 +695,19 @@ msgstr "Insertion de "
msgid " in database" msgid " in database"
msgstr " dans la base" msgstr " dans la base"
#: localize.php:230 vegas/index.php:34 #: localize.php:231 vegas/index.php:34
msgid "French" msgid "French"
msgstr "Français" msgstr "Français"
#: localize.php:230 vegas/index.php:34 #: localize.php:231 vegas/index.php:34
msgid "English" msgid "English"
msgstr "Anglais" msgstr "Anglais"
#: localize.php:230 vegas/index.php:34 #: localize.php:231 vegas/index.php:34
msgid "German" msgid "German"
msgstr "Allemand" msgstr "Allemand"
#: localize.php:230 vegas/index.php:34 #: localize.php:231 vegas/index.php:34
msgid "Spanish" msgid "Spanish"
msgstr "Espagnol" msgstr "Espagnol"
@@ -744,133 +819,201 @@ msgstr "Choix du language"
msgid "Photo's licence" msgid "Photo's licence"
msgstr "License des photos" msgstr "License des photos"
#: photo-du-mois.php:202 view_bdd.php:182 view_bdd2.php:339 #: photo-du-mois.php:202 view_bdd.php:187 view_bdd2.php:344
msgid "by" msgid "by"
msgstr "par" msgstr "par"
#: requests.php:28 view_bdd.php:108 view_bdd2.php:113 #: requests.php:28 view_bdd.php:111 view_bdd2.php:113
msgid "View database" msgid "View database"
msgstr "Voir la base" msgstr "Voir la base"
#: requests.php:166 view_bdd2.php:211 #: requests.php:166 view_bdd2.php:214
msgid "keywords" msgid "keywords"
msgstr "mots-clés" msgstr "mots-clés"
#: requests.php:180 view_bdd2.php:219 #: requests.php:180 view_bdd2.php:222
msgid "model" msgid "model"
msgstr "APN" msgstr "APN"
#: requests.php:193 view_bdd2.php:227 #: requests.php:193 view_bdd2.php:230
msgid "lens" msgid "lens"
msgstr "objectif" msgstr "objectif"
#: requests.php:206 view_bdd2.php:235 #: requests.php:206 view_bdd2.php:238
msgid "iso" msgid "iso"
msgstr "ISO" msgstr "ISO"
#: requests.php:219 view_bdd2.php:243 #: requests.php:219 view_bdd2.php:246
msgid "speed" msgid "speed"
msgstr "vitesse" msgstr "vitesse"
#: translator.php:26
msgid "String"
msgstr "Chaîne"
#: vegas/index.php:106 #: vegas/index.php:106
msgid "<span class=\"green\">Latest</span> images..." msgid "<span class=\"green\">Latest</span> images..."
msgstr "<span class=\"green\">Dernières</span> images..." msgstr "<span class=\"green\">Dernières</span> images..."
#: view_bdd.php:36 view_bdd2.php:41 #: vendor/phpmyadmin/motranslator/benchmark-apcu.php:21
msgid " photos successfully deleted !" #: vendor/phpmyadmin/motranslator/tests/MoFilesTest.php:29
msgstr " photos effacées !" #: vendor/phpmyadmin/motranslator/tests/TranslatorTest.php:24
msgid "Column"
msgstr ""
#: view_bdd.php:40 view_bdd2.php:45 #: vendor/phpmyadmin/motranslator/tests/FunctionsTest.php:34
msgid "Empty request !" #: vendor/phpmyadmin/motranslator/tests/LoaderTest.php:156
msgstr "Requête nulle !" #: vendor/phpmyadmin/motranslator/tests/LoaderTest.php:159
#: vendor/phpmyadmin/motranslator/tests/LoaderTest.php:171
#: vendor/phpmyadmin/motranslator/tests/LoaderTest.php:230
#: vendor/phpmyadmin/motranslator/tests/LoaderTest.php:238
#: vendor/phpmyadmin/motranslator/tests/LoaderTest.php:248
#: vendor/phpmyadmin/motranslator/tests/LoaderTest.php:322
msgid "Type"
msgstr ""
#: view_bdd.php:116 view_bdd.php:169 view_bdd2.php:295 view_bdd2.php:320 #: vendor/phpmyadmin/motranslator/tests/MoFilesTest.php:34
msgid "Edit" msgid "Column parser"
msgstr "Editer" msgstr ""
#: view_bdd.php:117 view_bdd.php:170 view_bdd2.php:296 view_bdd2.php:321 #: vendor/phpmyadmin/motranslator/tests/MoFilesTest.php:57
#: vendor/phpmyadmin/motranslator/tests/MoFilesTest.php:65
#: vendor/phpmyadmin/motranslator/tests/MoFilesTest.php:73
#: vendor/phpmyadmin/motranslator/tests/MoFilesTest.php:81
#: vendor/phpmyadmin/motranslator/tests/MoFilesTest.php:89
#: vendor/phpmyadmin/motranslator/tests/MoFilesTest.php:129
#, php-format
msgid "%d second"
msgid_plural "%d seconds"
msgstr[0] ""
msgstr[1] ""
#: vendor/phpmyadmin/motranslator/tests/MoFilesTest.php:98
#: vendor/phpmyadmin/motranslator/tests/MoFilesTest.php:183
#, php-format
msgid "\"%d\" second"
msgid_plural "\"%d\" seconds"
msgstr[0] ""
msgstr[1] ""
#: vendor/phpmyadmin/motranslator/tests/PluralTest.php:62
#: vendor/phpmyadmin/motranslator/tests/PluralTest.php:117
#, php-format
msgid "%d pig went to the market\n"
msgid_plural "%d pigs went to the market\n"
msgstr[0] ""
msgstr[1] ""
#: vendor/phpmyadmin/motranslator/tests/TranslatorTest.php:42
#: vendor/phpmyadmin/motranslator/tests/TranslatorTest.php:52
#: vendor/phpmyadmin/motranslator/tests/TranslatorTest.php:63
#: vendor/phpmyadmin/motranslator/tests/TranslatorTest.php:68
msgid "Test"
msgstr ""
#: vendor/phpmyadmin/motranslator/tests/TranslatorTest.php:77
msgid "shouldIWriteTests"
msgstr ""
#: vendor/phpmyadmin/motranslator/tests/TranslatorTest.php:81
msgid "is it hard"
msgstr ""
#: view_bdd.php:121 view_bdd.php:175 view_bdd2.php:300 view_bdd2.php:326
msgid "Suppress" msgid "Suppress"
msgstr "Supprimer" msgstr "Supprimer"
#: view_bdd.php:125 view_bdd.php:126 view_bdd.php:128 view_bdd.php:129 #: view_bdd.php:129 view_bdd.php:130 view_bdd.php:132 view_bdd.php:133
#: view_bdd.php:130 view_bdd.php:131 view_bdd.php:132 view_bdd.php:133
#: view_bdd.php:134 view_bdd.php:135 view_bdd.php:136 view_bdd.php:137 #: view_bdd.php:134 view_bdd.php:135 view_bdd.php:136 view_bdd.php:137
#: view_bdd.php:138 view_bdd.php:139 view_bdd.php:140 #: view_bdd.php:138 view_bdd.php:139 view_bdd.php:140 view_bdd.php:141
#: view_bdd.php:142 view_bdd.php:143 view_bdd.php:144
msgid "Filter" msgid "Filter"
msgstr "Filtre" msgstr "Filtre"
#: view_bdd.php:150 #: view_bdd.php:154
msgid "Date Original" msgid "Date Original"
msgstr "Date prise de vue" msgstr "Date prise de vue"
#: view_bdd.php:152 #: view_bdd.php:156
msgid "ISO" msgid "ISO"
msgstr "ISO" msgstr "ISO"
#: view_bdd.php:154 view_bdd2.php:300 #: view_bdd.php:158 view_bdd2.php:304
msgid "Exposure corr." msgid "Exposure corr."
msgstr "Correction dexpo." msgstr "Correction dexpo."
#: view_bdd.php:159 #: view_bdd.php:163
msgid "Programm" msgid "Programm"
msgstr "Programme" msgstr "Programme"
#: view_bdd.php:160 #: view_bdd.php:164
msgid "WB" msgid "WB"
msgstr "Balance des blancs" msgstr "Balance des blancs"
#: view_bdd.php:229 view_bdd2.php:427 #: view_bdd2.php:197
msgid "Log out" #, php-format
msgstr "Déconnexion" msgid "%d image found with the following query:"
msgid_plural "%d images found with the following query:"
msgstr[0] "%d image trouvée avec la requête suivante:"
msgstr[1] "%d images trouvées avec la requête suivante:"
#: view_bdd2.php:196 #: view_bdd2.php:253
msgid " images founds with the following request:"
msgstr " images trouvées avec la requête suivante:"
#: view_bdd2.php:250
msgid "Operator:" msgid "Operator:"
msgstr "Opérateur:" msgstr "Opérateur:"
#: view_bdd2.php:252 #: view_bdd2.php:255
msgid "AND" msgid "AND"
msgstr "ET" msgstr "ET"
#: view_bdd2.php:254 #: view_bdd2.php:257
msgid "OR" msgid "OR"
msgstr "OU" msgstr "OU"
#: view_bdd2.php:266 #: view_bdd2.php:269
msgid "All photos" msgid "All photos"
msgstr "Toutes les photos" msgstr "Toutes les photos"
#: view_bdd2.php:274 #: view_bdd2.php:277
msgid "year" msgid "year"
msgstr "an" msgstr "an"
#: view_bdd2.php:286 #: view_bdd2.php:289
msgid "OK" msgid "OK"
msgstr "Ok" msgstr "Ok"
#: view_bdd2.php:300 #: view_bdd2.php:304
msgid "Select" msgid "Select"
msgstr "Sélectionner" msgstr "Sélectionner"
#: view_bdd2.php:300 #: view_bdd2.php:304
msgid "Size" msgid "Size"
msgstr "Taille" msgstr "Taille"
#: view_bdd2.php:300 #: view_bdd2.php:304
msgid "Width" msgid "Width"
msgstr "Largeur" msgstr "Largeur"
#: view_bdd2.php:300 #: view_bdd2.php:304
msgid "Height" msgid "Height"
msgstr "Hauteur" msgstr "Hauteur"
#: view_bdd2.php:316 #: view_bdd2.php:320
msgid "No image found !" msgid "No image found !"
msgstr "Aucune image trouvée !" msgstr "Aucune image trouvée !"
#~ msgid " photos successfully deleted !"
#~ msgstr " photos effacées !"
#~ msgid "Empty request !"
#~ msgstr "Requête nulle !"
#~ msgid " rows deleted with following request:"
#~ msgstr " lignes supprimées avec la requête suivante:"
#, php-format
#~ msgid "Rates %s in &euro;/ week:"
#~ msgstr "Taux %s en &euro;/semaine:"
#~ msgid "Request null" #~ msgid "Request null"
#~ msgstr "Requête nulle" #~ msgstr "Requête nulle"

1
Locale/nocache Symbolic link
View File

@@ -0,0 +1 @@
.

5
composer.json Normal file
View File

@@ -0,0 +1,5 @@
{
"require": {
"phpmyadmin/motranslator": "^5.3"
}
}

692
composer.lock generated Normal file
View File

@@ -0,0 +1,692 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "b102e899e31d62f4d40282ff04a339d9",
"packages": [
{
"name": "phpmyadmin/motranslator",
"version": "5.3.1",
"source": {
"type": "git",
"url": "https://github.com/phpmyadmin/motranslator.git",
"reference": "d03b4d9c608e7265091bf6decc05323d16c7c047"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpmyadmin/motranslator/zipball/d03b4d9c608e7265091bf6decc05323d16c7c047",
"reference": "d03b4d9c608e7265091bf6decc05323d16c7c047",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
"symfony/expression-language": "^4.0 || ^5.0 || ^6.0"
},
"require-dev": {
"phpmyadmin/coding-standard": "^3.0.0",
"phpstan/phpstan": "^1.4.6",
"phpunit/phpunit": "^7.4 || ^8 || ^9"
},
"suggest": {
"ext-apcu": "Needed for ACPu-backed translation cache"
},
"type": "library",
"autoload": {
"psr-4": {
"PhpMyAdmin\\MoTranslator\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0-or-later"
],
"authors": [
{
"name": "The phpMyAdmin Team",
"email": "developers@phpmyadmin.net",
"homepage": "https://www.phpmyadmin.net/team/"
}
],
"description": "Translation API for PHP using Gettext MO files",
"homepage": "https://github.com/phpmyadmin/motranslator",
"keywords": [
"gettext",
"i18n",
"mo",
"translator"
],
"support": {
"issues": "https://github.com/phpmyadmin/motranslator/issues",
"source": "https://github.com/phpmyadmin/motranslator"
},
"time": "2023-08-23T18:32:07+00:00"
},
{
"name": "psr/cache",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/cache.git",
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"shasum": ""
},
"require": {
"php": ">=8.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Cache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for caching libraries",
"keywords": [
"cache",
"psr",
"psr-6"
],
"support": {
"source": "https://github.com/php-fig/cache/tree/3.0.0"
},
"time": "2021-02-03T23:26:27+00:00"
},
{
"name": "psr/container",
"version": "2.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/container.git",
"reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963",
"reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963",
"shasum": ""
},
"require": {
"php": ">=7.4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Container\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common Container Interface (PHP FIG PSR-11)",
"homepage": "https://github.com/php-fig/container",
"keywords": [
"PSR-11",
"container",
"container-interface",
"container-interop",
"psr"
],
"support": {
"issues": "https://github.com/php-fig/container/issues",
"source": "https://github.com/php-fig/container/tree/2.0.2"
},
"time": "2021-11-05T16:47:00+00:00"
},
{
"name": "psr/log",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"shasum": ""
},
"require": {
"php": ">=8.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"support": {
"source": "https://github.com/php-fig/log/tree/3.0.2"
},
"time": "2024-09-11T13:17:53+00:00"
},
{
"name": "symfony/cache",
"version": "v7.2.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/cache.git",
"reference": "e7e983596b744c4539f31e79b0350a6cf5878a20"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/cache/zipball/e7e983596b744c4539f31e79b0350a6cf5878a20",
"reference": "e7e983596b744c4539f31e79b0350a6cf5878a20",
"shasum": ""
},
"require": {
"php": ">=8.2",
"psr/cache": "^2.0|^3.0",
"psr/log": "^1.1|^2|^3",
"symfony/cache-contracts": "^2.5|^3",
"symfony/deprecation-contracts": "^2.5|^3.0",
"symfony/service-contracts": "^2.5|^3",
"symfony/var-exporter": "^6.4|^7.0"
},
"conflict": {
"doctrine/dbal": "<3.6",
"symfony/dependency-injection": "<6.4",
"symfony/http-kernel": "<6.4",
"symfony/var-dumper": "<6.4"
},
"provide": {
"psr/cache-implementation": "2.0|3.0",
"psr/simple-cache-implementation": "1.0|2.0|3.0",
"symfony/cache-implementation": "1.1|2.0|3.0"
},
"require-dev": {
"cache/integration-tests": "dev-master",
"doctrine/dbal": "^3.6|^4",
"predis/predis": "^1.1|^2.0",
"psr/simple-cache": "^1.0|^2.0|^3.0",
"symfony/clock": "^6.4|^7.0",
"symfony/config": "^6.4|^7.0",
"symfony/dependency-injection": "^6.4|^7.0",
"symfony/filesystem": "^6.4|^7.0",
"symfony/http-kernel": "^6.4|^7.0",
"symfony/messenger": "^6.4|^7.0",
"symfony/var-dumper": "^6.4|^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Cache\\": ""
},
"classmap": [
"Traits/ValueWrapper.php"
],
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides extended PSR-6, PSR-16 (and tags) implementations",
"homepage": "https://symfony.com",
"keywords": [
"caching",
"psr6"
],
"support": {
"source": "https://github.com/symfony/cache/tree/v7.2.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-12-07T08:08:50+00:00"
},
{
"name": "symfony/cache-contracts",
"version": "v3.5.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/cache-contracts.git",
"reference": "15a4f8e5cd3bce9aeafc882b1acab39ec8de2c1b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/cache-contracts/zipball/15a4f8e5cd3bce9aeafc882b1acab39ec8de2c1b",
"reference": "15a4f8e5cd3bce9aeafc882b1acab39ec8de2c1b",
"shasum": ""
},
"require": {
"php": ">=8.1",
"psr/cache": "^3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"autoload": {
"psr-4": {
"Symfony\\Contracts\\Cache\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Generic abstractions related to caching",
"homepage": "https://symfony.com",
"keywords": [
"abstractions",
"contracts",
"decoupling",
"interfaces",
"interoperability",
"standards"
],
"support": {
"source": "https://github.com/symfony/cache-contracts/tree/v3.5.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-09-25T14:20:29+00:00"
},
{
"name": "symfony/deprecation-contracts",
"version": "v3.5.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
"shasum": ""
},
"require": {
"php": ">=8.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"autoload": {
"files": [
"function.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-09-25T14:20:29+00:00"
},
{
"name": "symfony/expression-language",
"version": "v6.4.13",
"source": {
"type": "git",
"url": "https://github.com/symfony/expression-language.git",
"reference": "3524904fb026356a5230cd197f9a4e6a61e0e7df"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/expression-language/zipball/3524904fb026356a5230cd197f9a4e6a61e0e7df",
"reference": "3524904fb026356a5230cd197f9a4e6a61e0e7df",
"shasum": ""
},
"require": {
"php": ">=8.1",
"symfony/cache": "^5.4|^6.0|^7.0",
"symfony/deprecation-contracts": "^2.5|^3",
"symfony/service-contracts": "^2.5|^3"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\ExpressionLanguage\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides an engine that can compile and evaluate expressions",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/expression-language/tree/v6.4.13"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-10-09T08:40:40+00:00"
},
{
"name": "symfony/service-contracts",
"version": "v3.5.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
"reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/e53260aabf78fb3d63f8d79d69ece59f80d5eda0",
"reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0",
"shasum": ""
},
"require": {
"php": ">=8.1",
"psr/container": "^1.1|^2.0",
"symfony/deprecation-contracts": "^2.5|^3"
},
"conflict": {
"ext-psr": "<1.1|>=2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"autoload": {
"psr-4": {
"Symfony\\Contracts\\Service\\": ""
},
"exclude-from-classmap": [
"/Test/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Generic abstractions related to writing services",
"homepage": "https://symfony.com",
"keywords": [
"abstractions",
"contracts",
"decoupling",
"interfaces",
"interoperability",
"standards"
],
"support": {
"source": "https://github.com/symfony/service-contracts/tree/v3.5.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-09-25T14:20:29+00:00"
},
{
"name": "symfony/var-exporter",
"version": "v7.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-exporter.git",
"reference": "1a6a89f95a46af0f142874c9d650a6358d13070d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-exporter/zipball/1a6a89f95a46af0f142874c9d650a6358d13070d",
"reference": "1a6a89f95a46af0f142874c9d650a6358d13070d",
"shasum": ""
},
"require": {
"php": ">=8.2"
},
"require-dev": {
"symfony/property-access": "^6.4|^7.0",
"symfony/serializer": "^6.4|^7.0",
"symfony/var-dumper": "^6.4|^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\VarExporter\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Allows exporting any serializable PHP data structure to plain PHP code",
"homepage": "https://symfony.com",
"keywords": [
"clone",
"construct",
"export",
"hydrate",
"instantiate",
"lazy-loading",
"proxy",
"serialize"
],
"support": {
"source": "https://github.com/symfony/var-exporter/tree/v7.2.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-10-18T07:58:17+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {},
"platform-dev": {},
"plugin-api-version": "2.6.0"
}

View File

@@ -511,6 +511,10 @@ h3.greenstyle {
.font10 { .font10 {
font-size: 10px; font-size: 10px;
} }
.alert {
color: red;
text-align: left;
}
input[type="text"], textarea { input[type="text"], textarea {

224
delete_bdd.php Normal file
View File

@@ -0,0 +1,224 @@
<?php require ("3-protect.php");
include 'localize.php';
$domain = 'sentier';
localize($domain);
include 'functions.php';
$base = 'db_photo.sqlite3';
$conn = new PDO("sqlite:$base");
$conn2 = new PDO("sqlite:$base");
$msg = "";
$req_suppress = "";
$req_delete = "";
$files_deleted = "";
$files = array();
//_pr($_POST);
/*
// view_bdd2.php:
supress ; coche => delete_bdd.php (delete ; coche)
edit; coche => edit_bdd.php => modify_bdd.php (modif sur la bdd)
*/
if (isset($_SESSION["user"])) {
if ((isset($_POST["suppress"])) && ($_POST["suppress"] == "suppress")) {
if (isset($_POST['coche']) && (! empty($_POST['coche']))) {
$rr = "";
foreach($_POST['coche'] as $key => $value) {
$r = "id = '" . $value . "' OR ";
$rr .= $r;
}
$req = substr($rr, 0, -4);
$req_suppress = "SELECT * FROM photos WHERE " . $req . " ORDER BY id";
}
else {
$url = "view_bdd.php?message=" . urlencode(gettext("No images select !"));
header("location: $url");
}
}
elseif ((isset($_POST["delete"])) && ($_POST["delete"] == "delete")) {
if (isset($_POST['id']) && (! empty($_POST['id']))) {
$rr = "";
foreach($_POST['id'] as $key => $value) {
$r = "id = '" . $value . "' OR ";
$rr .= $r;
}
$req = substr($rr, 0, -4);
/**/
$req_suppress = "SELECT id, filename FROM photos WHERE " . $req . " ORDER BY id"; // Pour supprimer les fichiers
$stmt = $conn->prepare($req_suppress);
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$ids[] = $row['id'];
$file = $row['filename'];
if (file_exists($file)) {
$files[] = realpath('.') . "/" . $file;
}
else {
//$msg .= "File $file doesn't exist !";
$msg .= sprintf( gettext("File %s doesn't exist !"), $file);
}
}
//_pr($files);
$req_delete = "DELETE FROM photos WHERE id in (".str_repeat("?,", count($ids) - 1)."?)";
// DELETE FROM photos WHERE id in (?,?)
$stmt = $conn->prepare($req_delete);
$stmt->execute($ids);
$count = $stmt->rowCount();
if ($count = count($files)) {
foreach ($files as $file) {
if (unlink($file)) {
//echo "File: " . $file . " deleted!" . "<br />";
$files_deleted .= sprintf( gettext("File: %s deleted!"), $file ) . "\n";
//echo $a;
}
}
}
}
else {
$url = "view_bdd.php?message=" . urlencode(gettext("No images select !"));
header("location: $url");
}
}
else {
$url = "view_bdd.php?message=" . urlencode(gettext("No images select !"));
header("location: $url");
}
}
else {
$url = "admin.php?message=" . urlencode(gettext("Please log in !"));
header("location: $url");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><?php echo gettext('View photos in Sqlite base'); ?></title>
<link rel="stylesheet" href="css/sls.css" />
<link rel='stylesheet' href='lc-lightbox/css/lc_lightbox.min.css' />
<link rel='stylesheet' href='lc-lightbox/css/open_close_fx.css' />
<link rel='stylesheet' href='lc-lightbox/skins/minimal.css' />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
</head>
<body>
<?php
//debug_to_console($_GET);
//debug_to_console($req_edit);
echo '<h1>' . gettext('Suppress images ') . ': ' . $base . '</h1><br />';
if (($req_suppress != "") and ($req_delete == "")) {
echo '<h3>' . $msg . '</h3>';
try {
$conn3 = new PDO('sqlite:db_photo.sqlite3');
$stmt3 = $conn3->prepare($req_suppress);
$stmt3->execute();
echo '<form id="deleteImage" name="deleteImage" action="delete_bdd.php" method="post" class="myForm" >';
echo '<table class="styled-table">';
echo '<thead>';
echo '<th>' . gettext('Id') . '</th><th>' . gettext('Thumb') . '</th><th>' . gettext('Filename') . '</th><th>' . gettext('Date') . ' </th><th>' . gettext('Speed') . '</th><th>' . gettext('Iso') . '</th><th>' . gettext('Aperture') . '</th><th>' . gettext('Expo. correct') . '</th>';
echo '<th>' . gettext('Model') . '</th><th>' . gettext('Lens') . '</th><th>' . gettext('Focal') . '</th><th>' . gettext('Metering') . '</th><th>' . gettext('Program') . '</th><th>' . gettext('Wb') . '</th>';
echo '<th>' . gettext('Flash') . '</th><th>' . gettext('Software') . '</th><th>' . gettext('Keywords') . '</th><th>' . gettext('Title') . '</th><th>' . gettext('Creator') . '</th><th>' . gettext('City') . '</th><th>' . gettext('Department') . '</th><th>' . gettext('Code') . '</th><th>' . gettext('Country') . '</th><th>' . gettext('Copyright') . '</th><th>' . gettext('Legende') . '</th>';
echo '</thead>';
echo '<tbody>';
$nRows = 0;
while ($row = $stmt3->fetch(PDO::FETCH_ASSOC)) {
$thumbnail = host() . str_replace("photos/img", "photos/thumb", $row['filename']);
$full = host() . $row['filename'];
echo '<tr><td>' . $row['id'] . '</td><td>' . '<a href="' . $full . '"><img src="'.$thumbnail.'" /></a>' . '</td>';
echo '<td>' . $row['filename'] . '</td><td>' . $row['dateoriginal'] . '</td>';
echo '<td>' . $row['speed'] . '</td><td>' . $row['iso'] . '</td><td>' . $row['aperture'] . '</td><td>' . $row['correctexpo'] . '</td>';
echo '<td>' . $row['model'] . '</td>';
echo '<td><input type="text" id="lens" name="lens[]" value="' . $row['lens'] . '" size=""></td>';
echo '<td>' . $row['focal'] . '</td><td>' . $row['metering'] . '</td><td>' . $row['program'] . '</td><td>' . $row['wb'] . '</td>';
echo '<td>' . $row['flash'] . '</td><td>' . $row['software'] . '</td>';
//echo '<td><input type="text" id="keywords" name="keywords[]" value="' . $row['keywords'] . '" size=""></td>';
echo "<td><input type='text' id='keywords' name='keywords[]' value='" . $row['keywords'] . "' size=''></td>";
echo '<td><input type="text" id="title" name="title[]" value="' . $row['title'] . '" size=""></td>';
echo '<td><input type="text" id="creator" name="creator[]" value="' . $row['creator'] . '" size=""></td>';
echo '<td><input type="text" id="city" name="city[]" value="' . $row['city'] . '" size=""></td>';
echo '<td><input type="text" id="department" name="department[]" value="' . $row['department'] . '" size=""></td>';
echo '<td><input type="text" id="code" name="code[]" value="' . $row['code'] . '" size=""></td>';
echo '<td><input type="text" id="country" name="country[]" value="' . $row['country'] . '" size=""></td>';
echo '<td><input type="text" id="copyright" name="copyright[]" value="' . $row['copyright'] . '" size=""></td>';
echo '<td><input type="text" id="legende" name="legende[]" value="' . $row['legende'] . '" size=""></td></tr>';
echo '<input type="hidden" id="id" name="id[]" value="' . $row['id'] . '">';
$nRows++;
}
echo '</tbody></table>';
echo '<p class="alert">' . ngettext("Clic on <b>Delete</b> button will delete the image in the database and the file on the server.", "Clic on <b>Delete</b> button will delete the images in the database and the files on the server.", $nRows) . '</p>';
echo '<button type="submit" name="delete" value="delete" class="myButton all">' . gettext('Delete') . '</button>';
echo '</form>';
//$conn = null;
}
catch(PDOException $e) {
echo $e->getMessage();
}
$req_suppress = "";
}
if ($req_delete != "") {
$msg = sprintf(ngettext("%d row deleted and the following file:","%d rows deleted and the following files:", $count), $count);
//$msg = $count . gettext(" rows deleted and the following files:");
echo '<h3 class="greenstyle">' . $msg . '</h3>';
echo '<h3>' . nl2br($files_deleted) . '</h3>';
//echo '<pre><code>' . $req_delete . '</code></pre>';
}
?>
<p class="navPage"><a href="index.php" title="<?php echo gettext("Home"); ?>"><?php echo gettext("Home"); ?></a> | <a href="photo-du-mois.php" title="<?php echo gettext("Picture of the month"); ?>"><?php echo gettext("Picture of the month"); ?></a> | <a href="maps.php" title="<?php echo gettext("Maps"); ?>"><?php echo gettext("Maps"); ?></a> | <a href="admin.php" title="<?php echo gettext("Admin page"); ?>"><?php echo gettext("Admin page"); ?></a></p>
<p><em><small>&copy; 2013-<?php echo date('Y'); ?> sur-le-sentier.fr</small></em></p>
<script src='lc-lightbox/js/lc_lightbox.min.js' type='text/javascript'></script>
<script src='lc-lightbox/lib/AlloyFinger/alloy_finger.min.js' type='text/javascript'></script>
</body>
</html>

View File

@@ -220,13 +220,34 @@ function localize($domain) {
echo "langue: " . $langue . "<br>"; echo "langue: " . $langue . "<br>";
*/ */
putenv('LC_ALL=' . $langue); putenv('LC_ALL=' . $langue); // $langue = fr_FR.utf8
$loc = setlocale(LC_ALL, $langue); $loc = setlocale(LC_ALL, $langue);
bindtextdomain($domain, $root . '/Locale/nocache'); // by-pass gettext() cache. Now the cache is forced to flush every time.
bindtextdomain($domain, $root . '/Locale/'); bindtextdomain($domain, $root . '/Locale/');
bind_textdomain_codeset($domain, 'UTF-8'); bind_textdomain_codeset($domain, 'UTF-8');
textdomain($domain); textdomain($domain);
$nation = array('fr_FR' => gettext('French'), 'en_US' => gettext('English') , 'de_DE' => gettext('German'), 'es_ES' => gettext('Spanish') ); $nation = array('fr_FR' => gettext('French'), 'en_US' => gettext('English') , 'de_DE' => gettext('German'), 'es_ES' => gettext('Spanish') );
} }
function motranslator($domain) {
require('vendor/autoload.php');
// Create loader object
$loader = new PhpMyAdmin\MoTranslator\Loader();
// Set locale
//$loader->setlocale('fr');
$loader->setlocale('fr_FR.utf8');
// Set default text domain
$loader->textdomain('sentier');
// Set path where to look for a domain
//$loader->bindtextdomain('sentier', __DIR__ . '/data/locale/');
$loader->bindtextdomain('sentier', __DIR__ . '/Locale/');
}
?> ?>

BIN
photos/11_2024.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 KiB

BIN
photos/5_2005.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

BIN
photos/6_2005.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

39
translator.php Normal file
View File

@@ -0,0 +1,39 @@
<?php
require('vendor/autoload.php');
include 'localize.php';
$domain = 'sentier';
// Create loader object
$loader = new PhpMyAdmin\MoTranslator\Loader();
// Set locale
$loader->setlocale('fr_FR.utf8');
// Set default text domain
$loader->textdomain($domain);
// Set path where to look for a domain
$loader->bindtextdomain($domain, __DIR__ . '/Locale/');
// Get translator
$translator = $loader->getTranslator();
// Now you can use Translator API (see below)
echo $translator->gettext('String');
echo $translator->gettext('Aperture Priority');
//echo $translator->getTranslations();
/*
echo $translator->setTranslations([
'String' => 'Chaîne',
'Number' => 'Nombre',
]);
echo $translator->gettext('String');
*/
?>

19
translator_gettext.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
require('vendor/autoload.php');
// Load compatibility layer
PhpMyAdmin\MoTranslator\Loader::loadFunctions();
$langue = "fr_FR.utf8";
// Configure
_setlocale(LC_MESSAGES, $langue);
_textdomain('sentier');
_bindtextdomain('sentier', __DIR__ . '/Locale/');
_bind_textdomain_codeset('sentier', 'UTF-8');
// Use functions
echo _gettext('All photos');
echo __('Aperture Priority');
echo _gettext('motranslator');
?>

25
vendor/autoload.php vendored Normal file
View File

@@ -0,0 +1,25 @@
<?php
// autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
}
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitf0f23926796d6825a9caf18ca123a270::getLoader();

579
vendor/composer/ClassLoader.php vendored Normal file
View File

@@ -0,0 +1,579 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see https://www.php-fig.org/psr/psr-0/
* @see https://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
/** @var \Closure(string):void */
private static $includeFile;
/** @var string|null */
private $vendorDir;
// PSR-4
/**
* @var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array();
/**
* @var array<string, list<string>>
*/
private $prefixDirsPsr4 = array();
/**
* @var list<string>
*/
private $fallbackDirsPsr4 = array();
// PSR-0
/**
* List of PSR-0 prefixes
*
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
*
* @var array<string, array<string, list<string>>>
*/
private $prefixesPsr0 = array();
/**
* @var list<string>
*/
private $fallbackDirsPsr0 = array();
/** @var bool */
private $useIncludePath = false;
/**
* @var array<string, string>
*/
private $classMap = array();
/** @var bool */
private $classMapAuthoritative = false;
/**
* @var array<string, bool>
*/
private $missingClasses = array();
/** @var string|null */
private $apcuPrefix;
/**
* @var array<string, self>
*/
private static $registeredLoaders = array();
/**
* @param string|null $vendorDir
*/
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
self::initializeIncludeClosure();
}
/**
* @return array<string, list<string>>
*/
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
}
return array();
}
/**
* @return array<string, list<string>>
*/
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
/**
* @return list<string>
*/
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
/**
* @return list<string>
*/
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
/**
* @return array<string, string> Array of classname => path
*/
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array<string, string> $classMap Class to filename map
*
* @return void
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*
* @return void
*/
public function add($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
$paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
$paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
$paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
$paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
$paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
$paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 base directories
*
* @return void
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*
* @return void
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*
* @return void
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*
* @return void
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*
* @return void
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
if (null === $this->vendorDir) {
return;
}
if ($prepend) {
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
} else {
unset(self::$registeredLoaders[$this->vendorDir]);
self::$registeredLoaders[$this->vendorDir] = $this;
}
}
/**
* Unregisters this instance as an autoloader.
*
* @return void
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
if (null !== $this->vendorDir) {
unset(self::$registeredLoaders[$this->vendorDir]);
}
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return true|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
$includeFile = self::$includeFile;
$includeFile($file);
return true;
}
return null;
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
/**
* Returns the currently registered loaders keyed by their corresponding vendor directories.
*
* @return array<string, self>
*/
public static function getRegisteredLoaders()
{
return self::$registeredLoaders;
}
/**
* @param string $class
* @param string $ext
* @return string|false
*/
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
/**
* @return void
*/
private static function initializeIncludeClosure()
{
if (self::$includeFile !== null) {
return;
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*
* @param string $file
* @return void
*/
self::$includeFile = \Closure::bind(static function($file) {
include $file;
}, null, null);
}
}

362
vendor/composer/InstalledVersions.php vendored Normal file
View File

@@ -0,0 +1,362 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer;
use Composer\Autoload\ClassLoader;
use Composer\Semver\VersionParser;
/**
* This class is copied in every Composer installed project and available to all
*
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
* To require its presence, you can require `composer-runtime-api ^2.0`
*
* @final
*/
class InstalledVersions
{
/**
* @var mixed[]|null
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
*/
private static $installed;
/**
* @var bool|null
*/
private static $canGetVendors;
/**
* @var array[]
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
private static $installedByVendor = array();
/**
* Returns a list of all package names which are present, either by being installed, replaced or provided
*
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackages()
{
$packages = array();
foreach (self::getInstalled() as $installed) {
$packages[] = array_keys($installed['versions']);
}
if (1 === \count($packages)) {
return $packages[0];
}
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
}
/**
* Returns a list of all package names with a specific type e.g. 'library'
*
* @param string $type
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackagesByType($type)
{
$packagesByType = array();
foreach (self::getInstalled() as $installed) {
foreach ($installed['versions'] as $name => $package) {
if (isset($package['type']) && $package['type'] === $type) {
$packagesByType[] = $name;
}
}
}
return $packagesByType;
}
/**
* Checks whether the given package is installed
*
* This also returns true if the package name is provided or replaced by another package
*
* @param string $packageName
* @param bool $includeDevRequirements
* @return bool
*/
public static function isInstalled($packageName, $includeDevRequirements = true)
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
}
}
return false;
}
/**
* Checks whether the given package satisfies a version constraint
*
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
*
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
*
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
* @param string $packageName
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
* @return bool
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints((string) $constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
/**
* Returns a version constraint representing all the range(s) which are installed for a given package
*
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
* whether a given version of a package is installed, and not just whether it exists
*
* @param string $packageName
* @return string Version constraint usable with composer/semver
*/
public static function getVersionRanges($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
$ranges = array();
if (isset($installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['version'])) {
return null;
}
return $installed['versions'][$packageName]['version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getPrettyVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
return null;
}
return $installed['versions'][$packageName]['pretty_version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
*/
public static function getReference($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['reference'])) {
return null;
}
return $installed['versions'][$packageName]['reference'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
*/
public static function getInstallPath($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @return array
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
*/
public static function getRootPackage()
{
$installed = self::getInstalled();
return $installed[0]['root'];
}
/**
* Returns the raw installed.php data for custom implementations
*
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[]
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
*/
public static function getRawData()
{
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = include __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
return self::$installed;
}
/**
* Returns the raw data of all installed.php which are currently loaded for custom implementations
*
* @return array[]
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
public static function getAllRawData()
{
return self::getInstalled();
}
/**
* Lets you reload the static array from another file
*
* This is only useful for complex integrations in which a project needs to use
* this class but then also needs to execute another project's autoloader in process,
* and wants to ensure both projects have access to their version of installed.php.
*
* A typical case would be PHPUnit, where it would need to make sure it reads all
* the data it needs from this class, then call reload() with
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
* the project in which it runs can then also use this class safely, without
* interference between PHPUnit's dependencies and the project's dependencies.
*
* @param array[] $data A vendor/composer/installed.php data set
* @return void
*
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
*/
public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();
}
/**
* @return array[]
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
private static function getInstalled()
{
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
}
$installed = array();
$copiedLocalDir = false;
if (self::$canGetVendors) {
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
self::$installedByVendor[$vendorDir] = $required;
$installed[] = $required;
if (strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $required;
$copiedLocalDir = true;
}
}
}
}
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require __DIR__ . '/installed.php';
self::$installed = $required;
} else {
self::$installed = array();
}
}
if (self::$installed !== array() && !$copiedLocalDir) {
$installed[] = self::$installed;
}
return $installed;
}
}

21
vendor/composer/LICENSE vendored Normal file
View File

@@ -0,0 +1,21 @@
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

11
vendor/composer/autoload_classmap.php vendored Normal file
View File

@@ -0,0 +1,11 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
'<27>' => $vendorDir . '/symfony/cache/Traits/ValueWrapper.php',
);

10
vendor/composer/autoload_files.php vendored Normal file
View File

@@ -0,0 +1,10 @@
<?php
// autoload_files.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
);

View File

@@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
);

18
vendor/composer/autoload_psr4.php vendored Normal file
View File

@@ -0,0 +1,18 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'),
'Symfony\\Contracts\\Cache\\' => array($vendorDir . '/symfony/cache-contracts'),
'Symfony\\Component\\VarExporter\\' => array($vendorDir . '/symfony/var-exporter'),
'Symfony\\Component\\ExpressionLanguage\\' => array($vendorDir . '/symfony/expression-language'),
'Symfony\\Component\\Cache\\' => array($vendorDir . '/symfony/cache'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/src'),
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'),
'PhpMyAdmin\\MoTranslator\\' => array($vendorDir . '/phpmyadmin/motranslator/src'),
);

50
vendor/composer/autoload_real.php vendored Normal file
View File

@@ -0,0 +1,50 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitf0f23926796d6825a9caf18ca123a270
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInitf0f23926796d6825a9caf18ca123a270', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitf0f23926796d6825a9caf18ca123a270', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitf0f23926796d6825a9caf18ca123a270::getInitializer($loader));
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInitf0f23926796d6825a9caf18ca123a270::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
}
}, null, null);
foreach ($filesToLoad as $fileIdentifier => $file) {
$requireFile($fileIdentifier, $file);
}
return $loader;
}
}

84
vendor/composer/autoload_static.php vendored Normal file
View File

@@ -0,0 +1,84 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInitf0f23926796d6825a9caf18ca123a270
{
public static $files = array (
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
);
public static $prefixLengthsPsr4 = array (
'S' =>
array (
'Symfony\\Contracts\\Service\\' => 26,
'Symfony\\Contracts\\Cache\\' => 24,
'Symfony\\Component\\VarExporter\\' => 30,
'Symfony\\Component\\ExpressionLanguage\\' => 37,
'Symfony\\Component\\Cache\\' => 24,
),
'P' =>
array (
'Psr\\Log\\' => 8,
'Psr\\Container\\' => 14,
'Psr\\Cache\\' => 10,
'PhpMyAdmin\\MoTranslator\\' => 24,
),
);
public static $prefixDirsPsr4 = array (
'Symfony\\Contracts\\Service\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/service-contracts',
),
'Symfony\\Contracts\\Cache\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/cache-contracts',
),
'Symfony\\Component\\VarExporter\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/var-exporter',
),
'Symfony\\Component\\ExpressionLanguage\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/expression-language',
),
'Symfony\\Component\\Cache\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/cache',
),
'Psr\\Log\\' =>
array (
0 => __DIR__ . '/..' . '/psr/log/src',
),
'Psr\\Container\\' =>
array (
0 => __DIR__ . '/..' . '/psr/container/src',
),
'Psr\\Cache\\' =>
array (
0 => __DIR__ . '/..' . '/psr/cache/src',
),
'PhpMyAdmin\\MoTranslator\\' =>
array (
0 => __DIR__ . '/..' . '/phpmyadmin/motranslator/src',
),
);
public static $classMap = array (
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
'<27>' => __DIR__ . '/..' . '/symfony/cache/Traits/ValueWrapper.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitf0f23926796d6825a9caf18ca123a270::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitf0f23926796d6825a9caf18ca123a270::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitf0f23926796d6825a9caf18ca123a270::$classMap;
}, null, ClassLoader::class);
}
}

709
vendor/composer/installed.json vendored Normal file
View File

@@ -0,0 +1,709 @@
{
"packages": [
{
"name": "phpmyadmin/motranslator",
"version": "5.3.1",
"version_normalized": "5.3.1.0",
"source": {
"type": "git",
"url": "https://github.com/phpmyadmin/motranslator.git",
"reference": "d03b4d9c608e7265091bf6decc05323d16c7c047"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpmyadmin/motranslator/zipball/d03b4d9c608e7265091bf6decc05323d16c7c047",
"reference": "d03b4d9c608e7265091bf6decc05323d16c7c047",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
"symfony/expression-language": "^4.0 || ^5.0 || ^6.0"
},
"require-dev": {
"phpmyadmin/coding-standard": "^3.0.0",
"phpstan/phpstan": "^1.4.6",
"phpunit/phpunit": "^7.4 || ^8 || ^9"
},
"suggest": {
"ext-apcu": "Needed for ACPu-backed translation cache"
},
"time": "2023-08-23T18:32:07+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"PhpMyAdmin\\MoTranslator\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0-or-later"
],
"authors": [
{
"name": "The phpMyAdmin Team",
"email": "developers@phpmyadmin.net",
"homepage": "https://www.phpmyadmin.net/team/"
}
],
"description": "Translation API for PHP using Gettext MO files",
"homepage": "https://github.com/phpmyadmin/motranslator",
"keywords": [
"gettext",
"i18n",
"mo",
"translator"
],
"support": {
"issues": "https://github.com/phpmyadmin/motranslator/issues",
"source": "https://github.com/phpmyadmin/motranslator"
},
"install-path": "../phpmyadmin/motranslator"
},
{
"name": "psr/cache",
"version": "3.0.0",
"version_normalized": "3.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/cache.git",
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf",
"shasum": ""
},
"require": {
"php": ">=8.0.0"
},
"time": "2021-02-03T23:26:27+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Psr\\Cache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for caching libraries",
"keywords": [
"cache",
"psr",
"psr-6"
],
"support": {
"source": "https://github.com/php-fig/cache/tree/3.0.0"
},
"install-path": "../psr/cache"
},
{
"name": "psr/container",
"version": "2.0.2",
"version_normalized": "2.0.2.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/container.git",
"reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963",
"reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963",
"shasum": ""
},
"require": {
"php": ">=7.4.0"
},
"time": "2021-11-05T16:47:00+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Psr\\Container\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common Container Interface (PHP FIG PSR-11)",
"homepage": "https://github.com/php-fig/container",
"keywords": [
"PSR-11",
"container",
"container-interface",
"container-interop",
"psr"
],
"support": {
"issues": "https://github.com/php-fig/container/issues",
"source": "https://github.com/php-fig/container/tree/2.0.2"
},
"install-path": "../psr/container"
},
{
"name": "psr/log",
"version": "3.0.2",
"version_normalized": "3.0.2.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"shasum": ""
},
"require": {
"php": ">=8.0.0"
},
"time": "2024-09-11T13:17:53+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Psr\\Log\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"support": {
"source": "https://github.com/php-fig/log/tree/3.0.2"
},
"install-path": "../psr/log"
},
{
"name": "symfony/cache",
"version": "v7.2.1",
"version_normalized": "7.2.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/cache.git",
"reference": "e7e983596b744c4539f31e79b0350a6cf5878a20"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/cache/zipball/e7e983596b744c4539f31e79b0350a6cf5878a20",
"reference": "e7e983596b744c4539f31e79b0350a6cf5878a20",
"shasum": ""
},
"require": {
"php": ">=8.2",
"psr/cache": "^2.0|^3.0",
"psr/log": "^1.1|^2|^3",
"symfony/cache-contracts": "^2.5|^3",
"symfony/deprecation-contracts": "^2.5|^3.0",
"symfony/service-contracts": "^2.5|^3",
"symfony/var-exporter": "^6.4|^7.0"
},
"conflict": {
"doctrine/dbal": "<3.6",
"symfony/dependency-injection": "<6.4",
"symfony/http-kernel": "<6.4",
"symfony/var-dumper": "<6.4"
},
"provide": {
"psr/cache-implementation": "2.0|3.0",
"psr/simple-cache-implementation": "1.0|2.0|3.0",
"symfony/cache-implementation": "1.1|2.0|3.0"
},
"require-dev": {
"cache/integration-tests": "dev-master",
"doctrine/dbal": "^3.6|^4",
"predis/predis": "^1.1|^2.0",
"psr/simple-cache": "^1.0|^2.0|^3.0",
"symfony/clock": "^6.4|^7.0",
"symfony/config": "^6.4|^7.0",
"symfony/dependency-injection": "^6.4|^7.0",
"symfony/filesystem": "^6.4|^7.0",
"symfony/http-kernel": "^6.4|^7.0",
"symfony/messenger": "^6.4|^7.0",
"symfony/var-dumper": "^6.4|^7.0"
},
"time": "2024-12-07T08:08:50+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Component\\Cache\\": ""
},
"classmap": [
"Traits/ValueWrapper.php"
],
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides extended PSR-6, PSR-16 (and tags) implementations",
"homepage": "https://symfony.com",
"keywords": [
"caching",
"psr6"
],
"support": {
"source": "https://github.com/symfony/cache/tree/v7.2.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"install-path": "../symfony/cache"
},
{
"name": "symfony/cache-contracts",
"version": "v3.5.1",
"version_normalized": "3.5.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/cache-contracts.git",
"reference": "15a4f8e5cd3bce9aeafc882b1acab39ec8de2c1b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/cache-contracts/zipball/15a4f8e5cd3bce9aeafc882b1acab39ec8de2c1b",
"reference": "15a4f8e5cd3bce9aeafc882b1acab39ec8de2c1b",
"shasum": ""
},
"require": {
"php": ">=8.1",
"psr/cache": "^3.0"
},
"time": "2024-09-25T14:20:29+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Contracts\\Cache\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Generic abstractions related to caching",
"homepage": "https://symfony.com",
"keywords": [
"abstractions",
"contracts",
"decoupling",
"interfaces",
"interoperability",
"standards"
],
"support": {
"source": "https://github.com/symfony/cache-contracts/tree/v3.5.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"install-path": "../symfony/cache-contracts"
},
{
"name": "symfony/deprecation-contracts",
"version": "v3.5.1",
"version_normalized": "3.5.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
"shasum": ""
},
"require": {
"php": ">=8.1"
},
"time": "2024-09-25T14:20:29+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"installation-source": "dist",
"autoload": {
"files": [
"function.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"install-path": "../symfony/deprecation-contracts"
},
{
"name": "symfony/expression-language",
"version": "v6.4.13",
"version_normalized": "6.4.13.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/expression-language.git",
"reference": "3524904fb026356a5230cd197f9a4e6a61e0e7df"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/expression-language/zipball/3524904fb026356a5230cd197f9a4e6a61e0e7df",
"reference": "3524904fb026356a5230cd197f9a4e6a61e0e7df",
"shasum": ""
},
"require": {
"php": ">=8.1",
"symfony/cache": "^5.4|^6.0|^7.0",
"symfony/deprecation-contracts": "^2.5|^3",
"symfony/service-contracts": "^2.5|^3"
},
"time": "2024-10-09T08:40:40+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Component\\ExpressionLanguage\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides an engine that can compile and evaluate expressions",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/expression-language/tree/v6.4.13"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"install-path": "../symfony/expression-language"
},
{
"name": "symfony/service-contracts",
"version": "v3.5.1",
"version_normalized": "3.5.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
"reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/e53260aabf78fb3d63f8d79d69ece59f80d5eda0",
"reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0",
"shasum": ""
},
"require": {
"php": ">=8.1",
"psr/container": "^1.1|^2.0",
"symfony/deprecation-contracts": "^2.5|^3"
},
"conflict": {
"ext-psr": "<1.1|>=2"
},
"time": "2024-09-25T14:20:29+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "3.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Contracts\\Service\\": ""
},
"exclude-from-classmap": [
"/Test/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Generic abstractions related to writing services",
"homepage": "https://symfony.com",
"keywords": [
"abstractions",
"contracts",
"decoupling",
"interfaces",
"interoperability",
"standards"
],
"support": {
"source": "https://github.com/symfony/service-contracts/tree/v3.5.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"install-path": "../symfony/service-contracts"
},
{
"name": "symfony/var-exporter",
"version": "v7.2.0",
"version_normalized": "7.2.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-exporter.git",
"reference": "1a6a89f95a46af0f142874c9d650a6358d13070d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-exporter/zipball/1a6a89f95a46af0f142874c9d650a6358d13070d",
"reference": "1a6a89f95a46af0f142874c9d650a6358d13070d",
"shasum": ""
},
"require": {
"php": ">=8.2"
},
"require-dev": {
"symfony/property-access": "^6.4|^7.0",
"symfony/serializer": "^6.4|^7.0",
"symfony/var-dumper": "^6.4|^7.0"
},
"time": "2024-10-18T07:58:17+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Component\\VarExporter\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Allows exporting any serializable PHP data structure to plain PHP code",
"homepage": "https://symfony.com",
"keywords": [
"clone",
"construct",
"export",
"hydrate",
"instantiate",
"lazy-loading",
"proxy",
"serialize"
],
"support": {
"source": "https://github.com/symfony/var-exporter/tree/v7.2.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"install-path": "../symfony/var-exporter"
}
],
"dev": true,
"dev-package-names": []
}

131
vendor/composer/installed.php vendored Normal file
View File

@@ -0,0 +1,131 @@
<?php return array(
'root' => array(
'name' => '__root__',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '4c22f27eb63b45502b3a4a42004e6d40d7da55a3',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev' => true,
),
'versions' => array(
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '4c22f27eb63b45502b3a4a42004e6d40d7da55a3',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'phpmyadmin/motranslator' => array(
'pretty_version' => '5.3.1',
'version' => '5.3.1.0',
'reference' => 'd03b4d9c608e7265091bf6decc05323d16c7c047',
'type' => 'library',
'install_path' => __DIR__ . '/../phpmyadmin/motranslator',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/cache' => array(
'pretty_version' => '3.0.0',
'version' => '3.0.0.0',
'reference' => 'aa5030cfa5405eccfdcb1083ce040c2cb8d253bf',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/cache',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/cache-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '2.0|3.0',
),
),
'psr/container' => array(
'pretty_version' => '2.0.2',
'version' => '2.0.2.0',
'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/container',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/log' => array(
'pretty_version' => '3.0.2',
'version' => '3.0.2.0',
'reference' => 'f16e1d5863e37f8d8c2a01719f5b34baa2b714d3',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/log',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/simple-cache-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '1.0|2.0|3.0',
),
),
'symfony/cache' => array(
'pretty_version' => 'v7.2.1',
'version' => '7.2.1.0',
'reference' => 'e7e983596b744c4539f31e79b0350a6cf5878a20',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/cache',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/cache-contracts' => array(
'pretty_version' => 'v3.5.1',
'version' => '3.5.1.0',
'reference' => '15a4f8e5cd3bce9aeafc882b1acab39ec8de2c1b',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/cache-contracts',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/cache-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '1.1|2.0|3.0',
),
),
'symfony/deprecation-contracts' => array(
'pretty_version' => 'v3.5.1',
'version' => '3.5.1.0',
'reference' => '74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/expression-language' => array(
'pretty_version' => 'v6.4.13',
'version' => '6.4.13.0',
'reference' => '3524904fb026356a5230cd197f9a4e6a61e0e7df',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/expression-language',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/service-contracts' => array(
'pretty_version' => 'v3.5.1',
'version' => '3.5.1.0',
'reference' => 'e53260aabf78fb3d63f8d79d69ece59f80d5eda0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/service-contracts',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/var-exporter' => array(
'pretty_version' => 'v7.2.0',
'version' => '7.2.0.0',
'reference' => '1a6a89f95a46af0f142874c9d650a6358d13070d',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/var-exporter',
'aliases' => array(),
'dev_requirement' => false,
),
),
);

26
vendor/composer/platform_check.php vendored Normal file
View File

@@ -0,0 +1,26 @@
<?php
// platform_check.php @generated by Composer
$issues = array();
if (!(PHP_VERSION_ID >= 80200)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 8.2.0". You are running ' . PHP_VERSION . '.';
}
if ($issues) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
} elseif (!headers_sent()) {
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
}
}
trigger_error(
'Composer detected issues in your platform: ' . implode(' ', $issues),
E_USER_ERROR
);
}

View File

@@ -0,0 +1,104 @@
# Change Log
## [5.3.1] - 2023-08-23
* Add function guards to the global functions (#44)
## [5.3.0] - 2022-04-26
* Add support for Symfony 6
* Split out `.mo` parsing to separate `MoParser` class
* Added `CacheInterface` so alternate cache implementations are pluggable
* Added `ApcuCache` implementation to leverage shared in-memory translation cache
## [5.2.0] - 2021-02-05
* Fix "Translator::selectString() must be of the type integer, boolean returned" (#37)
* Fix "TypeError: StringReader::readintarray() ($count) must be of type int, float given" failing tests on ARM (#36)
* Add support for getting and setting all translations (#30)
## [5.1.0] - 2020-11-15
* Allow PHPUnit 9 (#35)
* Fix some typos
* Sync config files
* Allow PHP 8.0
## [5.0.0] - 2020-02-28
* Drop support for PHP 5.3, PHP 5.4, PHP 5.5, PHP 5.6, PHP 7.0 and HHVM
* Enabled strict mode on PHP files
* Add support for Symfony 5 (#34)
* Add support for phpunit 8
* Rename CHANGES.md to CHANGELOG.md and follow a standard format
## [4.0] - 2018-02-12
* The library no longer changes system locales.
## [3.4] - 2017-12-15
* Added Translator::setTranslation method.
## [3.3] - 2017-06-01
* Add support for switching locales for Loader instance.
## [3.2] - 2017-05-23
* Various fixes when handling corrupted mo files.
## [3.1] - 2017-05-15
* Documentation improvements.
## [3.0] - 2017-01-23
* All classes moved to the PhpMyAdmin namespace.
## [2.2] - 2017-01-07
* Coding style cleanup.
* Avoid installing tests using composer.
## [2.1] - 2016-12-21
* Various code cleanups.
* Added support for PHP 5.3.
## [2.0] - 2016-10-13
* Consistently use camelCase in API.
* No more relies on using eval().
* Depends on symfony/expression-language for calculations.
## [1.2] - 2016-09-22
* Stricter validation of plural expression.
## [1.1] - 2016-08-29
* Improved handling of corrupted mo files.
* Minor performance improvements.
* Stricter validation of plural expression.
## [1.0] - 2016-04-27
* Documentation improvements.
* Testsuite improvements.
## [0.4] - 2016-03-02
* Fixed test failures with hhvm due to broken putenv.
## [0.3] - 2016-03-01
* Added Loader::detectlocale method.
## [0.2] - 2016-02-24
* Marked PHP 5.4 and 5.5 as supported.
## [0.1] - 2016-02-23
* Initial release.

View File

@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at info@phpmyadmin.net. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

View File

@@ -0,0 +1,42 @@
# Contributing to motranslator
## Reporting issues
Our issue tracker is hosted at GitHub:
https://github.com/phpmyadmin/motranslator/issues
Please search for existing issues before reporting new ones.
## Working with Git checkout
The dependencies are managed by Composer, to get them all installed (or update
on consequent runs) do:
```
composer update
```
## Submitting patches
Please submit your patches using GitHub pull requests, this allows us to review
them and to run automated tests on the code.
## Coding standards
We do follow PSR-1 and PSR-2 coding standards.
You can use phpcbf to fix the code to match our expectations:
```
composer run phpcbf
```
## Testsuite
Our code comes with quite comprehensive testsuite, it is automatically executed
on every commit and pull request, you can also run it locally:
```
composer run phpunit
```

339
vendor/phpmyadmin/motranslator/LICENSE vendored Normal file
View File

@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{description}
Copyright (C) {year} {fullname}
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
{signature of Ty Coon}, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@@ -0,0 +1,29 @@
# Performance
This library was tweaked for best performance for single use - translating
application with many strings using mo file. Current benchmarks show it's about
four times faster than original php-gettext.
There are two benchmark scripts in the code:
* ``benchmark-context.php`` - benchmarks context usage
* ``benchmark-plural.php`` - benchmarks plural evaluation
* ``benchmark.php`` - benchmarks file parsing
* ``benchmark-apcu.php`` - benchmarks file parsing with APCu cache enabled
## Performance measurements
The performance improvements based on individual changes in the code:
| Stage | Seconds |
| -------------- | --------------- |
| Original code | 4.7929680347443 |
| Remove nocache | 4.6308250427246 |
| Direct endian | 4.5883052349091 |
| Remove attribs | 4.5297479629517 |
| String reader | 1.8148958683014 |
| No offset | 1.2436759471893 |
| Less attribs | 1.1722540855408 |
| Remove shift | 1.0970499515533 |
| Magic order | 1.0868430137634 |

242
vendor/phpmyadmin/motranslator/README.md vendored Normal file
View File

@@ -0,0 +1,242 @@
# motranslator
Translation API for PHP using Gettext MO files.
![Test-suite](https://github.com/phpmyadmin/motranslator/workflows/Run%20tests/badge.svg?branch=master)
[![codecov.io](https://codecov.io/github/phpmyadmin/motranslator/coverage.svg?branch=master)](https://codecov.io/github/phpmyadmin/motranslator?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/phpmyadmin/motranslator/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/phpmyadmin/motranslator/?branch=master)
[![Packagist](https://img.shields.io/packagist/dt/phpmyadmin/motranslator.svg)](https://packagist.org/packages/phpmyadmin/motranslator)
## Features
* All strings are stored in memory for fast lookup
* Fast loading of MO files
* Low level API for reading MO files
* Emulation of Gettext API
* No use of `eval()` for plural equation
## Limitations
* Default `InMemoryCache` not suitable for huge MO files which you don't want to store in memory
* Input and output encoding has to match (preferably UTF-8)
## Installation
Please use [Composer][1] to install:
```sh
composer require phpmyadmin/motranslator
```
## Documentation
The API documentation is available at <https://develdocs.phpmyadmin.net/motranslator/>.
## Object API usage
```php
// Create loader object
$loader = new PhpMyAdmin\MoTranslator\Loader();
// Set locale
$loader->setlocale('cs');
// Set default text domain
$loader->textdomain('domain');
// Set path where to look for a domain
$loader->bindtextdomain('domain', __DIR__ . '/data/locale/');
// Get translator
$translator = $loader->getTranslator();
// Now you can use Translator API (see below)
```
## Low level API usage
```php
// Directly load the mo file
// You can use null to not load a file and the use a setter to set the translations
$cache = new PhpMyAdmin\MoTranslator\Cache\InMemoryCache(new PhpMyAdmin\MoTranslator\MoParser('./path/to/file.mo'));
$translator = new PhpMyAdmin\MoTranslator\Translator($cache);
// Now you can use Translator API (see below)
```
## Translator API usage
```php
// Translate string
echo $translator->gettext('String');
// Translate plural string
echo $translator->ngettext('String', 'Plural string', $count);
// Translate string with context
echo $translator->pgettext('Context', 'String');
// Translate plural string with context
echo $translator->npgettext('Context', 'String', 'Plural string', $count);
// Get the translations
echo $translator->getTranslations();
// All getters and setters below are more to be used if you are using a manual loading mode
// Example: $translator = new PhpMyAdmin\MoTranslator\Translator(null);
// Set a translation
echo $translator->setTranslation('Test', 'Translation for "Test" key');
// Set translations
echo $translator->setTranslations([
'Test' => 'Translation for "Test" key',
'Test 2' => 'Translation for "Test 2" key',
]);
// Use the translation
echo $translator->gettext('Test 2'); // -> Translation for "Test 2" key
```
## Gettext compatibility usage
```php
// Load compatibility layer
PhpMyAdmin\MoTranslator\Loader::loadFunctions();
// Configure
_setlocale(LC_MESSAGES, 'cs');
_textdomain('phpmyadmin');
_bindtextdomain('phpmyadmin', __DIR__ . '/data/locale/');
_bind_textdomain_codeset('phpmyadmin', 'UTF-8');
// Use functions
echo _gettext('Type');
echo __('Type');
// It also support other Gettext functions
_dnpgettext($domain, $msgctxt, $msgid, $msgidPlural, $number);
_dngettext($domain, $msgid, $msgidPlural, $number);
_npgettext($msgctxt, $msgid, $msgidPlural, $number);
_ngettext($msgid, $msgidPlural, $number);
_dpgettext($domain, $msgctxt, $msgid);
_dgettext($domain, $msgid);
_pgettext($msgctxt, $msgid);
```
## Using APCu-backed cache
If you have the [APCu][5] extension installed you can use it for storing the translation cache. The `.mo` file
will then only be loaded once and all processes will share the same cache, reducing memory usage and resulting in
performance comparable to the native `gettext` extension.
If you are using `Loader`, pass it an `ApcuCacheFactory` _before_ getting the translator instance:
```php
PhpMyAdmin\MoTranslator\Loader::setCacheFactory(
new PhpMyAdmin\MoTranslator\Cache\AcpuCacheFactory()
);
$loader = new PhpMyAdmin\MoTranslator\Loader();
// Proceed as before
```
If you are using the low level API, instantiate the `ApcuCache` directly:
```php
$cache = new PhpMyAdmin\MoTranslator\Cache\ApcuCache(
new PhpMyAdmin\MoTranslator\MoParser('./path/to/file.mo'),
'de_DE', // the locale
'phpmyadmin' // the domain
);
$translator = new PhpMyAdmin\MoTranslator\Translator($cache);
// Proceed as before
```
By default, APCu will cache the translations until next server restart and prefix the cache entries with `mo_` to
avoid clashes with other cache entries. You can control this behaviour by passing `$ttl` and `$prefix` arguments, either
to the `ApcuCacheFactory` or when instantiating `ApcuCache`:
```php
PhpMyAdmin\MoTranslator\Loader::setCacheFactory(
new PhpMyAdmin\MoTranslator\Cache\AcpuCacheFactory(
3600, // cache for 1 hour
true, // reload on cache miss
'custom_' // custom prefix for cache entries
)
);
$loader = new PhpMyAdmin\MoTranslator\Loader();
// or...
$cache = new PhpMyAdmin\MoTranslator\Cache\ApcuCache(
new PhpMyAdmin\MoTranslator\MoParser('./path/to/file.mo'),
'de_DE',
'phpmyadmin',
3600, // cache for 1 hour
true, // reload on cache miss
'custom_' // custom prefix for cache entries
);
$translator = new PhpMyAdmin\MoTranslator\Translator($cache);
```
If you receive updated translation files you can load them without restarting the server using the low-level API:
```php
$parser = new PhpMyAdmin\MoTranslator\MoParser('./path/to/file.mo');
$cache = new PhpMyAdmin\MoTranslator\Cache\ApcuCache($parser, 'de_DE', 'phpmyadmin');
$parser->parseIntoCache($cache);
```
You should ensure APCu has enough memory to store all your translations, along with any other entries you use it
for. If an entry is evicted from cache, the `.mo` file will be re-parsed, impacting performance. See the
`apc.shm_size` and `apc.shm_segments` [documentation][6] and monitor cache usage when first rolling out.
If your `.mo` files are missing lots of translations, the first time a missing entry is requested the `.mo` file
will be re-parsed. Again, this will impact performance until all the missing entries are hit once. You can turn off this
behaviour by setting the `$reloadOnMiss` argument to `false`. If you do this it is _critical_ that APCu has enough
memory, or users will see untranslated text when entries are evicted.
## History
This library is based on [php-gettext][2]. It adds some performance
improvements and ability to install using [Composer][1].
## Motivation
Motivation for this library includes:
* The [php-gettext][2] library is not maintained anymore
* It doesn't work with recent PHP version (phpMyAdmin has patched version)
* It relies on `eval()` function for plural equations what can have severe security implications, see [CVE-2016-6175][4]
* It's not possible to install it using [Composer][1]
* There was place for performance improvements in the library
### Why not to use native gettext in PHP?
We've tried that, but it's not a viable solution:
* You can not use locales not known to system, what is something you can not
control from web application. This gets even more tricky with minimalist
virtualisation containers.
* Changing the MO file usually leads to PHP segmentation fault. It (or rather
Gettext library) caches headers of MO file and if it's content is changed
(for example new version is uploaded to server) it tries to access new data
with old references. This is bug known for ages:
https://bugs.php.net/bug.php?id=45943
### Why use Gettext and not JSON, YAML or whatever?
We want translators to be able to use their favorite tools and we want us to be
able to use wide range of tools available with Gettext as well such as
[web based translation using Weblate][3]. Using custom format usually adds
another barrier for translators and we want to make it easy for them to
contribute.
[1]:https://getcomposer.org/
[2]:https://launchpad.net/php-gettext
[3]:https://weblate.org/
[4]: https://www.cve.org/CVERecord?id=CVE-2016-6175
[5]:https://www.php.net/manual/en/book.apcu.php
[6]:https://www.php.net/manual/en/apcu.configuration.php

View File

@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
require './vendor/autoload.php';
$files = [
'big' => './tests/data/big.mo',
'little' => './tests/data/little.mo',
];
$start = microtime(true);
for ($i = 0; $i < 2000; ++$i) {
foreach ($files as $domain => $filename) {
$translator = new PhpMyAdmin\MoTranslator\Translator(
new PhpMyAdmin\MoTranslator\Cache\ApcuCache(
new PhpMyAdmin\MoTranslator\MoParser($filename), 'foo', $domain
)
);
$translator->gettext('Column');
}
}
$end = microtime(true);
$diff = $end - $start;
echo 'Execution took ' . $diff . ' seconds' . "\n";

View File

@@ -0,0 +1,56 @@
{
"name": "phpmyadmin/motranslator",
"description": "Translation API for PHP using Gettext MO files",
"license": "GPL-2.0-or-later",
"keywords": ["gettext", "mo", "translator", "i18n"],
"homepage": "https://github.com/phpmyadmin/motranslator",
"authors": [
{
"name": "The phpMyAdmin Team",
"email": "developers@phpmyadmin.net",
"homepage": "https://www.phpmyadmin.net/team/"
}
],
"support": {
"issues": "https://github.com/phpmyadmin/motranslator/issues",
"source": "https://github.com/phpmyadmin/motranslator"
},
"scripts": {
"phpcbf": "@php phpcbf",
"phpcs": "@php phpcs",
"phpstan": "@php phpstan",
"phpunit": "@php phpunit",
"test": [
"@phpcs",
"@phpstan",
"@phpunit"
]
},
"require": {
"php": "^7.1 || ^8.0",
"symfony/expression-language": "^4.0 || ^5.0 || ^6.0"
},
"require-dev": {
"phpunit/phpunit": "^7.4 || ^8 || ^9",
"phpmyadmin/coding-standard": "^3.0.0",
"phpstan/phpstan": "^1.4.6"
},
"autoload": {
"psr-4": {
"PhpMyAdmin\\MoTranslator\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"PhpMyAdmin\\MoTranslator\\Tests\\": "tests"
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"suggest": {
"ext-apcu": "Needed for ACPu-backed translation cache"
}
}

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
beStrictAboutOutputDuringTests="true"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<logging>
<log type="coverage-clover" target="build/logs/clover.xml" />
</logging>
<testsuites>
<testsuite name="Main">
<directory suffix=".php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<php>
<ini name="display_errors" value="On" />
<ini name="display_startup_errors" value="On" />
<ini name="error_reporting" value="E_ALL" />
</php>
</phpunit>

View File

@@ -0,0 +1,136 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Cache;
use PhpMyAdmin\MoTranslator\CacheException;
use PhpMyAdmin\MoTranslator\MoParser;
use function apcu_enabled;
use function apcu_entry;
use function apcu_exists;
use function apcu_fetch;
use function apcu_store;
use function array_combine;
use function array_keys;
use function array_map;
use function assert;
use function function_exists;
use function is_array;
use function is_string;
final class ApcuCache implements CacheInterface
{
public const LOADED_KEY = '__TRANSLATIONS_LOADED__';
/** @var MoParser */
private $parser;
/** @var string */
private $locale;
/** @var string */
private $domain;
/** @var int */
private $ttl;
/** @var bool */
private $reloadOnMiss;
/** @var string */
private $prefix;
public function __construct(
MoParser $parser,
string $locale,
string $domain,
int $ttl = 0,
bool $reloadOnMiss = true,
string $prefix = 'mo_'
) {
if (! (function_exists('apcu_enabled') && apcu_enabled())) {
throw new CacheException('ACPu extension must be installed and enabled');
}
$this->parser = $parser;
$this->locale = $locale;
$this->domain = $domain;
$this->ttl = $ttl;
$this->reloadOnMiss = $reloadOnMiss;
$this->prefix = $prefix;
$this->ensureTranslationsLoaded();
}
public function get(string $msgid): string
{
$msgstr = apcu_fetch($this->getKey($msgid), $success);
if ($success && is_string($msgstr)) {
return $msgstr;
}
if (! $this->reloadOnMiss) {
return $msgid;
}
return $this->reloadOnMiss($msgid);
}
private function reloadOnMiss(string $msgid): string
{
// store original if translation is not present
$cached = apcu_entry($this->getKey($msgid), static function () use ($msgid) {
return $msgid;
}, $this->ttl);
// if another process has updated cache, return early
if ($cached !== $msgid && is_string($cached)) {
return $cached;
}
// reload .mo file, in case entry has been evicted
$this->parser->parseIntoCache($this);
$msgstr = apcu_fetch($this->getKey($msgid), $success);
return $success && is_string($msgstr) ? $msgstr : $msgid;
}
public function set(string $msgid, string $msgstr): void
{
apcu_store($this->getKey($msgid), $msgstr, $this->ttl);
}
public function has(string $msgid): bool
{
return apcu_exists($this->getKey($msgid));
}
public function setAll(array $translations): void
{
$keys = array_map(function (string $msgid): string {
return $this->getKey($msgid);
}, array_keys($translations));
$translations = array_combine($keys, $translations);
assert(is_array($translations));
apcu_store($translations, null, $this->ttl);
}
private function getKey(string $msgid): string
{
return $this->prefix . $this->locale . '.' . $this->domain . '.' . $msgid;
}
private function ensureTranslationsLoaded(): void
{
// Try to prevent cache slam if multiple processes are trying to load translations. There is still a race
// between the exists check and creating the entry, but at least it's small
$key = $this->getKey(self::LOADED_KEY);
$loaded = apcu_exists($key) || apcu_entry($key, static function (): int {
return 0;
}, $this->ttl);
if ($loaded) {
return;
}
$this->parser->parseIntoCache($this);
apcu_store($this->getKey(self::LOADED_KEY), 1, $this->ttl);
}
}

View File

@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Cache;
use PhpMyAdmin\MoTranslator\MoParser;
final class ApcuCacheFactory implements CacheFactoryInterface
{
/** @var int */
private $ttl;
/** @var bool */
private $reloadOnMiss;
/** @var string */
private $prefix;
public function __construct(int $ttl = 0, bool $reloadOnMiss = true, string $prefix = 'mo_')
{
$this->ttl = $ttl;
$this->reloadOnMiss = $reloadOnMiss;
$this->prefix = $prefix;
}
public function getInstance(MoParser $parser, string $locale, string $domain): CacheInterface
{
return new ApcuCache($parser, $locale, $domain, $this->ttl, $this->reloadOnMiss, $this->prefix);
}
}

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Cache;
use PhpMyAdmin\MoTranslator\MoParser;
interface CacheFactoryInterface
{
public function getInstance(MoParser $parser, string $locale, string $domain): CacheInterface;
}

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Cache;
interface CacheInterface
{
/**
* Returns cached `msgstr` if it is in cache, otherwise `$msgid`
*/
public function get(string $msgid): string;
/**
* Caches `$msgstr` value for key `$mesid`
*/
public function set(string $msgid, string $msgstr): void;
/**
* Returns true if cache has entry for `$msgid`
*/
public function has(string $msgid): bool;
/**
* Populates cache with array of `$msgid => $msgstr` entries
*
* This will overwrite existing values for `$msgid`, but is not guaranteed to clear cache of existing entries
* not present in `$translations`.
*
* @param array<string, string> $translations
*/
public function setAll(array $translations): void;
}

View File

@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Cache;
interface GetAllInterface
{
/**
* @return array<string, string>
*/
public function getAll(): array;
}

View File

@@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Cache;
use PhpMyAdmin\MoTranslator\MoParser;
use function array_key_exists;
final class InMemoryCache implements CacheInterface, GetAllInterface
{
/** @var array<string, string> */
private $cache;
public function __construct(MoParser $parser)
{
$this->cache = [];
$parser->parseIntoCache($this);
}
public function get(string $msgid): string
{
return array_key_exists($msgid, $this->cache) ? $this->cache[$msgid] : $msgid;
}
public function set(string $msgid, string $msgstr): void
{
$this->cache[$msgid] = $msgstr;
}
public function has(string $msgid): bool
{
return array_key_exists($msgid, $this->cache);
}
public function setAll(array $translations): void
{
$this->cache = $translations;
}
/**
* @inheritDoc
*/
public function getAll(): array
{
return $this->cache;
}
}

View File

@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator;
use DomainException;
final class CacheException extends DomainException
{
}

View File

@@ -0,0 +1,318 @@
<?php
declare(strict_types=1);
/*
Copyright (c) 2005 Steven Armstrong <sa at c-area dot ch>
Copyright (c) 2009 Danilo Segan <danilo@kvota.net>
Copyright (c) 2016 Michal Čihař <michal@cihar.com>
This file is part of MoTranslator.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
namespace PhpMyAdmin\MoTranslator;
use PhpMyAdmin\MoTranslator\Cache\CacheFactoryInterface;
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
use function array_push;
use function file_exists;
use function getenv;
use function in_array;
use function preg_match;
use function sprintf;
class Loader
{
/**
* Loader instance.
*
* @static
* @var Loader
*/
private static $instance = null;
/**
* Factory to return a factory responsible for returning a `CacheInterface`
*
* @static
* @var CacheFactoryInterface|null
*/
private static $cacheFactory = null;
/**
* Default gettext domain to use.
*
* @var string
*/
private $defaultDomain = '';
/**
* Configured locale.
*
* @var string
*/
private $locale = '';
/**
* Loaded domains.
*
* @var array<string,array<string,Translator>>
*/
private $domains = [];
/**
* Bound paths for domains.
*
* @var array<string,string>
*/
private $paths = ['' => './'];
/**
* Returns the singleton Loader object.
*
* @return Loader object
*/
public static function getInstance(): Loader
{
if (self::$instance === null) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Loads global localization functions.
*/
public static function loadFunctions(): void
{
require_once __DIR__ . '/functions.php';
}
/**
* Figure out all possible locale names and start with the most
* specific ones. I.e. for sr_CS.UTF-8@latin, look through all of
* sr_CS.UTF-8@latin, sr_CS@latin, sr@latin, sr_CS.UTF-8, sr_CS, sr.
*
* @param string $locale Locale code
*
* @return string[] list of locales to try for any POSIX-style locale specification
*/
public static function listLocales(string $locale): array
{
$localeNames = [];
if ($locale) {
if (
preg_match(
'/^(?P<lang>[a-z]{2,3})' // language code
. '(?:_(?P<country>[A-Z]{2}))?' // country code
. '(?:\\.(?P<charset>[-A-Za-z0-9_]+))?' // charset
. '(?:@(?P<modifier>[-A-Za-z0-9_]+))?$/', // @ modifier
$locale,
$matches
)
) {
$lang = $matches['lang'] ?? null;
$country = $matches['country'] ?? null;
$charset = $matches['charset'] ?? null;
$modifier = $matches['modifier'] ?? null;
if ($modifier) {
if ($country) {
if ($charset) {
array_push(
$localeNames,
sprintf('%s_%s.%s@%s', $lang, $country, $charset, $modifier)
);
}
array_push(
$localeNames,
sprintf('%s_%s@%s', $lang, $country, $modifier)
);
} elseif ($charset) {
array_push(
$localeNames,
sprintf('%s.%s@%s', $lang, $charset, $modifier)
);
}
array_push(
$localeNames,
sprintf('%s@%s', $lang, $modifier)
);
}
if ($country) {
if ($charset) {
array_push(
$localeNames,
sprintf('%s_%s.%s', $lang, $country, $charset)
);
}
array_push(
$localeNames,
sprintf('%s_%s', $lang, $country)
);
} elseif ($charset) {
array_push(
$localeNames,
sprintf('%s.%s', $lang, $charset)
);
}
array_push($localeNames, $lang);
}
// If the locale name doesn't match POSIX style, just include it as-is.
if (! in_array($locale, $localeNames)) {
array_push($localeNames, $locale);
}
}
return $localeNames;
}
/**
* Sets factory responsible for composing a `CacheInterface`
*/
public static function setCacheFactory(?CacheFactoryInterface $cacheFactory): void
{
self::$cacheFactory = $cacheFactory;
}
/**
* Returns Translator object for domain or for default domain.
*
* @param string $domain Translation domain
*/
public function getTranslator(string $domain = ''): Translator
{
if (empty($domain)) {
$domain = $this->defaultDomain;
}
if (! isset($this->domains[$this->locale])) {
$this->domains[$this->locale] = [];
}
if (! isset($this->domains[$this->locale][$domain])) {
if (isset($this->paths[$domain])) {
$base = $this->paths[$domain];
} else {
$base = './';
}
$localeNames = $this->listLocales($this->locale);
$filename = '';
foreach ($localeNames as $locale) {
$filename = $base . '/' . $locale . '/LC_MESSAGES/' . $domain . '.mo';
if (file_exists($filename)) {
break;
}
}
// We don't care about invalid path, we will get fallback
// translator here
$moParser = new MoParser($filename);
if (self::$cacheFactory instanceof CacheFactoryInterface) {
$cache = self::$cacheFactory->getInstance($moParser, $this->locale, $domain);
} else {
$cache = new InMemoryCache($moParser);
}
$this->domains[$this->locale][$domain] = new Translator($cache);
}
return $this->domains[$this->locale][$domain];
}
/**
* Sets the path for a domain.
*
* @param string $domain Domain name
* @param string $path Path where to find locales
*/
public function bindtextdomain(string $domain, string $path): void
{
$this->paths[$domain] = $path;
}
/**
* Sets the default domain.
*
* @param string $domain Domain name
*/
public function textdomain(string $domain): void
{
$this->defaultDomain = $domain;
}
/**
* Sets a requested locale.
*
* @param string $locale Locale name
*
* @return string Set or current locale
*/
public function setlocale(string $locale): string
{
if (! empty($locale)) {
$this->locale = $locale;
}
return $this->locale;
}
/**
* Detects currently configured locale.
*
* It checks:
*
* - global lang variable
* - environment for LC_ALL, LC_MESSAGES and LANG
*
* @return string with locale name
*/
public function detectlocale(): string
{
if (isset($GLOBALS['lang'])) {
return $GLOBALS['lang'];
}
$locale = getenv('LC_ALL');
if ($locale !== false) {
return $locale;
}
$locale = getenv('LC_MESSAGES');
if ($locale !== false) {
return $locale;
}
$locale = getenv('LANG');
if ($locale !== false) {
return $locale;
}
return 'en';
}
}

View File

@@ -0,0 +1,109 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator;
use PhpMyAdmin\MoTranslator\Cache\CacheInterface;
use function is_readable;
use function strcmp;
final class MoParser
{
/**
* None error.
*/
public const ERROR_NONE = 0;
/**
* File does not exist.
*/
public const ERROR_DOES_NOT_EXIST = 1;
/**
* File has bad magic number.
*/
public const ERROR_BAD_MAGIC = 2;
/**
* Error while reading file, probably too short.
*/
public const ERROR_READING = 3;
/**
* Big endian mo file magic bytes.
*/
public const MAGIC_BE = "\x95\x04\x12\xde";
/**
* Little endian mo file magic bytes.
*/
public const MAGIC_LE = "\xde\x12\x04\x95";
/**
* Parse error code (0 if no error).
*
* @var int
*/
public $error = self::ERROR_NONE;
/** @var string|null */
private $filename;
public function __construct(?string $filename)
{
$this->filename = $filename;
}
/**
* Parses .mo file and stores results to `$cache`
*/
public function parseIntoCache(CacheInterface $cache): void
{
if ($this->filename === null) {
return;
}
if (! is_readable($this->filename)) {
$this->error = self::ERROR_DOES_NOT_EXIST;
return;
}
$stream = new StringReader($this->filename);
try {
$magic = $stream->read(0, 4);
if (strcmp($magic, self::MAGIC_LE) === 0) {
$unpack = 'V';
} elseif (strcmp($magic, self::MAGIC_BE) === 0) {
$unpack = 'N';
} else {
$this->error = self::ERROR_BAD_MAGIC;
return;
}
/* Parse header */
$total = $stream->readint($unpack, 8);
$originals = $stream->readint($unpack, 12);
$translations = $stream->readint($unpack, 16);
/* get original and translations tables */
$totalTimesTwo = (int) ($total * 2);// Fix for issue #36 on ARM
$tableOriginals = $stream->readintarray($unpack, $originals, $totalTimesTwo);
$tableTranslations = $stream->readintarray($unpack, $translations, $totalTimesTwo);
/* read all strings to the cache */
for ($i = 0; $i < $total; ++$i) {
$iTimesTwo = $i * 2;
$iPlusOne = $iTimesTwo + 1;
$iPlusTwo = $iTimesTwo + 2;
$original = $stream->read($tableOriginals[$iPlusTwo], $tableOriginals[$iPlusOne]);
$translation = $stream->read($tableTranslations[$iPlusTwo], $tableTranslations[$iPlusOne]);
$cache->set($original, $translation);
}
} catch (ReaderException $e) {
$this->error = self::ERROR_READING;
return;
}
}
}

View File

@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
/*
Copyright (c) 2003, 2005, 2006, 2009 Danilo Segan <danilo@kvota.net>.
Copyright (c) 2016 Michal Čihař <michal@cihar.com>
This file is part of MoTranslator.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
namespace PhpMyAdmin\MoTranslator;
use Exception;
/**
* Exception thrown when file can not be read.
*/
class ReaderException extends Exception
{
}

View File

@@ -0,0 +1,116 @@
<?php
declare(strict_types=1);
/*
Copyright (c) 2003, 2005, 2006, 2009 Danilo Segan <danilo@kvota.net>.
Copyright (c) 2016 Michal Čihař <michal@cihar.com>
This file is part of MoTranslator.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
namespace PhpMyAdmin\MoTranslator;
use function file_get_contents;
use function strlen;
use function substr;
use function unpack;
use const PHP_INT_MAX;
/**
* Simple wrapper around string buffer for
* random access and values parsing.
*/
class StringReader
{
/** @var string */
private $string;
/** @var int */
private $length;
/**
* @param string $filename Name of file to load
*/
public function __construct(string $filename)
{
$this->string = (string) file_get_contents($filename);
$this->length = strlen($this->string);
}
/**
* Read number of bytes from given offset.
*
* @param int $pos Offset
* @param int $bytes Number of bytes to read
*/
public function read(int $pos, int $bytes): string
{
if ($pos + $bytes > $this->length) {
throw new ReaderException('Not enough bytes!');
}
$data = substr($this->string, $pos, $bytes);
return $data === false ? '' : $data;
}
/**
* Reads a 32bit integer from the stream.
*
* @param string $unpack Unpack string
* @param int $pos Position
*
* @return int Integer from the stream
*/
public function readint(string $unpack, int $pos): int
{
$data = unpack($unpack, $this->read($pos, 4));
if ($data === false) {
return PHP_INT_MAX;
}
$result = $data[1];
/* We're reading unsigned int, but PHP will happily
* give us negative number on 32-bit platforms.
*
* See also documentation:
* https://secure.php.net/manual/en/function.unpack.php#refsect1-function.unpack-notes
*/
return $result < 0 ? PHP_INT_MAX : $result;
}
/**
* Reads an array of integers from the stream.
*
* @param string $unpack Unpack string
* @param int $pos Position
* @param int $count How many elements should be read
*
* @return int[] Array of Integers
*/
public function readintarray(string $unpack, int $pos, int $count): array
{
$data = unpack($unpack . $count, $this->read($pos, 4 * $count));
if ($data === false) {
return [];
}
return $data;
}
}

View File

@@ -0,0 +1,388 @@
<?php
declare(strict_types=1);
/*
Copyright (c) 2003, 2009 Danilo Segan <danilo@kvota.net>.
Copyright (c) 2005 Nico Kaiser <nico@siriux.net>
Copyright (c) 2016 Michal Čihař <michal@cihar.com>
This file is part of MoTranslator.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
namespace PhpMyAdmin\MoTranslator;
use PhpMyAdmin\MoTranslator\Cache\CacheInterface;
use PhpMyAdmin\MoTranslator\Cache\GetAllInterface;
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Throwable;
use function chr;
use function count;
use function explode;
use function get_class;
use function implode;
use function intval;
use function ltrim;
use function preg_replace;
use function rtrim;
use function sprintf;
use function stripos;
use function strpos;
use function strtolower;
use function substr;
use function trim;
/**
* Provides a simple gettext replacement that works independently from
* the system's gettext abilities.
* It can read MO files and use them for translating strings.
*
* It caches ll strings and translations to speed up the string lookup.
*/
class Translator
{
/**
* None error.
*/
public const ERROR_NONE = 0;
/**
* File does not exist.
*/
public const ERROR_DOES_NOT_EXIST = 1;
/**
* File has bad magic number.
*/
public const ERROR_BAD_MAGIC = 2;
/**
* Error while reading file, probably too short.
*/
public const ERROR_READING = 3;
/**
* Big endian mo file magic bytes.
*/
public const MAGIC_BE = "\x95\x04\x12\xde";
/**
* Little endian mo file magic bytes.
*/
public const MAGIC_LE = "\xde\x12\x04\x95";
/**
* Parse error code (0 if no error).
*
* @var int
*/
public $error = self::ERROR_NONE;
/**
* Cache header field for plural forms.
*
* @var string|null
*/
private $pluralEquation = null;
/** @var ExpressionLanguage|null Evaluator for plurals */
private $pluralExpression = null;
/** @var int|null number of plurals */
private $pluralCount = null;
/** @var CacheInterface */
private $cache;
/**
* @param CacheInterface|string|null $cache Mo file to load (null for no file) or a CacheInterface implementation
*/
public function __construct($cache)
{
if (! $cache instanceof CacheInterface) {
$cache = new InMemoryCache(new MoParser($cache));
}
$this->cache = $cache;
}
/**
* Translates a string.
*
* @param string $msgid String to be translated
*
* @return string translated string (or original, if not found)
*/
public function gettext(string $msgid): string
{
return $this->cache->get($msgid);
}
/**
* Check if a string is translated.
*
* @param string $msgid String to be checked
*/
public function exists(string $msgid): bool
{
return $this->cache->has($msgid);
}
/**
* Sanitize plural form expression for use in ExpressionLanguage.
*
* @param string $expr Expression to sanitize
*
* @return string sanitized plural form expression
*/
public static function sanitizePluralExpression(string $expr): string
{
// Parse equation
$expr = explode(';', $expr);
if (count($expr) >= 2) {
$expr = $expr[1];
} else {
$expr = $expr[0];
}
$expr = trim(strtolower($expr));
// Strip plural prefix
if (substr($expr, 0, 6) === 'plural') {
$expr = ltrim(substr($expr, 6));
}
// Strip equals
if (substr($expr, 0, 1) === '=') {
$expr = ltrim(substr($expr, 1));
}
// Cleanup from unwanted chars
$expr = preg_replace('@[^n0-9:\(\)\?=!<>/%&| ]@', '', $expr);
return (string) $expr;
}
/**
* Extracts number of plurals from plurals form expression.
*
* @param string $expr Expression to process
*
* @return int Total number of plurals
*/
public static function extractPluralCount(string $expr): int
{
$parts = explode(';', $expr, 2);
$nplurals = explode('=', trim($parts[0]), 2);
if (strtolower(rtrim($nplurals[0])) !== 'nplurals') {
return 1;
}
if (count($nplurals) === 1) {
return 1;
}
return intval($nplurals[1]);
}
/**
* Parse full PO header and extract only plural forms line.
*
* @param string $header Gettext header
*
* @return string verbatim plural form header field
*/
public static function extractPluralsForms(string $header): string
{
$headers = explode("\n", $header);
$expr = 'nplurals=2; plural=n == 1 ? 0 : 1;';
foreach ($headers as $header) {
if (stripos($header, 'Plural-Forms:') !== 0) {
continue;
}
$expr = substr($header, 13);
}
return $expr;
}
/**
* Get possible plural forms from MO header.
*
* @return string plural form header
*/
private function getPluralForms(): string
{
// lets assume message number 0 is header
// this is true, right?
// cache header field for plural forms
if ($this->pluralEquation === null) {
$header = $this->cache->get('');
$expr = $this->extractPluralsForms($header);
$this->pluralEquation = $this->sanitizePluralExpression($expr);
$this->pluralCount = $this->extractPluralCount($expr);
}
return $this->pluralEquation;
}
/**
* Detects which plural form to take.
*
* @param int $n count of objects
*
* @return int array index of the right plural form
*/
private function selectString(int $n): int
{
if ($this->pluralExpression === null) {
$this->pluralExpression = new ExpressionLanguage();
}
try {
$plural = (int) $this->pluralExpression->evaluate(
$this->getPluralForms(),
['n' => $n]
);
} catch (Throwable $e) {
$plural = 0;
}
if ($plural >= $this->pluralCount) {
$plural = $this->pluralCount - 1;
}
return $plural;
}
/**
* Plural version of gettext.
*
* @param string $msgid Single form
* @param string $msgidPlural Plural form
* @param int $number Number of objects
*
* @return string translated plural form
*/
public function ngettext(string $msgid, string $msgidPlural, int $number): string
{
// this should contains all strings separated by NULLs
$key = implode(chr(0), [$msgid, $msgidPlural]);
if (! $this->cache->has($key)) {
return $number !== 1 ? $msgidPlural : $msgid;
}
$result = $this->cache->get($key);
// find out the appropriate form
$select = $this->selectString($number);
$list = explode(chr(0), $result);
// @codeCoverageIgnoreStart
if ($list === false) {
// This was added in 3ff2c63bcf85f81b3a205ce7222de11b33e2bf56 for phpstan
// But according to the php manual it should never happen
return '';
}
// @codeCoverageIgnoreEnd
if (! isset($list[$select])) {
return $list[0];
}
return $list[$select];
}
/**
* Translate with context.
*
* @param string $msgctxt Context
* @param string $msgid String to be translated
*
* @return string translated plural form
*/
public function pgettext(string $msgctxt, string $msgid): string
{
$key = implode(chr(4), [$msgctxt, $msgid]);
$ret = $this->gettext($key);
if (strpos($ret, chr(4)) !== false) {
return $msgid;
}
return $ret;
}
/**
* Plural version of pgettext.
*
* @param string $msgctxt Context
* @param string $msgid Single form
* @param string $msgidPlural Plural form
* @param int $number Number of objects
*
* @return string translated plural form
*/
public function npgettext(string $msgctxt, string $msgid, string $msgidPlural, int $number): string
{
$key = implode(chr(4), [$msgctxt, $msgid]);
$ret = $this->ngettext($key, $msgidPlural, $number);
if (strpos($ret, chr(4)) !== false) {
return $msgid;
}
return $ret;
}
/**
* Set translation in place
*
* @param string $msgid String to be set
* @param string $msgstr Translation
*/
public function setTranslation(string $msgid, string $msgstr): void
{
$this->cache->set($msgid, $msgstr);
}
/**
* Set the translations
*
* @param array<string,string> $translations The translations "key => value" array
*/
public function setTranslations(array $translations): void
{
$this->cache->setAll($translations);
}
/**
* Get the translations
*
* @return array<string,string> The translations "key => value" array
*/
public function getTranslations(): array
{
if ($this->cache instanceof GetAllInterface) {
return $this->cache->getAll();
}
throw new CacheException(sprintf(
"Cache '%s' does not support getting translations",
get_class($this->cache)
));
}
}

View File

@@ -0,0 +1,226 @@
<?php
declare(strict_types=1);
/*
Copyright (c) 2005 Steven Armstrong <sa at c-area dot ch>
Copyright (c) 2009 Danilo Segan <danilo@kvota.net>
Copyright (c) 2016 Michal Čihař <michal@cihar.com>
This file is part of MoTranslator.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
use PhpMyAdmin\MoTranslator\Loader;
if (! function_exists('_setlocale')) {
/**
* Sets a requested locale.
*
* @param int $category Locale category, ignored
* @param string $locale Locale name
*
* @return string Set or current locale
*/
function _setlocale(int $category, string $locale): string
{
return Loader::getInstance()->setlocale($locale);
}
}
if (! function_exists('_bindtextdomain')) {
/**
* Sets the path for a domain.
*
* @param string $domain Domain name
* @param string $path Path where to find locales
*/
function _bindtextdomain(string $domain, string $path): void
{
Loader::getInstance()->bindtextdomain($domain, $path);
}
}
if (! function_exists('_bind_textdomain_codeset')) {
/**
* Dummy compatibility function, MoTranslator assumes
* everything is using same character set on input and
* output.
*
* Generally it is wise to output in UTF-8 and have
* mo files in UTF-8.
*
* @param string $domain Domain where to set character set
* @param string $codeset Character set to set
*/
function _bind_textdomain_codeset($domain, $codeset): void
{
}
}
if (! function_exists('_textdomain')) {
/**
* Sets the default domain.
*
* @param string $domain Domain name
*/
function _textdomain(string $domain): void
{
Loader::getInstance()->textdomain($domain);
}
}
if (! function_exists('_gettext')) {
/**
* Translates a string.
*
* @param string $msgid String to be translated
*
* @return string translated string (or original, if not found)
*/
function _gettext(string $msgid): string
{
return Loader::getInstance()->getTranslator()->gettext($msgid);
}
}
if (! function_exists('__')) {
/**
* Translates a string, alias for _gettext.
*
* @param string $msgid String to be translated
*
* @return string translated string (or original, if not found)
*/
function __(string $msgid): string
{
return Loader::getInstance()->getTranslator()->gettext($msgid);
}
}
if (! function_exists('_ngettext')) {
/**
* Plural version of gettext.
*
* @param string $msgid Single form
* @param string $msgidPlural Plural form
* @param int $number Number of objects
*
* @return string translated plural form
*/
function _ngettext(string $msgid, string $msgidPlural, int $number): string
{
return Loader::getInstance()->getTranslator()->ngettext($msgid, $msgidPlural, $number);
}
}
if (! function_exists('_pgettext')) {
/**
* Translate with context.
*
* @param string $msgctxt Context
* @param string $msgid String to be translated
*
* @return string translated plural form
*/
function _pgettext(string $msgctxt, string $msgid): string
{
return Loader::getInstance()->getTranslator()->pgettext($msgctxt, $msgid);
}
}
if (! function_exists('_npgettext')) {
/**
* Plural version of pgettext.
*
* @param string $msgctxt Context
* @param string $msgid Single form
* @param string $msgidPlural Plural form
* @param int $number Number of objects
*
* @return string translated plural form
*/
function _npgettext(string $msgctxt, string $msgid, string $msgidPlural, int $number): string
{
return Loader::getInstance()->getTranslator()->npgettext($msgctxt, $msgid, $msgidPlural, $number);
}
}
if (! function_exists('_dgettext')) {
/**
* Translates a string.
*
* @param string $domain Domain to use
* @param string $msgid String to be translated
*
* @return string translated string (or original, if not found)
*/
function _dgettext(string $domain, string $msgid): string
{
return Loader::getInstance()->getTranslator($domain)->gettext($msgid);
}
}
if (! function_exists('_dngettext')) {
/**
* Plural version of gettext.
*
* @param string $domain Domain to use
* @param string $msgid Single form
* @param string $msgidPlural Plural form
* @param int $number Number of objects
*
* @return string translated plural form
*/
function _dngettext(string $domain, string $msgid, string $msgidPlural, int $number): string
{
return Loader::getInstance()->getTranslator($domain)->ngettext($msgid, $msgidPlural, $number);
}
}
if (! function_exists('_dpgettext')) {
/**
* Translate with context.
*
* @param string $domain Domain to use
* @param string $msgctxt Context
* @param string $msgid String to be translated
*
* @return string translated plural form
*/
function _dpgettext(string $domain, string $msgctxt, string $msgid): string
{
return Loader::getInstance()->getTranslator($domain)->pgettext($msgctxt, $msgid);
}
}
if (! function_exists('_dnpgettext')) {
/**
* Plural version of pgettext.
*
* @param string $domain Domain to use
* @param string $msgctxt Context
* @param string $msgid Single form
* @param string $msgidPlural Plural form
* @param int $number Number of objects
*
* @return string translated plural form
*/
function _dnpgettext(string $domain, string $msgctxt, string $msgid, string $msgidPlural, int $number): string
{
return Loader::getInstance()->getTranslator($domain)->npgettext($msgctxt, $msgid, $msgidPlural, $number);
}
}

View File

@@ -0,0 +1,98 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Tests\Cache;
use PhpMyAdmin\MoTranslator\Cache\ApcuCache;
use PhpMyAdmin\MoTranslator\Cache\ApcuCacheFactory;
use PhpMyAdmin\MoTranslator\MoParser;
use PHPUnit\Framework\TestCase;
use function apcu_clear_cache;
use function apcu_delete;
use function apcu_enabled;
use function apcu_fetch;
use function function_exists;
use function sleep;
/**
* @covers \PhpMyAdmin\MoTranslator\Cache\ApcuCacheFactory
*/
class ApcuCacheFactoryTest extends TestCase
{
protected function setUp(): void
{
parent::setUp();
if (function_exists('apcu_enabled') && apcu_enabled()) {
return;
}
$this->markTestSkipped('ACPu extension is not installed and enabled for CLI');
}
protected function tearDown(): void
{
parent::tearDown();
apcu_clear_cache();
}
public function testGetInstanceReturnApcuCache(): void
{
$factory = new ApcuCacheFactory();
$instance = $factory->getInstance(new MoParser(null), 'foo', 'bar');
$this->assertInstanceOf(ApcuCache::class, $instance);
}
public function testConstructorSetsTtl(): void
{
$locale = 'foo';
$domain = 'bar';
$msgid = 'Column';
$ttl = 1;
$factory = new ApcuCacheFactory($ttl);
$parser = new MoParser(__DIR__ . '/../data/little.mo');
$factory->getInstance($parser, $locale, $domain);
sleep($ttl * 2);
apcu_fetch('mo_' . $locale . '.' . $domain . '.' . $msgid, $success);
$this->assertFalse($success);
}
public function testConstructorSetsReloadOnMiss(): void
{
$expected = 'Column';
$locale = 'foo';
$domain = 'bar';
$msgid = 'Column';
$factory = new ApcuCacheFactory(0, false);
$parser = new MoParser(__DIR__ . '/../data/little.mo');
$instance = $factory->getInstance($parser, $locale, $domain);
apcu_delete('mo_' . $locale . '.' . $domain . '.' . $msgid);
$actual = $instance->get($msgid);
$this->assertSame($expected, $actual);
}
public function testConstructorSetsPrefix(): void
{
$expected = 'Pole';
$locale = 'foo';
$domain = 'bar';
$msgid = 'Column';
$prefix = 'baz_';
$factory = new ApcuCacheFactory(0, true, $prefix);
$parser = new MoParser(__DIR__ . '/../data/little.mo');
$factory->getInstance($parser, $locale, $domain);
$actual = apcu_fetch($prefix . $locale . '.' . $domain . '.' . $msgid);
$this->assertSame($expected, $actual);
}
}

View File

@@ -0,0 +1,270 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Tests\Cache;
use PhpMyAdmin\MoTranslator\Cache\ApcuCache;
use PhpMyAdmin\MoTranslator\MoParser;
use PHPUnit\Framework\TestCase;
use ReflectionMethod;
use function apcu_clear_cache;
use function apcu_delete;
use function apcu_enabled;
use function apcu_entry;
use function apcu_fetch;
use function chr;
use function explode;
use function function_exists;
use function implode;
use function sleep;
/**
* @covers \PhpMyAdmin\MoTranslator\Cache\ApcuCache
*/
class ApcuCacheTest extends TestCase
{
protected function setUp(): void
{
parent::setUp();
if (function_exists('apcu_enabled') && apcu_enabled()) {
return;
}
$this->markTestSkipped('ACPu extension is not installed and enabled for CLI');
}
protected function tearDown(): void
{
parent::tearDown();
apcu_clear_cache();
}
public function testConstructorLoadsCache(): void
{
$expected = 'Pole';
$locale = 'foo';
$domain = 'bar';
$msgid = 'Column';
new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), $locale, $domain);
$actual = apcu_fetch('mo_' . $locale . '.' . $domain . '.' . $msgid);
$this->assertSame($expected, $actual);
}
public function testConstructorSetsTtl(): void
{
$locale = 'foo';
$domain = 'bar';
$msgid = 'Column';
$ttl = 1;
new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), $locale, $domain, $ttl);
sleep($ttl * 2);
apcu_fetch('mo_' . $locale . '.' . $domain . '.' . $msgid, $success);
$this->assertFalse($success);
apcu_fetch('mo_' . $locale . '.' . $domain . '.' . ApcuCache::LOADED_KEY, $success);
$this->assertFalse($success);
}
public function testConstructorSetsReloadOnMiss(): void
{
$expected = 'Column';
$locale = 'foo';
$domain = 'bar';
$msgid = 'Column';
$prefix = 'baz_';
$cache = new ApcuCache(
new MoParser(__DIR__ . '/../data/little.mo'),
$locale,
$domain,
0,
false,
$prefix
);
apcu_delete($prefix . $locale . '.' . $domain . '.' . $msgid);
$actual = $cache->get($msgid);
$this->assertEquals($expected, $actual);
}
public function testConstructorSetsPrefix(): void
{
$expected = 'Pole';
$locale = 'foo';
$domain = 'bar';
$msgid = 'Column';
$prefix = 'baz_';
new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), $locale, $domain, 0, true, $prefix);
$actual = apcu_fetch($prefix . $locale . '.' . $domain . '.' . $msgid);
$this->assertSame($expected, $actual);
}
public function testEnsureTranslationsLoadedSetsLoadedKey(): void
{
$expected = 1;
$locale = 'foo';
$domain = 'bar';
new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), $locale, $domain);
$actual = apcu_fetch('mo_' . $locale . '.' . $domain . '.' . ApcuCache::LOADED_KEY);
$this->assertSame($expected, $actual);
}
public function testEnsureTranslationsLoadedHonorsLock(): void
{
$locale = 'foo';
$domain = 'bar';
$msgid = 'Column';
$lock = 'mo_' . $locale . '.' . $domain . '.' . ApcuCache::LOADED_KEY;
apcu_entry($lock, static function () {
sleep(1);
return 1;
});
new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), $locale, $domain);
$actual = apcu_fetch($lock);
$this->assertSame(1, $actual);
apcu_fetch('mo_' . $locale . '.' . $domain . '.' . $msgid, $success);
$this->assertFalse($success);
}
public function testGetReturnsMsgstr(): void
{
$expected = 'Pole';
$msgid = 'Column';
$cache = new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), 'foo', 'bar');
$actual = $cache->get($msgid);
$this->assertSame($expected, $actual);
}
public function testGetReturnsMsgidForCacheMiss(): void
{
$expected = 'Column';
$cache = new ApcuCache(new MoParser(null), 'foo', 'bar');
$actual = $cache->get($expected);
$this->assertSame($expected, $actual);
}
public function testStoresMsgidOnCacheMiss(): void
{
$expected = 'Column';
$locale = 'foo';
$domain = 'bar';
$cache = new ApcuCache(new MoParser(null), $locale, $domain);
$cache->get($expected);
$actual = apcu_fetch('mo_' . $locale . '.' . $domain . '.' . $expected);
$this->assertSame($expected, $actual);
}
public function testGetReloadsOnCacheMiss(): void
{
$expected = 'Pole';
$locale = 'foo';
$domain = 'bar';
$msgid = 'Column';
$cache = new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), $locale, $domain);
apcu_delete('mo_' . $locale . '.' . $domain . '.' . ApcuCache::LOADED_KEY);
$actual = $cache->get($msgid);
$this->assertSame($expected, $actual);
}
public function testReloadOnMissHonorsLock(): void
{
$expected = 'Pole';
$locale = 'foo';
$domain = 'bar';
$msgid = 'Column';
$cache = new ApcuCache(new MoParser(null), $locale, $domain);
$method = new ReflectionMethod($cache, 'reloadOnMiss');
$method->setAccessible(true);
$key = 'mo_' . $locale . '.' . $domain . '.' . $msgid;
apcu_entry($key, static function () use ($expected): string {
sleep(1);
return $expected;
});
$actual = $method->invoke($cache, $msgid);
$this->assertSame($expected, $actual);
}
public function testSetSetsMsgstr(): void
{
$expected = 'Pole';
$msgid = 'Column';
$cache = new ApcuCache(new MoParser(null), 'foo', 'bar');
$cache->set($msgid, $expected);
$actual = $cache->get($msgid);
$this->assertSame($expected, $actual);
}
public function testHasReturnsFalse(): void
{
$cache = new ApcuCache(new MoParser(null), 'foo', 'bar');
$actual = $cache->has('Column');
$this->assertFalse($actual);
}
public function testHasReturnsTrue(): void
{
$cache = new ApcuCache(new MoParser(__DIR__ . '/../data/little.mo'), 'foo', 'bar');
$actual = $cache->has('Column');
$this->assertTrue($actual);
}
public function testSetAllSetsTranslations(): void
{
$translations = [
'foo' => 'bar',
'and' => 'another',
];
$cache = new ApcuCache(new MoParser(null), 'foo', 'bar');
$cache->setAll($translations);
foreach ($translations as $msgid => $expected) {
$actual = $cache->get($msgid);
$this->assertEquals($expected, $actual);
}
}
public function testCacheStoresPluralForms(): void
{
$expected = ['first', 'second'];
$plural = ["%d pig went to the market\n", "%d pigs went to the market\n"];
$msgid = implode(chr(0), $plural);
$cache = new ApcuCache(new MoParser(null), 'foo', 'bar');
$cache->set($msgid, implode(chr(0), $expected));
$msgstr = $cache->get($msgid);
$actual = explode(chr(0), $msgstr);
$this->assertSame($expected, $actual);
}
}

View File

@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Tests\Cache;
use PhpMyAdmin\MoTranslator\Cache\ApcuCache;
use PhpMyAdmin\MoTranslator\CacheException;
use PhpMyAdmin\MoTranslator\MoParser;
use PHPUnit\Framework\TestCase;
use function apcu_enabled;
use function function_exists;
final class ApcuDisabledTest extends TestCase
{
public function testConstructorApcuNotEnabledThrowsException(): void
{
if (function_exists('apcu_enabled') && apcu_enabled()) {
$this->markTestSkipped('ext-apcu is enabled');
}
$this->expectException(CacheException::class);
$this->expectExceptionMessage('ACPu extension must be installed and enabled');
new ApcuCache(new MoParser(null), 'foo', 'bar');
}
}

View File

@@ -0,0 +1,82 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Tests\Cache;
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
use PhpMyAdmin\MoTranslator\MoParser;
use PHPUnit\Framework\TestCase;
/**
* @covers \PhpMyAdmin\MoTranslator\Cache\InMemoryCache
*/
class InMemoryCacheTest extends TestCase
{
public function testConstructorParsesCache(): void
{
$expected = 'Pole';
$parser = new MoParser(__DIR__ . '/../data/little.mo');
$cache = new InMemoryCache($parser);
$actual = $cache->get('Column');
$this->assertSame($expected, $actual);
}
public function testGetReturnsMsgidForCacheMiss(): void
{
$expected = 'Column';
$cache = new InMemoryCache(new MoParser(null));
$actual = $cache->get($expected);
$this->assertSame($expected, $actual);
}
public function testSetSetsMsgstr(): void
{
$expected = 'Pole';
$msgid = 'Column';
$cache = new InMemoryCache(new MoParser(null));
$cache->set($msgid, $expected);
$actual = $cache->get($msgid);
$this->assertSame($expected, $actual);
}
public function testHasReturnsFalse(): void
{
$cache = new InMemoryCache(new MoParser(null));
$actual = $cache->has('Column');
$this->assertFalse($actual);
}
public function testHasReturnsTrue(): void
{
$cache = new InMemoryCache(new MoParser(__DIR__ . '/../data/little.mo'));
$actual = $cache->has('Column');
$this->assertTrue($actual);
}
public function testSetAllSetsTranslations(): void
{
$translations = [
'foo' => 'bar',
'and' => 'another',
];
$cache = new InMemoryCache(new MoParser(null));
$cache->setAll($translations);
foreach ($translations as $msgid => $expected) {
$actual = $cache->get($msgid);
$this->assertEquals($expected, $actual);
}
}
public function testGetAllReturnsTranslations(): void
{
$expected = [
'foo' => 'bar',
'and' => 'another',
];
$cache = new InMemoryCache(new MoParser(null));
$cache->setAll($expected);
$actual = $cache->getAll();
$this->assertSame($expected, $actual);
}
}

View File

@@ -0,0 +1,102 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Tests;
use PhpMyAdmin\MoTranslator\Loader;
use PHPUnit\Framework\TestCase;
/**
* Test for functions.
*/
class FunctionsTest extends TestCase
{
public function setUp(): void
{
Loader::loadFunctions();
_setlocale(0, 'cs');
_textdomain('phpmyadmin');
_bindtextdomain('phpmyadmin', __DIR__ . '/data/locale/');
_bind_textdomain_codeset('phpmyadmin', 'UTF-8');
}
public function testGettext(): void
{
$this->assertEquals(
'Typ',
_gettext('Type')
);
$this->assertEquals(
'Typ',
__('Type')
);
$this->assertEquals(
'%d sekundy',
_ngettext(
'%d second',
'%d seconds',
2
)
);
$this->assertEquals(
'%d seconds',
_npgettext(
'context',
'%d second',
'%d seconds',
2
)
);
$this->assertEquals(
'Tabulka',
_pgettext(
'Display format',
'Table'
)
);
}
public function testDomain(): void
{
$this->assertEquals(
'Typ',
_dgettext('phpmyadmin', 'Type')
);
$this->assertEquals(
'%d sekundy',
_dngettext(
'phpmyadmin',
'%d second',
'%d seconds',
2
)
);
$this->assertEquals(
'%d seconds',
_dnpgettext(
'phpmyadmin',
'context',
'%d second',
'%d seconds',
2
)
);
$this->assertEquals(
'Tabulka',
_dpgettext(
'phpmyadmin',
'Display format',
'Table'
)
);
}
}

View File

@@ -0,0 +1,325 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Tests;
use PhpMyAdmin\MoTranslator\Cache\CacheFactoryInterface;
use PhpMyAdmin\MoTranslator\Cache\CacheInterface;
use PhpMyAdmin\MoTranslator\Loader;
use PhpMyAdmin\MoTranslator\MoParser;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use function getenv;
use function putenv;
/**
* Test for mo loading.
*/
class LoaderTest extends TestCase
{
/**
* @param array[] $expected
*
* @dataProvider localeList
*/
public function testListLocales(string $locale, array $expected): void
{
$this->assertEquals(
$expected,
Loader::listLocales($locale)
);
}
/**
* @return array[]
*/
public function localeList(): array
{
return [
[
'cs_CZ',
[
'cs_CZ',
'cs',
],
],
[
'sr_CS.UTF-8@latin',
[
'sr_CS.UTF-8@latin',
'sr_CS@latin',
'sr@latin',
'sr_CS.UTF-8',
'sr_CS',
'sr',
],
],
// For a locale containing country code, we prefer
// full locale name, but if that's not found, fall back
// to the language only locale name.
[
'sr_RS',
[
'sr_RS',
'sr',
],
],
// If language code is used, it's the only thing returned.
[
'sr',
['sr'],
],
// There is support for language and charset only.
[
'sr.UTF-8',
[
'sr.UTF-8',
'sr',
],
],
// It can also split out character set from the full locale name.
[
'sr_RS.UTF-8',
[
'sr_RS.UTF-8',
'sr_RS',
'sr',
],
],
// There is support for @modifier in locale names as well.
[
'sr_RS.UTF-8@latin',
[
'sr_RS.UTF-8@latin',
'sr_RS@latin',
'sr@latin',
'sr_RS.UTF-8',
'sr_RS',
'sr',
],
],
[
'sr.UTF-8@latin',
[
'sr.UTF-8@latin',
'sr@latin',
'sr.UTF-8',
'sr',
],
],
// We can pass in only language and modifier.
[
'sr@latin',
[
'sr@latin',
'sr',
],
],
// If locale name is not following the regular POSIX pattern,
// it's used verbatim.
[
'something',
['something'],
],
// Passing in an empty string returns an empty array.
[
'',
[],
],
];
}
private function getLoader(string $domain, string $locale): Loader
{
$loader = new Loader();
$loader->setlocale($locale);
$loader->textdomain($domain);
$loader->bindtextdomain($domain, __DIR__ . '/data/locale/');
return $loader;
}
public function testLocaleChange(): void
{
$loader = new Loader();
$loader->setlocale('cs');
$loader->textdomain('phpmyadmin');
$loader->bindtextdomain('phpmyadmin', __DIR__ . '/data/locale/');
$translator = $loader->getTranslator('phpmyadmin');
$this->assertEquals('Typ', $translator->gettext('Type'));
$loader->setlocale('be_BY');
$translator = $loader->getTranslator('phpmyadmin');
$this->assertEquals('Тып', $translator->gettext('Type'));
}
/**
* @dataProvider translatorData
*/
public function testGetTranslator(string $domain, string $locale, string $otherdomain, string $expected): void
{
$loader = $this->getLoader($domain, $locale);
$translator = $loader->getTranslator($otherdomain);
$this->assertEquals(
$expected,
$translator->gettext('Type')
);
}
/**
* @return array[]
*/
public function translatorData(): array
{
return [
[
'phpmyadmin',
'cs',
'',
'Typ',
],
[
'phpmyadmin',
'cs_CZ',
'',
'Typ',
],
[
'phpmyadmin',
'be_BY',
'',
'Тып',
],
[
'phpmyadmin',
'be@latin',
'',
'Typ',
],
[
'phpmyadmin',
'cs',
'other',
'Type',
],
[
'other',
'cs',
'phpmyadmin',
'Type',
],
];
}
public function testInstance(): void
{
$loader = Loader::getInstance();
$loader->setlocale('cs');
$loader->textdomain('phpmyadmin');
$loader->bindtextdomain('phpmyadmin', __DIR__ . '/data/locale/');
$translator = $loader->getTranslator();
$this->assertEquals(
'Typ',
$translator->gettext('Type')
);
/* Ensure the object survives */
$loader = Loader::getInstance();
$translator = $loader->getTranslator();
$this->assertEquals(
'Typ',
$translator->gettext('Type')
);
/* Ensure the object can support different locale files for the same domain */
$loader = Loader::getInstance();
$loader->setlocale('be_BY');
$loader->bindtextdomain('phpmyadmin', __DIR__ . '/data/locale/');
$translator = $loader->getTranslator();
$this->assertEquals(
'Тып',
$translator->gettext('Type')
);
}
public function testDetect(): void
{
$GLOBALS['lang'] = 'foo';
$loader = Loader::getInstance();
$this->assertEquals(
'foo',
$loader->detectlocale()
);
unset($GLOBALS['lang']);
}
public function testDetectEnv(): void
{
$loader = Loader::getInstance();
foreach (['LC_MESSAGES', 'LC_ALL', 'LANG'] as $var) {
putenv($var);
if (getenv($var) === false) {
continue;
}
$this->markTestSkipped('Unsetting environment does not work');
}
unset($GLOBALS['lang']);
putenv('LC_ALL=baz');
$this->assertEquals(
'baz',
$loader->detectlocale()
);
putenv('LC_ALL');
putenv('LC_MESSAGES=bar');
$this->assertEquals(
'bar',
$loader->detectlocale()
);
putenv('LC_MESSAGES');
putenv('LANG=barr');
$this->assertEquals(
'barr',
$loader->detectlocale()
);
putenv('LANG');
$this->assertEquals(
'en',
$loader->detectlocale()
);
}
public function testSetCacheFactory(): void
{
$expected = 'Foo';
$locale = 'be_BY';
$domain = 'apcu';
$cache = $this->createMock(CacheInterface::class);
$cache->method('get')
->willReturn($expected);
/** @var CacheFactoryInterface&MockObject $factory */
$factory = $this->createMock(CacheFactoryInterface::class);
$factory->expects($this->once())
->method('getInstance')
->with($this->isInstanceOf(MoParser::class), $locale, $domain)
->willReturn($cache);
Loader::setCacheFactory($factory);
$loader = Loader::getInstance();
$loader->setlocale($locale);
$loader->bindtextdomain($domain, __DIR__ . '/data/locale/');
$translator = $loader->getTranslator($domain);
$actual = $translator->gettext('Type');
$this->assertEquals($expected, $actual);
}
}

View File

@@ -0,0 +1,230 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Tests;
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
use PhpMyAdmin\MoTranslator\MoParser;
use PhpMyAdmin\MoTranslator\Translator;
use PHPUnit\Framework\TestCase;
use function basename;
use function glob;
use function strpos;
/**
* Test for MO files parsing.
*/
class MoFilesTest extends TestCase
{
/**
* @dataProvider provideMoFiles
*/
public function testMoFileTranslate(string $filename): void
{
$parser = $this->getTranslator($filename);
$this->assertEquals(
'Pole',
$parser->gettext('Column')
);
// Non existing string
$this->assertEquals(
'Column parser',
$parser->gettext('Column parser')
);
}
/**
* @dataProvider provideMoFiles
*/
public function testMoFilePlurals(string $filename): void
{
$parser = $this->getTranslator($filename);
$expected2 = '%d sekundy';
if (strpos($filename, 'invalid-formula.mo') !== false || strpos($filename, 'lessplurals.mo') !== false) {
$expected0 = '%d sekunda';
$expected2 = '%d sekunda';
} elseif (strpos($filename, 'plurals.mo') !== false || strpos($filename, 'noheader.mo') !== false) {
$expected0 = '%d sekundy';
} else {
$expected0 = '%d sekund';
}
$this->assertEquals(
$expected0,
$parser->ngettext(
'%d second',
'%d seconds',
0
)
);
$this->assertEquals(
'%d sekunda',
$parser->ngettext(
'%d second',
'%d seconds',
1
)
);
$this->assertEquals(
$expected2,
$parser->ngettext(
'%d second',
'%d seconds',
2
)
);
$this->assertEquals(
$expected0,
$parser->ngettext(
'%d second',
'%d seconds',
5
)
);
$this->assertEquals(
$expected0,
$parser->ngettext(
'%d second',
'%d seconds',
10
)
);
// Non existing string
$this->assertEquals(
'"%d" seconds',
$parser->ngettext(
'"%d" second',
'"%d" seconds',
10
)
);
}
/**
* @dataProvider provideMoFiles
*/
public function testMoFileContext(string $filename): void
{
$parser = $this->getTranslator($filename);
$this->assertEquals(
'Tabulka',
$parser->pgettext(
'Display format',
'Table'
)
);
}
/**
* @dataProvider provideNotTranslatedFiles
*/
public function testMoFileNotTranslated(string $filename): void
{
$parser = $this->getTranslator($filename);
$this->assertEquals(
'%d second',
$parser->ngettext(
'%d second',
'%d seconds',
1
)
);
}
/**
* @return array[]
*/
public function provideMoFiles(): array
{
return $this->getFiles('./tests/data/*.mo');
}
/**
* @return array[]
*/
public function provideErrorMoFiles(): array
{
return $this->getFiles('./tests/data/error/*.mo');
}
/**
* @return array[]
*/
public function provideNotTranslatedFiles(): array
{
return $this->getFiles('./tests/data/not-translated/*.mo');
}
/**
* @dataProvider provideErrorMoFiles
*/
public function testEmptyMoFile(string $file): void
{
$parser = new MoParser($file);
$translator = new Translator(new InMemoryCache($parser));
if (basename($file) === 'magic.mo') {
$this->assertEquals(Translator::ERROR_BAD_MAGIC, $parser->error);
} else {
$this->assertEquals(Translator::ERROR_READING, $parser->error);
}
$this->assertEquals(
'Table',
$translator->pgettext(
'Display format',
'Table'
)
);
$this->assertEquals(
'"%d" seconds',
$translator->ngettext(
'"%d" second',
'"%d" seconds',
10
)
);
}
/**
* @dataProvider provideMoFiles
*/
public function testExists(string $file): void
{
$parser = $this->getTranslator($file);
$this->assertEquals(
true,
$parser->exists('Column')
);
$this->assertEquals(
false,
$parser->exists('Column parser')
);
}
/**
* @param string $pattern path names pattern to match
*
* @return array[]
*/
private function getFiles(string $pattern): array
{
$files = glob($pattern);
if ($files === false) {
return [];
}
$result = [];
foreach ($files as $file) {
$result[] = [$file];
}
return $result;
}
private function getTranslator(string $filename): Translator
{
return new Translator(new InMemoryCache(new MoParser($filename)));
}
}

View File

@@ -0,0 +1,152 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Tests;
use PhpMyAdmin\MoTranslator\Translator;
use PHPUnit\Framework\TestCase;
/**
* Test for gettext parsing.
*/
class PluralFormulaTest extends TestCase
{
/**
* Test for extractPluralsForms.
*
* @dataProvider pluralExtractionData
*/
public function testExtractPluralsForms(string $header, string $expected): void
{
$this->assertEquals(
$expected,
Translator::extractPluralsForms($header)
);
}
/**
* @return array[]
*/
public function pluralExtractionData(): array
{
return [
// It defaults to a "Western-style" plural header.
[
'',
'nplurals=2; plural=n == 1 ? 0 : 1;',
],
// Extracting it from the middle of the header works.
[
"Content-type: text/html; charset=UTF-8\n"
. "Plural-Forms: nplurals=1; plural=0;\n"
. "Last-Translator: nobody\n",
' nplurals=1; plural=0;',
],
// It's also case-insensitive.
[
"PLURAL-forms: nplurals=1; plural=0;\n",
' nplurals=1; plural=0;',
],
// It falls back to default if it's not on a separate line.
[
'Content-type: text/html; charset=UTF-8' // note the missing \n here
. "Plural-Forms: nplurals=1; plural=0;\n"
. "Last-Translator: nobody\n",
'nplurals=2; plural=n == 1 ? 0 : 1;',
],
];
}
/**
* @dataProvider pluralCounts
*/
public function testPluralCounts(string $expr, int $expected): void
{
$this->assertEquals(
$expected,
Translator::extractPluralCount($expr)
);
}
/**
* @return array[]
*/
public function pluralCounts(): array
{
return [
[
'',
1,
],
[
'foo=2; expr',
1,
],
[
'nplurals=2; epxr',
2,
],
[
' nplurals = 3 ; epxr',
3,
],
[
' nplurals = 4 ; epxr ; ',
4,
],
[
'nplurals',
1,
],
];
}
/**
* @dataProvider pluralExpressions
*/
public function testPluralExpression(string $expr, string $expected): void
{
$this->assertEquals(
$expected,
Translator::sanitizePluralExpression($expr)
);
}
/**
* @return array[]
*/
public function pluralExpressions(): array
{
return [
[
'',
'',
],
[
'nplurals=2; plural=n == 1 ? 0 : 1;',
'n == 1 ? 0 : 1',
],
[
' nplurals=1; plural=0;',
'0',
],
[
"nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n",
'n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5',
],
[
' nplurals=1; plural=baz(n);',
'(n)',
],
[
' plural=n',
'n',
],
[
'nplurals',
'n',
],
];
}
}

View File

@@ -0,0 +1,125 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Tests;
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
use PhpMyAdmin\MoTranslator\MoParser;
use PhpMyAdmin\MoTranslator\Translator;
use PHPUnit\Framework\TestCase;
use function chr;
use function implode;
/**
* Test for gettext parsing.
*/
class PluralTest extends TestCase
{
/**
* Test for npgettext.
*
* @param int $number Number
* @param string $expected Expected output
*
* @dataProvider providerTestNpgettext
*/
public function testNpgettext(int $number, string $expected): void
{
$parser = $this->getTranslator('');
$result = $parser->npgettext('context', "%d pig went to the market\n", "%d pigs went to the market\n", $number);
$this->assertSame($expected, $result);
}
/**
* Data provider for test_npgettext.
*
* @return array[]
*/
public static function providerTestNpgettext(): array
{
return [
[
1,
"%d pig went to the market\n",
],
[
2,
"%d pigs went to the market\n",
],
];
}
/**
* Test for ngettext
*/
public function testNgettext(): void
{
$parser = $this->getTranslator('');
$translationKey = implode(chr(0), ["%d pig went to the market\n", "%d pigs went to the market\n"]);
$parser->setTranslation($translationKey, '');
$result = $parser->ngettext("%d pig went to the market\n", "%d pigs went to the market\n", 1);
$this->assertSame('', $result);
}
/**
* @return array[]
*/
public function dataProviderPluralForms(): array
{
return [
['Plural-Forms: nplurals=2; plural=n != 1;'],
['Plural-Forms: nplurals=1; plural=0;'],
['Plural-Forms: nplurals=2; plural=(n > 1);'],
[
'Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n'
. '%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;',
],
['Plural-Forms: nplurals=2; plural=n >= 2 && (n < 11 || n > 99);'],
['Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3;'],
['Plural-Forms: nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2;'],
[
'Plural-Forms: nplurals=2; plural=n != 1 && n != 2 && n != 3 &'
. '& (n % 10 == 4 || n % 10 == 6 || n % 10 == 9);',
],
];
}
/**
* Test for ngettext
*
* @see https://github.com/phpmyadmin/motranslator/issues/37
*
* @dataProvider dataProviderPluralForms
*/
public function testNgettextSelectString(string $pluralForms): void
{
$parser = $this->getTranslator('');
$parser->setTranslation(
'',
"Project-Id-Version: phpMyAdmin 5.1.0-dev\n"
. "Report-Msgid-Bugs-To: translators@phpmyadmin.net\n"
. "PO-Revision-Date: 2020-09-01 09:12+0000\n"
. "Last-Translator: William Desportes <williamdes@wdes.fr>\n"
. 'Language-Team: English (United Kingdom) '
. "<https:\/\/hosted.weblate.org\/projects\/phpmyadmin\/master\/en_GB\/>\n"
. "Language: en_GB\n"
. "MIME-Version: 1.0\n"
. "Content-Type: text\/plain; charset=UTF-8\n"
. "Content-Transfer-Encoding: 8bit\n"
. $pluralForms . "\n"
. "X-Generator: Weblate 4.2.1-dev\n"
. ''
);
$translationKey = implode(chr(0), ["%d pig went to the market\n", "%d pigs went to the market\n"]);
$parser->setTranslation($translationKey, 'ok');
$result = $parser->ngettext("%d pig went to the market\n", "%d pigs went to the market\n", 1);
$this->assertSame('ok', $result);
}
private function getTranslator(string $filename): Translator
{
return new Translator(new InMemoryCache(new MoParser($filename)));
}
}

View File

@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Tests;
use PhpMyAdmin\MoTranslator\StringReader;
use PHPUnit\Framework\TestCase;
use function file_put_contents;
use function sys_get_temp_dir;
use function tempnam;
use function unlink;
class StringReaderTest extends TestCase
{
public function testReadFails(): void
{
$tempFile = (string) tempnam(sys_get_temp_dir(), 'phpMyAdmin_StringReaderTest');
$this->assertFileExists($tempFile);
$stringReader = new StringReader($tempFile);
unlink($tempFile);
$actual = $stringReader->read(-1, -1);
$this->assertSame('', $actual);
}
public function testReadIntArray(): void
{
$tempFile = (string) tempnam(sys_get_temp_dir(), 'phpMyAdmin_StringReaderTest');
file_put_contents($tempFile, "\0\0\0\0\0\0\0\0\0\0\0\0");
$this->assertFileExists($tempFile);
$stringReader = new StringReader($tempFile);
unlink($tempFile);
$actual = $stringReader->readintarray('V', 2, 2);
$this->assertSame([
1 => 0,
2 => 0,
], $actual);
}
}

View File

@@ -0,0 +1,98 @@
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Tests;
use PhpMyAdmin\MoTranslator\Cache\CacheInterface;
use PhpMyAdmin\MoTranslator\Cache\InMemoryCache;
use PhpMyAdmin\MoTranslator\CacheException;
use PhpMyAdmin\MoTranslator\MoParser;
use PhpMyAdmin\MoTranslator\Translator;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
/**
* Test for translator API
*/
class TranslatorTest extends TestCase
{
public function testConstructorWithFilenameParam(): void
{
$expected = 'Pole';
$translator = new Translator(__DIR__ . '/data/little.mo');
$actual = $translator->gettext('Column');
$this->assertSame($expected, $actual);
}
public function testConstructorWithNullParam(): void
{
$expected = 'Column';
$translator = new Translator(null);
$actual = $translator->gettext($expected);
$this->assertSame($expected, $actual);
}
/**
* Test on empty gettext
*/
public function testGettext(): void
{
$translator = $this->getTranslator('');
$this->assertEquals('Test', $translator->gettext('Test'));
}
/**
* Test set a translation
*/
public function testSetTranslation(): void
{
$translator = $this->getTranslator('');
$translator->setTranslation('Test', 'Translation');
$this->assertEquals('Translation', $translator->gettext('Test'));
}
/**
* Test get and set all translations
*/
public function testGetSetTranslations(): void
{
$transTable = ['Test' => 'Translation'];
$translator = $this->getTranslator('');
$translator->setTranslations($transTable);
$this->assertEquals('Translation', $translator->gettext('Test'));
$this->assertSame($transTable, $translator->getTranslations());
$translator = $this->getTranslator(null);
$translator->setTranslations($transTable);
$this->assertSame($transTable, $translator->getTranslations());
$this->assertEquals('Translation', $translator->gettext('Test'));
$transTable = [
'Test' => 'Translation',
'shouldIWriteTests' => 'as much as possible',
'is it hard' => 'it depends',
];
$translator = $this->getTranslator('');
$translator->setTranslations($transTable);
$this->assertSame($transTable, $translator->getTranslations());
$this->assertEquals('as much as possible', $translator->gettext('shouldIWriteTests'));
$translator = $this->getTranslator(null);
$translator->setTranslations($transTable);
$this->assertSame($transTable, $translator->getTranslations());
$this->assertEquals('it depends', $translator->gettext('is it hard'));
}
public function testGetTranslationsThrowsException(): void
{
/** @var CacheInterface&MockObject $cache */
$cache = $this->createMock(CacheInterface::class);
$translator = new Translator($cache);
$this->expectException(CacheException::class);
$translator->getTranslations();
}
private function getTranslator(?string $filename): Translator
{
return new Translator(new InMemoryCache(new MoParser($filename)));
}
}

Binary file not shown.

View File

@@ -0,0 +1 @@
<EFBFBD><12>1111<31><31><EFBFBD><EFBFBD>

View File

@@ -0,0 +1 @@
<EFBFBD><12>1111<31><7F><EFBFBD>

Binary file not shown.

View File

@@ -0,0 +1 @@
<EFBFBD><04><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>

View File

@@ -0,0 +1 @@
1234

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

16
vendor/psr/cache/CHANGELOG.md vendored Normal file
View File

@@ -0,0 +1,16 @@
# Changelog
All notable changes to this project will be documented in this file, in reverse chronological order by release.
## 1.0.1 - 2016-08-06
### Fixed
- Make spacing consistent in phpdoc annotations php-fig/cache#9 - chalasr
- Fix grammar in phpdoc annotations php-fig/cache#10 - chalasr
- Be more specific in docblocks that `getItems()` and `deleteItems()` take an array of strings (`string[]`) compared to just `array` php-fig/cache#8 - GrahamCampbell
- For `expiresAt()` and `expiresAfter()` in CacheItemInterface fix docblock to specify null as a valid parameters as well as an implementation of DateTimeInterface php-fig/cache#7 - GrahamCampbell
## 1.0.0 - 2015-12-11
Initial stable release; reflects accepted PSR-6 specification

19
vendor/psr/cache/LICENSE.txt vendored Normal file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2015 PHP Framework Interoperability Group
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

12
vendor/psr/cache/README.md vendored Normal file
View File

@@ -0,0 +1,12 @@
Caching Interface
==============
This repository holds all interfaces related to [PSR-6 (Caching Interface)][psr-url].
Note that this is not a Caching implementation of its own. It is merely interfaces that describe the components of a Caching mechanism.
The installable [package][package-url] and [implementations][implementation-url] are listed on Packagist.
[psr-url]: https://www.php-fig.org/psr/psr-6/
[package-url]: https://packagist.org/packages/psr/cache
[implementation-url]: https://packagist.org/providers/psr/cache-implementation

25
vendor/psr/cache/composer.json vendored Normal file
View File

@@ -0,0 +1,25 @@
{
"name": "psr/cache",
"description": "Common interface for caching libraries",
"keywords": ["psr", "psr-6", "cache"],
"license": "MIT",
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"require": {
"php": ">=8.0.0"
},
"autoload": {
"psr-4": {
"Psr\\Cache\\": "src/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
}
}

10
vendor/psr/cache/src/CacheException.php vendored Normal file
View File

@@ -0,0 +1,10 @@
<?php
namespace Psr\Cache;
/**
* Exception interface for all exceptions thrown by an Implementing Library.
*/
interface CacheException extends \Throwable
{
}

View File

@@ -0,0 +1,105 @@
<?php
namespace Psr\Cache;
/**
* CacheItemInterface defines an interface for interacting with objects inside a cache.
*
* Each Item object MUST be associated with a specific key, which can be set
* according to the implementing system and is typically passed by the
* Cache\CacheItemPoolInterface object.
*
* The Cache\CacheItemInterface object encapsulates the storage and retrieval of
* cache items. Each Cache\CacheItemInterface is generated by a
* Cache\CacheItemPoolInterface object, which is responsible for any required
* setup as well as associating the object with a unique Key.
* Cache\CacheItemInterface objects MUST be able to store and retrieve any type
* of PHP value defined in the Data section of the specification.
*
* Calling Libraries MUST NOT instantiate Item objects themselves. They may only
* be requested from a Pool object via the getItem() method. Calling Libraries
* SHOULD NOT assume that an Item created by one Implementing Library is
* compatible with a Pool from another Implementing Library.
*/
interface CacheItemInterface
{
/**
* Returns the key for the current cache item.
*
* The key is loaded by the Implementing Library, but should be available to
* the higher level callers when needed.
*
* @return string
* The key string for this cache item.
*/
public function getKey(): string;
/**
* Retrieves the value of the item from the cache associated with this object's key.
*
* The value returned must be identical to the value originally stored by set().
*
* If isHit() returns false, this method MUST return null. Note that null
* is a legitimate cached value, so the isHit() method SHOULD be used to
* differentiate between "null value was found" and "no value was found."
*
* @return mixed
* The value corresponding to this cache item's key, or null if not found.
*/
public function get(): mixed;
/**
* Confirms if the cache item lookup resulted in a cache hit.
*
* Note: This method MUST NOT have a race condition between calling isHit()
* and calling get().
*
* @return bool
* True if the request resulted in a cache hit. False otherwise.
*/
public function isHit(): bool;
/**
* Sets the value represented by this cache item.
*
* The $value argument may be any item that can be serialized by PHP,
* although the method of serialization is left up to the Implementing
* Library.
*
* @param mixed $value
* The serializable value to be stored.
*
* @return static
* The invoked object.
*/
public function set(mixed $value): static;
/**
* Sets the expiration time for this cache item.
*
* @param ?\DateTimeInterface $expiration
* The point in time after which the item MUST be considered expired.
* If null is passed explicitly, a default value MAY be used. If none is set,
* the value should be stored permanently or for as long as the
* implementation allows.
*
* @return static
* The called object.
*/
public function expiresAt(?\DateTimeInterface $expiration): static;
/**
* Sets the expiration time for this cache item.
*
* @param int|\DateInterval|null $time
* The period of time from the present after which the item MUST be considered
* expired. An integer parameter is understood to be the time in seconds until
* expiration. If null is passed explicitly, a default value MAY be used.
* If none is set, the value should be stored permanently or for as long as the
* implementation allows.
*
* @return static
* The called object.
*/
public function expiresAfter(int|\DateInterval|null $time): static;
}

View File

@@ -0,0 +1,138 @@
<?php
namespace Psr\Cache;
/**
* CacheItemPoolInterface generates CacheItemInterface objects.
*
* The primary purpose of Cache\CacheItemPoolInterface is to accept a key from
* the Calling Library and return the associated Cache\CacheItemInterface object.
* It is also the primary point of interaction with the entire cache collection.
* All configuration and initialization of the Pool is left up to an
* Implementing Library.
*/
interface CacheItemPoolInterface
{
/**
* Returns a Cache Item representing the specified key.
*
* This method must always return a CacheItemInterface object, even in case of
* a cache miss. It MUST NOT return null.
*
* @param string $key
* The key for which to return the corresponding Cache Item.
*
* @throws InvalidArgumentException
* If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException
* MUST be thrown.
*
* @return CacheItemInterface
* The corresponding Cache Item.
*/
public function getItem(string $key): CacheItemInterface;
/**
* Returns a traversable set of cache items.
*
* @param string[] $keys
* An indexed array of keys of items to retrieve.
*
* @throws InvalidArgumentException
* If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException
* MUST be thrown.
*
* @return iterable
* An iterable collection of Cache Items keyed by the cache keys of
* each item. A Cache item will be returned for each key, even if that
* key is not found. However, if no keys are specified then an empty
* traversable MUST be returned instead.
*/
public function getItems(array $keys = []): iterable;
/**
* Confirms if the cache contains specified cache item.
*
* Note: This method MAY avoid retrieving the cached value for performance reasons.
* This could result in a race condition with CacheItemInterface::get(). To avoid
* such situation use CacheItemInterface::isHit() instead.
*
* @param string $key
* The key for which to check existence.
*
* @throws InvalidArgumentException
* If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException
* MUST be thrown.
*
* @return bool
* True if item exists in the cache, false otherwise.
*/
public function hasItem(string $key): bool;
/**
* Deletes all items in the pool.
*
* @return bool
* True if the pool was successfully cleared. False if there was an error.
*/
public function clear(): bool;
/**
* Removes the item from the pool.
*
* @param string $key
* The key to delete.
*
* @throws InvalidArgumentException
* If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException
* MUST be thrown.
*
* @return bool
* True if the item was successfully removed. False if there was an error.
*/
public function deleteItem(string $key): bool;
/**
* Removes multiple items from the pool.
*
* @param string[] $keys
* An array of keys that should be removed from the pool.
*
* @throws InvalidArgumentException
* If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException
* MUST be thrown.
*
* @return bool
* True if the items were successfully removed. False if there was an error.
*/
public function deleteItems(array $keys): bool;
/**
* Persists a cache item immediately.
*
* @param CacheItemInterface $item
* The cache item to save.
*
* @return bool
* True if the item was successfully persisted. False if there was an error.
*/
public function save(CacheItemInterface $item): bool;
/**
* Sets a cache item to be persisted later.
*
* @param CacheItemInterface $item
* The cache item to save.
*
* @return bool
* False if the item could not be queued or if a commit was attempted and failed. True otherwise.
*/
public function saveDeferred(CacheItemInterface $item): bool;
/**
* Persists any deferred cache items.
*
* @return bool
* True if all not-yet-saved items were successfully saved or there were none. False otherwise.
*/
public function commit(): bool;
}

View File

@@ -0,0 +1,13 @@
<?php
namespace Psr\Cache;
/**
* Exception interface for invalid cache arguments.
*
* Any time an invalid argument is passed into a method it must throw an
* exception class which implements Psr\Cache\InvalidArgumentException.
*/
interface InvalidArgumentException extends CacheException
{
}

3
vendor/psr/container/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
composer.lock
composer.phar
/vendor/

21
vendor/psr/container/LICENSE vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2013-2016 container-interop
Copyright (c) 2016 PHP Framework Interoperability Group
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

13
vendor/psr/container/README.md vendored Normal file
View File

@@ -0,0 +1,13 @@
Container interface
==============
This repository holds all interfaces related to [PSR-11 (Container Interface)][psr-url].
Note that this is not a Container implementation of its own. It is merely abstractions that describe the components of a Dependency Injection Container.
The installable [package][package-url] and [implementations][implementation-url] are listed on Packagist.
[psr-url]: https://www.php-fig.org/psr/psr-11/
[package-url]: https://packagist.org/packages/psr/container
[implementation-url]: https://packagist.org/providers/psr/container-implementation

27
vendor/psr/container/composer.json vendored Normal file
View File

@@ -0,0 +1,27 @@
{
"name": "psr/container",
"type": "library",
"description": "Common Container Interface (PHP FIG PSR-11)",
"keywords": ["psr", "psr-11", "container", "container-interop", "container-interface"],
"homepage": "https://github.com/php-fig/container",
"license": "MIT",
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"require": {
"php": ">=7.4.0"
},
"autoload": {
"psr-4": {
"Psr\\Container\\": "src/"
}
},
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Psr\Container;
use Throwable;
/**
* Base interface representing a generic exception in a container.
*/
interface ContainerExceptionInterface extends Throwable
{
}

View File

@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace Psr\Container;
/**
* Describes the interface of a container that exposes methods to read its entries.
*/
interface ContainerInterface
{
/**
* Finds an entry of the container by its identifier and returns it.
*
* @param string $id Identifier of the entry to look for.
*
* @throws NotFoundExceptionInterface No entry was found for **this** identifier.
* @throws ContainerExceptionInterface Error while retrieving the entry.
*
* @return mixed Entry.
*/
public function get(string $id);
/**
* Returns true if the container can return an entry for the given identifier.
* Returns false otherwise.
*
* `has($id)` returning true does not mean that `get($id)` will not throw an exception.
* It does however mean that `get($id)` will not throw a `NotFoundExceptionInterface`.
*
* @param string $id Identifier of the entry to look for.
*
* @return bool
*/
public function has(string $id): bool;
}

View File

@@ -0,0 +1,10 @@
<?php
namespace Psr\Container;
/**
* No entry was found in the container.
*/
interface NotFoundExceptionInterface extends ContainerExceptionInterface
{
}

19
vendor/psr/log/LICENSE vendored Normal file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2012 PHP Framework Interoperability Group
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

58
vendor/psr/log/README.md vendored Normal file
View File

@@ -0,0 +1,58 @@
PSR Log
=======
This repository holds all interfaces/classes/traits related to
[PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md).
Note that this is not a logger of its own. It is merely an interface that
describes a logger. See the specification for more details.
Installation
------------
```bash
composer require psr/log
```
Usage
-----
If you need a logger, you can use the interface like this:
```php
<?php
use Psr\Log\LoggerInterface;
class Foo
{
private $logger;
public function __construct(LoggerInterface $logger = null)
{
$this->logger = $logger;
}
public function doSomething()
{
if ($this->logger) {
$this->logger->info('Doing work');
}
try {
$this->doSomethingElse();
} catch (Exception $exception) {
$this->logger->error('Oh no!', array('exception' => $exception));
}
// do something useful
}
}
```
You can then pick one of the implementations of the interface to get a logger.
If you want to implement the interface, you can require this package and
implement `Psr\Log\LoggerInterface` in your code. Please read the
[specification text](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)
for details.

Some files were not shown because too many files have changed in this diff Show More