Samx Here
n1udSecurity


Server : Apache
System : Linux webd348.cluster026.gra.hosting.ovh.net 5.15.148-ovh-vps-grsec-zfs-classid #1 SMP Thu Feb 8 09:41:04 UTC 2024 x86_64
User : hednacluml ( 122243)
PHP Version : 8.3.9
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
Directory :  /home/hednacluml/jobs/plugins-dist/textwheel/typographie/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/hednacluml/jobs/plugins-dist/textwheel/typographie/fr.php
<?php

/***************************************************************************\
 *  SPIP, Système de publication pour l'internet                           *
 *                                                                         *
 *  Copyright © avec tendresse depuis 2001                                 *
 *  Arnaud Martin, Antoine Pitrou, Philippe Rivière, Emmanuel Saint-James  *
 *                                                                         *
 *  Ce programme est un logiciel libre distribué sous licence GNU/GPL.     *
\***************************************************************************/

if (!defined('_ECRIRE_INC_VERSION')) {
	return;
}

// Correction typographique francaise

function typographie_fr($t) {

	static $trans;

	if (!isset($trans)) {
		$trans = [
			'&nbsp;' => '~',
			'&raquo;' => '&#187;',
			'&laquo;' => '&#171;',
			'&rdquo;' => '&#8221;',
			'&ldquo;' => '&#8220;',
			'&deg;' => '&#176;',
			"'" => '&#8217;'
		];
		$charset = $GLOBALS['meta']['charset'] ?? '';
		switch ($charset) {
			case 'utf-8':
				$trans["\xc2\xa0"] = '~';
				$trans["\xc2\xbb"] = '&#187;';
				$trans["\xc2\xab"] = '&#171;';
				$trans["\xe2\x80\x94"] = '--';
				$trans["\xe2\x80\x9d"] = '&#8221;';
				$trans["\xe2\x80\x9c"] = '&#8220;';
				$trans["\xc2\xb0"] = '&#176;';
				$trans["\xe2\x80\x89"] = '~'; # &finesp;
				break;
			default:
				$trans["\xa0"] = '~';
				$trans["\xab"] = '&#171;';
				$trans["\xbb"] = '&#187;';
				$trans["\xb0"] = '&#176;';
				break;
		}
	}

	# cette chaine ne peut pas exister,
	# cf. TYPO_PROTECTEUR dans inc/texte
	$pro = "-\x2-";

	$t = str_replace(array_keys($trans), array_values($trans), $t);

	# la typo du ; risque de clasher avec les entites &xxx;
	if (strpos($t, ';') !== false) {
		$t = str_replace(';', '~;', $t);
		$t = preg_replace(',(&#?[0-9a-z]+)~;,iS', '$1;', $t);
	}

	/* 2 */
	$t = preg_replace('/&#187;| --?,|(?::(?!:)| %)(?:\W|$)/S', '~$0', $t);

	/* 3 */
	$t = preg_replace('/[!?][!?\.]*/S', "$pro~$0", $t, -1, $c);
	if ($c) {
		$t = preg_replace("/([\[<\(!\?\.])$pro~/S", '$1', $t);
		$t = str_replace("$pro", '', $t);
	}

	/* 4 */
	$t = preg_replace('/&#171;|M(?:M?\.|mes?|r\.?|&#176;) |[nN]&#176; /S', '$0~', $t);

	if (strpos($t, '\~') !== false) {
		$t = str_replace('\~', "\x1\x14", $t);
	}

	if (strpos($t, '~') !== false) {
		$t = preg_replace('/ *~+ */S', '~', $t);
	}

	$t = preg_replace('/--([^-]|$)/S', "$pro&mdash;$1", $t, -1, $c);
	if ($c) {
		$t = preg_replace("/([-\n])$pro&mdash;/S", '$1--', $t);
		$t = str_replace($pro, '', $t);
	}

	$t = preg_replace(',(' . _PROTOCOLES_STD . ')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S', '$1$3$4', $t);
	$t = str_replace('~', '&nbsp;', $t);

	if (strpos($t, "\x1") !== false) {
		$t = str_replace("\x1\x14", '~', $t);
	}

	return $t;
}

SAMX