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


PHP DAV\PropPatch類代碼示例

本文整理匯總了PHP中Sabre\DAV\PropPatch的典型用法代碼示例。如果您正苦於以下問題:PHP PropPatch類的具體用法?PHP PropPatch怎麽用?PHP PropPatch使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了PropPatch類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: updateAddressBook

 /**
  * Updates properties for an address book.
  *
  * The list of mutations is stored in a Sabre\DAV\PropPatch object.
  * To do the actual updates, you must tell this object which properties
  * you're going to process with the handle() method.
  *
  * Calling the handle method is like telling the PropPatch object "I
  * promise I can handle updating this property".
  *
  * Read the PropPatch documenation for more info and examples.
  *
  * @param string $addressBookId
  * @param \Sabre\DAV\PropPatch $propPatch
  * @return void
  */
 public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch)
 {
     foreach ($this->addressBooks as &$book) {
         if ($book['id'] !== $addressBookId) {
             continue;
         }
         $propPatch->handleRemaining(function ($mutations) use(&$book) {
             foreach ($mutations as $key => $value) {
                 $book[$key] = $value;
             }
             return true;
         });
     }
 }
開發者ID:sebbie42,項目名稱:casebox,代碼行數:30,代碼來源:Mock.php

示例2: propPatch

 public function propPatch($path, DAV\PropPatch $propPatch)
 {
     $node = $this->server->tree->getNodeForPath($path);
     // The File object is the only thing we can change properties on:
     if (!$node instanceof \SambaDAV\File) {
         return;
     }
     // These properties are silently ignored for now;
     // smbclient has no 'touch' command; for documentation purposes:
     //  {urn:schemas-microsoft-com:}Win32CreationTime
     //  {urn:schemas-microsoft-com:}Win32LastAccessTime
     //  {urn:schemas-microsoft-com:}Win32LastModifiedTime
     $handled = ['{DAV:}ishidden', '{DAV:}isreadonly', '{urn:schemas-microsoft-com:}Win32FileAttributes'];
     $propPatch->handle($handled, [$node, 'updateProperties']);
 }
開發者ID:krekike,項目名稱:sambadav,代碼行數:15,代碼來源:MSPropertiesPlugin.php

示例3: propPatch

 /**
  * Updates properties for a path
  *
  * This method received a PropPatch object, which contains all the
  * information about the update.
  *
  * Usually you would want to call 'handleRemaining' on this object, to get;
  * a list of all properties that need to be stored.
  *
  * @param string $path
  * @param PropPatch $propPatch
  * @return void
  */
 function propPatch($path, PropPatch $propPatch)
 {
     $propPatch->handleRemaining(function ($properties) use($path) {
         $updateStmt = $this->pdo->prepare("REPLACE INTO propertystorage (path, name, value) VALUES (?, ?, ?)");
         $deleteStmt = $this->pdo->prepare("DELETE FROM propertystorage WHERE path = ? AND name = ?");
         foreach ($properties as $name => $value) {
             if (!is_null($value)) {
                 $updateStmt->execute([$path, $name, $value]);
             } else {
                 $deleteStmt->execute([$path, $name]);
             }
         }
         return true;
     });
 }
開發者ID:MetallianFR68,項目名稱:myroundcube,代碼行數:28,代碼來源:PDO.php

示例4: updateAddressBook

 /**
  * Updates properties for an address book.
  *
  * The list of mutations is stored in a Sabre\DAV\PropPatch object.
  * To do the actual updates, you must tell this object which properties
  * you're going to process with the handle() method.
  *
  * Calling the handle method is like telling the PropPatch object "I
  * promise I can handle updating this property".
  *
  * Read the PropPatch documenation for more info and examples.
  *
  * @param string $addressBookId
  * @param \Sabre\DAV\PropPatch $propPatch
  * @return void
  */
 function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch)
 {
     $supportedProperties = ['{DAV:}displayname', '{' . Plugin::NS_CARDDAV . '}addressbook-description'];
     $propPatch->handle($supportedProperties, function ($mutations) use($addressBookId) {
         $updates = [];
         foreach ($mutations as $property => $newValue) {
             switch ($property) {
                 case '{DAV:}displayname':
                     $updates['displayname'] = $newValue;
                     break;
                 case '{' . Plugin::NS_CARDDAV . '}addressbook-description':
                     $updates['description'] = $newValue;
                     break;
             }
         }
         $query = $this->db->getQueryBuilder();
         $query->update('addressbooks');
         foreach ($updates as $key => $value) {
             $query->set($key, $query->createNamedParameter($value));
         }
         $query->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId)))->execute();
         $this->addChange($addressBookId, "", 2);
         return true;
     });
 }
開發者ID:quality123,項目名稱:core,代碼行數:41,代碼來源:carddavbackend.php

