function pmpapi_pull_parse_doc_metadata in Public Media Platform API Integration 7
Parses out metadata from PMP docs.
Parameters
$docs array: PMP docs to be parsed
Return value
array All parsed metadata, one element per doc
1 call to pmpapi_pull_parse_doc_metadata()
- pmpapi_pull_filter_form in pmpapi_pull/
pmpapi_pull.pages.inc - Form constructor for the PMPAPI pull search form.
File
- pmpapi_pull/
pmpapi_pull.pages.inc, line 211
Code
function pmpapi_pull_parse_doc_metadata($docs) {
$metadata = array();
$pulling = variable_get('pmpapi_pull_pull_active');
foreach ($docs as $doc) {
$title = $doc->attributes->title;
$pieces = explode('/', $doc->links->profile[0]->href);
$profile = array_pop($pieces);
$guid = $doc->attributes->guid;
$api_date = $doc->attributes->published;
$timestamp = strtotime($api_date);
$pub_date = format_date($timestamp, 'custom', 'D, M jS Y \\a\\t g:i a');
$been_pulled = pmpapi_pull_doc_has_been_pulled($guid);
$mapped_profile = pmpapi_pull_find_mapped_entity($profile);
if (!$pulling || !$mapped_profile || pmpapi_get_eid_from_guid($guid) && !$been_pulled) {
$preview = check_plain($title);
}
elseif ($been_pulled) {
$preview = check_plain($title) . ' ' . l('[' . t('Re-pull') . ']', 'admin/content/pmp/preview/' . $guid);
}
else {
$preview = l($title, 'admin/content/pmp/preview/' . $guid);
}
$metadata[] = array(
$preview,
$profile,
$guid,
$pub_date,
);
}
return $metadata;
}