當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SyncObject::getUnsetVars方法代碼示例

本文整理匯總了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);
 }
開發者ID:BackupTheBerlios,項目名稱:z-push-svn,代碼行數:73,代碼來源:mapiprovider.php


注:本文中的SyncObject::getUnsetVars方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。