Refactor
This commit is contained in:
parent
8fbe7682e7
commit
3a239019e3
4 changed files with 9 additions and 7 deletions
|
@ -19,6 +19,7 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
|||
case 'GET':
|
||||
if (isset($_GET['userid']) || isset($_SESSION['user']['id'])) {
|
||||
$user = isset($_GET['userid']) ? new User($_GET['userid']) : new User();
|
||||
|
||||
$wishlists = $user->getWishlists();
|
||||
$wishlists = array_map(function ($dataWishlist) {
|
||||
$data = $dataWishlist;
|
||||
|
@ -31,6 +32,7 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
|||
|
||||
return $data;
|
||||
}, $wishlists);
|
||||
|
||||
$response['results'] = $wishlists;
|
||||
$response['success'] = true;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ $(function() {
|
|||
on: 'now',
|
||||
onSuccess: function(response, element, xhr) {
|
||||
wishlists = response.results;
|
||||
console.log(wishlists);
|
||||
|
||||
element.dropdown({
|
||||
values: wishlists,
|
||||
|
|
|
@ -52,9 +52,10 @@ class EmbedCache
|
|||
$info_simplified->providerUrl = '';
|
||||
$info_simplified->publishedTime = '';
|
||||
$info_simplified->redirect = '';
|
||||
$info_simplified->title = '';
|
||||
$info_simplified->url = '';
|
||||
$info_simplified->title = $url;
|
||||
$info_simplified->url = $url;
|
||||
|
||||
/*
|
||||
try {
|
||||
$info = $embed->get($url);
|
||||
|
||||
|
@ -78,13 +79,13 @@ class EmbedCache
|
|||
$info_simplified->title = (string) $info->title;
|
||||
$info_simplified->url = (string) $info->url;
|
||||
} catch (\Throwable $ex) {
|
||||
$info_simplified->title = (string) $ex->getMessage();
|
||||
$info_simplified->url = (string) $url;
|
||||
$info_simplified->title = $ex->getMessage();
|
||||
}
|
||||
*/
|
||||
|
||||
$info = $info_simplified;
|
||||
|
||||
file_put_contents($filepath, json_encode($info));
|
||||
// file_put_contents($filepath, json_encode($info));
|
||||
}
|
||||
|
||||
return $info;
|
||||
|
|
|
@ -62,7 +62,7 @@ class Wishlist
|
|||
ob_start();
|
||||
|
||||
/**
|
||||
* Exclude
|
||||
* Options
|
||||
*/
|
||||
$exclude = isset($options['exclude']) ? $options['exclude'] : array();
|
||||
|
||||
|
|
Loading…
Reference in a new issue