function pmpapi_doc_is_valid in Public Media Platform API Integration 7
Determines if a given PMP doc is valid (i.e., not embargoed nor expired)
Parameters
$doc object: A PMP doc.
Return value
boolean TRUE if doc is valid, FALSE if not.
1 call to pmpapi_doc_is_valid()
- PMPAPIDrupalPull::saveEntity in pmpapi_pull/
classes/ PMPAPIDrupalPull.php - Saves a PMP doc as an entity.
File
- ./
pmpapi.module, line 623 - Creates basic calls to the PMP API.
Code
function pmpapi_doc_is_valid($doc) {
$now = pmpapi_convert_timestamp();
$from_timestamp = strtotime($doc->attributes->valid->from);
$to_timestamp = strtotime($doc->attributes->valid->to);
$from = pmpapi_convert_timestamp($from_timestamp);
$to = pmpapi_convert_timestamp($to_timestamp);
return $now >= $from && $now <= $to;
}