author | ymh <ymh.work@gmail.com> |
Wed, 16 Oct 2019 11:23:38 +0200 | |
changeset 14 | 00ac8f60d73f |
parent 1 | f6eb5a861d2f |
permissions | -rwxr-xr-x |
0 | 1 |
<!DOCTYPE html> |
2 |
<html class="no-js"> |
|
3 |
<head> |
|
4 |
<meta charset="iso-8859-1"> |
|
5 |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1, charset=iso-8859-1"> |
|
6 |
<title></title> |
|
7 |
<meta name="description" content=""> |
|
8 |
<meta name="viewport" content="width=device-width"> |
|
9 |
||
10 |
<!-- Place favicon.ico and apple-touch-icon.png in the root directory --> |
|
11 |
||
12 |
<link rel="stylesheet" href="css/normalize.css"> |
|
13 |
<link rel="stylesheet" href="css/style.css"> |
|
14 |
<!--<script src="js/vendor/modernizr-2.6.2.min.js"></script>--> |
|
15 |
</head> |
|
16 |
<body> |
|
17 |
<?php |
|
18 |
function removeAccents($str, $charset='utf-8') |
|
19 |
{ |
|
20 |
$str = htmlentities($str, ENT_NOQUOTES, $charset); |
|
21 |
||
22 |
$str = preg_replace('#&([A-za-z])(?:acute|cedil|circ|grave|orn|ring|slash|th|tilde|uml);#', '\1', $str); |
|
23 |
$str = preg_replace('#&([A-za-z]{2})(?:lig);#', '\1', $str); // pour les ligatures e.g. 'œ' |
|
24 |
$str = preg_replace('#&[^;]+;#', '', $str); |
|
25 |
$str = str_replace(' ','',$str); |
|
26 |
||
27 |
return $str; |
|
28 |
} |
|
29 |
function writeLinks(){ |
|
30 |
$document = 'mots.xml'; |
|
31 |
$document_xml = new DomDocument(); |
|
32 |
$document_xml->load($document); |
|
33 |
$elements = $document_xml->getElementsByTagName('glossaire'); |
|
34 |
$resultat_html = ''; |
|
35 |
$arbre = $elements->item(0); |
|
36 |
||
37 |
$mots = $arbre -> childNodes; |
|
38 |
||
39 |
$monfichier = fopen('mots.txt', 'r+'); |
|
40 |
fseek($monfichier, 0); |
|
41 |
||
42 |
$value = 0; |
|
43 |
||
44 |
foreach($mots as $mot){ |
|
45 |
if($mot->hasChildNodes()){ |
|
46 |
if($mot->hasAttributes()){ |
|
47 |
$wordName = $mot -> getAttribute('name'); |
|
48 |
$wordName = removeAccents($wordName); |
|
49 |
$wordName = strtolower($wordName); |
|
50 |
echo($wordName); |
|
51 |
} |
|
52 |
else{ |
|
53 |
echo($mot -> nodeValue); |
|
54 |
} |
|
55 |
||
56 |
if(isset($wordName)){ |
|
1
f6eb5a861d2f
remove unnessary files. Make timthumb work
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
57 |
$wordUrl = 'http://enmi-conf.org/enmi12/glossaire/index.php?mot=' . $wordName; |
0 | 58 |
} |
59 |
else{ |
|
60 |
echo($mot -> nodeValue); |
|
61 |
} |
|
62 |
||
63 |
fseek($monfichier, 0, SEEK_END); |
|
64 |
||
65 |
if(isset($wordName) && isset($wordUrl)){ |
|
66 |
fputs($monfichier, ' |
|
67 |
<link wordName="' . $wordName . '"> |
|
68 |
' . $wordUrl . ' |
|
69 |
</link>'); |
|
70 |
$value++; |
|
71 |
echo($value); |
|
72 |
} |
|
73 |
} |
|
74 |
||
75 |
} |
|
76 |
||
77 |
fclose($monfichier); |
|
78 |
||
79 |
} |
|
80 |
||
81 |
writeLinks(); |
|
82 |
?> |
|
83 |
</body> |
|
1
f6eb5a861d2f
remove unnessary files. Make timthumb work
ymh <ymh.work@gmail.com>
parents:
0
diff
changeset
|
84 |
</html> |