-
Notifications
You must be signed in to change notification settings - Fork 158
/
em.php
39 lines (35 loc) · 1011 Bytes
/
em.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
<?php
/**
* Copyright (c) UNA, Inc - https://una.io
* MIT License - https://opensource.org/licenses/MIT
*
* @defgroup UnaCore UNA Core
* @{
*/
require_once('./inc/header.inc.php');
$aEmbedData = BxDolPage::getEmbedData(bx_get('url'));
if(empty($aEmbedData)){
header('HTTP/1.0 404 Not Found');
header('Status: 404 Not Found');
exit();
}
$aResult = [
'version' => '1.0',
'type' => 'rich',
'title' => $aEmbedData['title'],
'url' => $aEmbedData['url'],
'provider_name' => getParam('site_title'),
'provider_url' => BX_DOL_URL_ROOT,
'html' => $aEmbedData['html'],
];
if ($aEmbedData['thumbnail_url']){
$aResult['thumbnail_url'] = $aEmbedData['thumbnail_url'];
}
if ($aEmbedData['author_name']){
$aResult['author_name'] = $aEmbedData['author_name'];
}
if ($aEmbedData['author_url']){
$aResult['author_url'] = $aEmbedData['author_url'];
}
header('Content-Type: application/json; charset=utf-8');
echo json_encode($aResult);