示例5: updateAddressBook

 /**
  * Updates properties for an address book.
  *
  * The list of mutations is stored in a Sabre\DAV\PropPatch object.
  * To do the actual updates, you must tell this object which properties
  * you're going to process with the handle() method.
  *
  * Calling the handle method is like telling the PropPatch object "I
  * promise I can handle updating this property".
  *
  * Read the PropPatch documenation for more info and examples.
  *
  * @param string $addressBookId
  * @param \Sabre\DAV\PropPatch $propPatch
  * @return void
  */
 function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch)
 {
     $supportedProperties = ['{DAV:}displayname', '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description'];
     $propPatch->handle($supportedProperties, function ($mutations) use($addressBookId) {
         $updates = [];
         foreach ($mutations as $property => $newValue) {
             switch ($property) {
                 case '{DAV:}displayname':
                     $updates['displayname'] = $newValue;
                     break;
                 case '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description':
                     $updates['description'] = $newValue;
                     break;
             }
         }
         $query = 'UPDATE ' . $this->addressBooksTableName . ' SET ';
         $first = true;
         foreach ($updates as $key => $value) {
             if ($first) {
                 $first = false;
             } else {
                 $query .= ', ';
             }
             $query .= ' `' . $key . '` = :' . $key . ' ';
         }
         $query .= ' WHERE id = :addressbookid';
         $stmt = $this->pdo->prepare($query);
         $updates['addressbookid'] = $addressBookId;
         $stmt->execute($updates);
         $this->addChange($addressBookId, "", 2);
         return true;
     });
 }
開發者ID:mattes,項目名稱:sabre-dav,代碼行數:49,代碼來源:PDO.php

示例6: propPatch

 /**
  * Updates properties on this node.
  *
  * This method received a PropPatch object, which contains all the
  * information about the update.
  *
  * To update specific properties, call the 'handle' method on this object.
  * Read the PropPatch documentation for more information.
  *
  * @param PropPatch $propPatch
  * @return void
  */
 function propPatch(PropPatch $propPatch)
 {
     $propPatch->handleRemaining(function (array $properties) {
         $resourceData = $this->getResourceData();
         foreach ($properties as $propertyName => $propertyValue) {
             // If it was null, we need to delete the property
             if (is_null($propertyValue)) {
                 unset($resourceData['properties'][$propertyName]);
             } else {
                 $resourceData['properties'][$propertyName] = $propertyValue;
             }
         }
         $this->putResourceData($resourceData);
         return true;
     });
 }
開發者ID:bogolubov,項目名稱:owncollab_talks-1,代碼行數:28,代碼來源:Node.php

示例7: propPatch

 /**
  * Updates properties for a path
  *
  * This method received a PropPatch object, which contains all the
  * information about the update.
  *
  * Usually you would want to call 'handleRemaining' on this object, to get;
  * a list of all properties that need to be stored.
  *
  * @param string $path
  * @param PropPatch $propPatch
  * @return void
  */
 function propPatch($path, PropPatch $propPatch)
 {
     if (!isset($this->data[$path])) {
         $this->data[$path] = [];
     }
     $propPatch->handleRemaining(function ($properties) use($path) {
         foreach ($properties as $propName => $propValue) {
             if (is_null($propValue)) {
                 unset($this->data[$path][$propName]);
             } else {
                 $this->data[$path][$propName] = $propValue;
             }
             return true;
         }
     });
 }
開發者ID:jakobsack,項目名稱:sabre-dav,代碼行數:29,代碼來源:Mock.php

示例8: propPatch

 /**
  * Updates properties on this node.
  *
  * This method received a PropPatch object, which contains all the
  * information about the update.
  *
  * To update specific properties, call the 'handle' method on this object.
  * Read the PropPatch documentation for more information.
  *
  * @param array $mutations
  * @return bool|array
  */
 public function propPatch(PropPatch $proppatch)
 {
     $proppatch->handleRemaining(function ($updateProperties) {
         switch ($this->failMode) {
             case 'updatepropsfalse':
                 return false;
             case 'updatepropsarray':
                 $r = [];
                 foreach ($updateProperties as $k => $v) {
                     $r[$k] = 402;
                 }
                 return $r;
             case 'updatepropsobj':
                 return new \STDClass();
         }
     });
 }
開發者ID:MetallianFR68,項目名稱:myroundcube,代碼行數:29,代碼來源:PropertiesCollection.php

示例9: updateAddressBook

 /**
  * Updates an addressbook's properties
  *
  * See \Sabre\DAV\IProperties for a description of the mutations array, as
  * well as the return value.
  *
  * @param mixed $addressbookid
  * @see \Sabre\DAV\IProperties::updateProperties
  * @return bool|array
  */
 public function updateAddressBook($addressbookid, PropPatch $propPatch)
 {
     $changes = array();
     $mutations = $propPatch->getRemainingMutations();
     foreach ($mutations as $property => $newvalue) {
         switch ($property) {
             case '{DAV:}displayname':
                 $changes['displayname'] = $newvalue;
                 break;
             case '{' . \Sabre\CardDAV\Plugin::NS_CARDDAV . '}addressbook-description':
                 $changes['description'] = $newvalue;
                 break;
             default:
                 // If any unsupported values were being updated, we must
                 // let the entire request fail.
                 return false;
         }
     }
     list($id, $backend) = $this->getBackendForAddressBook($addressbookid);
     return $backend->updateAddressBook($id, $changes);
 }
