Create New Item
type
File
Folder
name
Search file in folder and subfolders...
Are you sure want to rename?
/
src
/
controllers
:
api-preferiti.inc.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php header('Access-Control-Allow-Origin: *'); header('Content-Type: text/json; charset="UTF-8"'); # GET if ($_SERVER['REQUEST_METHOD'] == 'GET') { $favourites = $user->get_favourites(); $favourites = array_values(array_filter($favourites, function ($i) { return in_array($i['content_type'], array('blog-article')); })); $result = array( "favourites" => array_map(function ($b) { return $b['content']->json(); }, $favourites), ); # JSON output echo json_encode($result); } # DEFAULT else { header('HTTP/1.0 400 Bad Request', true, 400); header("Content-Type: application/json; charset=utf-8"); echo json_encode(array("error" => "unsupported method")); } ?>