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