-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers.php
More file actions
55 lines (49 loc) · 1.44 KB
/
helpers.php
File metadata and controls
55 lines (49 loc) · 1.44 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
<?php
function get_file_extension($url) {
$array = explode('.', $url);
return end($array);
}
function get_filename_2($url) {
$array = explode('/', $url);
return end($array);
}
function get_media($media) {
$file_extension = get_file_extension($media);
switch ($file_extension) {
case 'jpg':
case 'JPG':
case 'png':
case 'PNG':
$media = array(
"type" => "image",
"image" => array(
"link" => $media # "https://www.educatout.com/images/medium/Lenfant-qui-veut-controler-les-autres-FB.jpg" # noqa
)
);
break;
case 'mp4':
case 'MP4':
$media = array(
"type" => "video",
"video" => array(
"link" => $media # "https://www.educatout.com/images/medium/Lenfant-qui-veut-controler-les-autres-FB.jpg" # noqa
)
);
break;
case 'pdf':
case 'PDF':
$media = array(
"type" => "document",
"document" => array(
"filename" => get_filename_2($media),
"link" => $media # "https://www.educatout.com/images/medium/Lenfant-qui-veut-controler-les-autres-FB.jpg" # noqa
)
);
break;
default:
$media = null;
break;
}
return $media;
}
?>