本文整理匯總了PHP中Source::setChanged方法的典型用法代碼示例。如果您正苦於以下問題:PHP Source::setChanged方法的具體用法?PHP Source::setChanged怎麽用?PHP Source::setChanged使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Source
的用法示例。
在下文中一共展示了Source::setChanged方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: list
static function &getInstance($data, $simple = true)
{
global $gedcom_record_cache, $GEDCOM, $pgv_changes;
if (is_array($data)) {
$ged_id = $data['ged_id'];
$pid = $data['xref'];
} else {
$ged_id = get_id_from_gedcom($GEDCOM);
$pid = $data;
}
// Check the cache first
if (isset($gedcom_record_cache[$pid][$ged_id])) {
return $gedcom_record_cache[$pid][$ged_id];
}
// Look for the record in the database
if (!is_array($data)) {
$data = fetch_source_record($pid, $ged_id);
// If we didn't find the record in the database, it may be remote
if (!$data && strpos($pid, ':')) {
list($servid, $remoteid) = explode(':', $pid);
$service = ServiceClient::getInstance($servid);
if ($service) {
// TYPE will be replaced with the type from the remote record
$data = $service->mergeGedcomRecord($remoteid, "0 @{$pid}@ TYPE\n1 RFN {$pid}", false);
}
}
// If we didn't find the record in the database, it may be new/pending
if (!$data && PGV_USER_CAN_EDIT && isset($pgv_changes[$pid . '_' . $GEDCOM])) {
$data = find_updated_record($pid);
$fromfile = true;
}
// If we still didn't find it, it doesn't exist
if (!$data) {
return null;
}
}
// Create the object
$object = new Source($data, $simple);
if (!empty($fromfile)) {
$object->setChanged(true);
}
// Store it in the cache
$gedcom_record_cache[$object->xref][$object->ged_id] =& $object;
//-- also store it using its reference id (sid:pid and local gedcom for remote links)
$gedcom_record_cache[$pid][$ged_id] =& $object;
return $object;
}