-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
57 lines (47 loc) · 1.73 KB
/
Copy pathtest.php
File metadata and controls
57 lines (47 loc) · 1.73 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
$posD = 0;
$posF = 0;
$lenght = 0;
$i = 0;
$lastPos = 0;
$chaine = "Plus besoin de téléphone ou télécommande pour contrôler ces lumières (e.g Philips HUE), ou bien ces volet roulant, sa cafetière connecté. Le but de ce projet est de créer un système infrarouge polyvalent qui peut s’intégrer partout <img src=\"https://www.erenumerique.fr/articles/7961/Leap_Motion-01.jpg\">";
function getDescImg($chaines, $check){
$posD = strpos($chaines, "<img");
$posF = strpos($chaines, "\">", $posD);
if ($posD != false) {
if ($posF == null) {
$posF = strpos($chaines, "\" >", $posD);
$lenght = $posF - $posD +3;
}else {
$lenght = $posF - $posD +2;
}
$img = substr($chaines, $posD, $lenght);
substr_replace($chaines, "", $posD, $lenght);
if ($check == false) {
$specialChar = nl2br(htmlspecialchars(str_replace("<br />", "", $chaines)));
}else {
$specialChar = nl2br(htmlspecialchars($chaines));
}
$posD = strpos($specialChar, "<img");
$posF = strpos($specialChar, "">", $posD);
if ($posF == null) {
$posF = strpos($specialChar, "" >", $posD);
$lenght = $posF - $posD +11;
}else {
$lenght = $posF - $posD +10;
}
$result = substr_replace($specialChar, $img, $posD, $lenght);
//var_dump($posD);
}else {
if ($check == false) {
$specialChar = nl2br(htmlspecialchars(str_replace("<br />", "", $chaines)));
}else {
$specialChar = nl2br(htmlspecialchars($chaines));
}
$result = $specialChar;
}
//print $img."<br />";
return $result;
}
$descriptionL = getDescImg($chaine, false);
print $descriptionL;