-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypofr.php
42 lines (34 loc) · 906 Bytes
/
typofr.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/*
Plugin Name: TypoFR
Plugin URI: https://github.com/borisschapira/typofr
Description: a plugin for french typography management, powered by JoliTypo
Version: 0.2
Author: Boris Schapira
Author URI: http://borisschapira.com
License: MIT
*/
include 'vendor/autoload.php';
// Correction typographique francaise par JoliTypo
use JoliTypo\Fixer;
function typofr($text)
{
static $fixer;
if (!isset($fixer)) {
$fixer = new Fixer(array(
'Ellipsis',
'Dimension',
'Dash',
'FrenchQuotes',
'FrenchNoBreakSpace',
'CurlyQuote',
'Hyphen',
'Trademark'));
$fixer->setLocale('fr_FR'); // Needed by the Hyphen Fixer
}
$decoded = utf8_decode($text);
$fixed = $fixer->fix($decoded);
return $fixed;
}
add_filter('the_content', 'typofr');
add_filter('the_title', 'typofr');