当前位置: 首页>>代码示例>>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;未经允许,请勿转载。