開發者ID:s3menzer,項目名稱:contacts,代碼行數:31,代碼來源:backend.php

示例10: updateCalendar

 /**
  * Updates properties for a calendar.
  *
  * The list of mutations is stored in a Sabre\DAV\PropPatch object.
  * To do the actual updates, you must tell this object which properties
  * you're going to process with the handle() method.
  *
  * Calling the handle method is like telling the PropPatch object "I
  * promise I can handle updating this property".
  *
  * Read the PropPatch documentation for more info and examples.
  *
  * @param mixed $calendarId
  * @param \Sabre\DAV\PropPatch $propPatch
  * @return void
  */
 function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch)
 {
     $propPatch->handleRemaining(function ($props) use($calendarId) {
         foreach ($this->calendars as $k => $calendar) {
             if ($calendar['id'] === $calendarId) {
                 foreach ($props as $propName => $propValue) {
                     if (is_null($propValue)) {
                         unset($this->calendars[$k][$propName]);
                     } else {
                         $this->calendars[$k][$propName] = $propValue;
                     }
                 }
                 return true;
             }
         }
     });
 }
開發者ID:BlaBlaNet,項目名稱:hubzilla,代碼行數:33,代碼來源:Mock.php

示例11: updatePrincipal

 /**
  * Updates one ore more webdav properties on a principal.
  *
  * The list of mutations is stored in a Sabre\DAV\PropPatch object.
  * To do the actual updates, you must tell this object which properties
  * you're going to process with the handle() method.
  *
  * Calling the handle method is like telling the PropPatch object "I
  * promise I can handle updating this property".
  *
  * Read the PropPatch documenation for more info and examples.
  *
  * @param string $path
  * @param \Sabre\DAV\PropPatch $propPatch
  */
 public function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch)
 {
     $value = null;
     foreach ($this->principals as $principalIndex => $value) {
         if ($value['uri'] === $path) {
             $principal = $value;
             break;
         }
     }
     if (!$principal) {
         return;
     }
     $propPatch->handleRemaining(function ($mutations) use($principal, $principalIndex) {
         foreach ($mutations as $prop => $value) {
             if (is_null($value) && isset($principal[$prop])) {
                 unset($principal[$prop]);
             } else {
                 $principal[$prop] = $value;
             }
         }
         $this->principals[$principalIndex] = $principal;
         return true;
     });
 }
開發者ID:mattes,項目名稱:sabre-dav,代碼行數:39,代碼來源:Mock.php

示例12: propPatch

 /**
  * Updates properties on this node.
  *
  * This method received a PropPatch object, which contains all the
  * information about the update.
  *
  * To update specific properties, call the 'handle' method on this object.
  * Read the PropPatch documentation for more information.
  *
  * @param PropPatch $propPatch
  * @return void
  */
 function propPatch(PropPatch $propPatch)
 {
     // other properties than 'message' are read only
     $propPatch->handle(self::PROPERTY_NAME_MESSAGE, [$this, 'updateComment']);
 }
開發者ID:GitHubUser4234,項目名稱:core,代碼行數:17,代碼來源:CommentNode.php

示例13: handleUpdateProperties

 /**
  * Update ownCloud-specific properties
  *
  * @param string $path
  * @param PropPatch $propPatch
  *
  * @return void
  */
 public function handleUpdateProperties($path, PropPatch $propPatch)
 {
     $propPatch->handle(self::GETLASTMODIFIED_PROPERTYNAME, function ($time) use($path) {
         if (empty($time)) {
             return false;
         }
         $node = $this->tree->getNodeForPath($path);
         if (is_null($node)) {
             return 404;
         }
         $node->touch($time);
         return true;
     });
     $propPatch->handle(self::GETETAG_PROPERTYNAME, function ($etag) use($path) {
         if (empty($etag)) {
             return false;
         }
         $node = $this->tree->getNodeForPath($path);
         if (is_null($node)) {
             return 404;
         }
         if ($node->setEtag($etag) !== -1) {
             return true;
         }
         return false;
     });
 }
開發者ID:brunomilet,項目名稱:owncloud-core,代碼行數:35,代碼來源:filesplugin.php

示例14: propPatch

 /**
  * @inheritdoc
  */
 function propPatch(PropPatch $propPatch)
 {
     $propPatch->handle(self::PROPERTY_NAME_READ_MARKER, [$this, 'setReadMarker']);
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:7,代碼來源:EntityCollection.php

示例15: updateProperties

    /**
     * This method updates a resource's properties
     *
     * The properties array must be a list of properties. Array-keys are
     * property names in clarknotation, array-values are it's values.
     * If a property must be deleted, the value should be null.
     *
     * Note that this request should either completely succeed, or
     * completely fail.
     *
     * The response is an array with properties for keys, and http status codes
     * as their values.
     *
     * @param string $path
     * @param array $properties
     * @return array
     */
    function updateProperties($path, array $properties) {

        $propPatch = new PropPatch($properties);
        $this->emit('propPatch', [$path, $propPatch]);
        $propPatch->commit();

        return $propPatch->getResult();

    }
開發者ID:nikosv,項目名稱:openeclass,代碼行數:26,代碼來源:Server.php


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