本文整理汇总了PHP中Sabre_DAV_XMLUtil::parseClarkNotation方法的典型用法代码示例。如果您正苦于以下问题:PHP Sabre_DAV_XMLUtil::parseClarkNotation方法的具体用法?PHP Sabre_DAV_XMLUtil::parseClarkNotation怎么用?PHP Sabre_DAV_XMLUtil::parseClarkNotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sabre_DAV_XMLUtil
的用法示例。
在下文中一共展示了Sabre_DAV_XMLUtil::parseClarkNotation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testParseClarkNotationFail
/**
* @expectedException InvalidArgumentException
*/
function testParseClarkNotationFail()
{
Sabre_DAV_XMLUtil::parseClarkNotation('}foo');
}
示例2: propPatch
/**
* Updates a list of properties on the server
*
* The list of properties must have clark-notation properties for the keys,
* and the actual (string) value for the value. If the value is null, an
* attempt is made to delete the property.
*
* @todo Must be building the request using the DOM, and does not yet
* support complex properties.
* @param string $url
* @param array $properties
* @return void
*/
public function propPatch($url, array $properties)
{
$body = '<?xml version="1.0"?>' . "\n";
$body .= '<d:propertyupdate xmlns:d="DAV:">' . "\n";
foreach ($properties as $propName => $propValue) {
list($namespace, $elementName) = Sabre_DAV_XMLUtil::parseClarkNotation($propName);
if ($propValue === null) {
$body .= "<d:remove><d:prop>\n";
if ($namespace === 'DAV:') {
$body .= ' <d:' . $elementName . ' />' . "\n";
} else {
$body .= " <x:" . $elementName . " xmlns:x=\"" . $namespace . "\"/>\n";
}
$body .= "</d:prop></d:remove>\n";
} else {
$body .= "<d:set><d:prop>\n";
if ($namespace === 'DAV:') {
$body .= ' <d:' . $elementName . '>';
} else {
$body .= " <x:" . $elementName . " xmlns:x=\"" . $namespace . "\">";
}
// Shitty.. i know
$body .= htmlspecialchars($propValue, ENT_NOQUOTES, 'UTF-8');
if ($namespace === 'DAV:') {
$body .= '</d:' . $elementName . '>' . "\n";
} else {
$body .= "</x:" . $elementName . ">\n";
}
$body .= "</d:prop></d:set>\n";
}
}
$body .= '</d:propertyupdate>';
$this->request('PROPPATCH', $url, $body, array('Content-Type' => 'application/xml'));
}