diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..f6fb500729dc65db88ad2947b749373e00cb63f8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+/vendor/
+/composer.phar
+/composer.lock
+/phpcs.xml
+/phpstan.neon
+/.php_cs.cache
+/.php_cs.txt
diff --git a/action/acceder_document.php b/action/acceder_document.php
index 2012fa521bb0adb272761129c63214c94fbaba4f..bc22bd7820f604d7c46b3549b45452383b88e7ab 100644
--- a/action/acceder_document.php
+++ b/action/acceder_document.php
@@ -31,7 +31,8 @@ function action_acceder_document_dist() {
 	$arg = rawurldecode(_request('arg'));
 
 	$status = false;
-	if (strpos($f, '../') !== false
+	if (
+		strpos($f, '../') !== false
 		or preg_match(',^\w+://,', $f)
 	) {
 		$status = 403;
@@ -52,7 +53,8 @@ function action_acceder_document_dist() {
 			} else {
 				// ETag pour gerer le status 304
 				$ETag = md5($file . ': ' . filemtime($file));
-				if (isset($_SERVER['HTTP_IF_NONE_MATCH'])
+				if (
+					isset($_SERVER['HTTP_IF_NONE_MATCH'])
 					and $_SERVER['HTTP_IF_NONE_MATCH'] == $ETag
 				) {
 					http_status(304); // Not modified
@@ -100,7 +102,8 @@ function action_acceder_document_dist() {
 				// sinon l'ignorer car certains navigateurs pataugent
 
 				$f = basename($file);
-				if (isset($doc['titre'])
+				if (
+					isset($doc['titre'])
 					and (preg_match('/^\w+[.]\w+$/', $doc['titre']) or $doc['titre'] == 'Makefile')
 				) {
 					$f = $doc['titre'];
diff --git a/action/ajouter_documents.php b/action/ajouter_documents.php
index 518b9211a40f1e87d03699e1de997689e5fb08ac..ddfbb19de127a84df7450b962629c51546851b18 100644
--- a/action/ajouter_documents.php
+++ b/action/ajouter_documents.php
@@ -44,7 +44,7 @@ include_spip('inc/renseigner_document');
  */
 function action_ajouter_documents_dist($id_document, $files, $objet, $id_objet, $mode) {
 	$ajouter_un_document = charger_fonction('ajouter_un_document', 'action');
-	$ajoutes = array();
+	$ajoutes = [];
 
 	// on ne peut mettre qu'un seul document a la place d'un autre ou en vignette d'un autre
 	if (intval($id_document)) {
@@ -104,9 +104,11 @@ function action_ajouter_un_document_dist($id_document, $file, $objet, $id_objet,
 	$mode = ((isset($file['mode']) and $file['mode']) ? $file['mode'] : $mode);
 
 	include_spip('inc/modifier');
-	if (isset($file['distant']) and $file['distant']
-		and !in_array($mode, array('choix', 'auto', 'image', 'document'))) {
-		spip_log("document distant $source accepte sans verification, mode=$mode", 'medias'._LOG_INFO_IMPORTANTE);
+	if (
+		isset($file['distant']) and $file['distant']
+		and !in_array($mode, ['choix', 'auto', 'image', 'document'])
+	) {
+		spip_log("document distant $source accepte sans verification, mode=$mode", 'medias' . _LOG_INFO_IMPORTANTE);
 		include_spip('inc/distant');
 		$file['tmp_name'] = _DIR_RACINE . copie_locale($source);
 		$source = $file['tmp_name'];
@@ -118,10 +120,10 @@ function action_ajouter_un_document_dist($id_document, $file, $objet, $id_objet,
 	// content-type est connu, et si possible recuperer la taille, voire plus.
 	if (isset($file['distant']) and $file['distant']) {
 		if (!tester_url_absolue($source)) {
-			return _T('medias:erreur_chemin_distant', array('nom' => $source));
+			return _T('medias:erreur_chemin_distant', ['nom' => $source]);
 		}
 		include_spip('inc/distant');
-		$source = str_replace(array("'",'"','<'),array("%27",'%22','%3C'), $source);
+		$source = str_replace(["'",'"','<'], ['%27','%22','%3C'], $source);
 		if (is_array($a = renseigner_source_distante($source))) {
 			$champs = $a;
 			# NB: dans les bonnes conditions (fichier autorise et pas trop gros)
@@ -153,10 +155,9 @@ function action_ajouter_un_document_dist($id_document, $file, $objet, $id_objet,
 			return $a; // message d'erreur
 		}
 	} else { // pas distant
-
-		$champs = array(
+		$champs = [
 			'distant' => 'non'
-		);
+		];
 
 		$champs['titre'] = '';
 		if ($titrer) {
@@ -172,7 +173,7 @@ function action_ajouter_un_document_dist($id_document, $file, $objet, $id_objet,
 
 		if (!is_array($fichier = fixer_fichier_upload($file, $mode))) {
 			return is_string($fichier) ?
-				$fichier : _T('medias:erreur_upload_type_interdit', array('nom' => $file['name']));
+				$fichier : _T('medias:erreur_upload_type_interdit', ['nom' => $file['name']]);
 		}
 
 		$champs['inclus'] = $fichier['inclus'];
@@ -222,7 +223,7 @@ function action_ajouter_un_document_dist($id_document, $file, $objet, $id_objet,
 		$champs = array_merge($champs, $infos);
 
 		// Si mode == 'choix', fixer le mode image/document
-		if (in_array($mode, array('choix', 'auto'))) {
+		if (in_array($mode, ['choix', 'auto'])) {
 			$choisir_mode_document = charger_fonction('choisir_mode_document', 'inc');
 			$mode = $choisir_mode_document($champs, $champs['inclus'] == 'image', $objet);
 		}
@@ -284,7 +285,7 @@ function action_ajouter_un_document_dist($id_document, $file, $objet, $id_objet,
 		}
 	}
 	if (!$id_document) {
-		return _T('medias:erreur_insertion_document_base', array('fichier' => '<em>' . $file['name'] . '</em>'));
+		return _T('medias:erreur_insertion_document_base', ['fichier' => '<em>' . $file['name'] . '</em>']);
 	}
 
 	document_modifier($id_document, $champs);
@@ -294,8 +295,8 @@ function action_ajouter_un_document_dist($id_document, $file, $objet, $id_objet,
 	// Ce plugin ferait quand même mieux de se placer dans metadata/jpg.php
 	pipeline(
 		'post_edition',
-		array(
-			'args' => array(
+		[
+			'args' => [
 				'table' => 'spip_documents', // compatibilite
 				'table_objet' => 'documents',
 				'spip_table_objet' => 'spip_documents',
@@ -305,9 +306,9 @@ function action_ajouter_un_document_dist($id_document, $file, $objet, $id_objet,
 				'serveur' => '', // serveur par defaut, on ne sait pas faire mieux pour le moment
 				'action' => 'ajouter_document',
 				'operation' => 'ajouter_document', // compat <= v2.0
-			),
+			],
 			'data' => $champs
-		)
+		]
 	);
 
 	return $id_document;
@@ -325,7 +326,7 @@ function determiner_sous_dossier_document($ext, $fichier, $mode) {
 
 	// si mode un logoxx on met dans logo/
 	if (strncmp($mode, 'logo', 4) === 0) {
-		return "logo";
+		return 'logo';
 	}
 
 	return $ext;
@@ -384,26 +385,31 @@ function corriger_extension($ext) {
  *     - false ou message d'erreur si l'extension est refusée
  */
 function verifier_upload_autorise($source, $mode = '') {
-	$infos = array('fichier' => $source);
+	$infos = ['fichier' => $source];
 	$res = false;
-	if (preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $match)
+	if (
+		preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $match)
 		and $ext = $match[1]
 	) {
 		$ext = corriger_extension(strtolower($ext));
-		if ($res = sql_fetsel(
-			'extension,inclus,media_defaut as media',
-			'spip_types_documents',
-			'extension=' . sql_quote($ext) . " AND upload='oui'"
-		)) {
+		if (
+			$res = sql_fetsel(
+				'extension,inclus,media_defaut as media',
+				'spip_types_documents',
+				'extension=' . sql_quote($ext) . " AND upload='oui'"
+			)
+		) {
 			$infos = array_merge($infos, $res);
 		}
 	}
 	if (!$res) {
-		if ($res = sql_fetsel(
-			'extension,inclus,media_defaut as media',
-			'spip_types_documents',
-			"extension='zip' AND upload='oui'"
-		)) {
+		if (
+			$res = sql_fetsel(
+				'extension,inclus,media_defaut as media',
+				'spip_types_documents',
+				"extension='zip' AND upload='oui'"
+			)
+		) {
 			$infos = array_merge($infos, $res);
 			$res['autozip'] = true;
 		}
@@ -457,7 +463,7 @@ function fixer_fichier_upload($file, $mode = '') {
 			if ($row['fichier'] && (!$taille = @intval(filesize(get_spip_doc($row['fichier']))))) {
 				spip_log('Echec copie du fichier ' . $file['tmp_name'] . ' (taille de fichier indéfinie)');
 				spip_unlink(get_spip_doc($row['fichier']));
-				return _T('medias:erreur_copie_fichier', array('nom' => $file['tmp_name']));
+				return _T('medias:erreur_copie_fichier', ['nom' => $file['tmp_name']]);
 			} else {
 				return $row;
 			}
@@ -505,7 +511,7 @@ function fixer_fichier_upload($file, $mode = '') {
 				spip_log('Echec copie du fichier ' . $file['tmp_name'] . ' (taille de fichier indéfinie)');
 				spip_unlink(get_spip_doc($row['fichier']));
 
-				return _T('medias:erreur_copie_fichier', array('nom' => $file['tmp_name']));
+				return _T('medias:erreur_copie_fichier', ['nom' => $file['tmp_name']]);
 			} else {
 				return $row;
 			}
diff --git a/action/changer_mode_document.php b/action/changer_mode_document.php
index c51cc9171db76ab023542445c25ae842f9ffd862..3b31918cffd552967d39eb117cf4e7b3de58af28 100644
--- a/action/changer_mode_document.php
+++ b/action/changer_mode_document.php
@@ -37,7 +37,8 @@ function action_changer_mode_document_dist($id_document = null, $mode = null) {
 		}
 	}
 
-	if ($id_document
+	if (
+		$id_document
 		and include_spip('inc/autoriser')
 		and autoriser('modifier', 'document', $id_document)
 	) {
@@ -49,10 +50,11 @@ function action_changer_mode_document_dist($id_document = null, $mode = null) {
 function action_changer_mode_document_post($id_document, $mode) {
 	// - id_document le doc a modifier
 	// - mode le mode a lui donner
-	if ($id_document = intval($id_document)
-		and in_array($mode, array('vignette', 'image', 'document'))
+	if (
+		$id_document = intval($id_document)
+		and in_array($mode, ['vignette', 'image', 'document'])
 	) {
 		include_spip('action/editer_document');
-		document_modifier($id_document, array('mode' => $mode));
+		document_modifier($id_document, ['mode' => $mode]);
 	}
 }
diff --git a/action/copier_local.php b/action/copier_local.php
index 24d1f19c0be6be9d277cae537aeb98ea3ca603a2..a0feac6c31479f1ef912b8fd2e8cf94f92a40a1a 100644
--- a/action/copier_local.php
+++ b/action/copier_local.php
@@ -54,7 +54,7 @@ function action_copier_local_dist($id_document = null) {
 function action_copier_local_post($id_document) {
 
 	// Il faut la source du document pour le copier
-	$row = sql_fetsel('mode,fichier, descriptif, credits', 'spip_documents', 'id_document='.intval($id_document));
+	$row = sql_fetsel('mode,fichier, descriptif, credits', 'spip_documents', 'id_document=' . intval($id_document));
 	$source = $row['fichier'];
 
 	// si la source est bien un fichier distant
@@ -68,11 +68,11 @@ function action_copier_local_post($id_document) {
 			and valider_url_distante($source)
 		) {
 			$fichier = _DIR_RACINE . $fichier;
-			$files = array();
-			$files[] = array('tmp_name' => $fichier, 'name' => basename($fichier));
+			$files = [];
+			$files[] = ['tmp_name' => $fichier, 'name' => basename($fichier)];
 			$ajouter_documents = charger_fonction('ajouter_documents', 'action');
 			spip_log("convertit doc $id_document en local: $source => $fichier", 'medias');
-			$liste = array();
+			$liste = [];
 			$ajouter_documents($id_document, $files, '', 0, $row['mode'], $liste);
 
 			spip_unlink($fichier);
@@ -81,7 +81,7 @@ function action_copier_local_post($id_document) {
 			include_spip('action/editer_document');
 			document_modifier(
 				$id_document,
-				array('credits' => ($row['credits'] ? $row['credits'] . ', ' : '') . $source)
+				['credits' => ($row['credits'] ? $row['credits'] . ', ' : '') . $source]
 			);
 
 			return true;
@@ -95,5 +95,5 @@ function action_copier_local_post($id_document) {
 		spip_log("echec copie locale $source n'est pas une URL distante", 'medias' . _LOG_ERREUR);
 	}
 
-	return _T('medias:erreur_copie_fichier', array('nom' => $source));
+	return _T('medias:erreur_copie_fichier', ['nom' => $source]);
 }
diff --git a/action/desordonner_liens_documents.php b/action/desordonner_liens_documents.php
index 17f4852c2a8d7d4c9f3c60877ec42c1670f0d8e1..a77a619209b378f4fd19f4374ef62ab63f62b692 100644
--- a/action/desordonner_liens_documents.php
+++ b/action/desordonner_liens_documents.php
@@ -73,7 +73,7 @@ function desordonner_liens_documents($document, $objet, $id_objet) {
 	} else {
 		list($image, $mode) = explode('/', $document);
 		$image = ($image == 'I');
-		$typdoc = sql_in('docs.extension', array('gif', 'jpg', 'png'), $image ? '' : 'NOT');
+		$typdoc = sql_in('docs.extension', ['gif', 'jpg', 'png'], $image ? '' : 'NOT');
 
 		$obj = 'id_objet=' . intval($id_objet) . ' AND objet=' . sql_quote($objet);
 
@@ -101,8 +101,8 @@ function desordonner_liens_documents($document, $objet, $id_objet) {
  */
 function desordonner_liens_document($id_document, $objet, $id_objet) {
 	objet_qualifier_liens(
-		array('document' => $id_document),
-		array($objet => $id_objet),
-		array('rang_lien' => 0)
+		['document' => $id_document],
+		[$objet => $id_objet],
+		['rang_lien' => 0]
 	);
-}
\ No newline at end of file
+}
diff --git a/action/dissocier_document.php b/action/dissocier_document.php
index 50ab09b98ef950ff2be5aceccd13fd055afe72a8..943bfa05b643dcea977d28ab2b181ed9faf5af8b 100644
--- a/action/dissocier_document.php
+++ b/action/dissocier_document.php
@@ -56,7 +56,8 @@ function action_dissocier_document_dist($arg = null) {
 	if (count($arg) > 4 and $arg[4] == 'safe') {
 		$check = true;
 	}
-	if ($id_objet = intval($id_objet)
+	if (
+		$id_objet = intval($id_objet)
 		and (
 			($id_objet < 0 and $id_objet == -$GLOBALS['visiteur_session']['id_auteur'])
 			or autoriser('dissocierdocuments', $objet, $id_objet)
@@ -91,11 +92,11 @@ function supprimer_lien_document($id_document, $objet, $id_objet, $supprime = fa
 
 	// D'abord on ne supprime pas, on dissocie
 	include_spip('action/editer_liens');
-	objet_dissocier(array('document' => $id_document), array($objet => $id_objet), array('role' => '*'));
+	objet_dissocier(['document' => $id_document], [$objet => $id_objet], ['role' => '*']);
 
 	// Si c'est une vignette, l'eliminer du document auquel elle appartient
 	// cas tordu peu probable
-	sql_updateq('spip_documents', array('id_vignette' => 0), 'id_vignette=' . $id_document);
+	sql_updateq('spip_documents', ['id_vignette' => 0], 'id_vignette=' . $id_document);
 
 	// verifier son statut apres une suppression de lien
 	include_spip('action/editer_document');
@@ -107,17 +108,17 @@ function supprimer_lien_document($id_document, $objet, $id_objet, $supprime = fa
 
 	pipeline(
 		'post_edition',
-		array(
-			'args' => array(
+		[
+			'args' => [
 				'operation' => 'delier_document', // compat v<=2
 				'action' => 'delier_document',
 				'table' => 'spip_documents',
 				'id_objet' => $id_document,
 				'objet' => $objet,
 				'id' => $id_objet
-			),
+			],
 			'data' => null
-		)
+		]
 	);
 
 	if ($check) {
@@ -165,7 +166,7 @@ function dissocier_document($document, $objet, $id_objet, $supprime = false, $ch
 	} else {
 		list($image, $mode) = explode('/', $document);
 		$image = ($image == 'I');
-		$typdoc = sql_in('docs.extension', array('gif', 'jpg', 'png'), $image ? '' : 'NOT');
+		$typdoc = sql_in('docs.extension', ['gif', 'jpg', 'png'], $image ? '' : 'NOT');
 
 		$obj = 'id_objet=' . intval($id_objet) . ' AND objet=' . sql_quote($objet);
 
diff --git a/action/editer_document.php b/action/editer_document.php
index 7f74235559b2ff4d36da7cb1baf568bb95c48280..9490862fd29ab84ef611c4a811602a41f4f4c2bc 100644
--- a/action/editer_document.php
+++ b/action/editer_document.php
@@ -34,12 +34,12 @@ function action_editer_document_dist($arg = null) {
 	}
 
 	if (!$id_document) {
-		return array(0, '');
+		return [0, ''];
 	} // erreur
 
 	$err = document_modifier($id_document);
 
-	return array($id_document, $err);
+	return [$id_document, $err];
 }
 
 /**
@@ -52,10 +52,10 @@ function action_editer_document_dist($arg = null) {
  */
 function document_inserer($id_parent = null, $set = null) {
 
-	$champs = array(
+	$champs = [
 		'statut' => 'prop',
 		'date' => 'NOW()',
-	);
+	];
 
 	if ($set) {
 		$champs = array_merge($champs, $set);
@@ -64,23 +64,23 @@ function document_inserer($id_parent = null, $set = null) {
 	// Envoyer aux plugins
 	$champs = pipeline(
 		'pre_insertion',
-		array(
-			'args' => array(
+		[
+			'args' => [
 				'table' => 'spip_documents',
-			),
+			],
 			'data' => $champs
-		)
+		]
 	);
 	$id_document = sql_insertq('spip_documents', $champs);
 	pipeline(
 		'post_insertion',
-		array(
-			'args' => array(
+		[
+			'args' => [
 				'table' => 'spip_documents',
 				'id_objet' => $id_document
-			),
+			],
 			'data' => $champs
-		)
+		]
 	);
 
 	return $id_document;
@@ -105,7 +105,7 @@ function document_modifier($id_document, $set = null) {
 		// white list
 		objet_info('document', 'champs_editables'),
 		// black list
-		array('parents', 'ajout_parents'),
+		['parents', 'ajout_parents'],
 		// donnees eventuellement fournies
 		$set
 	);
@@ -127,21 +127,24 @@ function document_modifier($id_document, $set = null) {
 		$ancien_fichier = sql_getfetsel('fichier', 'spip_documents', 'id_document=' . intval($id_document));
 	}
 
-	if ($err = objet_modifier_champs(
-		'document',
-		$id_document,
-		array(
+	if (
+		$err = objet_modifier_champs(
+			'document',
+			$id_document,
+			[
 			'data' => $set,
 			'invalideur' => $invalideur,
 			'indexation' => $indexation
-		),
-		$champs
-	)) {
+			],
+			$champs
+		)
+	) {
 		return $err;
 	}
 
 	// nettoyer l'ancien fichier si necessaire
-	if (isset($champs['fichier']) // un plugin a pu interdire la modif du fichier en virant le champ
+	if (
+		isset($champs['fichier']) // un plugin a pu interdire la modif du fichier en virant le champ
 		and $champs['fichier']
 		and $ancien_fichier // on avait bien note le nom du fichier avant la modif
 		and $ancien_fichier !== $champs['fichier'] // et il a ete modifie
@@ -153,7 +156,7 @@ function document_modifier($id_document, $set = null) {
 
 	// Changer le statut du document ?
 	// le statut n'est jamais fixe manuellement mais decoule de celui des objets lies
-	$champs = collecter_requests(array('parents', 'ajouts_parents'), array(), $set);
+	$champs = collecter_requests(['parents', 'ajouts_parents'], [], $set);
 	if (document_instituer($id_document, $champs)) {
 		//
 		// Post-modifications
@@ -174,7 +177,7 @@ function document_modifier($id_document, $set = null) {
  * @param array $champs
  * @return bool
  */
-function document_instituer($id_document, $champs = array()) {
+function document_instituer($id_document, $champs = []) {
 
 	$statut = isset($champs['statut']) ? $champs['statut'] : null;
 	$date_publication = isset($champs['date_publication']) ? $champs['date_publication'] : null;
@@ -185,11 +188,11 @@ function document_instituer($id_document, $champs = array()) {
 		medias_revision_document_parents($id_document, $champs['ajout_parents'], true);
 	}
 
-	$row = sql_fetsel('statut,date_publication', 'spip_documents', 'id_document='.intval($id_document));
+	$row = sql_fetsel('statut,date_publication', 'spip_documents', 'id_document=' . intval($id_document));
 	$statut_ancien = $row['statut'];
 	$date_publication_ancienne = $row['date_publication'];
 
-	$champs = array();
+	$champs = [];
 
 	/* Autodetermination du statut si non fourni */
 	if (is_null($statut)) {
@@ -200,7 +203,6 @@ function document_instituer($id_document, $champs = array()) {
 		if ($champs === false) {
 			return false;
 		}
-
 	}
 	else {
 		if ($statut !== $statut_ancien) {
@@ -208,24 +210,27 @@ function document_instituer($id_document, $champs = array()) {
 		}
 	}
 
-	if (!is_null($date_publication)
+	if (
+		!is_null($date_publication)
 		and empty($champs['date_publication'])
-		and $date_publication != $date_publication_ancienne) {
+		and $date_publication != $date_publication_ancienne
+	) {
 		$champs['date_publication'] = $date_publication;
 	}
 
 	// Envoyer aux plugins
-	$champs = pipeline('pre_edition',
-		array(
-			'args' => array(
+	$champs = pipeline(
+		'pre_edition',
+		[
+			'args' => [
 				'table' => 'spip_documents',
 				'id_objet' => $id_document,
 				'action' => 'instituer',
 				'statut_ancien' => $statut_ancien,
 				'date_ancienne' => $date_publication_ancienne,
-			),
+			],
 			'data' => $champs
-		)
+		]
 	);
 
 	if (!count($champs)) {
@@ -242,7 +247,7 @@ function document_instituer($id_document, $champs = array()) {
 		if (count($publier_rubriques)) {
 			include_spip('inc/rubriques');
 			foreach ($publier_rubriques as $r) {
-				calculer_rubriques_if($r['id_objet'], array('statut' => $champs['statut']), $statut_ancien, false);
+				calculer_rubriques_if($r['id_objet'], ['statut' => $champs['statut']], $statut_ancien, false);
 			}
 		}
 	}
@@ -251,17 +256,18 @@ function document_instituer($id_document, $champs = array()) {
 	include_spip('inc/invalideur');
 	suivre_invalideur("id='document/$id_document'");
 
-	pipeline('post_edition',
-		array(
-			'args' => array(
+	pipeline(
+		'post_edition',
+		[
+			'args' => [
 				'table' => 'spip_documents',
 				'id_objet' => $id_document,
 				'action' => 'instituer',
 				'statut_ancien' => $statut_ancien,
 				'date_ancienne' => $date_publication_ancienne,
-			),
+			],
 			'data' => $champs
-		)
+		]
 	);
 
 	return true;
@@ -283,13 +289,14 @@ function medias_revision_document_parents($id_document, $parents = null, $ajout
 		return;
 	}
 
-	$insertions = array();
-	$objets_parents = array(); // array('article'=>array(12,23))
+	$insertions = [];
+	$objets_parents = []; // array('article'=>array(12,23))
 
 	// au format objet|id_objet
 	foreach ($parents as $p) {
 		$p = explode('|', $p);
-		if (preg_match('/^[a-z0-9_]+$/i', $objet = $p[0])
+		if (
+			preg_match('/^[a-z0-9_]+$/i', $objet = $p[0])
 			and (($p[1] = intval($p[1])) or in_array($objet, ['site', 'rubrique']))
 		) { // securite
 			$objets_parents[$p[0]][] = $p[1];
@@ -298,14 +305,14 @@ function medias_revision_document_parents($id_document, $parents = null, $ajout
 
 	include_spip('action/editer_liens');
 	// les liens actuels
-	$liens = objet_trouver_liens(array('document' => $id_document), '*');
-	$deja_parents = array();
+	$liens = objet_trouver_liens(['document' => $id_document], '*');
+	$deja_parents = [];
 	// si ce n'est pas un ajout, il faut supprimer les liens actuels qui ne sont pas dans $objets_parents
 	if (!$ajout) {
 		foreach ($liens as $k => $lien) {
 			if (!isset($objets_parents[$lien['objet']]) or !in_array($lien['id_objet'], $objets_parents[$lien['objet']])) {
 				if (autoriser('dissocierdocuments', $lien['objet'], $lien['id_objet'])) {
-					objet_dissocier(array('document' => $id_document), array($lien['objet'] => $lien['id_objet']));
+					objet_dissocier(['document' => $id_document], [$lien['objet'] => $lien['id_objet']]);
 				}
 				unset($liens[$k]);
 			} else {
@@ -317,7 +324,8 @@ function medias_revision_document_parents($id_document, $parents = null, $ajout
 	// trier les objets à traiter : ne pas prendre en compte ceux qui sont déjà associés ou qu'on n'a pas le droit d'associer
 	foreach ($objets_parents as $objet => $ids) {
 		foreach ($ids as $k => $id) {
-			if ((
+			if (
+				(
 					isset($deja_parents[$objet])
 					and in_array($id, $deja_parents[$objet])
 				)
@@ -327,5 +335,5 @@ function medias_revision_document_parents($id_document, $parents = null, $ajout
 			}
 		}
 	}
-	objet_associer(array('document' => $id_document), $objets_parents);
+	objet_associer(['document' => $id_document], $objets_parents);
 }
diff --git a/action/ordonner_liens_documents.php b/action/ordonner_liens_documents.php
index 79f35a07e5fe6341fcc95194d597e2158ab253b1..ca1a3ff34ee400b9afcebd62ab2b88a64a2cdaa8 100644
--- a/action/ordonner_liens_documents.php
+++ b/action/ordonner_liens_documents.php
@@ -44,23 +44,25 @@ function action_ordonner_liens_dist() {
 
 	list($_id_objet, $table_liens) = objet_associable($objet);
 
-	$success = $errors = array();
+	$success = $errors = [];
 
 	$actuels = sql_allfetsel(
-		array($_id_objet . ' AS id', 'rang_lien'),
+		[$_id_objet . ' AS id', 'rang_lien'],
 		$table_liens,
-		array(
+		[
 			sql_in($_id_objet, $ordre),
 			'objet = ' . sql_quote($objet_lie),
 			'id_objet = ' . sql_quote($id_objet_lie)
-		)
+		]
 	);
 
 	$futurs = array_flip($ordre);
 	// ordre de 1 à n (pas de 0 à n).
-	array_walk($futurs, function(&$v) { $v++; });
+	array_walk($futurs, function (&$v) {
+ $v++;
+	});
 
-	$updates = array();
+	$updates = [];
 
 	foreach ($actuels as $l) {
 		if ($futurs[$l['id']] !== $l['rang_lien']) {
@@ -72,21 +74,21 @@ function action_ordonner_liens_dist() {
 		foreach ($updates as $id => $ordre) {
 			sql_updateq(
 				$table_liens,
-				array('rang_lien' => $ordre),
-				array(
+				['rang_lien' => $ordre],
+				[
 					$_id_objet . ' = ' . $id,
 					'objet = ' . sql_quote($objet_lie),
 					'id_objet = ' . sql_quote($id_objet_lie)
-				)
+				]
 			);
 		}
 	}
 
-	return envoyer_json_envoi(array(
+	return envoyer_json_envoi([
 		'done' => true,
 		'success' => $success,
 		'errors' => $errors,
-	));
+	]);
 }
 
 function envoyer_json_envoi($data) {
@@ -95,9 +97,9 @@ function envoyer_json_envoi($data) {
 }
 
 function envoyer_json_erreur($msg) {
-	return envoyer_json_envoi(array(
+	return envoyer_json_envoi([
 		'done' => false,
-		'success' => array(),
-		'errors' => array($msg)
-	));
+		'success' => [],
+		'errors' => [$msg]
+	]);
 }
diff --git a/action/supprimer_document.php b/action/supprimer_document.php
index ca3e315ece12cb61b9d1733732f49a1e3b0ac001..9d8f5492cf55954427357d0b7e1635699076d47d 100644
--- a/action/supprimer_document.php
+++ b/action/supprimer_document.php
@@ -30,7 +30,7 @@ function action_supprimer_document_dist($id_document = 0) {
 	// si c'etait une vignette, modifier le document source !
 	if ($source = sql_getfetsel('id_document', 'spip_documents', 'id_vignette=' . intval($id_document))) {
 		include_spip('action/editer_document');
-		document_modifier($source, array('id_vignette' => 0));
+		document_modifier($source, ['id_vignette' => 0]);
 	}
 
 	include_spip('inc/documents');
@@ -46,7 +46,7 @@ function action_supprimer_document_dist($id_document = 0) {
 	// Si c'est un document ayant une vignette, supprimer aussi la vignette
 	if ($doc['id_vignette']) {
 		action_supprimer_document_dist($doc['id_vignette']);
-		objet_dissocier(array('document' => $doc['id_vignette']), '*');
+		objet_dissocier(['document' => $doc['id_vignette']], '*');
 	}
 	// Si c'est un document ayant des documents annexes (sous-titre, ...)
 	// les supprimer aussi
@@ -59,7 +59,7 @@ function action_supprimer_document_dist($id_document = 0) {
 	}
 
 	// dereferencer dans la base
-	objet_dissocier(array('document' => $id_document), '*', array('role' => '*'));
+	objet_dissocier(['document' => $id_document], '*', ['role' => '*']);
 	sql_delete('spip_documents', 'id_document=' . intval($id_document));
 
 
@@ -76,16 +76,16 @@ function action_supprimer_document_dist($id_document = 0) {
 
 	pipeline(
 		'post_edition',
-		array(
-			'args' => array(
+		[
+			'args' => [
 				'operation' => 'supprimer_document', // compat v<=2
 				'action' => 'supprimer_document',
 				'table' => 'spip_documents',
 				'id_objet' => $id_document,
 				'document' => $doc,
-			),
+			],
 			'data' => null
-		)
+		]
 	);
 
 	return true;
diff --git a/action/supprimer_tous_orphelins.php b/action/supprimer_tous_orphelins.php
index 417594acbe28032532b21bbf0afe07693e2135bc..6e3230b041ed1139535837f48196e9cf67b49df9 100644
--- a/action/supprimer_tous_orphelins.php
+++ b/action/supprimer_tous_orphelins.php
@@ -24,7 +24,7 @@ function action_supprimer_tous_orphelins() {
 	//on recupere le contexte pour ne supprimer les orphelins que de ce dernier
 	list($media, $distant, $statut, $sanstitre) = explode('/', $arg);
 
-	$where = array();
+	$where = [];
 	//critere sur le media
 	if ($media) {
 		$select = 'media=' . sql_quote($media);
diff --git a/action/tourner.php b/action/tourner.php
index 30c6fcf9ad5c314064725be4eff6183e6306fe8d..aaeb395b31b13eb78bfdb430a80b31870c2dc6ee 100644
--- a/action/tourner.php
+++ b/action/tourner.php
@@ -104,12 +104,12 @@ function action_tourner_post($id_document, $angle) {
 
 	// succes !
 	if ($largeur > 0 and $hauteur > 0) {
-		$set = array(
+		$set = [
 			'fichier' => set_spip_doc($dest),
 			'largeur' => $largeur,
 			'hauteur' => $hauteur,
 			'distant' => 'non' // le document n'est plus distant apres une transformation
-		);
+		];
 		if ($taille = @filesize($dest)) {
 			$set['taille'] = $taille;
 		}
@@ -121,18 +121,18 @@ function action_tourner_post($id_document, $angle) {
 		// pipeline pour les plugins
 		pipeline(
 			'post_edition',
-			array(
-				'args' => array(
+			[
+				'args' => [
 					'table' => 'spip_documents',
 					'table_objet' => 'documents',
 					'spip_table_objet' => 'spip_documents',
 					'type' => 'document',
 					'id_objet' => $id_document,
-					'champs' => array('rotation' => $angle, 'orientation' => $var_rot, 'fichier' => $row['fichier']),
+					'champs' => ['rotation' => $angle, 'orientation' => $var_rot, 'fichier' => $row['fichier']],
 					'action' => 'tourner',
-				),
+				],
 				'data' => $set
-			)
+			]
 		);
 	}
 }
@@ -142,7 +142,8 @@ function action_tourner_post($id_document, $angle) {
 // https://code.spip.net/@tourner_selon_exif_orientation
 function tourner_selon_exif_orientation($id_document, $fichier) {
 
-	if (function_exists('exif_read_data')
+	if (
+		function_exists('exif_read_data')
 		and $exif = exif_read_data($fichier)
 		and (
 			$ort = $exif['IFD0']['Orientation']
@@ -161,7 +162,7 @@ function tourner_selon_exif_orientation($id_document, $fichier) {
 				$rot = -90;
 		}
 		if ($rot) {
-			action_tourner_post(array(null, $id_document, $rot));
+			action_tourner_post([null, $id_document, $rot]);
 		}
 	}
 }
diff --git a/action/verifier_documents_brises.php b/action/verifier_documents_brises.php
index 967e92dba92025e6e15d49a3c15b914125244400..1ee184143d3a20a0db8d9c5b258510705a489f80 100644
--- a/action/verifier_documents_brises.php
+++ b/action/verifier_documents_brises.php
@@ -29,7 +29,7 @@ function action_verifier_documents_brises_dist() {
 		$res = sql_select('fichier,brise,id_document', 'spip_documents', "distant='non'");
 		while ($row = sql_fetch($res)) {
 			if (($brise = !@file_exists(get_spip_doc($row['fichier']))) != $row['brise']) {
-				sql_updateq('spip_documents', array('brise' => $brise), 'id_document=' . intval($row['id_document']));
+				sql_updateq('spip_documents', ['brise' => $brise], 'id_document=' . intval($row['id_document']));
 			}
 		}
 	}
diff --git a/action/verifier_documents_liens.php b/action/verifier_documents_liens.php
index ef20a0cc0e0500d6925e4ed1349cdb9a46e5e990..74beebfb63e888611384c9e9f558837253ca73c2 100644
--- a/action/verifier_documents_liens.php
+++ b/action/verifier_documents_liens.php
@@ -36,5 +36,5 @@ function action_verifier_documents_liens_dist($id_document = null) {
 
 	$id_document = ($id_document == '*') ? '*' : intval($id_document);
 	include_spip('action/editer_liens');
-	objet_optimiser_liens(array('document' => $id_document), '*');
+	objet_optimiser_liens(['document' => $id_document], '*');
 }
diff --git a/base/medias.php b/base/medias.php
index 004d4d1db5be3e35d8006655a5d974110551f750..07b996c7271db3560805d44d8ab0692f68a8c514 100644
--- a/base/medias.php
+++ b/base/medias.php
@@ -30,13 +30,13 @@ function medias_declarer_tables_interfaces($interfaces) {
 	$interfaces['table_des_tables']['documents'] = 'documents';
 	$interfaces['table_des_tables']['types_documents'] = 'types_documents';
 
-	$interfaces['exceptions_des_tables']['documents']['type_document'] = array('types_documents', 'titre');
-	$interfaces['exceptions_des_tables']['documents']['extension_document'] = array('types_documents', 'extension');
-	$interfaces['exceptions_des_tables']['documents']['mime_type'] = array('types_documents', 'mime_type');
-	$interfaces['exceptions_des_tables']['documents']['media_document'] = array('types_documents', 'media');
+	$interfaces['exceptions_des_tables']['documents']['type_document'] = ['types_documents', 'titre'];
+	$interfaces['exceptions_des_tables']['documents']['extension_document'] = ['types_documents', 'extension'];
+	$interfaces['exceptions_des_tables']['documents']['mime_type'] = ['types_documents', 'mime_type'];
+	$interfaces['exceptions_des_tables']['documents']['media_document'] = ['types_documents', 'media'];
 
-	$interfaces['exceptions_des_jointures']['spip_documents']['id_forum'] = array('spip_documents_liens', 'id_forum');
-	$interfaces['exceptions_des_jointures']['spip_documents']['vu'] = array('spip_documents_liens', 'vu');
+	$interfaces['exceptions_des_jointures']['spip_documents']['id_forum'] = ['spip_documents_liens', 'id_forum'];
+	$interfaces['exceptions_des_jointures']['spip_documents']['vu'] = ['spip_documents_liens', 'vu'];
 	$interfaces['table_date']['types_documents'] = 'date';
 
 	$interfaces['table_des_traitements']['FICHIER'][] = 'get_spip_doc(%s)';
@@ -53,7 +53,7 @@ function medias_declarer_tables_interfaces($interfaces) {
  */
 function medias_declarer_tables_principales($tables_principales) {
 
-	$spip_types_documents = array(
+	$spip_types_documents = [
 		'extension' => "varchar(10) DEFAULT '' NOT NULL",
 		'titre' => "text DEFAULT '' NOT NULL",
 		'descriptif' => "text DEFAULT '' NOT NULL",
@@ -62,15 +62,15 @@ function medias_declarer_tables_principales($tables_principales) {
 		'upload' => "ENUM('oui', 'non') DEFAULT 'oui'  NOT NULL",
 		'media_defaut' => "varchar(10) DEFAULT 'file' NOT NULL",
 		'maj' => 'TIMESTAMP'
-	);
+	];
 
-	$spip_types_documents_key = array(
+	$spip_types_documents_key = [
 		'PRIMARY KEY' => 'extension',
 		'KEY inclus' => 'inclus'
-	);
+	];
 
 	$tables_principales['spip_types_documents'] =
-		array('field' => &$spip_types_documents, 'key' => &$spip_types_documents_key);
+		['field' => &$spip_types_documents, 'key' => &$spip_types_documents_key];
 
 	return $tables_principales;
 }
@@ -83,25 +83,25 @@ function medias_declarer_tables_principales($tables_principales) {
  */
 function medias_declarer_tables_auxiliaires($tables_auxiliaires) {
 
-	$spip_documents_liens = array(
+	$spip_documents_liens = [
 		'id_document' => "bigint(21) DEFAULT '0' NOT NULL",
 		'id_objet' => "bigint(21) DEFAULT '0' NOT NULL",
 		'objet' => "VARCHAR (25) DEFAULT '' NOT NULL",
 		'vu' => "ENUM('non', 'oui') DEFAULT 'non' NOT NULL",
 		'rang_lien' => "int(4) DEFAULT '0' NOT NULL"
-	);
+	];
 
-	$spip_documents_liens_key = array(
+	$spip_documents_liens_key = [
 		'PRIMARY KEY' => 'id_document,id_objet,objet',
 		'KEY id_document' => 'id_document',
 		'KEY id_objet' => 'id_objet',
 		'KEY objet' => 'objet',
-	);
+	];
 
-	$tables_auxiliaires['spip_documents_liens'] = array(
+	$tables_auxiliaires['spip_documents_liens'] = [
 		'field' => &$spip_documents_liens,
 		'key' => &$spip_documents_liens_key
-	);
+	];
 
 	return $tables_auxiliaires;
 }
@@ -121,9 +121,9 @@ function medias_declarer_tables_objets_surnoms($surnoms) {
 
 function medias_declarer_tables_objets_sql($tables) {
 	$tables['spip_articles']['champs_versionnes'][] = 'jointure_documents';
-	$tables['spip_documents'] = array(
-		'table_objet_surnoms' => array('doc', 'img', 'emb'),
-		'type_surnoms' => array(),
+	$tables['spip_documents'] = [
+		'table_objet_surnoms' => ['doc', 'img', 'emb'],
+		'type_surnoms' => [],
 		'url_voir' => 'document_edit',
 		'url_edit' => 'document_edit',
 		'page' => '',
@@ -137,7 +137,7 @@ function medias_declarer_tables_objets_sql($tables) {
 		'titre' => "CASE WHEN length(titre)>0 THEN titre ELSE fichier END as titre, '' AS lang",
 		'date' => 'date',
 		'principale' => 'oui',
-		'field' => array(
+		'field' => [
 			'id_document' => 'bigint(21) NOT NULL',
 			'id_vignette' => "bigint(21) DEFAULT '0' NOT NULL",
 			'extension' => "VARCHAR(10) DEFAULT '' NOT NULL",
@@ -158,34 +158,34 @@ function medias_declarer_tables_objets_sql($tables) {
 			'date_publication' => "datetime DEFAULT '0000-00-00 00:00:00' NOT NULL",
 			'brise' => 'tinyint DEFAULT 0',
 			'maj' => 'TIMESTAMP'
-		),
-		'key' => array(
+		],
+		'key' => [
 			'PRIMARY KEY' => 'id_document',
 			'KEY id_vignette' => 'id_vignette',
 			'KEY mode' => 'mode',
 			'KEY extension' => 'extension'
-		),
-		'join' => array(
+		],
+		'join' => [
 			'id_document' => 'id_document',
 			'extension' => 'extension'
-		),
-		'statut' => array(
-			array(
+		],
+		'statut' => [
+			[
 				'champ' => 'statut',
 				'publie' => 'publie',
 				'previsu' => 'publie,prop,prepa',
 				'post_date' => 'date_publication',
-				'exception' => array('statut', 'tout')
-			)
-		),
-		'tables_jointures' => array('types_documents'),
-		'rechercher_champs' => array(
+				'exception' => ['statut', 'tout']
+			]
+		],
+		'tables_jointures' => ['types_documents'],
+		'rechercher_champs' => [
 			'titre' => 3,
 			'descriptif' => 1,
 			'fichier' => 1,
 			'credits' => 1,
-		),
-		'champs_editables' => array(
+		],
+		'champs_editables' => [
 			'titre',
 			'descriptif',
 			'date',
@@ -201,8 +201,8 @@ function medias_declarer_tables_objets_sql($tables) {
 			'extension',
 			'id_vignette',
 			'media'
-		),
-		'champs_versionnes' => array(
+		],
+		'champs_versionnes' => [
 			'id_vignette',
 			'titre',
 			'descriptif',
@@ -214,17 +214,17 @@ function medias_declarer_tables_objets_sql($tables) {
 			'credits',
 			'fichier',
 			'distant'
-		),
-		'modeles' => array('document', 'doc', 'img', 'emb', 'image', 'video', 'audio', 'file'),
+		],
+		'modeles' => ['document', 'doc', 'img', 'emb', 'image', 'video', 'audio', 'file'],
 		'modeles_styliser' => 'medias_modeles_styliser',
-	);
+	];
 
 	// jointures sur les forum pour tous les objets
 	$tables[]['tables_jointures'][] = 'documents_liens';
 
 	// recherche jointe sur les documents pour les articles et rubriques
-	$tables['spip_articles']['rechercher_jointures']['document'] = array('titre' => 2, 'descriptif' => 1);
-	$tables['spip_rubriques']['rechercher_jointures']['document'] = array('titre' => 2, 'descriptif' => 1);
+	$tables['spip_articles']['rechercher_jointures']['document'] = ['titre' => 2, 'descriptif' => 1];
+	$tables['spip_rubriques']['rechercher_jointures']['document'] = ['titre' => 2, 'descriptif' => 1];
 
 	return $tables;
 }
@@ -243,13 +243,13 @@ function creer_base_types_doc($serveur = '', $champ_media = 'media_defaut') {
 
 	// charger en memoire tous les types deja definis pour limiter les requettes
 	$rows = sql_allfetsel('mime_type,titre,inclus,extension,' . $champ_media . ',upload,descriptif', 'spip_types_documents', '', '', '', '', '', $serveur);
-	$deja = array();
+	$deja = [];
 	foreach ($rows as $k => $row) {
 		$deja[$row['extension']] = &$rows[$k];
 	}
 
-	$insertions = array();
-	$updates = array();
+	$insertions = [];
+	$updates = [];
 
 	foreach ($tables_mime as $extension => $type_mime) {
 		if (isset($tables_images[$extension])) {
@@ -271,18 +271,20 @@ function creer_base_types_doc($serveur = '', $champ_media = 'media_defaut') {
 
 		// type de media
 		$media = 'file';
-		if (preg_match(',^image/,', $type_mime) or in_array($type_mime, array('application/illustrator'))) {
+		if (preg_match(',^image/,', $type_mime) or in_array($type_mime, ['application/illustrator'])) {
 			$media = 'image';
 		} elseif (preg_match(',^audio/,', $type_mime)) {
 			$media = 'audio';
-		} elseif (preg_match(',^video/,', $type_mime) or in_array(
-			$type_mime,
-			array('application/ogg', 'application/x-shockwave-flash', 'application/mp4')
-		)) {
+		} elseif (
+			preg_match(',^video/,', $type_mime) or in_array(
+				$type_mime,
+				['application/ogg', 'application/x-shockwave-flash', 'application/mp4']
+			)
+		) {
 			$media = 'video';
 		}
 
-		$set = array(
+		$set = [
 			'mime_type' => $type_mime,
 			'titre' => $titre,
 			'inclus' => $inclus,
@@ -290,7 +292,7 @@ function creer_base_types_doc($serveur = '', $champ_media = 'media_defaut') {
 			$champ_media => $media,
 			'upload' => 'oui',
 			'descriptif' => '',
-		);
+		];
 		if (!isset($deja[$extension])) {
 			$insertions[] = $set;
 		} elseif (array_diff($deja[$extension], $set)) {
@@ -322,15 +324,17 @@ function medias_optimiser_base_disparus($flux) {
 	// optimiser les liens morts :
 	// entre documents vers des objets effaces
 	// depuis des documents effaces
-	$flux['data'] += objet_optimiser_liens(array('document' => '*'), '*');
+	$flux['data'] += objet_optimiser_liens(['document' => '*'], '*');
 
 	// on ne nettoie volontairement pas automatiquement les documents orphelins
 	// mais il faut nettoyer les logos qui ne sont plus liés à rien
-	$res = sql_select("D.id_document",
-		"spip_documents AS D
+	$res = sql_select(
+		'D.id_document',
+		'spip_documents AS D
 						LEFT JOIN spip_documents_liens AS L
-							ON (L.id_document=D.id_document)",
-		sql_in('D.mode', ['logoon', 'logooff']) . " AND L.id_document IS NULL");
+							ON (L.id_document=D.id_document)',
+		sql_in('D.mode', ['logoon', 'logooff']) . ' AND L.id_document IS NULL'
+	);
 
 	$supprimer_document = charger_fonction('supprimer_document', 'action');
 	while ($row = sql_fetch($res)) {
diff --git a/base/typedoc.php b/base/typedoc.php
index 9a5bf4dee66e4c66a4e1ffc969387ca7ce9a106c..a24fadc3889a02047eede6f66f831305cd84258a 100644
--- a/base/typedoc.php
+++ b/base/typedoc.php
@@ -16,7 +16,7 @@ if (!defined('_ECRIRE_INC_VERSION')) {
 
 global $tables_images, $tables_sequences, $tables_documents, $tables_mime, $mime_alias;
 
-$tables_images = array(
+$tables_images = [
 	// Images reconnues par PHP
 	'jpg' => 'JPEG',
 	'png' => 'PNG',
@@ -26,11 +26,11 @@ $tables_images = array(
 	// Autres images (peuvent utiliser le tag <img>)
 	'bmp' => 'BMP',
 	'svg' => 'SVG',
-);
+];
 
 // Multimedia (peuvent utiliser le tag <embed>)
 
-$tables_sequences = array(
+$tables_sequences = [
 	'aac' => 'Advanced Audio Coding',
 	'ac3' => 'AC-3 Compressed Audio',
 	'aifc' => 'Compressed AIFF Audio',
@@ -86,10 +86,10 @@ $tables_sequences = array(
 	'y4m' => 'YUV4MPEG2',
 	'3ga' => '3GP Audio File',
 	'3gp' => '3rd Generation Partnership Project'
-);
+];
 
 // Documents varies
-$tables_documents = array(
+$tables_documents = [
 	'7z' => '7 Zip',
 	'abw' => 'Abiword',
 	'ai' => 'Adobe Illustrator',
@@ -210,9 +210,9 @@ $tables_documents = array(
 	'xlsx' => 'Excel',
 	'xltm' => 'Excel template',
 	'xltx' => 'Excel template'
-);
+];
 
-$tables_mime = array(
+$tables_mime = [
 	// Images reconnues par PHP
 	'jpg' => 'image/jpeg',
 	'png' => 'image/png',
@@ -399,10 +399,10 @@ $tables_mime = array(
 	'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
 	'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12',
 	'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'
-);
+];
 
 
-$mime_alias = array(
+$mime_alias = [
 	'application/x-ogg' => 'application/ogg',
 	'audio/3gpp' => 'video/3gpp',
 	'audio/x-mpeg' => 'audio/mpeg',
@@ -411,4 +411,4 @@ $mime_alias = array(
 	'video/flv' => 'video/x-flv',
 	'video/mp4' => 'application/mp4',
 	'image/jpg' => 'image/jpeg'
-);
+];
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000000000000000000000000000000000000..889d1e4163d7fac6c0026804b315563084b34bed
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,7 @@
+{
+    "require-dev": {
+        "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
+        "spip/coding-standards": "^1.2",
+        "phpstan/phpstan": "^0.12.98"
+    }
+}
diff --git a/formulaires/changer_fichier_document.php b/formulaires/changer_fichier_document.php
index bbf8657071fa296763d643346044adc07c3f4e7f..f59a8f0271e83f5ab14e355899e947ed79b37dc7 100644
--- a/formulaires/changer_fichier_document.php
+++ b/formulaires/changer_fichier_document.php
@@ -17,7 +17,7 @@ if (!defined('_ECRIRE_INC_VERSION')) {
 function formulaires_changer_fichier_document_charger_dist($id_document) {
 	$valeurs = sql_fetsel('id_document,fichier,distant', 'spip_documents', 'id_document=' . intval($id_document));
 	if (!$valeurs) {
-		return array('editable' => false);
+		return ['editable' => false];
 	}
 
 	$charger = charger_fonction('charger', 'formulaires/joindre_document');
@@ -29,7 +29,7 @@ function formulaires_changer_fichier_document_charger_dist($id_document) {
 }
 
 function formulaires_changer_fichier_document_verifier_dist($id_document) {
-	$erreurs = array();
+	$erreurs = [];
 	if (_request('copier_local')) {
 	} else {
 		$verifier = charger_fonction('verifier', 'formulaires/joindre_document');
@@ -42,7 +42,7 @@ function formulaires_changer_fichier_document_verifier_dist($id_document) {
 function formulaires_changer_fichier_document_traiter_dist($id_document) {
 	if (_request('copier_local')) {
 		$copier_local = charger_fonction('copier_local', 'action');
-		$res = array('editable' => true);
+		$res = ['editable' => true];
 		if (($err = $copier_local($id_document)) === true) {
 			$res['message_ok'] = _T('medias:document_copie_locale_succes');
 		} else {
@@ -50,7 +50,8 @@ function formulaires_changer_fichier_document_traiter_dist($id_document) {
 		}
 	} else {
 		// liberer le nom de l'ancien fichier pour permettre le remplacement par un fichier du meme nom
-		if ($ancien_fichier = sql_getfetsel('fichier', 'spip_documents', 'id_document=' . intval($id_document))
+		if (
+			$ancien_fichier = sql_getfetsel('fichier', 'spip_documents', 'id_document=' . intval($id_document))
 			and @file_exists($f = get_spip_doc($ancien_fichier))
 		) {
 			spip_unlink($f);
diff --git a/formulaires/configurer_documents.php b/formulaires/configurer_documents.php
index 60fdc05dbe62cd6e2108f9ba57f43cc698d66e13..78b0605af770ab636dd19c6e73f6307a0e12138a 100644
--- a/formulaires/configurer_documents.php
+++ b/formulaires/configurer_documents.php
@@ -27,11 +27,13 @@ if (!defined('_ECRIRE_INC_VERSION')) {
  *     Environnement du formulaire
  **/
 function formulaires_configurer_documents_charger_dist() {
-	$valeurs = array();
-	foreach (array(
+	$valeurs = [];
+	foreach (
+		[
 		'documents_objets',
 		'documents_date',
-	) as $m) {
+		] as $m
+	) {
 		$valeurs[$m] = isset($GLOBALS['meta'][$m]) ? $GLOBALS['meta'][$m] : '';
 	}
 	$valeurs['documents_objets'] = explode(',', $valeurs['documents_objets']);
@@ -46,7 +48,7 @@ function formulaires_configurer_documents_charger_dist() {
  *     Retours du traitement
  **/
 function formulaires_configurer_documents_traiter_dist() {
-	$res = array('editable' => true);
+	$res = ['editable' => true];
 	if (!is_null($v = _request($m = 'documents_date'))) {
 		ecrire_meta($m, $v == 'oui' ? 'oui' : 'non');
 	}
diff --git a/formulaires/editer_document.php b/formulaires/editer_document.php
index d821f6ed070f2919dba7730e4f476e353bef0b3d..0758cb17c43db64d525326f3b445871a6258d81a 100644
--- a/formulaires/editer_document.php
+++ b/formulaires/editer_document.php
@@ -25,7 +25,7 @@ function formulaires_editer_document_charger_dist(
 	$retour = '',
 	$lier_trad = 0,
 	$config_fonc = 'documents_edit_config',
-	$row = array(),
+	$row = [],
 	$hidden = ''
 ) {
 	$valeurs = formulaires_editer_objet_charger('document', $id_document, $id_parent, $lier_trad, $retour, $config_fonc, $row, $hidden);
@@ -36,11 +36,11 @@ function formulaires_editer_document_charger_dist(
 	}
 
 	// relier les parents
-	$valeurs['parents'] = array();
+	$valeurs['parents'] = [];
 	$valeurs['_hidden'] = '';
 	$parents = sql_allfetsel('objet,id_objet', 'spip_documents_liens', 'id_document=' . intval($id_document));
 	foreach ($parents as $p) {
-		if (in_array($p['objet'], array('article', 'rubrique')) and $p['id_objet'] > 0) {
+		if (in_array($p['objet'], ['article', 'rubrique']) and $p['id_objet'] > 0) {
 			$valeurs['parents'][] = $p['objet'] . '|' . $p['id_objet'];
 		} else {
 			$valeurs['_hidden'] .= "<input type='hidden' name='parents[]' value='" . $p['objet'] . '|' . $p['id_objet'] . "' />";
@@ -66,7 +66,7 @@ function formulaires_editer_document_charger_dist(
 	);
 	$valeurs['type_document'] = $row['type_document'];
 	$valeurs['_inclus'] = $row['inclus'];
-	if (in_array($valeurs['extension'], array('jpg', 'gif', 'png', 'svg'))) {
+	if (in_array($valeurs['extension'], ['jpg', 'gif', 'png', 'svg'])) {
 		$valeurs['apercu'] = get_spip_doc($valeurs['fichier']);
 	}
 
@@ -76,7 +76,8 @@ function formulaires_editer_document_charger_dist(
 		include_spip('inc/renseigner_document');
 		$infos = renseigner_taille_dimension_image(get_spip_doc($valeurs['fichier']), $valeurs['extension']);
 		if ($infos and is_array($infos) and isset($infos['taille'])) {
-			if ($infos['taille'] != $valeurs['taille']
+			if (
+				$infos['taille'] != $valeurs['taille']
 				or ($infos['type_image'] && ($infos['largeur'] != $valeurs['largeur']))
 				or ($infos['type_image'] && ($infos['hauteur'] != $valeurs['hauteur']))
 			) {
@@ -106,7 +107,7 @@ function formulaires_editer_document_charger_dist(
 function documents_edit_config($row) {
 	global $spip_lang;
 
-	$config = array();//$GLOBALS['meta'];
+	$config = [];//$GLOBALS['meta'];
 	$config['lignes'] = 8;
 	$config['langue'] = $spip_lang;
 
@@ -121,10 +122,10 @@ function formulaires_editer_document_verifier_dist(
 	$retour = '',
 	$lier_trad = 0,
 	$config_fonc = 'documents_edit_config',
-	$row = array(),
+	$row = [],
 	$hidden = ''
 ) {
-	$erreurs = formulaires_editer_objet_verifier('document', $id_document, is_numeric($id_document) ? array() : array('titre'));
+	$erreurs = formulaires_editer_objet_verifier('document', $id_document, is_numeric($id_document) ? [] : ['titre']);
 
 	// verifier l'upload si on a demande a changer le document
 	if (_request('joindre_upload') or _request('joindre_ftp') or _request('joindre_distant')) {
@@ -137,7 +138,8 @@ function formulaires_editer_document_verifier_dist(
 
 	// On ne vérifie la date que si on avait le droit de la modifier
 	if (lire_config('documents_date') == 'oui') {
-		if (!$date = recup_date(_request('saisie_date') . ' ' . _request('saisie_heure') . ':00')
+		if (
+			!$date = recup_date(_request('saisie_date') . ' ' . _request('saisie_heure') . ':00')
 			or !($date = mktime($date[3], $date[4], 0, $date[1], $date[2], $date[0]))
 		) {
 			$erreurs['saisie_date'] = _T('medias:format_date_incorrect');
@@ -158,16 +160,16 @@ function formulaires_editer_document_traiter_dist(
 	$retour = '',
 	$lier_trad = 0,
 	$config_fonc = 'documents_edit_config',
-	$row = array(),
+	$row = [],
 	$hidden = ''
 ) {
 	if (is_null(_request('parents'))) {
-		set_request('parents', array());
+		set_request('parents', []);
 	}
 
 	// verifier les infos de taille et dimensions sur les fichiers locaux
 	// cas des maj de fichier directes par ftp
-	foreach (array('taille', 'largeur', 'hauteur') as $c) {
+	foreach (['taille', 'largeur', 'hauteur'] as $c) {
 		if (($v = _request("_{$c}_modif")) and !_request($c)) {
 			set_request($c, $v);
 		}
@@ -176,7 +178,8 @@ function formulaires_editer_document_traiter_dist(
 	$res = formulaires_editer_objet_traiter('document', $id_document, $id_parent, $lier_trad, $retour, $config_fonc, $row, $hidden);
 	set_request('parents');
 	$autoclose = "<script type='text/javascript'>if (window.jQuery) jQuery.modalboxclose();</script>";
-	if (_request('copier_local')
+	if (
+		_request('copier_local')
 		or _request('joindre_upload')
 		or _request('joindre_ftp')
 		or _request('joindre_distant')
@@ -185,7 +188,7 @@ function formulaires_editer_document_traiter_dist(
 		$autoclose = '';
 		if (_request('copier_local')) {
 			$copier_local = charger_fonction('copier_local', 'action');
-			$res = array('editable' => true);
+			$res = ['editable' => true];
 			if (($err = $copier_local($id_document)) === true) {
 				$res['message_ok'] = (isset($res['message_ok']) ? $res['message_ok'] . '<br />' : '') . _T('medias:document_copie_locale_succes');
 			} else {
@@ -194,7 +197,8 @@ function formulaires_editer_document_traiter_dist(
 			set_request('credits'); // modifie par la copie locale
 		} else {
 			// liberer le nom de l'ancien fichier pour permettre le remplacement par un fichier du meme nom
-			if ($ancien_fichier = sql_getfetsel('fichier', 'spip_documents', 'id_document=' . intval($id_document))
+			if (
+				$ancien_fichier = sql_getfetsel('fichier', 'spip_documents', 'id_document=' . intval($id_document))
 				and !tester_url_absolue($ancien_fichier)
 				and @file_exists($rename = get_spip_doc($ancien_fichier))
 			) {
diff --git a/formulaires/illustrer_document.php b/formulaires/illustrer_document.php
index 485e226856d9c9f4fcdd81583baa792932475132..dd3b87d6d1cd8602280e677f56a260d05f85b67f 100644
--- a/formulaires/illustrer_document.php
+++ b/formulaires/illustrer_document.php
@@ -18,7 +18,7 @@ function formulaires_illustrer_document_charger_dist($id_document) {
 	include_spip('inc/documents');
 	$valeurs = sql_fetsel('id_document,mode,id_vignette,extension,media', 'spip_documents', 'id_document=' . intval($id_document));
 	if (!$valeurs /*OR in_array($valeurs['extension'],array('jpg','gif','png'))*/) {
-		return array('editable' => false, 'id' => $id_document);
+		return ['editable' => false, 'id' => $id_document];
 	}
 
 	$valeurs['id'] = $id_document;
@@ -36,7 +36,7 @@ function formulaires_illustrer_document_charger_dist($id_document) {
 		$valeurs['largeur'] = null;
 		$valeurs['id_vignette'] = null;
 	}
-	$valeurs['_pipeline'] = array('editer_contenu_objet', array('type' => 'illustrer_document', 'id' => $id_document));
+	$valeurs['_pipeline'] = ['editer_contenu_objet', ['type' => 'illustrer_document', 'id' => $id_document]];
 
 	if (intval($id_document) and !autoriser('modifier', 'document', intval($id_document))) {
 		$valeurs['editable'] = '';
@@ -46,7 +46,7 @@ function formulaires_illustrer_document_charger_dist($id_document) {
 }
 
 function formulaires_illustrer_document_verifier_dist($id_document) {
-	$erreurs = array();
+	$erreurs = [];
 	if (_request('supprimer')) {
 	} else {
 		$id_vignette = sql_getfetsel('id_vignette', 'spip_documents', 'id_document=' . intval($id_document));
@@ -59,7 +59,7 @@ function formulaires_illustrer_document_verifier_dist($id_document) {
 
 function formulaires_illustrer_document_traiter_dist($id_document) {
 	$id_vignette = sql_getfetsel('id_vignette', 'spip_documents', 'id_document=' . intval($id_document));
-	$res = array('editable' => true);
+	$res = ['editable' => true];
 	if (_request('supprimer')) {
 		$supprimer_document = charger_fonction('supprimer_document', 'action');
 		if ($id_vignette and $supprimer_document($id_vignette)) {
@@ -75,11 +75,12 @@ function formulaires_illustrer_document_traiter_dist($id_document) {
 
 		$ajoute = $ajouter_documents($id_vignette, $files, '', 0, 'vignette');
 
-		if (is_numeric(reset($ajoute))
+		if (
+			is_numeric(reset($ajoute))
 			and $id_vignette = reset($ajoute)
 		) {
 			include_spip('action/editer_document');
-			document_modifier($id_document, array('id_vignette' => $id_vignette, 'mode' => 'document'));
+			document_modifier($id_document, ['id_vignette' => $id_vignette, 'mode' => 'document']);
 			$res['message_ok'] = _T('medias:document_installe_succes');
 		} else {
 			$res['message_erreur'] = reset($ajoute);
diff --git a/formulaires/joindre_document.php b/formulaires/joindre_document.php
index 5773e37b9a6a68ffbf48dceacc875756b210eba7..fdc901533b8cd2421bb6dbcef8281359ae4fb148 100644
--- a/formulaires/joindre_document.php
+++ b/formulaires/joindre_document.php
@@ -36,10 +36,12 @@ function joindre_determiner_mode($mode, $id_document, $objet) {
 		if (intval($id_document)) {
 			$mode = sql_getfetsel('mode', 'spip_documents', 'id_document=' . intval($id_document));
 		}
-		if (!in_array($mode, array('choix', 'document', 'image'))) {
+		if (!in_array($mode, ['choix', 'document', 'image'])) {
 			$mode = 'choix';
-			if ($objet
-				and !in_array(table_objet_sql($objet), explode(',', $GLOBALS['meta']['documents_objets']))) {
+			if (
+				$objet
+				and !in_array(table_objet_sql($objet), explode(',', $GLOBALS['meta']['documents_objets']))
+			) {
 				$mode = 'image';
 			}
 		}
@@ -80,7 +82,7 @@ function formulaires_joindre_document_charger_dist(
 	$proposer_media = true,
 	$proposer_ftp = true
 ) {
-	$valeurs = array();
+	$valeurs = [];
 	$mode = joindre_determiner_mode($mode, $id_document, $objet);
 
 
@@ -91,7 +93,7 @@ function formulaires_joindre_document_charger_dist(
 	$valeurs['fichier_upload'] = $valeurs['_options_upload_ftp'] = $valeurs['_dir_upload_ftp'] = '';
 	$valeurs['joindre_upload'] = $valeurs['joindre_distant'] =
 	$valeurs['joindre_ftp'] = $valeurs['joindre_mediatheque'] = '';
-	
+
 	// gérer le focus de la méthode d'upload lorsque le formulaire est envoyé
 	$valeurs['methode_focus'] = _request('methode_focus');
 
@@ -181,7 +183,7 @@ function formulaires_joindre_document_verifier_dist(
 ) {
 	include_spip('inc/joindre_document');
 
-	$erreurs = array();
+	$erreurs = [];
 	// on joint un document deja dans le site
 	if (_request('joindre_mediatheque')) {
 		$refdoc_joindre = intval(preg_replace(',^(doc|document|img),', '', _request('refdoc_joindre')));
@@ -200,7 +202,8 @@ function formulaires_joindre_document_verifier_dist(
 			} else {
 				// regarder si on a eu une erreur sur l'upload d'un fichier
 				foreach ($files as $file) {
-					if (isset($file['error'])
+					if (
+						isset($file['error'])
 						and $test = joindre_upload_error($file['error'])
 					) {
 						if (is_string($test)) {
@@ -213,7 +216,8 @@ function formulaires_joindre_document_verifier_dist(
 
 				// si ce n'est pas deja un post de zip confirme
 				// regarder si il faut lister le contenu du zip et le presenter
-				if (!count($erreurs)
+				if (
+					!count($erreurs)
 					and !_request('joindre_zip')
 					and $contenu_zip = joindre_verifier_zip($files)
 				) {
@@ -224,11 +228,11 @@ function formulaires_joindre_document_verifier_dist(
 						$erreurs['message_erreur'] = '';
 						$erreurs['lister_contenu_archive'] = recuperer_fond(
 							'formulaires/inc-lister_archive_jointe',
-							array(
+							[
 								'chemin_zip' => $token_zip,
 								'liste_fichiers_zip' => $fichiers,
 								'erreurs_fichier_zip' => $erreurs
-							)
+							]
 						);
 					} else {
 						$erreurs['message_erreur'] = _T('medias:erreur_aucun_fichier');
@@ -277,11 +281,11 @@ function formulaires_joindre_document_traiter_dist(
 	$proposer_media = true,
 	$proposer_ftp = true
 ) {
-	$res = array('editable' => true);
+	$res = ['editable' => true];
 	$ancre = '';
 	// on joint un document deja dans le site
 	if (_request('joindre_mediatheque')) {
-		$sel = array();
+		$sel = [];
 		$refdoc_joindre = _request('refdoc_joindre');
 		$refdoc_joindre = strtr($refdoc_joindre, ';,', '  ');
 		$refdoc_joindre = preg_replace(',\b(doc|document|img),', '', $refdoc_joindre);
@@ -294,7 +298,7 @@ function formulaires_joindre_document_traiter_dist(
 		foreach ($refdoc_joindre as $j) {
 			if ($j = intval(preg_replace(',^(doc|document|img),', '', $j))) {
 				// lier le parent en plus
-				$champs = array('ajout_parents' => array("$objet|$id_objet"));
+				$champs = ['ajout_parents' => ["$objet|$id_objet"]];
 				document_modifier($j, $champs);
 				if (!$ancre) {
 					$ancre = $j;
@@ -329,14 +333,14 @@ function formulaires_joindre_document_traiter_dist(
 		}
 
 		// checker les erreurs eventuelles
-		$messages_erreur = array();
-		$sel = array();
+		$messages_erreur = [];
+		$sel = [];
 		foreach ($nouveaux_doc as $doc) {
 			if (!is_numeric($doc)) {
 				$messages_erreur[] = $doc;
 			} // cas qui devrait etre traite en amont
 			elseif (!$doc) {
-				$messages_erreur[] = _T('medias:erreur_insertion_document_base', array('fichier' => '<em>???</em>'));
+				$messages_erreur[] = _T('medias:erreur_insertion_document_base', ['fichier' => '<em>???</em>']);
 			} else {
 				if (!$ancre) {
 					$ancre = $doc;
@@ -394,7 +398,7 @@ function formulaires_joindre_document_traiter_dist(
  */
 function joindre_options_upload_ftp($dir, $mode = 'document') {
 	$fichiers = preg_files($dir);
-	$exts = $dirs = $texte_upload = array();
+	$exts = $dirs = $texte_upload = [];
 
 	// en mode "charger une image", ne proposer que les inclus
 	$inclus = ($mode == 'image' or $mode == 'vignette')
@@ -425,7 +429,7 @@ function joindre_options_upload_ftp($dir, $mode = 'document') {
 				if (!in_array($ledossier, $dirs)) {
 					$texte_upload[] = "\n<option value=\"$ledossier\">"
 						. str_repeat('&nbsp;', $k)
-						. _T('medias:tout_dossier_upload', array('upload' => $ledossier))
+						. _T('medias:tout_dossier_upload', ['upload' => $ledossier])
 						. '</option>';
 					$dirs[] = $ledossier;
 				}
@@ -496,7 +500,7 @@ function joindre_liste_erreurs_to_li($erreurs) {
 	if (count($erreurs) > 4) {
 		$res = "<p style='cursor:pointer;' onclick='jQuery(this).siblings(\"ul\").toggle();return false;'>" . _T(
 			'medias:erreurs_voir',
-			array('nb' => count($erreurs))
+			['nb' => count($erreurs)]
 		) . '</p><ul class="spip none-js">' . $res . '</ul>';
 	} else {
 		$res = "<ul class=\"spip\">$res</ul>";
diff --git a/inc/choisir_mode_document.php b/inc/choisir_mode_document.php
index 1ba892bb95db59b3c8015c8494c8b918ce372afd..1cca1610a0e918966e16a6ad5177840f7b5c9873 100644
--- a/inc/choisir_mode_document.php
+++ b/inc/choisir_mode_document.php
@@ -57,7 +57,8 @@ function inc_choisir_mode_document($infos, $type_inclus_image, $objet) {
 		return 'image';
 	}
 
-	if ($infos['largeur'] > 0
+	if (
+		$infos['largeur'] > 0
 		and $infos['largeur'] < _LARGEUR_MODE_IMAGE
 	) {
 		return 'image';
diff --git a/inc/determiner_statut_document.php b/inc/determiner_statut_document.php
index e9676f7ba510a0cea8b1be828d444577e030ef79..8fc14b24325b540f595fd618bf746dd2ec79612a 100644
--- a/inc/determiner_statut_document.php
+++ b/inc/determiner_statut_document.php
@@ -42,7 +42,7 @@ function inc_determiner_statut_document($id_document, $statut_ancien, $date_publ
 	while ($row = sql_fetch($res)) {
 		if (
 			// si ce n'est pas un logo
-			!in_array($row['mode'], array('logoon','logooff'))
+			!in_array($row['mode'], ['logoon','logooff'])
 			and (
 				// cas particulier des rubriques qui sont publiees des qu'elles contiennent un document !
 				$row['objet'] == 'rubrique'
@@ -54,7 +54,8 @@ function inc_determiner_statut_document($id_document, $statut_ancien, $date_publ
 			$date_publication = 0;
 			continue;
 		} // si pas publie, et article, il faut checker la date de post-publi eventuelle
-		elseif ($row['objet'] == 'article'
+		elseif (
+			$row['objet'] == 'article'
 			and $row2 = sql_fetsel(
 				'date',
 				'spip_articles',
diff --git a/inc/documenter_objet.php b/inc/documenter_objet.php
index b9ce21feb0f783fc2227a53b7b5bbac214dfb2a0..e912344bb5e14c00e3115f7602b98d352002558d 100644
--- a/inc/documenter_objet.php
+++ b/inc/documenter_objet.php
@@ -44,7 +44,7 @@ function inc_documenter_objet_dist($id, $type) {
 	$marquer_doublons_doc = charger_fonction('marquer_doublons_doc', 'inc');
 	$marquer_doublons_doc($champs, $id, $type, $id_table_objet, $table_objet, $spip_table_objet, '', $serveur);
 
-	$contexte = array('objet' => $type, 'id_objet' => $id);
+	$contexte = ['objet' => $type, 'id_objet' => $id];
 
 	return recuperer_fond('prive/objets/contenu/portfolio_document', array_merge($_GET, $contexte));
 }
diff --git a/inc/documents.php b/inc/documents.php
index 2ba0644fbee914c1b27cd7749b744043c929883f..7f2a0b380a2843c35846375fcc30a929c4573863 100644
--- a/inc/documents.php
+++ b/inc/documents.php
@@ -131,7 +131,7 @@ function vignette_automatique($img, $doc, $lien, $x = 0, $y = 0, $align = '', $c
 			$img = $f($e, false);
 			$size = @spip_getimagesize($img);
 			$img = "<img src='$img' " . $size[3] . ' />';
-			$class .= " spip_document_icone";
+			$class .= ' spip_document_icone';
 		}
 	} else {
 		$size = @spip_getimagesize($img);
@@ -180,7 +180,8 @@ function vignette_automatique($img, $doc, $lien, $x = 0, $y = 0, $align = '', $c
  * @return string Chemin de l’image
  */
 function image_du_document($document, $connect = null) {
-	if ($e = $document['extension']
+	if (
+		$e = $document['extension']
 		and in_array($e, formats_image_acceptables())
 		and (!test_espace_prive() or $GLOBALS['meta']['creer_preview'] == 'oui')
 		and $document['fichier']
@@ -224,7 +225,7 @@ function affiche_raccourci_doc($doc, $id, $align = '', $short = false) {
 	$pipe = '';
 	if ($align) {
 		$pipe = "|$align";
-	} 
+	}
 
 	$model = "&lt;$doc$id$pipe&gt;";
 	$text = $model;
@@ -232,13 +233,13 @@ function affiche_raccourci_doc($doc, $id, $align = '', $short = false) {
 		$text = $align ? $align : $model;
 	}
 
-	$classes = "btn btn_link btn_mini";
+	$classes = 'btn btn_link btn_mini';
 	$classes = " class=\"$classes\"";
 
 	$styles = '';
 	if ($align && !$short) {
-		// a priori ne sert plus de toutes façons… 
-		$styles = "text-align: " . ($align ?: 'center') . ";";
+		// a priori ne sert plus de toutes façons…
+		$styles = 'text-align: ' . ($align ?: 'center') . ';';
 		$styles = " style=\"$styles\"";
 	}
 
@@ -247,6 +248,6 @@ function affiche_raccourci_doc($doc, $id, $align = '', $short = false) {
 
 	$title = attribut_html(_T('medias:inserer_raccourci'));
 	$title = " title=\"$title\"";
-	
+
 	return "\n<button{$classes}{$styles}{$js}{$title}>$text</button>\n";
 }
diff --git a/inc/getdocument.php b/inc/getdocument.php
index 3823c2a6aeb02f0216592ad151e442a99c99aeaf..47db1043b47d47866065cc0e3e6c29f5c9cb8841 100644
--- a/inc/getdocument.php
+++ b/inc/getdocument.php
@@ -49,7 +49,7 @@ function erreur_upload_trop_gros() {
 		. '<br />'
 		. _T(
 			'medias:upload_limit',
-			array('max' => ini_get('upload_max_filesize'))
+			['max' => ini_get('upload_max_filesize')]
 		)
 		. '</p>';
 
diff --git a/inc/joindre_document.php b/inc/joindre_document.php
index d38ea00fb4726432c2296249a7e606118eaec31b..72ac41ce26c8d03c640ae11f1e8f971f14a1f079 100644
--- a/inc/joindre_document.php
+++ b/inc/joindre_document.php
@@ -24,7 +24,7 @@ if (!defined('_ECRIRE_INC_VERSION')) {
  * @return string/array
  */
 function joindre_trouver_fichier_envoye() {
-	static $files = array();
+	static $files = [];
 	// on est appele deux fois dans un hit, resservir ce qu'on a trouve a la verif
 	// lorsqu'on est appelle au traitement
 
@@ -58,7 +58,7 @@ function joindre_trouver_fichier_envoye() {
 		}
 		include_spip('inc/distant');
 		if (!valider_url_distante($path)) {
-			return _T('medias:erreur_upload_type_interdit', array('nom' => $path));
+			return _T('medias:erreur_upload_type_interdit', ['nom' => $path]);
 		}
 		include_spip('action/ajouter_documents');
 		$infos = renseigner_source_distante($path);
@@ -66,13 +66,13 @@ function joindre_trouver_fichier_envoye() {
 			return $infos;
 		} // message d'erreur
 		else {
-			return array(
-				array(
+			return [
+				[
 					'name' => basename($path),
 					'tmp_name' => $path,
 					'distant' => true,
-				)
-			);
+				]
+			];
 		}
 	} elseif (_request('joindre_ftp')) {
 		$path = _request('cheminftp');
@@ -89,30 +89,32 @@ function joindre_trouver_fichier_envoye() {
 
 		if (!is_dir($upload)) {
 			// seul un fichier est demande
-			return array(
-				array(
+			return [
+				[
 					'name' => basename($upload),
 					'tmp_name' => $upload
-				)
-			);
+				]
+			];
 		} else {
 			// on upload tout un repertoire
-			$files = array();
+			$files = [];
 			foreach (preg_files($upload) as $fichier) {
-				$files[] = array(
+				$files[] = [
 					'name' => basename($fichier),
 					'tmp_name' => $fichier
-				);
+				];
 			}
 
 			return $files;
 		}
 	} elseif (_request('joindre_zip') and $token_zip = _request('chemin_zip')) {
 		$zip_to_clean = (isset($GLOBALS['visiteur_session']['zip_to_clean']) ?
-			unserialize($GLOBALS['visiteur_session']['zip_to_clean']) : array());
-		if (!$zip_to_clean
+			unserialize($GLOBALS['visiteur_session']['zip_to_clean']) : []);
+		if (
+			!$zip_to_clean
 			or !isset($zip_to_clean[$token_zip])
-			or !$path = $zip_to_clean[$token_zip]) {
+			or !$path = $zip_to_clean[$token_zip]
+		) {
 			return _T('avis_operation_impossible');
 		}
 
@@ -123,22 +125,22 @@ function joindre_trouver_fichier_envoye() {
 			return _T('avis_operation_impossible');
 		}
 
-		$files = array();
+		$files = [];
 		if (_request('options_upload_zip') == 'deballe') {
 			$files = joindre_deballer_lister_zip($path, _TMP_DIR);
 		}
 
 		// si le zip doit aussi etre conserve, l'ajouter
 		if (_request('options_upload_zip') == 'upload' or _request('options_deballe_zip_conserver')) {
-			$files[] = array(
+			$files[] = [
 				'name' => basename($path),
 				'tmp_name' => $path,
-			);
+			];
 		}
 		return $files;
 	}
 
-	return array();
+	return [];
 }
 
 /**
@@ -210,19 +212,19 @@ function joindre_upload_error($error) {
 		case 1: /* UPLOAD_ERR_INI_SIZE */
 			$msg = _T(
 				'medias:upload_limit',
-				array('max' => ini_get('upload_max_filesize'))
+				['max' => ini_get('upload_max_filesize')]
 			);
 			break;
 		case 2: /* UPLOAD_ERR_FORM_SIZE */
 			$msg = _T(
 				'medias:upload_limit',
-				array('max' => ini_get('upload_max_filesize'))
+				['max' => ini_get('upload_max_filesize')]
 			);
 			break;
 		case 3: /* UPLOAD_ERR_PARTIAL  */
 			$msg = _T(
 				'medias:upload_limit',
-				array('max' => ini_get('upload_max_filesize'))
+				['max' => ini_get('upload_max_filesize')]
 			);
 			break;
 		case 6: /* UPLOAD_ERR_NO_TMP_DIR  */
@@ -250,7 +252,8 @@ function joindre_upload_error($error) {
  * @return string
  */
 function joindre_verifier_zip($files) {
-	if (function_exists('gzopen')
+	if (
+		function_exists('gzopen')
 		and (count($files) == 1)
 		and !isset($files[0]['distant'])
 		and
@@ -270,7 +273,8 @@ function joindre_verifier_zip($files) {
 
 		// Est-ce qu'on sait le lire ?
 		include_spip('inc/archives');
-		if ($zip
+		if (
+			$zip
 			and $archive = new Spip\Archives\SpipArchives($zip)
 			and $infos = $archive->informer()
 			and $contenu = joindre_decrire_contenu_zip($infos)
@@ -278,7 +282,7 @@ function joindre_verifier_zip($files) {
 			and rename($zip, $tmp = $tmp . basename($zip))
 		) {
 			$zip_to_clean = (isset($GLOBALS['visiteur_session']['zip_to_clean']) ?
-				unserialize($GLOBALS['visiteur_session']['zip_to_clean']) : array());
+				unserialize($GLOBALS['visiteur_session']['zip_to_clean']) : []);
 			$zip_to_clean[md5($tmp)] = $tmp;
 			session_set('zip_to_clean', serialize($zip_to_clean));
 			$contenu[] = $tmp;
@@ -307,15 +311,15 @@ function joindre_decrire_contenu_zip($infos) {
 	}
 
 	// Verifier si le contenu peut etre uploade (verif extension)
-	$fichiers = array();
-	$erreurs = array();
+	$fichiers = [];
+	$erreurs = [];
 	foreach ($infos['fichiers'] as $file) {
 		if (accepte_fichier_upload($f = $file['filename'])) {
 			$fichiers[$f] = $file;
 		} else // pas de message pour les dossiers et fichiers caches
 		{
 			if (substr($f, -1) !== '/' and substr(basename($f), 0, 1) !== '.') {
-				$erreurs[] = _T('medias:erreur_upload_type_interdit', array('nom' => $f));
+				$erreurs[] = _T('medias:erreur_upload_type_interdit', ['nom' => $f]);
 			}
 		}
 	}
@@ -327,7 +331,7 @@ function joindre_decrire_contenu_zip($infos) {
 
 	ksort($fichiers);
 
-	return array($fichiers, $erreurs);
+	return [$fichiers, $erreurs];
 }
 
 
@@ -336,20 +340,22 @@ function joindre_deballer_lister_zip($path, $tmp_dir) {
 	include_spip('inc/archives');
 	$archive = new Spip\Archives\SpipArchives($path);
 
-	if ($infos = $archive->informer()
-	  and $contenu = joindre_decrire_contenu_zip($infos)) {
+	if (
+		$infos = $archive->informer()
+		and $contenu = joindre_decrire_contenu_zip($infos)
+	) {
 		$fichiers = reset($contenu);
 		$fichiers = array_column($fichiers, 'filename');
 		if ($archive->deballer($tmp_dir, $fichiers)) {
 			$files = [];
 			foreach ($fichiers as $fichier) {
 				$f = basename($fichier);
-				$files[] = array(
+				$files[] = [
 					'tmp_name' => $tmp_dir . $fichier,
 					'name' => $f,
 					'titrer' => _request('options_deballe_zip_titrer'),
 					'mode' => null
-				);
+				];
 			}
 			return $files;
 		}
@@ -371,7 +377,8 @@ if (!function_exists('fixer_extension_document')) {
 	function fixer_extension_document($doc) {
 		$extension = '';
 		$name = $doc['name'];
-		if (preg_match(',\.([^.]+)$,', $name, $r)
+		if (
+			preg_match(',\.([^.]+)$,', $name, $r)
 			and $t = sql_fetsel(
 				'extension',
 				'spip_types_documents',
@@ -387,7 +394,7 @@ if (!function_exists('fixer_extension_document')) {
 			}
 		}
 
-		return array($extension, $name);
+		return [$extension, $name];
 	}
 }
 
@@ -399,7 +406,8 @@ if (!function_exists('fixer_extension_document')) {
  * @return bool|int
  */
 function accepte_fichier_upload($f) {
-	if (!preg_match(',.*__MACOSX/,', $f)
+	if (
+		!preg_match(',.*__MACOSX/,', $f)
 		and !preg_match(',^\.,', basename($f))
 	) {
 		include_spip('action/ajouter_documents');
@@ -411,4 +419,3 @@ function accepte_fichier_upload($f) {
 		);
 	}
 }
-
diff --git a/inc/marquer_doublons_doc.php b/inc/marquer_doublons_doc.php
index 756606a65afc26fdbffd2fe2f39c27d03b7d80f0..f9a8f03b652ccc63af723572adee0529c2ad9198 100644
--- a/inc/marquer_doublons_doc.php
+++ b/inc/marquer_doublons_doc.php
@@ -66,7 +66,7 @@ function inc_marquer_doublons_doc_dist(
 	$id_table_objet,
 	$table_objet,
 	$spip_table_objet,
-	$desc = array(),
+	$desc = [],
 	$serveur = ''
 ) {
 
@@ -84,7 +84,7 @@ function inc_marquer_doublons_doc_dist(
 	// Il faut récupérer toutes les données qui impactent les liens de documents vus
 	// afin de savoir lesquels sont présents dans les textes, et pouvoir actualiser avec
 	// les liens actuellement enregistrés.
-	$absents = array();
+	$absents = [];
 
 	// Récupérer chaque champ impactant qui existe dans la table de l'objet et qui nous manque
 	foreach ($GLOBALS['medias_liste_champs'] as $champ) {
@@ -111,24 +111,24 @@ function inc_marquer_doublons_doc_dist(
 	$modeles = $modeles['modeles'];
 
 	// liste d'id_documents trouvés dans les textes
-	$GLOBALS['doublons_documents_inclus'] = array();
+	$GLOBALS['doublons_documents_inclus'] = [];
 
 	// detecter les doublons dans ces textes
-	traiter_modeles(implode(' ', $champs), array('documents' => $modeles), '', '', null, array(
+	traiter_modeles(implode(' ', $champs), ['documents' => $modeles], '', '', null, [
 		'objet' => $type,
 		'id_objet' => $id,
 		$id_table_objet => $id
-	));
+	]);
 
 	$texte_documents_vus = $GLOBALS['doublons_documents_inclus'];
 
 	// on ne modifie les liaisons que si c'est nécessaire
-	$bdd_documents_vus = array(
-		'oui' => array(),
-		'non' => array()
-	);
+	$bdd_documents_vus = [
+		'oui' => [],
+		'non' => []
+	];
 
-	$liaisons = objet_trouver_liens(array('document' => '*'), array($type => $id));
+	$liaisons = objet_trouver_liens(['document' => '*'], [$type => $id]);
 	foreach ($liaisons as $l) {
 		$bdd_documents_vus[$l['vu']][] = $l['id_document'];
 	}
@@ -145,12 +145,12 @@ function inc_marquer_doublons_doc_dist(
 		$ids = array_column($ids, 'id_document');
 		if ($ids) {
 			// Creer le lien s'il n'existe pas déjà
-			objet_associer(array('document' => $ids), array($type => $id), array('vu' => 'oui'));
-			objet_qualifier_liens(array('document' => $ids), array($type => $id), array('vu' => 'oui'));
+			objet_associer(['document' => $ids], [$type => $id], ['vu' => 'oui']);
+			objet_qualifier_liens(['document' => $ids], [$type => $id], ['vu' => 'oui']);
 		}
 	}
 
 	if ($anciens) {
-		objet_qualifier_liens(array('document' => $anciens), array($type => $id), array('vu' => 'non'));
+		objet_qualifier_liens(['document' => $anciens], [$type => $id], ['vu' => 'non']);
 	}
 }
diff --git a/inc/renseigner_document.php b/inc/renseigner_document.php
index 6c46726363cca67314883d0595ebb871194e3858..55eed2aabf1eb5134bf097e3f0dd8033ffbf77ad 100644
--- a/inc/renseigner_document.php
+++ b/inc/renseigner_document.php
@@ -45,7 +45,7 @@ if (!defined('_ECRIRE_INC_VERSION')) {
  *     - fichier : Chemin local du fichier s'il a été recopié
  */
 function renseigner_source_distante($source) {
-	static $infos = array();
+	static $infos = [];
 	if (isset($infos[$source])) {
 		return $infos[$source];
 	}
@@ -55,13 +55,13 @@ function renseigner_source_distante($source) {
 	// qui est capable de renseigner complete
 	// fichier et mode + tous les autres champs a son gout
 	// ex : oembed
-	$a = pipeline('renseigner_document_distant', array('source' => $source));
+	$a = pipeline('renseigner_document_distant', ['source' => $source]);
 
 	// si la source est encore la, en revenir a la
 	// methode traditionnelle : chargement de l'url puis analyse
 	if (!isset($a['fichier']) or !isset($a['mode'])) {
 		if (!$a = recuperer_infos_distantes($a['source'])) {
-			return _T('medias:erreur_chemin_distant', array('nom' => $source));
+			return _T('medias:erreur_chemin_distant', ['nom' => $source]);
 		}
 		# NB: dans les bonnes conditions (fichier autorise et pas trop gros)
 		# $a['fichier'] est une copie locale du fichier
@@ -103,12 +103,12 @@ function renseigner_source_distante($source) {
  */
 function renseigner_taille_dimension_image($fichier, $ext, $distant = false) {
 
-	$infos = array(
+	$infos = [
 		'largeur' => 0,
 		'hauteur' => 0,
 		'type_image' => '',
 		'taille' => 0
-	);
+	];
 
 	// Quelques infos sur le fichier
 	if (
@@ -122,22 +122,22 @@ function renseigner_taille_dimension_image($fichier, $ext, $distant = false) {
 
 			// recuperer un debut de fichier 512ko semblent suffire
 			$tmp = _DIR_TMP . md5($fichier);
-			$res = recuperer_url($fichier, array('file' => $tmp, 'taille_max' => 512 * 1024));
+			$res = recuperer_url($fichier, ['file' => $tmp, 'taille_max' => 512 * 1024]);
 			if (!$res) {
 				spip_log("Echec copie du fichier $fichier", 'medias');
 
-				return _T('medias:erreur_copie_fichier', array('nom' => $fichier));
+				return _T('medias:erreur_copie_fichier', ['nom' => $fichier]);
 			}
 			$fichier = $tmp;
 		} else {
 			spip_log("Echec copie du fichier $fichier", 'medias');
 
-			return _T('medias:erreur_copie_fichier', array('nom' => $fichier));
+			return _T('medias:erreur_copie_fichier', ['nom' => $fichier]);
 		}
 	}
 
 	// chercher une fonction de description
-	$meta = array();
+	$meta = [];
 	if ($metadata = charger_fonction($ext, 'metadata', true)) {
 		$meta = $metadata($fichier);
 	} else {
@@ -149,7 +149,7 @@ function renseigner_taille_dimension_image($fichier, $ext, $distant = false) {
 
 	$meta = pipeline(
 		'renseigner_document',
-		array('args' => array('extension' => $ext, 'fichier' => $fichier), 'data' => $meta)
+		['args' => ['extension' => $ext, 'fichier' => $fichier], 'data' => $meta]
 	);
 
 	include_spip('inc/filtres'); # pour objet_info()
@@ -172,12 +172,13 @@ function sanitizer_document($fichier, $ext) {
 	// verifier que le fichier existe, sinon on ne peut rien faire
 	if (
 		!$fichier
-		or !@file_exists($fichier)) {
+		or !@file_exists($fichier)
+	) {
 		return false;
 	}
-	if ($sanitizer = charger_fonction($ext, 'sanitizer', true)){
+	if ($sanitizer = charger_fonction($ext, 'sanitizer', true)) {
 		return $sanitizer($fichier);
 	}
 
 	return false;
-}
\ No newline at end of file
+}
diff --git a/inc/verifier_document_mode_image.php b/inc/verifier_document_mode_image.php
index 8573f775812c1334c354e6ed9c52c7ca45f19bce..00a82ed9bf13e1ce63d5f5a7af0f297abedf2543 100644
--- a/inc/verifier_document_mode_image.php
+++ b/inc/verifier_document_mode_image.php
@@ -1,4 +1,5 @@
 <?php
+
 /***************************************************************************\
  *  SPIP, Système de publication pour l'internet                           *
  *                                                                         *
@@ -17,12 +18,12 @@ function inc_verifier_document_mode_image_dist($infos) {
 
 	// Si on veut uploader une image, il faut qu'elle ait ete bien lue
 	if ($infos['inclus'] != 'image') {
-		return _T('medias:erreur_format_fichier_image', array('nom' => $infos['fichier']));
+		return _T('medias:erreur_format_fichier_image', ['nom' => $infos['fichier']]);
 	}
 
 	if (isset($infos['largeur']) and isset($infos['hauteur'])) {
 		if (!($infos['largeur'] or $infos['hauteur'])) {
-			return _T('medias:erreur_upload_vignette', array('nom' => $infos['fichier']));
+			return _T('medias:erreur_upload_vignette', ['nom' => $infos['fichier']]);
 		}
 	}
 
diff --git a/inc/verifier_document_mode_vignette.php b/inc/verifier_document_mode_vignette.php
index aceaa10e3eec98702a35a2fac7bdd6c311525e19..29c188747cf9cbf726ede8087c4691c53399e170 100644
--- a/inc/verifier_document_mode_vignette.php
+++ b/inc/verifier_document_mode_vignette.php
@@ -1,4 +1,5 @@
 <?php
+
 /***************************************************************************\
  *  SPIP, Système de publication pour l'internet                           *
  *                                                                         *
@@ -17,12 +18,12 @@ function inc_verifier_document_mode_vignette_dist($infos) {
 
 	// Si on veut uploader une vignette, il faut qu'elle ait ete bien lue
 	if ($infos['inclus'] != 'image') {
-		return _T('medias:erreur_format_fichier_image', array('nom' => $infos['fichier']));
+		return _T('medias:erreur_format_fichier_image', ['nom' => $infos['fichier']]);
 	}
 
 	if (isset($infos['largeur']) and isset($infos['hauteur'])) {
 		if (!($infos['largeur'] or $infos['hauteur'])) {
-			return _T('medias:erreur_upload_vignette', array('nom' => $infos['fichier']));
+			return _T('medias:erreur_upload_vignette', ['nom' => $infos['fichier']]);
 		}
 	}
 
diff --git a/inc/verifier_taille_document_acceptable.php b/inc/verifier_taille_document_acceptable.php
index ee015039bcb82172c5834035cc0c2eac35ccb1f7..70f80f19339b547b69e45ffe0f5b9621f816c340 100644
--- a/inc/verifier_taille_document_acceptable.php
+++ b/inc/verifier_taille_document_acceptable.php
@@ -1,4 +1,5 @@
 <?php
+
 /***************************************************************************\
  *  SPIP, Système de publication pour l'internet                           *
  *                                                                         *
@@ -56,7 +57,7 @@ function inc_verifier_taille_document_acceptable_dist(&$infos, $is_logo = false)
 			return $res;
 		}
 
-		if ($is_logo){
+		if ($is_logo) {
 			$max_size = (defined('_IMG_MAX_SIZE') and _IMG_MAX_SIZE) ? _IMG_MAX_SIZE : null;
 		}
 		else {
@@ -84,7 +85,8 @@ function inc_verifier_taille_document_acceptable_dist(&$infos, $is_logo = false)
  */
 function medias_verifier_largeur_hauteur_image(&$infos, $max_width = null, $max_height = null, $min_width = null, $min_height = null) {
 
-	if (($max_width and $infos['largeur'] > $max_width)
+	if (
+		($max_width and $infos['largeur'] > $max_width)
 		or ($max_height and $infos['hauteur'] > $max_height)
 	) {
 		// pas la peine d'embeter le redacteur avec ca si on a active le calcul des miniatures
@@ -104,63 +106,65 @@ function medias_verifier_largeur_hauteur_image(&$infos, $max_width = null, $max_
 			}
 		}
 
-		if (($max_width and $infos['largeur'] > $max_width)
+		if (
+			($max_width and $infos['largeur'] > $max_width)
 			or ($max_height and $infos['hauteur'] > $max_height)
 		) {
 			return _T(
 				'medias:info_image_max_taille',
-				array(
+				[
 					'maxi' =>
 						_T(
 							'info_largeur_vignette',
-							array(
+							[
 								'largeur_vignette' => $max_width,
 								'hauteur_vignette' => $max_height
-							)
+							]
 						),
 					'actuel' =>
 						_T(
 							'info_largeur_vignette',
-							array(
+							[
 								'largeur_vignette' => $infos['largeur'],
 								'hauteur_vignette' => $infos['hauteur']
-							)
+							]
 						)
-				)
+				]
 			);
 		}
 	}
 
-	if (($min_width and $infos['largeur'] < $min_width)
+	if (
+		($min_width and $infos['largeur'] < $min_width)
 		or ($min_height and $infos['hauteur'] < $min_height)
 	) {
-		if ($min_width and $max_width and $min_width>$max_width){
+		if ($min_width and $max_width and $min_width > $max_width) {
 			spip_log('Constantes invalides détectées, modifiez votre fichier de configuration (_IMG_MIN_WIDTH > _IMG_MAX_WIDTH)', 'medias' . _LOG_INFO_IMPORTANTE);
 		}
-		if ($min_height and $max_height and $min_height>$max_height){
+		if ($min_height and $max_height and $min_height > $max_height) {
 			spip_log('Constantes invalides détectées, modifiez votre fichier de configuration (_IMG_MIN_HEIGHT > _IMG_MAX_HEIGHT)', 'medias' . _LOG_INFO_IMPORTANTE);
 		}
 
 		return _T(
 			'medias:info_image_min_taille',
-			array(
+			[
 				'mini' =>
 					_T(
 						'info_largeur_vignette',
-						array(
+						[
 							'largeur_vignette' => $min_width,
 							'hauteur_vignette' => $min_height
-						)
+						]
 					),
 				'actuel' =>
 					_T(
 						'info_largeur_vignette',
-						array(
+						[
 							'largeur_vignette' => $infos['largeur'],
 							'hauteur_vignette' => $infos['hauteur']
-						)
+						]
 					)
-			)
+			]
 		);
 	}
 
@@ -178,10 +182,10 @@ function medias_verifier_poids_fichier($infos, $max_size = null, $is_image = fal
 	if ($max_size and $infos['taille'] > $max_size * 1024) {
 		return _T(
 			$is_image ? 'medias:info_image_max_poids' : 'medias:info_doc_max_poids',
-			array(
+			[
 				'maxi' => taille_en_octets($max_size * 1024),
 				'actuel' => taille_en_octets($infos['taille'])
-			)
+			]
 		);
 	}
 
diff --git a/inc/vignette.php b/inc/vignette.php
index 1c616baa3b22d75f1f5547f73364ea67911d3166..de9abe88c4a2367ee09912e56456b868b4284c94 100644
--- a/inc/vignette.php
+++ b/inc/vignette.php
@@ -1,4 +1,5 @@
 <?php
+
 /***************************************************************************\
  *  SPIP, Système de publication pour l'internet                           *
  *                                                                         *
@@ -48,7 +49,7 @@ function inc_vignette_dist($ext, $size = true, $loop = true) {
 	// dans les vignettes persos, ou dans les vignettes standard
 	if (
 		# installation dans un dossier /vignettes personnel, par exemple /squelettes/vignettes
-	!$v = find_in_path('prive/vignettes/' . $ext . '.svg')
+		!$v = find_in_path('prive/vignettes/' . $ext . '.svg')
 	) {
 		if ($loop) {
 			$f = charger_fonction('vignette', 'inc');
@@ -68,5 +69,5 @@ function inc_vignette_dist($ext, $size = true, $loop = true) {
 		$hauteur = $size[1];
 	}
 
-	return array($v, $largeur, $hauteur);
+	return [$v, $largeur, $hauteur];
 }
diff --git a/medias_administrations.php b/medias_administrations.php
index 2a471e9290f4ab38c86ec1b7d078d8d649ac59e8..8ddcac23c4710a7de5289d3ca9ede02408588d92 100644
--- a/medias_administrations.php
+++ b/medias_administrations.php
@@ -62,7 +62,8 @@ function medias_upgrade($nom_meta_base_version, $version_cible) {
 	// cas typique d'un upgrade qui commence par suppression de connect.php
 	// SPIP lance la maj des plugins lors de la connexion, alors que l'upgrade SPIP
 	// a pas encore ete joue : ca casse cet upgrade quand on migre depuis un tres vieux SPIP
-	if (isset($GLOBALS['meta']['version_installee'])
+	if (
+		isset($GLOBALS['meta']['version_installee'])
 		and ($GLOBALS['spip_version_base'] != (str_replace(',', '.', $GLOBALS['meta']['version_installee'])))
 	) {
 		return;
@@ -70,165 +71,165 @@ function medias_upgrade($nom_meta_base_version, $version_cible) {
 
 	if (!isset($GLOBALS['meta'][$nom_meta_base_version])) {
 		$trouver_table = charger_fonction('trouver_table', 'base');
-		if ($desc = $trouver_table('spip_documents')
+		if (
+			$desc = $trouver_table('spip_documents')
 			and !isset($desc['field']['statut'])
 		) {
 			ecrire_meta($nom_meta_base_version, '0.1.0');
 		}
 	}
 
-	$maj = array();
-	$maj['create'] = array(
-		array('maj_tables', array('spip_documents', 'spip_documents_liens', 'spip_types_documents')),
-		array('creer_base_types_doc')
-	);
-	$maj['0.2.0'] = array(
-		array('sql_alter', "TABLE spip_documents ADD statut varchar(10) DEFAULT '0' NOT NULL"),
-	);
-	$maj['0.3.0'] = array(
-		array('sql_alter', "TABLE spip_documents ADD date_publication datetime DEFAULT '0000-00-00 00:00:00' NOT NULL"),
-	);
-	$maj['0.4.0'] = array(
+	$maj = [];
+	$maj['create'] = [
+		['maj_tables', ['spip_documents', 'spip_documents_liens', 'spip_types_documents']],
+		['creer_base_types_doc']
+	];
+	$maj['0.2.0'] = [
+		['sql_alter', "TABLE spip_documents ADD statut varchar(10) DEFAULT '0' NOT NULL"],
+	];
+	$maj['0.3.0'] = [
+		['sql_alter', "TABLE spip_documents ADD date_publication datetime DEFAULT '0000-00-00 00:00:00' NOT NULL"],
+	];
+	$maj['0.4.0'] = [
 		// recalculer tous les statuts en tenant compte de la date de publi des articles...
-		array('medias_check_statuts', true),
-	);
-	$maj['0.5.0'] = array(
-		array('sql_alter', 'TABLE spip_documents ADD brise tinyint DEFAULT 0'),
-	);
-	$maj['0.6.0'] = array(
-		array('sql_alter', "TABLE spip_types_documents ADD media varchar(10) DEFAULT 'file' NOT NULL"),
-		array('creer_base_types_doc', '', 'media'),
-	);
-	$maj['0.7.0'] = array(
-		array('sql_alter', "TABLE spip_documents ADD credits varchar(255) DEFAULT '' NOT NULL"),
-	);
-	$maj['0.10.0'] = array(
-		array('sql_alter', "TABLE spip_documents CHANGE fichier fichier TEXT NOT NULL DEFAULT ''"),
-	);
-	$maj['0.11.0'] = array(
-		array('sql_alter', "TABLE spip_documents CHANGE mode mode varchar(10) DEFAULT 'document' NOT NULL"),
-	);
-	$maj['0.14.0'] = array(
-		array('medias_maj_meta_documents'),
-		array('creer_base_types_doc', '', 'media'),
-	);
-	$maj['0.15.0'] = array(
-		array('creer_base_types_doc', '', 'media'),
-	);
-	$maj['0.15.1'] = array(
-		array('sql_alter', 'TABLE spip_documents CHANGE taille taille bigint'),
-	);
-	$maj['0.16.0'] = array(
-		array('creer_base_types_doc', '', 'media'),
-	);
+		['medias_check_statuts', true],
+	];
+	$maj['0.5.0'] = [
+		['sql_alter', 'TABLE spip_documents ADD brise tinyint DEFAULT 0'],
+	];
+	$maj['0.6.0'] = [
+		['sql_alter', "TABLE spip_types_documents ADD media varchar(10) DEFAULT 'file' NOT NULL"],
+		['creer_base_types_doc', '', 'media'],
+	];
+	$maj['0.7.0'] = [
+		['sql_alter', "TABLE spip_documents ADD credits varchar(255) DEFAULT '' NOT NULL"],
+	];
+	$maj['0.10.0'] = [
+		['sql_alter', "TABLE spip_documents CHANGE fichier fichier TEXT NOT NULL DEFAULT ''"],
+	];
+	$maj['0.11.0'] = [
+		['sql_alter', "TABLE spip_documents CHANGE mode mode varchar(10) DEFAULT 'document' NOT NULL"],
+	];
+	$maj['0.14.0'] = [
+		['medias_maj_meta_documents'],
+		['creer_base_types_doc', '', 'media'],
+	];
+	$maj['0.15.0'] = [
+		['creer_base_types_doc', '', 'media'],
+	];
+	$maj['0.15.1'] = [
+		['sql_alter', 'TABLE spip_documents CHANGE taille taille bigint'],
+	];
+	$maj['0.16.0'] = [
+		['creer_base_types_doc', '', 'media'],
+	];
 
-	$maj['1.0.0'] = array(
+	$maj['1.0.0'] = [
 		// on cree le champ en defaut '?' pour reperer les nouveaux a peupler
-		array('sql_alter', "TABLE spip_documents ADD media varchar(10) DEFAULT '?' NOT NULL"),
-		array('medias_peuple_media_document', 'media'),
+		['sql_alter', "TABLE spip_documents ADD media varchar(10) DEFAULT '?' NOT NULL"],
+		['medias_peuple_media_document', 'media'],
 		// puis on retablit le bon defaut
-		array('sql_alter', "TABLE spip_documents CHANGE media media varchar(10) DEFAULT 'file' NOT NULL"),
-	);
-	$maj['1.0.1'] = array(
+		['sql_alter', "TABLE spip_documents CHANGE media media varchar(10) DEFAULT 'file' NOT NULL"],
+	];
+	$maj['1.0.1'] = [
 		// puis on retablit le bon defaut
-		array('sql_alter', "TABLE spip_types_documents CHANGE media media_defaut varchar(10) DEFAULT 'file' NOT NULL"),
-	);
+		['sql_alter', "TABLE spip_types_documents CHANGE media media_defaut varchar(10) DEFAULT 'file' NOT NULL"],
+	];
 
-	$maj['1.1.0'] = array(
-		array('sql_alter', 'TABLE spip_documents_liens ADD INDEX id_objet (id_objet)'),
-		array('sql_alter', 'TABLE spip_documents_liens ADD INDEX objet (objet)'),
-	);
-	$maj['1.1.1'] = array(
-		array('creer_base_types_doc'),
-	);
+	$maj['1.1.0'] = [
+		['sql_alter', 'TABLE spip_documents_liens ADD INDEX id_objet (id_objet)'],
+		['sql_alter', 'TABLE spip_documents_liens ADD INDEX objet (objet)'],
+	];
+	$maj['1.1.1'] = [
+		['creer_base_types_doc'],
+	];
 	// reparer les media sur les file suite a upgrade rate depuis SPIP 2.x
-	$maj['1.2.0'] = array(
+	$maj['1.2.0'] = [
 		// on remet en ? tous les media=file
-		array('sql_updateq', 'spip_documents', array('media' => '?'), "media='file'"),
+		['sql_updateq', 'spip_documents', ['media' => '?'], "media='file'"],
 		// et on repeuple
-		array('medias_peuple_media_document'),
-	);
-	$maj['1.2.1'] = array(
-		array('creer_base_types_doc'),
-	);
-	$maj['1.2.3'] = array(
+		['medias_peuple_media_document'],
+	];
+	$maj['1.2.1'] = [
+		['creer_base_types_doc'],
+	];
+	$maj['1.2.3'] = [
 		// ajout de mbtiles
-		array('creer_base_types_doc'),
+		['creer_base_types_doc'],
 		// reparer les clauses DEFAULT manquantes de maniere reccurente sur cette table
-		array('sql_alter', "TABLE spip_documents CHANGE extension extension VARCHAR(10) DEFAULT '' NOT NULL"),
-		array('sql_alter', "TABLE spip_documents CHANGE credits credits varchar(255) DEFAULT '' NOT NULL"),
-		array('sql_alter', "TABLE spip_documents CHANGE statut statut varchar(10) DEFAULT '0' NOT NULL"),
-	);
-	$maj['1.2.4'] = array(
+		['sql_alter', "TABLE spip_documents CHANGE extension extension VARCHAR(10) DEFAULT '' NOT NULL"],
+		['sql_alter', "TABLE spip_documents CHANGE credits credits varchar(255) DEFAULT '' NOT NULL"],
+		['sql_alter', "TABLE spip_documents CHANGE statut statut varchar(10) DEFAULT '0' NOT NULL"],
+	];
+	$maj['1.2.4'] = [
 		// ajout de tar
-		array('creer_base_types_doc')
-	);
-	$maj['1.2.5'] = array(
+		['creer_base_types_doc']
+	];
+	$maj['1.2.5'] = [
 		// ajout de json
-		array('creer_base_types_doc')
-	);
-	$maj['1.2.6'] = array(
+		['creer_base_types_doc']
+	];
+	$maj['1.2.6'] = [
 		// ajout de md (markdown)
-		array('creer_base_types_doc')
-	);
-	$maj['1.2.7'] = array(
+		['creer_base_types_doc']
+	];
+	$maj['1.2.7'] = [
 		// ajout de ics + vcf
-		array('creer_base_types_doc')
-	);
-	$maj['1.3.0'] = array(
+		['creer_base_types_doc']
+	];
+	$maj['1.3.0'] = [
 		// ajout de rang_lien
-		array('maj_tables', 'spip_documents_liens'),
-	);
-	$maj['1.3.1'] = array(
+		['maj_tables', 'spip_documents_liens'],
+	];
+	$maj['1.3.1'] = [
 		// plus de place dans les crédits
-		array('sql_alter', "TABLE spip_documents CHANGE credits credits text DEFAULT '' NOT NULL"),
-	);
-	$maj['1.3.2'] = array(
+		['sql_alter', "TABLE spip_documents CHANGE credits credits text DEFAULT '' NOT NULL"],
+	];
+	$maj['1.3.2'] = [
 		// buggons en 2038 plutôt qu'en 2018'
-		array('medias_check_statuts', true),
-	);
-	$maj['1.3.4'] = array(
+		['medias_check_statuts', true],
+	];
+	$maj['1.3.4'] = [
 		// 1.3.2 et 1.3.3 n'étaient pas suffisants grml'
-		array('medias_maj_date_publication_documents'),
-		array('medias_check_statuts', true)
-	);
-	$maj['1.3.5'] = array(
+		['medias_maj_date_publication_documents'],
+		['medias_check_statuts', true]
+	];
+	$maj['1.3.5'] = [
 		// ajout de duree
-		array('maj_tables', 'spip_documents'),
-	);
-	$maj['1.3.6'] = array(
+		['maj_tables', 'spip_documents'],
+	];
+	$maj['1.3.6'] = [
 		// ajout de vtt
-		array('creer_base_types_doc')
-	);
+		['creer_base_types_doc']
+	];
 
-	$maj['1.4.0'] = array(
+	$maj['1.4.0'] = [
 		// update de SVG
-		array('creer_base_types_doc')
-	);
+		['creer_base_types_doc']
+	];
 
-	$maj['1.5.0'] = array(
+	$maj['1.5.0'] = [
 		// ajout de webp
-		array('creer_base_types_doc'),
-	);
-	
+		['creer_base_types_doc'],
+	];
+
 
 	// upgrade des logos
 	$maj['1.6.0'] = [];
 	$tables_objets_sql = lister_tables_objets_sql();
-	foreach(array_keys($tables_objets_sql) as $table) {
+	foreach (array_keys($tables_objets_sql) as $table) {
 		$maj['1.6.0'][] = ['medias_upgrade_logo_objet', objet_type($table)];
 	};
 
 
-	$maj['1.7.0'] = array(
+	$maj['1.7.0'] = [
 		// ajout de alt
-		array('maj_tables', 'spip_documents'),
-	);
+		['maj_tables', 'spip_documents'],
+	];
 
 	include_spip('base/upgrade');
 	include_spip('base/medias');
 	maj_plugin($nom_meta_base_version, $version_cible, $maj);
-
 }
 
 /**
@@ -246,7 +247,7 @@ function medias_upgrade_logo_objet($objet) {
  * Maj des meta documents
  */
 function medias_maj_meta_documents() {
-	$config = array();
+	$config = [];
 	if (isset($GLOBALS['meta']['documents_article']) and $GLOBALS['meta']['documents_article'] !== 'non') {
 		$config[] = 'spip_articles';
 	}
@@ -261,7 +262,7 @@ function medias_peuple_media_document($champ_media = 'media_defaut') {
 	while ($row = sql_fetch($res)) {
 		// attention ici c'est encore le champ media, car on le renomme juste apres
 		$media = sql_getfetsel($champ_media, 'spip_types_documents', 'extension=' . sql_quote($row['extension']));
-		sql_updateq('spip_documents', array('media' => $media), 'media=' . sql_quote('?') . ' AND extension=' . sql_quote($row['extension']));
+		sql_updateq('spip_documents', ['media' => $media], 'media=' . sql_quote('?') . ' AND extension=' . sql_quote($row['extension']));
 		if (time() >= _TIME_OUT) {
 			return;
 		}
@@ -272,8 +273,8 @@ function medias_peuple_media_document($champ_media = 'media_defaut') {
  * Maj des date de publication des documents cf ticket #3329, z104221
  */
 function medias_maj_date_publication_documents() {
-	sql_update('spip_documents', array('statut' => '0'), 'date_publication > ' . sql_quote('2017-01-01 00:00:00'));
-	sql_update('spip_documents', array('statut' => '0'), 'date_publication = ' . sql_quote('1970-01-01 01:33:58'));
+	sql_update('spip_documents', ['statut' => '0'], 'date_publication > ' . sql_quote('2017-01-01 00:00:00'));
+	sql_update('spip_documents', ['statut' => '0'], 'date_publication = ' . sql_quote('1970-01-01 01:33:58'));
 }
 
 /*
diff --git a/medias_autoriser.php b/medias_autoriser.php
index 577036fed0eeaffa7547134869c045a1af7f809a..e6064ceee36be945e44d0105dc4435dcf5d9e5a3 100644
--- a/medias_autoriser.php
+++ b/medias_autoriser.php
@@ -81,7 +81,8 @@ function autoriser_document_tailler_dist($faire, $type, $id, $qui, $options) {
 
 	// (on ne le propose pas pour les images qu'on sait
 	// lire : gif jpg png), sauf bug, ou document distant
-	if (in_array($document['extension'], array('gif', 'jpg', 'png'))
+	if (
+		in_array($document['extension'], ['gif', 'jpg', 'png'])
 		and $document['hauteur']
 		and $document['largeur']
 		and $document['distant'] != 'oui'
@@ -93,7 +94,8 @@ function autoriser_document_tailler_dist($faire, $type, $id, $qui, $options) {
 	$extension = $document['extension'];
 	$type_inclus = sql_getfetsel('inclus', 'spip_types_documents', 'extension=' . sql_quote($extension));
 
-	if (($type_inclus == 'embed' or $type_inclus == 'image')
+	if (
+		($type_inclus == 'embed' or $type_inclus == 'image')
 		and (
 			// documents dont la taille est definie
 			($document['largeur'] * $document['hauteur'])
@@ -156,7 +158,7 @@ function autoriser_joindredocument_dist($faire, $type, $id, $qui, $opt) {
  * @return bool          true s'il a le droit, false sinon
  */
 function autoriser_document_modifier_dist($faire, $type, $id, $qui, $opt) {
-	static $m = array();
+	static $m = [];
 
 	$q = $qui['id_auteur'];
 	if (isset($m[$q][$id])) {
@@ -165,7 +167,8 @@ function autoriser_document_modifier_dist($faire, $type, $id, $qui, $opt) {
 
 	$s = sql_getfetsel('statut', 'spip_documents', 'id_document=' . intval($id));
 	// les admins ont le droit de modifier tous les documents existants
-	if ($qui['statut'] == '0minirezo'
+	if (
+		$qui['statut'] == '0minirezo'
 		and !$qui['restreint']
 	) {
 		return is_string($s) ? true : false;
@@ -210,7 +213,8 @@ function autoriser_document_modifier_dist($faire, $type, $id, $qui, $opt) {
  * @return bool          true s'il a le droit, false sinon
  */
 function autoriser_document_supprimer_dist($faire, $type, $id, $qui, $opt) {
-	if (!intval($id)
+	if (
+		!intval($id)
 		or !$qui['id_auteur']
 		or !autoriser('ecrire', '', '', $qui)
 	) {
@@ -230,11 +234,13 @@ function autoriser_document_supprimer_dist($faire, $type, $id, $qui, $opt) {
 		return !$id_document or autoriser('modifier', 'document', $id_document);
 	}
 	// si c'est un document annexe, se ramener a l'autorisation de son parent
-	if ($id_document = sql_getfetsel(
-		'id_objet',
-		'spip_documents_liens',
-		"objet='document' AND id_document=" . intval($id)
-	)) {
+	if (
+		$id_document = sql_getfetsel(
+			'id_objet',
+			'spip_documents_liens',
+			"objet='document' AND id_document=" . intval($id)
+		)
+	) {
 		return autoriser('modifier', 'document', $id_document);
 	}
 
@@ -264,7 +270,8 @@ function autoriser_document_supprimer_dist($faire, $type, $id, $qui, $opt) {
  **/
 function autoriser_document_voir_dist($faire, $type, $id, $qui, $opt) {
 
-	if (!isset($GLOBALS['meta']['creer_htaccess'])
+	if (
+		!isset($GLOBALS['meta']['creer_htaccess'])
 		or $GLOBALS['meta']['creer_htaccess'] != 'oui'
 	) {
 		return true;
@@ -274,7 +281,7 @@ function autoriser_document_voir_dist($faire, $type, $id, $qui, $opt) {
 		return false;
 	}
 
-	if (in_array($qui['statut'], array('0minirezo', '1comite'))) {
+	if (in_array($qui['statut'], ['0minirezo', '1comite'])) {
 		return 'htaccess';
 	}
 
@@ -282,13 +289,15 @@ function autoriser_document_voir_dist($faire, $type, $id, $qui, $opt) {
 		foreach ($liens as $l) {
 			$table_sql = table_objet_sql($l['objet']);
 			$id_table = id_table_objet($l['objet']);
-			if (sql_countsel(
-				$table_sql,
-				"$id_table = " . intval($l['id_objet'])
-					. (in_array($l['objet'], array('article', 'rubrique', 'breve'))
+			if (
+				sql_countsel(
+					$table_sql,
+					"$id_table = " . intval($l['id_objet'])
+					. (in_array($l['objet'], ['article', 'rubrique', 'breve'])
 					? " AND statut = 'publie'"
 					: '')
-			) > 0) {
+				) > 0
+			) {
 				return 'htaccess';
 			}
 		}
@@ -327,7 +336,8 @@ function autoriser_autoassocierdocument_dist($faire, $type, $id, $qui, $opt) {
  * @return bool          true s'il a le droit, false sinon
  */
 function autoriser_orphelins_supprimer_dist($faire, $type, $id, $qui, $opt) {
-	if ($qui['statut'] == '0minirezo'
+	if (
+		$qui['statut'] == '0minirezo'
 		and !$qui['restreint']
 	) {
 		return true;
diff --git a/medias_fonctions.php b/medias_fonctions.php
index 34dbe1266fc3fe0bfefab33fd7052d2bb433c909..6941834acdf7e50e14a0b8e3778c9e24487da18f 100644
--- a/medias_fonctions.php
+++ b/medias_fonctions.php
@@ -23,7 +23,8 @@ if (!defined('_ECRIRE_INC_VERSION')) {
 }
 
 // nettoyer les zip abandonnes par l'utilisateur
-if (isset($GLOBALS['visiteur_session']['zip_to_clean'])
+if (
+	isset($GLOBALS['visiteur_session']['zip_to_clean'])
 	and test_espace_prive()
 	and isset($_SERVER['REQUEST_METHOD'])
 	and $_SERVER['REQUEST_METHOD'] !== 'POST'
@@ -41,7 +42,8 @@ if (isset($GLOBALS['visiteur_session']['zip_to_clean'])
 
 // capturer un formulaire POST plus grand que post_max_size
 // on genere un minipres car on ne peut rien faire de mieux
-if (isset($_SERVER['REQUEST_METHOD'])
+if (
+	isset($_SERVER['REQUEST_METHOD'])
 	and $_SERVER['REQUEST_METHOD'] == 'POST'
 	and empty($_POST)
 	and isset($_SERVER['CONTENT_TYPE'])
@@ -50,7 +52,7 @@ if (isset($_SERVER['REQUEST_METHOD'])
 	and $_SERVER['CONTENT_LENGTH'] > medias_inigetoctets('post_max_size')
 ) {
 	include_spip('inc/minipres');
-	echo minipres(_T('medias:upload_limit', array('max' => ini_get('post_max_size'))));
+	echo minipres(_T('medias:upload_limit', ['max' => ini_get('post_max_size')]));
 	exit;
 }
 
@@ -65,12 +67,12 @@ function medias_modeles_styliser($modele, $id) {
 	if (defined('_COMPORTEMENT_HISTORIQUE_IMG_DOC_EMB') and _COMPORTEMENT_HISTORIQUE_IMG_DOC_EMB) {
 		return $modele;
 	}
-	switch($modele) {
+	switch ($modele) {
 		case 'img':
 		case 'doc':
 		case 'emb':
 			$m = 'file';
-			if ($doc = sql_fetsel('id_document,media', 'spip_documents', 'id_document='.intval($id))) {
+			if ($doc = sql_fetsel('id_document,media', 'spip_documents', 'id_document=' . intval($id))) {
 				$m = $doc['media']; // image, audio, video, file
 			}
 			if (trouve_modele("{$m}_{$modele}")) {
@@ -167,19 +169,20 @@ function boucle_DOCUMENTS($id_boucle, &$boucles) {
 
 	// on ne veut pas des fichiers de taille nulle,
 	// sauf s'ils sont distants (taille inconnue)
-	array_unshift($boucle->where, array("'($id_table.taille > 0 OR $id_table.distant=\\'oui\\')'"));
+	array_unshift($boucle->where, ["'($id_table.taille > 0 OR $id_table.distant=\\'oui\\')'"]);
 
 	/**
 	 * N'afficher que les modes de documents que l'on accepte
 	 * Utiliser le "pipeline medias_documents_visibles" pour en ajouter
 	 */
-	if (!isset($boucle->modificateur['criteres']['mode'])
+	if (
+		!isset($boucle->modificateur['criteres']['mode'])
 		and !isset($boucle->modificateur['tout'])
 	) {
-		$modes = pipeline('medias_documents_visibles', array('image', 'document'));
+		$modes = pipeline('medias_documents_visibles', ['image', 'document']);
 		$f = sql_serveur('quote', $boucle->sql_serveur, true);
 		$modes = addslashes(join(',', array_map($f, array_unique($modes))));
-		array_unshift($boucle->where, array("'IN'", "'$id_table.mode'", "'($modes)'"));
+		array_unshift($boucle->where, ["'IN'", "'$id_table.mode'", "'($modes)'"]);
 	}
 
 	return calculer_boucle($id_boucle, $boucles);
@@ -312,55 +315,56 @@ function medias_lister_methodes_upload($env) {
 		$env = unserialize($env);
 	}
 
-	$methodes = array();
+	$methodes = [];
 	// méthodes d'upload disponibles
-	$methodes = array();
-	$methodes['upload'] = array('label_lien'=>_T('medias:bouton_download_local'),'label_bouton'=>_T('bouton_upload'));
+	$methodes = [];
+	$methodes['upload'] = ['label_lien' => _T('medias:bouton_download_local'),'label_bouton' => _T('bouton_upload')];
 
-	if((isset($env['mediatheque']) and $env['mediatheque'])){
-		$methodes['mediatheque'] = array('label_lien'=>_T('medias:bouton_download_par_mediatheque'),'label_bouton'=>_T('medias:bouton_attacher_document'));
+	if ((isset($env['mediatheque']) and $env['mediatheque'])) {
+		$methodes['mediatheque'] = ['label_lien' => _T('medias:bouton_download_par_mediatheque'),'label_bouton' => _T('medias:bouton_attacher_document')];
 	}
-	
-	if((isset($env['proposer_ftp']) and $env['proposer_ftp'])){
-		$methodes['ftp'] = array('label_lien'=>_T('medias:bouton_download_par_ftp'),'label_bouton'=>_T('bouton_choisir'));
+
+	if ((isset($env['proposer_ftp']) and $env['proposer_ftp'])) {
+		$methodes['ftp'] = ['label_lien' => _T('medias:bouton_download_par_ftp'),'label_bouton' => _T('bouton_choisir')];
 	}
-	$methodes['distant'] = array('label_lien'=>_T('medias:bouton_download_sur_le_web'),'label_bouton'=>_T('bouton_choisir'));
+	$methodes['distant'] = ['label_lien' => _T('medias:bouton_download_sur_le_web'),'label_bouton' => _T('bouton_choisir')];
 
 	// pipeline pour les méthodes d'upload
 	$objet = isset($env['objet']) ? $env['objet'] : '';
 	$id_objet = isset($env['id_objet']) ? $env['id_objet'] : '';
 
-	$methodes = pipeline('medias_methodes_upload',
-		array(
-			'args' => array('objet' => $objet, 'id_objet' => $id_objet),
+	$methodes = pipeline(
+		'medias_methodes_upload',
+		[
+			'args' => ['objet' => $objet, 'id_objet' => $id_objet],
 			'data' => $methodes
-		)
+		]
 	);
 
 	return $methodes;
 }
 
 function duree_en_secondes($duree, $precis = false) {
-	$out = "";
+	$out = '';
 	$heures = $minutes = 0;
-	if ($duree>3600) {
-		$heures = intval(floor($duree/3600));
+	if ($duree > 3600) {
+		$heures = intval(floor($duree / 3600));
 		$duree -= $heures * 3600;
 	}
-	if ($duree>60) {
-		$minutes = intval(floor($duree/60));
+	if ($duree > 60) {
+		$minutes = intval(floor($duree / 60));
 		$duree -= $minutes * 60;
 	}
 
-	if ($heures>0 or $minutes>0) {
-		$out = _T('date_fmt_heures_minutes', array('h' => $heures, 'm' => $minutes));
+	if ($heures > 0 or $minutes > 0) {
+		$out = _T('date_fmt_heures_minutes', ['h' => $heures, 'm' => $minutes]);
 		if (!$heures) {
 			$out = preg_replace(',^0[^\d]+,Uims', '', $out);
 		}
 	}
 
 	if (!$heures or $precis) {
-		$out .= intval($duree).'s';
+		$out .= intval($duree) . 's';
 	}
 	return $out;
 }
@@ -390,7 +394,7 @@ function duree_en_secondes($duree, $precis = false) {
  * @param string $mime_type
  * @return string
  */
-function medias_trouver_modele_emb($extension, $mime_type, $modele_base='file') {
+function medias_trouver_modele_emb($extension, $mime_type, $modele_base = 'file') {
 	if ($extension and trouve_modele($fond = $modele_base . '_emb_' . $extension)) {
 		return $fond;
 	}
@@ -415,7 +419,7 @@ function medias_trouver_modele_emb($extension, $mime_type, $modele_base='file')
  * @note
  *     le nomage au pluriel est historique.
  *     préférer au singulier pour toute nouvelle classe.
- * 
+ *
  * @param int $id_document
  * @param string $media
  * @param array $env
@@ -439,12 +443,12 @@ function filtre_medias_modele_document_standard_classes_dist($Pile, $id_document
 		$classes[] = 'spip_document_center';
 	}
 	if (!empty($var['legende'])) {
-		$classes[] = "spip_document_avec_legende";
+		$classes[] = 'spip_document_avec_legende';
 	}
 	if (!empty($env['class'])) {
 		$classes[] = $env['class'];
 	}
-	return implode(" ", $classes);
+	return implode(' ', $classes);
 }
 
 
@@ -464,14 +468,14 @@ function filtre_medias_modele_document_standard_attributs_dist($Pile, $id_docume
 	if (!empty($var['legende'])) {
 		$len = spip_strlen(textebrut($var['legende']));
 		// des x. "x" = 32 caratères, "xx" => 64, "xxx" => 128, etc...
-		$lenx = medias_str_repeat_log($len, 2, "x", 4);
+		$lenx = medias_str_repeat_log($len, 2, 'x', 4);
 		$attrs['data-legende-len'] = $len;
 		$attrs['data-legende-lenx'] = $lenx;
 	}
 
-	$res = "";
-	foreach($attrs as $attr => $value) {
-		$res .= "$attr=\"" . attribut_html($value) . "\""; 
+	$res = '';
+	foreach ($attrs as $attr => $value) {
+		$res .= "$attr=\"" . attribut_html($value) . '"';
 	};
 	return $res;
 }
@@ -481,54 +485,54 @@ function filtre_medias_modele_document_standard_attributs_dist($Pile, $id_docume
  * Retourne une chaine répétée d'autant de fois le logarithme
  *
  * @example medias_str_repeat_log(124, 2)
- * 
+ *
  *     Avec $base = 2 et $remove = 0
- * 
- *     0 => 
+ *
+ *     0 =>
  *     2 => x
  *     4 => xx
  *     8 => xxx
  *     16 => xxxx
  *     32 => xxxxx
  *     64 => xxxxxx
- * 
+ *
  * @example medias_str_repeat_log(124, 2, "x", 4)
- * 
+ *
  *     Avec $base = 2 et $remove = 4
- * 
- *     0 => 
- *     2 => 
- *     4 => 
- *     8 => 
- *     16 => 
+ *
+ *     0 =>
+ *     2 =>
+ *     4 =>
+ *     8 =>
+ *     16 =>
  *     32 => x
  *     64 => xx
- * 
- * @note 
+ *
+ * @note
  *     L'inverse (nb caractères => valeur) est donc `pow($base, $nb_char)`
- * 
+ *
  *     En partant du nombre de "x" on retrouve la fourchette du nombre de départ.
  *     Si $base = 2 et $remove = 4 :
- * 
+ *
  *    - "xxx" = 2 ^ (strlen("xxx") + 4) = 2 ^ (3 + 4) = 128
  *    - "xxxxx" = 2 ^ (5 + 4) = 512
- 
+
  *     x = 32,
  *     xx = 64
  *     xxx = 128
  *     xxxx = 256
- *     xxxxx = 512 
+ *     xxxxx = 512
  *     ...
- * 
+ *
  *     Ce qui veut dire que "xxx" provient d'une valeur entre 128 et 255.
- * 
+ *
  * @note
  *     C'est surtout utile pour une sélection en CSS (car CSS ne permet pas de sélecteur "lower than" ou "greater than") :
- * 
+ *
  *    ```spip
  *    <div class='demo' data-demo-lenx='[(#TEXTE|textebrut|spip_strlen|medias_str_repeat_log{2,x,4})]'>...</div>`
  *    ```
- * 
+ *
  *    ```css
  *    .demo[data-demo-lenx^="xxxx"] {
  *       // le contenu fait au moins 256 caractères
@@ -537,15 +541,15 @@ function filtre_medias_modele_document_standard_attributs_dist($Pile, $id_docume
  *       // le contenu fait au moins 256 caractères
  *    }
  *    ```
- * 
- * @param float $num 
+ *
+ * @param float $num
  * @param float $log
  * @param string $pad_string
  * @param int $remove : Nombre de caractères à enlever.
- * 
+ *
  * @return string Des x
  */
-function medias_str_repeat_log($num, $base = 2, $string = "x", $remove = 0) {
+function medias_str_repeat_log($num, $base = 2, $string = 'x', $remove = 0) {
 	$pad = str_repeat($string, (int)log($num, $base));
 	return substr($pad, $remove);
 }
diff --git a/medias_pipelines.php b/medias_pipelines.php
index 3c2704b2f06adf5c417ce95061f16377725a8c64..a706202ecc8105b749dbed8bbdd974476080f058 100644
--- a/medias_pipelines.php
+++ b/medias_pipelines.php
@@ -33,7 +33,8 @@ if (!defined('_ECRIRE_INC_VERSION')) {
  *     Nom du squelette par défaut qui sera utilisé
  **/
 function medias_detecter_fond_par_defaut($fond) {
-	if (empty($_GET) and empty($_POST) and empty($_FILES)
+	if (
+		empty($_GET) and empty($_POST) and empty($_FILES)
 		and isset($_SERVER['CONTENT_LENGTH'])
 		and isset($_SERVER['CONTENT_TYPE'])
 		and strstr($_SERVER['CONTENT_TYPE'], 'multipart/form-data;')
@@ -75,12 +76,12 @@ function medias_post_insertion($flux) {
 
 		# utiliser l'api editer_lien pour les appels aux pipeline edition_lien
 		include_spip('action/editer_liens');
-		$liens = objet_trouver_liens(array('document' => '*'), array($objet => 0 - $id_auteur));
+		$liens = objet_trouver_liens(['document' => '*'], [$objet => 0 - $id_auteur]);
 		foreach ($liens as $lien) {
-			objet_associer(array('document' => $lien['document']), array($objet => $id_objet), $lien);
+			objet_associer(['document' => $lien['document']], [$objet => $id_objet], $lien);
 		}
 		// un simple delete pour supprimer les liens temporaires
-		sql_delete('spip_documents_liens', array('id_objet = ' . (0 - $id_auteur), 'objet=' . sql_quote($objet)));
+		sql_delete('spip_documents_liens', ['id_objet = ' . (0 - $id_auteur), 'objet=' . sql_quote($objet)]);
 	}
 
 	return $flux;
@@ -97,7 +98,7 @@ function medias_affiche_milieu($flux) {
 	if ($flux['args']['exec'] == 'configurer_contenu') {
 		$flux['data'] .= recuperer_fond(
 			'prive/squelettes/inclure/configurer',
-			array('configurer' => 'configurer_documents')
+			['configurer' => 'configurer_documents']
 		);
 	}
 
@@ -146,8 +147,16 @@ function medias_post_edition($flux) {
 			$table_objet = isset($flux['args']['table_objet']) ?
 				$flux['args']['table_objet'] : table_objet($flux['args']['table'], $serveur);
 			$marquer_doublons_doc = charger_fonction('marquer_doublons_doc', 'inc');
-			$marquer_doublons_doc($flux['data'], $flux['args']['id_objet'], $type, id_table_objet($type, $serveur),
-				$table_objet, $flux['args']['table'], '', $serveur);
+			$marquer_doublons_doc(
+				$flux['data'],
+				$flux['args']['id_objet'],
+				$type,
+				id_table_objet($type, $serveur),
+				$table_objet,
+				$flux['args']['table'],
+				'',
+				$serveur
+			);
 		}
 
 		if (($flux['args']['action'] and $flux['args']['action'] == 'instituer') or isset($flux['data']['statut'])) {
@@ -167,9 +176,16 @@ function medias_post_edition($flux) {
 		if (isset($flux['args']['table']) and $flux['args']['table'] !== 'spip_documents') {
 			// verifier les doublons !
 			$marquer_doublons_doc = charger_fonction('marquer_doublons_doc', 'inc');
-			$marquer_doublons_doc($flux['data'], $flux['args']['id_objet'], $flux['args']['type'],
-				id_table_objet($flux['args']['type'], $serveur), $flux['args']['table_objet'],
-				$flux['args']['spip_table_objet'], '', $serveur);
+			$marquer_doublons_doc(
+				$flux['data'],
+				$flux['args']['id_objet'],
+				$flux['args']['type'],
+				id_table_objet($flux['args']['type'], $serveur),
+				$flux['args']['table_objet'],
+				$flux['args']['spip_table_objet'],
+				'',
+				$serveur
+			);
 		}
 	}
 
@@ -186,7 +202,8 @@ function medias_post_edition($flux) {
  * @return array
  */
 function medias_afficher_complement_objet($flux) {
-	if ($type = $flux['args']['type']
+	if (
+		$type = $flux['args']['type']
 		and $id = intval($flux['args']['id'])
 	) {
 		include_spip('inc/config');
@@ -221,7 +238,8 @@ function medias_afficher_complement_objet($flux) {
  *     Données du pipeline
  */
 function medias_affiche_gauche($flux) {
-	if ($en_cours = trouver_objet_exec($flux['args']['exec'])
+	if (
+		$en_cours = trouver_objet_exec($flux['args']['exec'])
 		and $en_cours['edition'] !== false // page edition uniquement
 		and $type = $en_cours['type']
 		and $id_table_objet = $en_cours['id_table_objet']
@@ -233,7 +251,7 @@ function medias_affiche_gauche($flux) {
 	) {
 		$flux['data'] .= recuperer_fond(
 			'prive/objets/editer/colonne_document',
-			array('objet' => $type, 'id_objet' => $id)
+			['objet' => $type, 'id_objet' => $id]
 		);
 	}
 
@@ -304,7 +322,8 @@ function medias_renseigner_document_distant($flux) {
  * @return array
  */
 function medias_objet_compte_enfants($flux) {
-	if ($objet = $flux['args']['objet']
+	if (
+		$objet = $flux['args']['objet']
 		and $id = intval($flux['args']['id_objet'])
 	) {
 		// juste les publies ?
@@ -332,7 +351,8 @@ function medias_objet_compte_enfants($flux) {
  * @return array
  */
 function medias_boite_infos($flux) {
-	if ($flux['args']['type'] == 'rubrique'
+	if (
+		$flux['args']['type'] == 'rubrique'
 		and $id_rubrique = $flux['args']['id']
 	) {
 		if ($nb = sql_countsel('spip_documents_liens', "objet='rubrique' AND id_objet=" . intval($id_rubrique))) {
@@ -357,14 +377,14 @@ function medias_boite_infos($flux) {
  * @return array      Données du pipeline
  **/
 function medias_revisions_chercher_label($flux) {
-	foreach (array('id_vignette', 'hauteur', 'largeur', 'mode', 'taille') as $champ) {
+	foreach (['id_vignette', 'hauteur', 'largeur', 'mode', 'taille'] as $champ) {
 		if ($flux['args']['champ'] == $champ) {
 			$flux['data'] = 'medias:info_' . $champ;
 
 			return $flux;
 		}
 	}
-	foreach (array('fichier', 'taille', 'mode', 'credits') as $champ) {
+	foreach (['fichier', 'taille', 'mode', 'credits'] as $champ) {
 		if ($flux['args']['champ'] == $champ) {
 			$flux['data'] = 'medias:label_' . $champ;
 
@@ -387,21 +407,24 @@ function medias_revisions_chercher_label($flux) {
  */
 function medias_calculer_rubriques($flux) {
 	$r = sql_select(
-		"R.id_rubrique AS id, max(D.date) AS date_h",
-		["spip_rubriques AS R", "spip_documents_liens AS DL", "spip_documents AS D"],
+		'R.id_rubrique AS id, max(D.date) AS date_h',
+		['spip_rubriques AS R', 'spip_documents_liens AS DL', 'spip_documents AS D'],
 		[
-			"R.id_rubrique = DL.id_objet",
+			'R.id_rubrique = DL.id_objet',
 			"DL.objet = 'rubrique'",
-			"D.id_document = DL.id_document",
+			'D.id_document = DL.id_document',
 			"D.statut = 'publie'",
-			"D.date > R.date_tmp",
-			sql_in("D.mode", ['image', 'document'])
+			'D.date > R.date_tmp',
+			sql_in('D.mode', ['image', 'document'])
 		],
-		"R.id_rubrique"
+		'R.id_rubrique'
 	);
 	while ($row = sql_fetch($r)) {
-		sql_updateq('spip_rubriques', array('statut_tmp' => 'publie', 'date_tmp' => $row['date_h']),
-			"id_rubrique=" . $row['id']);
+		sql_updateq(
+			'spip_rubriques',
+			['statut_tmp' => 'publie', 'date_tmp' => $row['date_h']],
+			'id_rubrique=' . $row['id']
+		);
 	}
 	return $flux;
-}
\ No newline at end of file
+}
diff --git a/metadata/audio.php b/metadata/audio.php
index f0a94f1095ee43ce1b73fe352d798a95681b048e..d9bb12f37e79b6ee4318a9c1ce1beb9a3bfe3428 100644
--- a/metadata/audio.php
+++ b/metadata/audio.php
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * GetID3
  * Gestion des métadonnées de fichiers sonores et vidéos directement dans SPIP
@@ -24,25 +25,25 @@ if (!defined('_ECRIRE_INC_VERSION')) {
  *    Le tableau comprenant les différentes metas à mettre en base
  */
 function metadata_audio($file) {
-	$meta = array();
+	$meta = [];
 
 	include_spip('lib/getid3/getid3');
-	$getID3 = new getID3;
-	$getID3->setOption(array('tempdir' => _DIR_TMP));
+	$getID3 = new getID3();
+	$getID3->setOption(['tempdir' => _DIR_TMP]);
 
 	// Scan file - should parse correctly if file is not corrupted
 	$file_info = $getID3->analyze($file);
 
 	if (isset($file_info['id3v2']['comments']['title'])) {
-		$meta['titre'] = ucfirst(trim(implode(' ',$file_info['id3v2']['comments']['title'])));
+		$meta['titre'] = ucfirst(trim(implode(' ', $file_info['id3v2']['comments']['title'])));
 	}
 	if (isset($file_info['id3v2']['comments']['artist'])) {
-		$meta['credits'] = implode(', ',$file_info['id3v2']['comments']['artist']);
+		$meta['credits'] = implode(', ', $file_info['id3v2']['comments']['artist']);
 		if (isset($file_info['id3v2']['comments']['album'])) {
-			$meta['credits'] .= '/'.trim(implode(' ',$file_info['id3v2']['comments']['album']));
+			$meta['credits'] .= '/' . trim(implode(' ', $file_info['id3v2']['comments']['album']));
 		}
 		if (isset($file_info['id3v2']['comments']['year'])) {
-			$meta['credits'] .= ' ('.trim(implode(' ',$file_info['id3v2']['comments']['year'])).')';
+			$meta['credits'] .= ' (' . trim(implode(' ', $file_info['id3v2']['comments']['year'])) . ')';
 		}
 	}
 	if (isset($file_info['playtime_seconds'])) {
diff --git a/metadata/html.php b/metadata/html.php
index 1a0cc1c881be43edbc6fd04d8d76497978d2f36a..c56ff17191ef68250cbbb378e75348ef61fe234c 100644
--- a/metadata/html.php
+++ b/metadata/html.php
@@ -23,11 +23,12 @@ include_spip('inc/autoriser');
  * @return array
  */
 function medata_html_dist($file) {
-	$meta = array();
+	$meta = [];
 
 	// Securite si pas autorise : virer les scripts et les references externes
 	// sauf si on est en mode javascript 'ok' (1), cf. inc_version
-	if ($GLOBALS['filtrer_javascript'] < 1
+	if (
+		$GLOBALS['filtrer_javascript'] < 1
 		and !autoriser('televerser', 'script')
 	) {
 		$texte = spip_file_get_contents($file);
diff --git a/metadata/image.php b/metadata/image.php
index 521a606ccc1258f0f3d989d04b5f4b4d608f018b..29d8b5617034a80b29131c54b8c9a990b9f82059 100644
--- a/metadata/image.php
+++ b/metadata/image.php
@@ -15,7 +15,7 @@ if (!defined('_ECRIRE_INC_VERSION')) {
 }
 
 function metadata_image_dist($fichier) {
-	$meta = array();
+	$meta = [];
 
 	if ($size_image = @spip_getimagesize($fichier)) {
 		$meta['largeur'] = intval($size_image[0]);
diff --git a/metadata/video.php b/metadata/video.php
index c59ad863c6c3199f3d73707ff088df080be54d20..0f7339a06f6229eec38fb296c4132fc64618725f 100644
--- a/metadata/video.php
+++ b/metadata/video.php
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * GetID3
  * Gestion des métadonnées de fichiers sonores et vidéos directement dans SPIP
@@ -24,11 +25,11 @@ if (!defined('_ECRIRE_INC_VERSION')) {
  *    Le tableau comprenant les différentes metas à mettre en base
  */
 function metadata_video($file) {
-	$meta = array();
+	$meta = [];
 
 	include_spip('lib/getid3/getid3');
-	$getID3 = new getID3;
-	$getID3->setOption(array('tempdir' => _DIR_TMP));
+	$getID3 = new getID3();
+	$getID3->setOption(['tempdir' => _DIR_TMP]);
 
 	// Scan file - should parse correctly if file is not corrupted
 	$file_info = $getID3->analyze($file);
diff --git a/modeles/document_case_fonctions.php b/modeles/document_case_fonctions.php
index d7618a4e14ce3ea3032f1915abeefb4d86c420f0..ec9b1894237bc28c7c38af7abdc1b79e95fc142c 100644
--- a/modeles/document_case_fonctions.php
+++ b/modeles/document_case_fonctions.php
@@ -1,4 +1,5 @@
 <?php
+
 /***************************************************************************\
  *  SPIP, Système de publication pour l'internet                           *
  *                                                                         *
@@ -56,10 +57,11 @@ function medias_raccourcis_doc(
 		// Affichage du raccourci <doc...> correspondant
 		$raccourci = medias_raccourcis_doc_groupe($doc, $id_document);
 
-		if ($mode == 'document'
+		if (
+			$mode == 'document'
 			and ($inclus == 'embed' or $inclus == 'image')
 			and (($largeur > 0 and $hauteur > 0)
-				or in_array($media, array('video', 'audio')))
+				or in_array($media, ['video', 'audio']))
 		) {
 			$raccourci =
 				'<span class="raccourcis_group_label">' . _T('medias:info_inclusion_vignette') . '</span>'
@@ -73,11 +75,11 @@ function medias_raccourcis_doc(
 }
 
 
-function medias_raccourcis_doc_groupe($doc, $id_document) : string {
+function medias_raccourcis_doc_groupe($doc, $id_document): string {
 	$raccourci =
 		affiche_raccourci_doc($doc, $id_document, '')
 		. affiche_raccourci_doc($doc, $id_document, 'left', true)
 		. affiche_raccourci_doc($doc, $id_document, 'center', true)
 		. affiche_raccourci_doc($doc, $id_document, 'right', true);
 	return "<div class='groupe-btns'>$raccourci</div>";
-}
\ No newline at end of file
+}
diff --git a/modeles/document_desc_fonctions.php b/modeles/document_desc_fonctions.php
index 12261248378717d645368f3ded882628ee0e3cef..97a7055661f9cd85b894230dc6a1270e71344bbe 100644
--- a/modeles/document_desc_fonctions.php
+++ b/modeles/document_desc_fonctions.php
@@ -1,4 +1,5 @@
 <?php
+
 /***************************************************************************\
  *  SPIP, Système de publication pour l'internet                           *
  *                                                                         *
diff --git a/phpcs.xml.dist b/phpcs.xml.dist
new file mode 100644
index 0000000000000000000000000000000000000000..d75d301a1679dec7517b60c515092b744edfaf16
--- /dev/null
+++ b/phpcs.xml.dist
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<ruleset>
+    <file>.</file>
+    <exclude-pattern>vendor/*</exclude-pattern>
+    <exclude-pattern>lang/*</exclude-pattern>
+    <exclude-pattern>lib/*</exclude-pattern>
+
+    <rule ref="SPIP41"/>
+
+    <config name="ignore_warnings_on_exit" value="1"/>
+    <arg name="cache" value=".php_cs.cache"/>
+    <arg name="report-full" value=".php_cs.txt"/>
+    <arg name="report-summary"/>
+    <arg value="s"/>
+</ruleset>
diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
new file mode 100644
index 0000000000000000000000000000000000000000..8f86970a0a7b4bd87edd5cbd2cce8f095c0d4022
--- /dev/null
+++ b/phpstan-baseline.neon
@@ -0,0 +1,1992 @@
+parameters:
+	ignoreErrors:
+		-
+			message: "#^Function _T not found\\.$#"
+			count: 2
+			path: action/acceder_document.php
+
+		-
+			message: "#^Function _request not found\\.$#"
+			count: 3
+			path: action/acceder_document.php
+
+		-
+			message: "#^Function get_spip_doc not found\\.$#"
+			count: 1
+			path: action/acceder_document.php
+
+		-
+			message: "#^Function http_status not found\\.$#"
+			count: 2
+			path: action/acceder_document.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 5
+			path: action/acceder_document.php
+
+		-
+			message: "#^Function minipres not found\\.$#"
+			count: 2
+			path: action/acceder_document.php
+
+		-
+			message: "#^Function set_spip_doc not found\\.$#"
+			count: 1
+			path: action/acceder_document.php
+
+		-
+			message: "#^Function spip_log not found\\.$#"
+			count: 1
+			path: action/acceder_document.php
+
+		-
+			message: "#^Function sql_fetsel not found\\.$#"
+			count: 1
+			path: action/acceder_document.php
+
+		-
+			message: "#^Function sql_quote not found\\.$#"
+			count: 1
+			path: action/acceder_document.php
+
+		-
+			message: "#^Function verifier_cle_action not found\\.$#"
+			count: 1
+			path: action/acceder_document.php
+
+		-
+			message: "#^Function _T not found\\.$#"
+			count: 6
+			path: action/ajouter_documents.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 6
+			path: action/ajouter_documents.php
+
+		-
+			message: "#^Function copie_locale not found\\.$#"
+			count: 1
+			path: action/ajouter_documents.php
+
+		-
+			message: "#^Function copier_document not found\\.$#"
+			count: 3
+			path: action/ajouter_documents.php
+
+		-
+			message: "#^Function deplacer_fichier_upload not found\\.$#"
+			count: 1
+			path: action/ajouter_documents.php
+
+		-
+			message: "#^Function effacer_repertoire_temporaire not found\\.$#"
+			count: 1
+			path: action/ajouter_documents.php
+
+		-
+			message: "#^Function get_spip_doc not found\\.$#"
+			count: 4
+			path: action/ajouter_documents.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 10
+			path: action/ajouter_documents.php
+
+		-
+			message: "#^Function pipeline not found\\.$#"
+			count: 1
+			path: action/ajouter_documents.php
+
+		-
+			message: "#^Function set_spip_doc not found\\.$#"
+			count: 1
+			path: action/ajouter_documents.php
+
+		-
+			message: "#^Function spip_log not found\\.$#"
+			count: 11
+			path: action/ajouter_documents.php
+
+		-
+			message: "#^Function spip_unlink not found\\.$#"
+			count: 5
+			path: action/ajouter_documents.php
+
+		-
+			message: "#^Function sql_fetsel not found\\.$#"
+			count: 2
+			path: action/ajouter_documents.php
+
+		-
+			message: "#^Function sql_getfetsel not found\\.$#"
+			count: 1
+			path: action/ajouter_documents.php
+
+		-
+			message: "#^Function sql_quote not found\\.$#"
+			count: 2
+			path: action/ajouter_documents.php
+
+		-
+			message: "#^Function supprimer_fichier not found\\.$#"
+			count: 1
+			path: action/ajouter_documents.php
+
+		-
+			message: "#^Function tester_url_absolue not found\\.$#"
+			count: 1
+			path: action/ajouter_documents.php
+
+		-
+			message: "#^Function translitteration not found\\.$#"
+			count: 2
+			path: action/ajouter_documents.php
+
+		-
+			message: "#^Instantiated class Spip\\\\Archives\\\\SpipArchives not found\\.$#"
+			count: 1
+			path: action/ajouter_documents.php
+
+		-
+			message: "#^Function autoriser not found\\.$#"
+			count: 1
+			path: action/changer_mode_document.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 1
+			path: action/changer_mode_document.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 2
+			path: action/changer_mode_document.php
+
+		-
+			message: "#^Function spip_log not found\\.$#"
+			count: 1
+			path: action/changer_mode_document.php
+
+		-
+			message: "#^Function _T not found\\.$#"
+			count: 1
+			path: action/copier_local.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 2
+			path: action/copier_local.php
+
+		-
+			message: "#^Function copie_locale not found\\.$#"
+			count: 1
+			path: action/copier_local.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 2
+			path: action/copier_local.php
+
+		-
+			message: "#^Function spip_log not found\\.$#"
+			count: 4
+			path: action/copier_local.php
+
+		-
+			message: "#^Function spip_unlink not found\\.$#"
+			count: 1
+			path: action/copier_local.php
+
+		-
+			message: "#^Function sql_fetsel not found\\.$#"
+			count: 1
+			path: action/copier_local.php
+
+		-
+			message: "#^Function tester_url_absolue not found\\.$#"
+			count: 2
+			path: action/copier_local.php
+
+		-
+			message: "#^Function autoriser not found\\.$#"
+			count: 1
+			path: action/desordonner_liens_documents.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 1
+			path: action/desordonner_liens_documents.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 1
+			path: action/desordonner_liens_documents.php
+
+		-
+			message: "#^Function objet_qualifier_liens not found\\.$#"
+			count: 1
+			path: action/desordonner_liens_documents.php
+
+		-
+			message: "#^Function spip_log not found\\.$#"
+			count: 1
+			path: action/desordonner_liens_documents.php
+
+		-
+			message: "#^Function sql_fetch not found\\.$#"
+			count: 1
+			path: action/desordonner_liens_documents.php
+
+		-
+			message: "#^Function sql_in not found\\.$#"
+			count: 1
+			path: action/desordonner_liens_documents.php
+
+		-
+			message: "#^Function sql_quote not found\\.$#"
+			count: 2
+			path: action/desordonner_liens_documents.php
+
+		-
+			message: "#^Function sql_select not found\\.$#"
+			count: 1
+			path: action/desordonner_liens_documents.php
+
+		-
+			message: "#^Function autoriser not found\\.$#"
+			count: 1
+			path: action/dissocier_document.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 3
+			path: action/dissocier_document.php
+
+		-
+			message: "#^Function depublier_branche_rubrique_if not found\\.$#"
+			count: 1
+			path: action/dissocier_document.php
+
+		-
+			message: "#^Function id_table_objet not found\\.$#"
+			count: 1
+			path: action/dissocier_document.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 4
+			path: action/dissocier_document.php
+
+		-
+			message: "#^Function objet_dissocier not found\\.$#"
+			count: 1
+			path: action/dissocier_document.php
+
+		-
+			message: "#^Function pipeline not found\\.$#"
+			count: 1
+			path: action/dissocier_document.php
+
+		-
+			message: "#^Function spip_log not found\\.$#"
+			count: 1
+			path: action/dissocier_document.php
+
+		-
+			message: "#^Function sql_countsel not found\\.$#"
+			count: 1
+			path: action/dissocier_document.php
+
+		-
+			message: "#^Function sql_fetch not found\\.$#"
+			count: 1
+			path: action/dissocier_document.php
+
+		-
+			message: "#^Function sql_fetsel not found\\.$#"
+			count: 1
+			path: action/dissocier_document.php
+
+		-
+			message: "#^Function sql_in not found\\.$#"
+			count: 1
+			path: action/dissocier_document.php
+
+		-
+			message: "#^Function sql_quote not found\\.$#"
+			count: 2
+			path: action/dissocier_document.php
+
+		-
+			message: "#^Function sql_select not found\\.$#"
+			count: 1
+			path: action/dissocier_document.php
+
+		-
+			message: "#^Function sql_updateq not found\\.$#"
+			count: 1
+			path: action/dissocier_document.php
+
+		-
+			message: "#^Function suivre_invalideur not found\\.$#"
+			count: 1
+			path: action/dissocier_document.php
+
+		-
+			message: "#^Function supprimer_lien_document\\(\\) should return bool but return statement is missing\\.$#"
+			count: 1
+			path: action/dissocier_document.php
+
+		-
+			message: "#^Function table_objet not found\\.$#"
+			count: 1
+			path: action/dissocier_document.php
+
+		-
+			message: "#^Function table_objet_sql not found\\.$#"
+			count: 1
+			path: action/dissocier_document.php
+
+		-
+			message: "#^Function autoriser not found\\.$#"
+			count: 2
+			path: action/editer_document.php
+
+		-
+			message: "#^Function calculer_rubriques_if not found\\.$#"
+			count: 1
+			path: action/editer_document.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 2
+			path: action/editer_document.php
+
+		-
+			message: "#^Function collecter_requests not found\\.$#"
+			count: 2
+			path: action/editer_document.php
+
+		-
+			message: "#^Function get_spip_doc not found\\.$#"
+			count: 1
+			path: action/editer_document.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 7
+			path: action/editer_document.php
+
+		-
+			message: "#^Function objet_associer not found\\.$#"
+			count: 1
+			path: action/editer_document.php
+
+		-
+			message: "#^Function objet_dissocier not found\\.$#"
+			count: 1
+			path: action/editer_document.php
+
+		-
+			message: "#^Function objet_info not found\\.$#"
+			count: 1
+			path: action/editer_document.php
+
+		-
+			message: "#^Function objet_modifier_champs not found\\.$#"
+			count: 1
+			path: action/editer_document.php
+
+		-
+			message: "#^Function objet_trouver_liens not found\\.$#"
+			count: 1
+			path: action/editer_document.php
+
+		-
+			message: "#^Function pipeline not found\\.$#"
+			count: 4
+			path: action/editer_document.php
+
+		-
+			message: "#^Function spip_unlink not found\\.$#"
+			count: 1
+			path: action/editer_document.php
+
+		-
+			message: "#^Function sql_allfetsel not found\\.$#"
+			count: 1
+			path: action/editer_document.php
+
+		-
+			message: "#^Function sql_fetsel not found\\.$#"
+			count: 1
+			path: action/editer_document.php
+
+		-
+			message: "#^Function sql_getfetsel not found\\.$#"
+			count: 2
+			path: action/editer_document.php
+
+		-
+			message: "#^Function sql_insertq not found\\.$#"
+			count: 1
+			path: action/editer_document.php
+
+		-
+			message: "#^Function sql_updateq not found\\.$#"
+			count: 1
+			path: action/editer_document.php
+
+		-
+			message: "#^Function suivre_invalideur not found\\.$#"
+			count: 2
+			path: action/editer_document.php
+
+		-
+			message: "#^Function tester_url_absolue not found\\.$#"
+			count: 1
+			path: action/editer_document.php
+
+		-
+			message: "#^Function _T not found\\.$#"
+			count: 4
+			path: action/ordonner_liens_documents.php
+
+		-
+			message: "#^Function _request not found\\.$#"
+			count: 4
+			path: action/ordonner_liens_documents.php
+
+		-
+			message: "#^Function autoriser not found\\.$#"
+			count: 1
+			path: action/ordonner_liens_documents.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 3
+			path: action/ordonner_liens_documents.php
+
+		-
+			message: "#^Function objet_associable not found\\.$#"
+			count: 2
+			path: action/ordonner_liens_documents.php
+
+		-
+			message: "#^Function objet_type not found\\.$#"
+			count: 2
+			path: action/ordonner_liens_documents.php
+
+		-
+			message: "#^Function sql_allfetsel not found\\.$#"
+			count: 1
+			path: action/ordonner_liens_documents.php
+
+		-
+			message: "#^Function sql_in not found\\.$#"
+			count: 1
+			path: action/ordonner_liens_documents.php
+
+		-
+			message: "#^Function sql_quote not found\\.$#"
+			count: 4
+			path: action/ordonner_liens_documents.php
+
+		-
+			message: "#^Function sql_updateq not found\\.$#"
+			count: 1
+			path: action/ordonner_liens_documents.php
+
+		-
+			message: "#^Function autoriser not found\\.$#"
+			count: 1
+			path: action/supprimer_document.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 1
+			path: action/supprimer_document.php
+
+		-
+			message: "#^Function copie_locale not found\\.$#"
+			count: 1
+			path: action/supprimer_document.php
+
+		-
+			message: "#^Function get_spip_doc not found\\.$#"
+			count: 1
+			path: action/supprimer_document.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 5
+			path: action/supprimer_document.php
+
+		-
+			message: "#^Function objet_dissocier not found\\.$#"
+			count: 2
+			path: action/supprimer_document.php
+
+		-
+			message: "#^Function pipeline not found\\.$#"
+			count: 1
+			path: action/supprimer_document.php
+
+		-
+			message: "#^Function spip_log not found\\.$#"
+			count: 3
+			path: action/supprimer_document.php
+
+		-
+			message: "#^Function spip_unlink not found\\.$#"
+			count: 2
+			path: action/supprimer_document.php
+
+		-
+			message: "#^Function sql_allfetsel not found\\.$#"
+			count: 1
+			path: action/supprimer_document.php
+
+		-
+			message: "#^Function sql_delete not found\\.$#"
+			count: 1
+			path: action/supprimer_document.php
+
+		-
+			message: "#^Function sql_fetsel not found\\.$#"
+			count: 1
+			path: action/supprimer_document.php
+
+		-
+			message: "#^Function sql_getfetsel not found\\.$#"
+			count: 1
+			path: action/supprimer_document.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 2
+			path: action/supprimer_tous_orphelins.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 1
+			path: action/supprimer_tous_orphelins.php
+
+		-
+			message: "#^Function sql_fetch not found\\.$#"
+			count: 1
+			path: action/supprimer_tous_orphelins.php
+
+		-
+			message: "#^Function sql_get_select not found\\.$#"
+			count: 1
+			path: action/supprimer_tous_orphelins.php
+
+		-
+			message: "#^Function sql_quote not found\\.$#"
+			count: 3
+			path: action/supprimer_tous_orphelins.php
+
+		-
+			message: "#^Function sql_select not found\\.$#"
+			count: 1
+			path: action/supprimer_tous_orphelins.php
+
+		-
+			message: "#^Function action_tourner_post invoked with 1 parameter, 2 required\\.$#"
+			count: 1
+			path: action/tourner.php
+
+		-
+			message: "#^Function autoriser not found\\.$#"
+			count: 1
+			path: action/tourner.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 1
+			path: action/tourner.php
+
+		-
+			message: "#^Function copie_locale not found\\.$#"
+			count: 1
+			path: action/tourner.php
+
+		-
+			message: "#^Function deplacer_fichier_upload not found\\.$#"
+			count: 1
+			path: action/tourner.php
+
+		-
+			message: "#^Function extraire_attribut not found\\.$#"
+			count: 2
+			path: action/tourner.php
+
+		-
+			message: "#^Function filtrer not found\\.$#"
+			count: 2
+			path: action/tourner.php
+
+		-
+			message: "#^Function get_spip_doc not found\\.$#"
+			count: 1
+			path: action/tourner.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 6
+			path: action/tourner.php
+
+		-
+			message: "#^Function pipeline not found\\.$#"
+			count: 1
+			path: action/tourner.php
+
+		-
+			message: "#^Function set_spip_doc not found\\.$#"
+			count: 1
+			path: action/tourner.php
+
+		-
+			message: "#^Function spip_getimagesize not found\\.$#"
+			count: 1
+			path: action/tourner.php
+
+		-
+			message: "#^Function spip_log not found\\.$#"
+			count: 4
+			path: action/tourner.php
+
+		-
+			message: "#^Function spip_unlink not found\\.$#"
+			count: 1
+			path: action/tourner.php
+
+		-
+			message: "#^Function sql_fetsel not found\\.$#"
+			count: 1
+			path: action/tourner.php
+
+		-
+			message: "#^Function sql_updateq not found\\.$#"
+			count: 1
+			path: action/tourner.php
+
+		-
+			message: "#^Function supprimer_timestamp not found\\.$#"
+			count: 1
+			path: action/tourner.php
+
+		-
+			message: "#^Function taille_image not found\\.$#"
+			count: 1
+			path: action/tourner.php
+
+		-
+			message: "#^Function autoriser not found\\.$#"
+			count: 1
+			path: action/verifier_documents_brises.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 1
+			path: action/verifier_documents_brises.php
+
+		-
+			message: "#^Function get_spip_doc not found\\.$#"
+			count: 1
+			path: action/verifier_documents_brises.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 2
+			path: action/verifier_documents_brises.php
+
+		-
+			message: "#^Function sql_fetch not found\\.$#"
+			count: 1
+			path: action/verifier_documents_brises.php
+
+		-
+			message: "#^Function sql_select not found\\.$#"
+			count: 1
+			path: action/verifier_documents_brises.php
+
+		-
+			message: "#^Function sql_updateq not found\\.$#"
+			count: 1
+			path: action/verifier_documents_brises.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 1
+			path: action/verifier_documents_liens.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 1
+			path: action/verifier_documents_liens.php
+
+		-
+			message: "#^Function objet_optimiser_liens not found\\.$#"
+			count: 1
+			path: action/verifier_documents_liens.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 1
+			path: base/medias.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 3
+			path: base/medias.php
+
+		-
+			message: "#^Function objet_optimiser_liens not found\\.$#"
+			count: 1
+			path: base/medias.php
+
+		-
+			message: "#^Function sql_allfetsel not found\\.$#"
+			count: 1
+			path: base/medias.php
+
+		-
+			message: "#^Function sql_fetch not found\\.$#"
+			count: 1
+			path: base/medias.php
+
+		-
+			message: "#^Function sql_in not found\\.$#"
+			count: 1
+			path: base/medias.php
+
+		-
+			message: "#^Function sql_insertq_multi not found\\.$#"
+			count: 1
+			path: base/medias.php
+
+		-
+			message: "#^Function sql_quote not found\\.$#"
+			count: 1
+			path: base/medias.php
+
+		-
+			message: "#^Function sql_select not found\\.$#"
+			count: 1
+			path: base/medias.php
+
+		-
+			message: "#^Function sql_updateq not found\\.$#"
+			count: 1
+			path: base/medias.php
+
+		-
+			message: "#^Function _T not found\\.$#"
+			count: 1
+			path: formulaires/changer_fichier_document.php
+
+		-
+			message: "#^Function _request not found\\.$#"
+			count: 2
+			path: formulaires/changer_fichier_document.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 4
+			path: formulaires/changer_fichier_document.php
+
+		-
+			message: "#^Function get_spip_doc not found\\.$#"
+			count: 1
+			path: formulaires/changer_fichier_document.php
+
+		-
+			message: "#^Function spip_unlink not found\\.$#"
+			count: 1
+			path: formulaires/changer_fichier_document.php
+
+		-
+			message: "#^Function sql_fetsel not found\\.$#"
+			count: 1
+			path: formulaires/changer_fichier_document.php
+
+		-
+			message: "#^Function sql_getfetsel not found\\.$#"
+			count: 1
+			path: formulaires/changer_fichier_document.php
+
+		-
+			message: "#^Function _T not found\\.$#"
+			count: 1
+			path: formulaires/configurer_documents.php
+
+		-
+			message: "#^Function _request not found\\.$#"
+			count: 2
+			path: formulaires/configurer_documents.php
+
+		-
+			message: "#^Function ecrire_meta not found\\.$#"
+			count: 2
+			path: formulaires/configurer_documents.php
+
+		-
+			message: "#^Function _T not found\\.$#"
+			count: 3
+			path: formulaires/editer_document.php
+
+		-
+			message: "#^Function _request not found\\.$#"
+			count: 21
+			path: formulaires/editer_document.php
+
+		-
+			message: "#^Function affdate not found\\.$#"
+			count: 2
+			path: formulaires/editer_document.php
+
+		-
+			message: "#^Function autoriser not found\\.$#"
+			count: 2
+			path: formulaires/editer_document.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 5
+			path: formulaires/editer_document.php
+
+		-
+			message: "#^Function formulaires_editer_objet_charger not found\\.$#"
+			count: 1
+			path: formulaires/editer_document.php
+
+		-
+			message: "#^Function formulaires_editer_objet_traiter not found\\.$#"
+			count: 1
+			path: formulaires/editer_document.php
+
+		-
+			message: "#^Function formulaires_editer_objet_verifier not found\\.$#"
+			count: 1
+			path: formulaires/editer_document.php
+
+		-
+			message: "#^Function get_spip_doc not found\\.$#"
+			count: 3
+			path: formulaires/editer_document.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 5
+			path: formulaires/editer_document.php
+
+		-
+			message: "#^Function lire_config not found\\.$#"
+			count: 2
+			path: formulaires/editer_document.php
+
+		-
+			message: "#^Function recup_date not found\\.$#"
+			count: 1
+			path: formulaires/editer_document.php
+
+		-
+			message: "#^Function set_request not found\\.$#"
+			count: 9
+			path: formulaires/editer_document.php
+
+		-
+			message: "#^Function spip_unlink not found\\.$#"
+			count: 1
+			path: formulaires/editer_document.php
+
+		-
+			message: "#^Function sql_allfetsel not found\\.$#"
+			count: 1
+			path: formulaires/editer_document.php
+
+		-
+			message: "#^Function sql_fetsel not found\\.$#"
+			count: 1
+			path: formulaires/editer_document.php
+
+		-
+			message: "#^Function sql_getfetsel not found\\.$#"
+			count: 1
+			path: formulaires/editer_document.php
+
+		-
+			message: "#^Function sql_quote not found\\.$#"
+			count: 1
+			path: formulaires/editer_document.php
+
+		-
+			message: "#^Function tester_url_absolue not found\\.$#"
+			count: 1
+			path: formulaires/editer_document.php
+
+		-
+			message: "#^Function _T not found\\.$#"
+			count: 3
+			path: formulaires/illustrer_document.php
+
+		-
+			message: "#^Function _request not found\\.$#"
+			count: 2
+			path: formulaires/illustrer_document.php
+
+		-
+			message: "#^Function autoriser not found\\.$#"
+			count: 1
+			path: formulaires/illustrer_document.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 3
+			path: formulaires/illustrer_document.php
+
+		-
+			message: "#^Function get_spip_doc not found\\.$#"
+			count: 1
+			path: formulaires/illustrer_document.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 3
+			path: formulaires/illustrer_document.php
+
+		-
+			message: "#^Function sql_fetsel not found\\.$#"
+			count: 2
+			path: formulaires/illustrer_document.php
+
+		-
+			message: "#^Function sql_getfetsel not found\\.$#"
+			count: 2
+			path: formulaires/illustrer_document.php
+
+		-
+			message: "#^Function _T not found\\.$#"
+			count: 9
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function _request not found\\.$#"
+			count: 6
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function attribut_html not found\\.$#"
+			count: 1
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function autoriser not found\\.$#"
+			count: 2
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 1
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function date_interface not found\\.$#"
+			count: 1
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function determine_upload not found\\.$#"
+			count: 1
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function effacer_repertoire_temporaire not found\\.$#"
+			count: 2
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 7
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function joli_repertoire not found\\.$#"
+			count: 1
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function preg_files not found\\.$#"
+			count: 1
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function recuperer_fond not found\\.$#"
+			count: 1
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function set_request not found\\.$#"
+			count: 1
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function singulier_ou_pluriel not found\\.$#"
+			count: 2
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function sql_fetsel not found\\.$#"
+			count: 1
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function sql_getfetsel not found\\.$#"
+			count: 2
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function table_objet_sql not found\\.$#"
+			count: 1
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function taille_en_octets not found\\.$#"
+			count: 1
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function test_espace_prive not found\\.$#"
+			count: 1
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function translitteration not found\\.$#"
+			count: 1
+			path: formulaires/joindre_document.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 1
+			path: inc/determiner_statut_document.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 1
+			path: inc/determiner_statut_document.php
+
+		-
+			message: "#^Function objet_test_si_publie not found\\.$#"
+			count: 1
+			path: inc/determiner_statut_document.php
+
+		-
+			message: "#^Function sql_fetch not found\\.$#"
+			count: 1
+			path: inc/determiner_statut_document.php
+
+		-
+			message: "#^Function sql_fetsel not found\\.$#"
+			count: 1
+			path: inc/determiner_statut_document.php
+
+		-
+			message: "#^Function sql_select not found\\.$#"
+			count: 1
+			path: inc/determiner_statut_document.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 1
+			path: inc/documenter_objet.php
+
+		-
+			message: "#^Function id_table_objet not found\\.$#"
+			count: 1
+			path: inc/documenter_objet.php
+
+		-
+			message: "#^Function recuperer_fond not found\\.$#"
+			count: 1
+			path: inc/documenter_objet.php
+
+		-
+			message: "#^Function sql_fetsel not found\\.$#"
+			count: 1
+			path: inc/documenter_objet.php
+
+		-
+			message: "#^Function table_objet not found\\.$#"
+			count: 1
+			path: inc/documenter_objet.php
+
+		-
+			message: "#^Function table_objet_sql not found\\.$#"
+			count: 1
+			path: inc/documenter_objet.php
+
+		-
+			message: "#^Function _T not found\\.$#"
+			count: 1
+			path: inc/documents.php
+
+		-
+			message: "#^Function attribut_html not found\\.$#"
+			count: 2
+			path: inc/documents.php
+
+		-
+			message: "#^Function autoriser not found\\.$#"
+			count: 2
+			path: inc/documents.php
+
+		-
+			message: "#^Function calculer_cle_action not found\\.$#"
+			count: 1
+			path: inc/documents.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 1
+			path: inc/documents.php
+
+		-
+			message: "#^Function copie_locale not found\\.$#"
+			count: 3
+			path: inc/documents.php
+
+		-
+			message: "#^Function couper not found\\.$#"
+			count: 1
+			path: inc/documents.php
+
+		-
+			message: "#^Function document_spip_externe not found\\.$#"
+			count: 1
+			path: inc/documents.php
+
+		-
+			message: "#^Function formats_image_acceptables not found\\.$#"
+			count: 1
+			path: inc/documents.php
+
+		-
+			message: "#^Function generer_url_action not found\\.$#"
+			count: 1
+			path: inc/documents.php
+
+		-
+			message: "#^Function get_spip_doc not found\\.$#"
+			count: 3
+			path: inc/documents.php
+
+		-
+			message: "#^Function image_reduire not found\\.$#"
+			count: 2
+			path: inc/documents.php
+
+		-
+			message: "#^Function importer_charset not found\\.$#"
+			count: 2
+			path: inc/documents.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 9
+			path: inc/documents.php
+
+		-
+			message: "#^Function inserer_attribut not found\\.$#"
+			count: 3
+			path: inc/documents.php
+
+		-
+			message: "#^Function is_utf8 not found\\.$#"
+			count: 1
+			path: inc/documents.php
+
+		-
+			message: "#^Function spip_file_get_contents not found\\.$#"
+			count: 1
+			path: inc/documents.php
+
+		-
+			message: "#^Function spip_getimagesize not found\\.$#"
+			count: 2
+			path: inc/documents.php
+
+		-
+			message: "#^Function sql_fetsel not found\\.$#"
+			count: 3
+			path: inc/documents.php
+
+		-
+			message: "#^Function sql_quote not found\\.$#"
+			count: 1
+			path: inc/documents.php
+
+		-
+			message: "#^Function supprimer_tags not found\\.$#"
+			count: 1
+			path: inc/documents.php
+
+		-
+			message: "#^Function taille_en_octets not found\\.$#"
+			count: 1
+			path: inc/documents.php
+
+		-
+			message: "#^Function test_espace_prive not found\\.$#"
+			count: 1
+			path: inc/documents.php
+
+		-
+			message: "#^Function typo not found\\.$#"
+			count: 1
+			path: inc/documents.php
+
+		-
+			message: "#^Function _T not found\\.$#"
+			count: 2
+			path: inc/getdocument.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 2
+			path: inc/getdocument.php
+
+		-
+			message: "#^Function minipres not found\\.$#"
+			count: 1
+			path: inc/getdocument.php
+
+		-
+			message: "#^Function taille_en_octets not found\\.$#"
+			count: 1
+			path: inc/getdocument.php
+
+		-
+			message: "#^Function _T not found\\.$#"
+			count: 16
+			path: inc/joindre_document.php
+
+		-
+			message: "#^Function _request not found\\.$#"
+			count: 11
+			path: inc/joindre_document.php
+
+		-
+			message: "#^Function accepte_fichier_upload\\(\\) should return bool\\|int but return statement is missing\\.$#"
+			count: 1
+			path: inc/joindre_document.php
+
+		-
+			message: "#^Function copier_document not found\\.$#"
+			count: 1
+			path: inc/joindre_document.php
+
+		-
+			message: "#^Function creer_repertoire_documents not found\\.$#"
+			count: 1
+			path: inc/joindre_document.php
+
+		-
+			message: "#^Function determine_upload not found\\.$#"
+			count: 1
+			path: inc/joindre_document.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 11
+			path: inc/joindre_document.php
+
+		-
+			message: "#^Function preg_files not found\\.$#"
+			count: 1
+			path: inc/joindre_document.php
+
+		-
+			message: "#^Function propre not found\\.$#"
+			count: 1
+			path: inc/joindre_document.php
+
+		-
+			message: "#^Function session_set not found\\.$#"
+			count: 1
+			path: inc/joindre_document.php
+
+		-
+			message: "#^Function sous_repertoire not found\\.$#"
+			count: 1
+			path: inc/joindre_document.php
+
+		-
+			message: "#^Function spip_log not found\\.$#"
+			count: 2
+			path: inc/joindre_document.php
+
+		-
+			message: "#^Function sql_countsel not found\\.$#"
+			count: 1
+			path: inc/joindre_document.php
+
+		-
+			message: "#^Function sql_fetsel not found\\.$#"
+			count: 2
+			path: inc/joindre_document.php
+
+		-
+			message: "#^Function sql_quote not found\\.$#"
+			count: 3
+			path: inc/joindre_document.php
+
+		-
+			message: "#^Function valider_url_distante not found\\.$#"
+			count: 1
+			path: inc/joindre_document.php
+
+		-
+			message: "#^Instantiated class Spip\\\\Archives\\\\SpipArchives not found\\.$#"
+			count: 2
+			path: inc/joindre_document.php
+
+		-
+			message: "#^Undefined variable\\: \\$msg$#"
+			count: 1
+			path: inc/joindre_document.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 1
+			path: inc/marquer_doublons_doc.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 4
+			path: inc/marquer_doublons_doc.php
+
+		-
+			message: "#^Function lister_tables_objets_sql not found\\.$#"
+			count: 1
+			path: inc/marquer_doublons_doc.php
+
+		-
+			message: "#^Function objet_associer not found\\.$#"
+			count: 1
+			path: inc/marquer_doublons_doc.php
+
+		-
+			message: "#^Function objet_qualifier_liens not found\\.$#"
+			count: 2
+			path: inc/marquer_doublons_doc.php
+
+		-
+			message: "#^Function objet_trouver_liens not found\\.$#"
+			count: 1
+			path: inc/marquer_doublons_doc.php
+
+		-
+			message: "#^Function sql_allfetsel not found\\.$#"
+			count: 1
+			path: inc/marquer_doublons_doc.php
+
+		-
+			message: "#^Function sql_fetsel not found\\.$#"
+			count: 1
+			path: inc/marquer_doublons_doc.php
+
+		-
+			message: "#^Function sql_in not found\\.$#"
+			count: 1
+			path: inc/marquer_doublons_doc.php
+
+		-
+			message: "#^Function sql_quote not found\\.$#"
+			count: 1
+			path: inc/marquer_doublons_doc.php
+
+		-
+			message: "#^Function traiter_modeles not found\\.$#"
+			count: 1
+			path: inc/marquer_doublons_doc.php
+
+		-
+			message: "#^Function _T not found\\.$#"
+			count: 3
+			path: inc/renseigner_document.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 3
+			path: inc/renseigner_document.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 2
+			path: inc/renseigner_document.php
+
+		-
+			message: "#^Function objet_info not found\\.$#"
+			count: 1
+			path: inc/renseigner_document.php
+
+		-
+			message: "#^Function pipeline not found\\.$#"
+			count: 2
+			path: inc/renseigner_document.php
+
+		-
+			message: "#^Function recuperer_infos_distantes not found\\.$#"
+			count: 1
+			path: inc/renseigner_document.php
+
+		-
+			message: "#^Function recuperer_url not found\\.$#"
+			count: 1
+			path: inc/renseigner_document.php
+
+		-
+			message: "#^Function set_spip_doc not found\\.$#"
+			count: 1
+			path: inc/renseigner_document.php
+
+		-
+			message: "#^Function spip_log not found\\.$#"
+			count: 2
+			path: inc/renseigner_document.php
+
+		-
+			message: "#^Function sql_getfetsel not found\\.$#"
+			count: 1
+			path: inc/renseigner_document.php
+
+		-
+			message: "#^Function sql_quote not found\\.$#"
+			count: 1
+			path: inc/renseigner_document.php
+
+		-
+			message: "#^Function _T not found\\.$#"
+			count: 2
+			path: inc/verifier_document_mode_image.php
+
+		-
+			message: "#^Function _T not found\\.$#"
+			count: 2
+			path: inc/verifier_document_mode_vignette.php
+
+		-
+			message: "#^Function _T not found\\.$#"
+			count: 7
+			path: inc/verifier_taille_document_acceptable.php
+
+		-
+			message: "#^Function extraire_attribut not found\\.$#"
+			count: 1
+			path: inc/verifier_taille_document_acceptable.php
+
+		-
+			message: "#^Function filtrer not found\\.$#"
+			count: 1
+			path: inc/verifier_taille_document_acceptable.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 1
+			path: inc/verifier_taille_document_acceptable.php
+
+		-
+			message: "#^Function spip_log not found\\.$#"
+			count: 2
+			path: inc/verifier_taille_document_acceptable.php
+
+		-
+			message: "#^Function spip_unlink not found\\.$#"
+			count: 1
+			path: inc/verifier_taille_document_acceptable.php
+
+		-
+			message: "#^Function supprimer_timestamp not found\\.$#"
+			count: 1
+			path: inc/verifier_taille_document_acceptable.php
+
+		-
+			message: "#^Function taille_en_octets not found\\.$#"
+			count: 2
+			path: inc/verifier_taille_document_acceptable.php
+
+		-
+			message: "#^Function taille_image not found\\.$#"
+			count: 1
+			path: inc/verifier_taille_document_acceptable.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 1
+			path: inc/vignette.php
+
+		-
+			message: "#^Function find_in_path not found\\.$#"
+			count: 1
+			path: inc/vignette.php
+
+		-
+			message: "#^Function spip_getimagesize not found\\.$#"
+			count: 1
+			path: inc/vignette.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 2
+			path: medias_administrations.php
+
+		-
+			message: "#^Function ecrire_meta not found\\.$#"
+			count: 2
+			path: medias_administrations.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 4
+			path: medias_administrations.php
+
+		-
+			message: "#^Function lister_tables_objets_sql not found\\.$#"
+			count: 1
+			path: medias_administrations.php
+
+		-
+			message: "#^Function logo_migrer_en_base not found\\.$#"
+			count: 1
+			path: medias_administrations.php
+
+		-
+			message: "#^Function maj_plugin not found\\.$#"
+			count: 1
+			path: medias_administrations.php
+
+		-
+			message: "#^Function objet_type not found\\.$#"
+			count: 1
+			path: medias_administrations.php
+
+		-
+			message: "#^Function sql_allfetsel not found\\.$#"
+			count: 2
+			path: medias_administrations.php
+
+		-
+			message: "#^Function sql_fetch not found\\.$#"
+			count: 1
+			path: medias_administrations.php
+
+		-
+			message: "#^Function sql_getfetsel not found\\.$#"
+			count: 1
+			path: medias_administrations.php
+
+		-
+			message: "#^Function sql_quote not found\\.$#"
+			count: 6
+			path: medias_administrations.php
+
+		-
+			message: "#^Function sql_select not found\\.$#"
+			count: 1
+			path: medias_administrations.php
+
+		-
+			message: "#^Function sql_update not found\\.$#"
+			count: 2
+			path: medias_administrations.php
+
+		-
+			message: "#^Function sql_updateq not found\\.$#"
+			count: 1
+			path: medias_administrations.php
+
+		-
+			message: "#^Function autoriser not found\\.$#"
+			count: 11
+			path: medias_autoriser.php
+
+		-
+			message: "#^Function autoriser_document_tailler_dist\\(\\) should return bool but return statement is missing\\.$#"
+			count: 1
+			path: medias_autoriser.php
+
+		-
+			message: "#^Function autoriser_orphelins_supprimer_dist\\(\\) should return bool but return statement is missing\\.$#"
+			count: 1
+			path: medias_autoriser.php
+
+		-
+			message: "#^Function id_table_objet not found\\.$#"
+			count: 1
+			path: medias_autoriser.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 1
+			path: medias_autoriser.php
+
+		-
+			message: "#^Function lire_config not found\\.$#"
+			count: 1
+			path: medias_autoriser.php
+
+		-
+			message: "#^Function sql_allfetsel not found\\.$#"
+			count: 1
+			path: medias_autoriser.php
+
+		-
+			message: "#^Function sql_countsel not found\\.$#"
+			count: 2
+			path: medias_autoriser.php
+
+		-
+			message: "#^Function sql_fetch not found\\.$#"
+			count: 1
+			path: medias_autoriser.php
+
+		-
+			message: "#^Function sql_fetsel not found\\.$#"
+			count: 1
+			path: medias_autoriser.php
+
+		-
+			message: "#^Function sql_getfetsel not found\\.$#"
+			count: 5
+			path: medias_autoriser.php
+
+		-
+			message: "#^Function sql_quote not found\\.$#"
+			count: 1
+			path: medias_autoriser.php
+
+		-
+			message: "#^Function sql_select not found\\.$#"
+			count: 1
+			path: medias_autoriser.php
+
+		-
+			message: "#^Function table_objet_sql not found\\.$#"
+			count: 2
+			path: medias_autoriser.php
+
+		-
+			message: "#^Function _T not found\\.$#"
+			count: 10
+			path: medias_fonctions.php
+
+		-
+			message: "#^Function attribut_html not found\\.$#"
+			count: 1
+			path: medias_fonctions.php
+
+		-
+			message: "#^Function calculer_boucle not found\\.$#"
+			count: 1
+			path: medias_fonctions.php
+
+		-
+			message: "#^Function charger_filtre not found\\.$#"
+			count: 1
+			path: medias_fonctions.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 1
+			path: medias_fonctions.php
+
+		-
+			message: "#^Function http_img_pack not found\\.$#"
+			count: 1
+			path: medias_fonctions.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 1
+			path: medias_fonctions.php
+
+		-
+			message: "#^Function minipres not found\\.$#"
+			count: 1
+			path: medias_fonctions.php
+
+		-
+			message: "#^Function pipeline not found\\.$#"
+			count: 2
+			path: medias_fonctions.php
+
+		-
+			message: "#^Function session_set not found\\.$#"
+			count: 1
+			path: medias_fonctions.php
+
+		-
+			message: "#^Function spip_strlen not found\\.$#"
+			count: 1
+			path: medias_fonctions.php
+
+		-
+			message: "#^Function sql_fetsel not found\\.$#"
+			count: 1
+			path: medias_fonctions.php
+
+		-
+			message: "#^Function sql_get_select not found\\.$#"
+			count: 1
+			path: medias_fonctions.php
+
+		-
+			message: "#^Function sql_serveur not found\\.$#"
+			count: 1
+			path: medias_fonctions.php
+
+		-
+			message: "#^Function test_espace_prive not found\\.$#"
+			count: 1
+			path: medias_fonctions.php
+
+		-
+			message: "#^Function textebrut not found\\.$#"
+			count: 1
+			path: medias_fonctions.php
+
+		-
+			message: "#^Function trouve_modele not found\\.$#"
+			count: 4
+			path: medias_fonctions.php
+
+		-
+			message: "#^Function _T not found\\.$#"
+			count: 1
+			path: medias_ieconfig.php
+
+		-
+			message: "#^Function autoriser not found\\.$#"
+			count: 3
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 3
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function id_table_objet not found\\.$#"
+			count: 2
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 8
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function lire_config not found\\.$#"
+			count: 1
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function objet_associer not found\\.$#"
+			count: 1
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function objet_trouver_liens not found\\.$#"
+			count: 1
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function objet_type not found\\.$#"
+			count: 2
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function recuperer_fond not found\\.$#"
+			count: 2
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function singulier_ou_pluriel not found\\.$#"
+			count: 1
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function sql_allfetsel not found\\.$#"
+			count: 1
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function sql_countsel not found\\.$#"
+			count: 3
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function sql_delete not found\\.$#"
+			count: 1
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function sql_fetch not found\\.$#"
+			count: 1
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function sql_in not found\\.$#"
+			count: 1
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function sql_quote not found\\.$#"
+			count: 4
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function sql_select not found\\.$#"
+			count: 1
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function sql_updateq not found\\.$#"
+			count: 1
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function table_objet not found\\.$#"
+			count: 1
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function table_objet_sql not found\\.$#"
+			count: 1
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function trouver_objet_exec not found\\.$#"
+			count: 1
+			path: medias_pipelines.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 1
+			path: metadata/audio.php
+
+		-
+			message: "#^Function autoriser not found\\.$#"
+			count: 1
+			path: metadata/html.php
+
+		-
+			message: "#^Function ecrire_fichier not found\\.$#"
+			count: 1
+			path: metadata/html.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 2
+			path: metadata/html.php
+
+		-
+			message: "#^Function safehtml not found\\.$#"
+			count: 1
+			path: metadata/html.php
+
+		-
+			message: "#^Function spip_file_get_contents not found\\.$#"
+			count: 1
+			path: metadata/html.php
+
+		-
+			message: "#^Function spip_getimagesize not found\\.$#"
+			count: 1
+			path: metadata/image.php
+
+		-
+			message: "#^Function charger_fonction not found\\.$#"
+			count: 1
+			path: metadata/swf.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 1
+			path: metadata/video.php
+
+		-
+			message: "#^Function _T not found\\.$#"
+			count: 2
+			path: modeles/document_case_fonctions.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 1
+			path: modeles/document_case_fonctions.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 1
+			path: modeles/document_desc_fonctions.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 1
+			path: prive/squelettes/inclure/ajouter-documents_fonctions.php
+
+		-
+			message: "#^Function sql_allfetsel not found\\.$#"
+			count: 1
+			path: prive/squelettes/inclure/mediatheque-navigation_fonctions.php
+
+		-
+			message: "#^Function sql_quote not found\\.$#"
+			count: 1
+			path: prive/squelettes/inclure/mediatheque-navigation_fonctions.php
+
+		-
+			message: "#^Function chemin_image not found\\.$#"
+			count: 1
+			path: puce_statut/document.php
+
+		-
+			message: "#^Function ecrire_fichier not found\\.$#"
+			count: 1
+			path: sanitizer/svg.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 2
+			path: sanitizer/svg.php
+
+		-
+			message: "#^Function spip_log not found\\.$#"
+			count: 2
+			path: sanitizer/svg.php
+
+		-
+			message: "#^Function svg_charger not found\\.$#"
+			count: 1
+			path: sanitizer/svg.php
+
+		-
+			message: "#^Function svg_force_viewBox_px not found\\.$#"
+			count: 1
+			path: sanitizer/svg.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 1
+			path: urls/generer_url_document.php
+
+		-
+			message: "#^Function include_spip not found\\.$#"
+			count: 1
+			path: urls/generer_url_ecrire_document.php
+
diff --git a/phpstan.neon.dist b/phpstan.neon.dist
new file mode 100644
index 0000000000000000000000000000000000000000..6c6ae5639052e5330f5a6834c93ff9dfaa4736dd
--- /dev/null
+++ b/phpstan.neon.dist
@@ -0,0 +1,13 @@
+includes:
+	- phpstan-baseline.neon
+
+parameters:
+    paths:
+        - .
+    excludePaths:
+        analyseAndScan:
+            - vendor
+            - lang
+        analyse:
+            - lib
+    level: 0
diff --git a/prive/squelettes/inclure/ajouter-documents_fonctions.php b/prive/squelettes/inclure/ajouter-documents_fonctions.php
index 800bbb26c4af5942eb93535fb6d61227760c0f6d..9c0d70f0d261fe47f74b65b603af7a182db08714 100644
--- a/prive/squelettes/inclure/ajouter-documents_fonctions.php
+++ b/prive/squelettes/inclure/ajouter-documents_fonctions.php
@@ -10,7 +10,6 @@
  *  Pour plus de détails voir le fichier COPYING.txt ou l'aide en ligne.   *
 \***************************************************************************/
 
-
 if (!defined('_ECRIRE_INC_VERSION')) {
 	return;
 }
diff --git a/prive/squelettes/inclure/mediatheque-navigation_fonctions.php b/prive/squelettes/inclure/mediatheque-navigation_fonctions.php
index 994a0cc9b55713c1751cfe9eb1d793a047d6acf2..a23b94cb6f874c5fd64dd6cc6a6160171750ced3 100644
--- a/prive/squelettes/inclure/mediatheque-navigation_fonctions.php
+++ b/prive/squelettes/inclure/mediatheque-navigation_fonctions.php
@@ -10,7 +10,6 @@
  *  Pour plus de détails voir le fichier COPYING.txt ou l'aide en ligne.   *
 \***************************************************************************/
 
-
 if (!defined('_ECRIRE_INC_VERSION')) {
 	return;
 }
@@ -24,5 +23,5 @@ function liste_extensions_utilisees($media) {
 			'media=' . sql_quote($media)
 		),
 		'extension'
-	) : array();
+	) : [];
 }
diff --git a/prive/vignettes/index.php b/prive/vignettes/index.php
index 91302b88e39e83981d1aaf59a1bd2c989c4e7e60..471875edcadcae76b74f6ff33b94a052b47fab99 100644
--- a/prive/vignettes/index.php
+++ b/prive/vignettes/index.php
@@ -7,15 +7,15 @@
 <body style="background: #fff; text-align: center;">
 <h1>Index des vignettes de SPIP</h1>
 <?php
-$files = array_merge(glob(__DIR__ . '/*.svg'),glob(__DIR__ . '/*.png'));
+$files = array_merge(glob(__DIR__ . '/*.svg'), glob(__DIR__ . '/*.png'));
 sort($files);
 ?>
 <h2><?=count($files) ?> Icones au format SVG</h2>
 <div class="thumbnails">
 	<?php
 	foreach ($files as $file) {
-		$file = substr($file, strlen(__DIR__) +1);
-		$extension = substr($file,-3);
+		$file = substr($file, strlen(__DIR__) + 1);
+		$extension = substr($file, -3);
 		$r = "\n\t<figure class='ext-$extension'><img src='$file' alt='$file' /><figcaption>$file</figcaption></figure>";
 		echo $r;
 	}
diff --git a/sanitizer/svg.php b/sanitizer/svg.php
index 2cc360c7d633a01eb2395af6389cc20ce7bf0cd0..13d842a2044302214b902a074ed499d3e9225ed2 100644
--- a/sanitizer/svg.php
+++ b/sanitizer/svg.php
@@ -36,17 +36,17 @@ function sanitizer_svg_dist($file) {
 
 	include_spip('inc/svg');
 	if ($svg = svg_charger($file)) {
-
 		// forcer une viewBox et width+height en px
 		$svg = svg_force_viewBox_px($svg, true);
 
 		// Securite si pas autorise : virer les scripts et les references externes
 		// sauf si on est en mode javascript 'ok' (1), cf. inc_version
-		if ($GLOBALS['filtrer_javascript'] < 1
+		if (
+			$GLOBALS['filtrer_javascript'] < 1
 			// qu'on soit admin ou non, on sanitize les SVGs car rien ne dit qu'un admin sait que ca contient du JS
-		  // and !autoriser('televerser', 'script')
+			// and !autoriser('televerser', 'script')
 		) {
-			spip_log("sanitization SVG $file", "svg");
+			spip_log("sanitization SVG $file", 'svg');
 
 			if (!class_exists('enshrined\svgSanitize\Sanitizer')) {
 				spl_autoload_register(function ($class) {
@@ -60,7 +60,7 @@ function sanitizer_svg_dist($file) {
 					$file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
 									if (file_exists($file)) {
 						require $file;
-					}
+									}
 				});
 			}
 
@@ -75,14 +75,14 @@ function sanitizer_svg_dist($file) {
 				$svg = $sanitizer->sanitize($svg);
 
 				// loger les sanitization
-				$trace = "";
+				$trace = '';
 				foreach ($sanitizer->getXmlIssues() as $issue) {
-					$trace .= $issue['message'] . " L".$issue['line']."\n";
+					$trace .= $issue['message'] . ' L' . $issue['line'] . "\n";
 				}
 				if ($trace) {
-					spip_log($trace, "svg" . _LOG_DEBUG);
+					spip_log($trace, 'svg' . _LOG_DEBUG);
 				}
-			} while (strlen($svg) !== $size and $maxiter-->0);
+			} while (strlen($svg) !== $size and $maxiter-- > 0);
 		}
 
 		ecrire_fichier($file, $svg);