本文整理匯總了PHP中SyncObject::getUnsetVars方法的典型用法代碼示例。如果您正苦於以下問題:PHP SyncObject::getUnsetVars方法的具體用法?PHP SyncObject::getUnsetVars怎麽用?PHP SyncObject::getUnsetVars使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SyncObject
的用法示例。
在下文中一共展示了SyncObject::getUnsetVars方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setPropsInMAPI
/**
* Sets the properties in a MAPI object according to an Sync object and a property mapping
*
* @param mixed $mapimessage
* @param SyncObject $message
* @param array $mapping
*
* @access private
* @return
*/
private function setPropsInMAPI($mapimessage, $message, $mapping)
{
$mapiprops = $this->getPropIdsFromStrings($mapping);
$unsetVars = $message->getUnsetVars();
$propsToDelete = array();
$propsToSet = array();
foreach ($mapiprops as $asprop => $mapiprop) {
if (isset($message->{$asprop})) {
// UTF8->windows1252.. this is ok for all numerical values
if (mapi_prop_type($mapiprop) != PT_BINARY && mapi_prop_type($mapiprop) != PT_MV_BINARY) {
if (is_array($message->{$asprop})) {
$value = array_map("u2wi", $message->{$asprop});
} else {
$value = u2wi($message->{$asprop});
}
} else {
$value = $message->{$asprop};
}
// Make sure the php values are the correct type
switch (mapi_prop_type($mapiprop)) {
case PT_BINARY:
case PT_STRING8:
settype($value, "string");
break;
case PT_BOOLEAN:
settype($value, "boolean");
break;
case PT_SYSTIME:
case PT_LONG:
settype($value, "integer");
break;
}
// decode base64 value
if ($mapiprop == PR_RTF_COMPRESSED) {
$value = base64_decode($value);
if (strlen($value) == 0) {
continue;
}
// PDA will sometimes give us an empty RTF, which we'll ignore.
// Note that you can still remove notes because when you remove notes it gives
// a valid compressed RTF with nothing in it.
}
// if an "empty array" is to be saved, it the mvprop should be deleted - fixes Mantis #468
if (is_array($value) && empty($value)) {
$propsToDelete[] = $mapiprop;
ZLog::Write(LOGLEVEL_DEBUG, sprintf("MAPIProvider->setPropsInMAPI(): Property '%s' to be deleted as it is an empty array", $asprop));
} else {
// all properties will be set at once
$propsToSet[$mapiprop] = $value;
}
} elseif (in_array($asprop, $unsetVars)) {
$propsToDelete[] = $mapiprop;
}
}
mapi_setprops($mapimessage, $propsToSet);
if (mapi_last_hresult()) {
Zlog::Write(LOGLEVEL_WARN, sprintf("Failed to set properties, trying to set them separately. Error code was:%x", mapi_last_hresult()));
$this->setPropsIndividually($mapimessage, $propsToSet, $mapiprops);
}
mapi_deleteprops($mapimessage, $propsToDelete);
//clean up
unset($unsetVars, $propsToDelete);
}