HTTP_WebDAV_Client
[ class tree: HTTP_WebDAV_Client ] [ index: HTTP_WebDAV_Client ] [ all elements ]

Source for file _parse_lock_response.php

Documentation is available at _parse_lock_response.php

  1. <?php
  2.  
  3.     // helper class for parsing LOCK request bodies
  4. class HTTP_WebDAV_Client_parse_lock_response
  5. {
  6.     var $locktoken "";
  7.     var $collect_locktoken = false;
  8.         
  9.     function HTTP_WebDAV_Client_parse_lock_response($response
  10.     {
  11.         $xml_parser xml_parser_create_ns("UTF-8"" ");
  12.         xml_set_element_handler($xml_parser,
  13.                                 array(&$this"_startElement"),
  14.                                 array(&$this"_endElement"));
  15.         xml_set_character_data_handler($xml_parser,
  16.                                        array(&$this"_data"));
  17.         xml_parser_set_option($xml_parser,
  18.                               XML_OPTION_CASE_FOLDINGfalse);
  19.  
  20.         $this->success xml_parse($xml_parser$responsetrue);
  21.     
  22.         xml_parser_free($xml_parser);
  23.     }
  24.     
  25.  
  26.     function _startElement($parser$name$attrs
  27.     {
  28.         if (strstr($name" ")) {
  29.             list($ns$tagexplode(" "$name);
  30.         else {
  31.             $ns  "";
  32.             $tag $name;
  33.         }
  34.  
  35.         if ($ns == "DAV:"{
  36.             switch ($tag{
  37.             case "locktoken":
  38.                 $this->collect_locktoken = true;
  39.                 break;
  40.             }
  41.         }
  42.     }
  43.  
  44.     function _data($parser$data
  45.     {
  46.         if ($this->collect_locktoken{
  47.             $this->locktoken .= $data;
  48.         }
  49.     }
  50.  
  51.     function _endElement($parser$name
  52.     {
  53.         if (strstr($name" ")) {
  54.             list($ns$tagexplode(" "$name);
  55.         else {
  56.             $ns  "";
  57.             $tag $name;
  58.         }
  59.  
  60.         switch ($tag{
  61.         case "locktoken":
  62.             $this->collect_locktoken = false;
  63.             $this->locktoken trim($this->locktoken);
  64.             break;
  65.         }
  66.     }
  67. }
  68.  
  69. /*
  70.  * Local variables:
  71.  * tab-width: 4
  72.  * c-basic-offset: 4
  73.  * indent-tabs-mode:nil
  74.  * End:
  75.  */

Documentation generated on Mon, 11 Mar 2019 15:46:45 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.