Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions ting_covers.pages.inc
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@
/**
* Return the URL for the cover of an object.
*/
function ting_covers_objects() {
function ting_covers_objects($http_request = TRUE, $cover_data = array()) {
$covers = array();
$image_styles = array();
$missing_images_local_ids = array();

foreach ($_POST['coverData'] as $cover_info) {
if ($http_request) {
$cover_data = $_POST['coverData'];
}
elseif (!$http_request && empty($cover_data)) {
return $covers;
}

foreach ($cover_data as $cover_info) {
// Determine if the local id is a known negative.
if (cache_get('ting_covers:' . $cover_info['local_id'], FALSE)) {
break;
Expand Down Expand Up @@ -81,7 +88,12 @@ function ting_covers_objects() {
}

// Return all image information.
drupal_json_output($covers);
if ($http_request) {
drupal_json_output($covers);
}
else {
return $covers;
}
}

/**
Expand Down