PageRenderTime 27ms CodeModel.GetById 5ms RepoModel.GetById 0ms app.codeStats 0ms

/akelos_utils/contrib/pear/VersionControl/SVN/Parsers/Log.php

https://github.com/bermi/akelos
PHP | 125 lines | 58 code | 6 blank | 61 comment | 1 complexity | b81db8fec35371b3d7d06503b79a1261 MD5 | raw file
  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP version 5 |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 2004, Clay Loveless |
  7. // | All rights reserved. |
  8. // +----------------------------------------------------------------------+
  9. // | This LICENSE is in the BSD license style. |
  10. // | http://www.opensource.org/licenses/bsd-license.php |
  11. // | |
  12. // | Redistribution and use in source and binary forms, with or without |
  13. // | modification, are permitted provided that the following conditions |
  14. // | are met: |
  15. // | |
  16. // | * Redistributions of source code must retain the above copyright |
  17. // | notice, this list of conditions and the following disclaimer. |
  18. // | |
  19. // | * Redistributions in binary form must reproduce the above |
  20. // | copyright notice, this list of conditions and the following |
  21. // | disclaimer in the documentation and/or other materials provided |
  22. // | with the distribution. |
  23. // | |
  24. // | * Neither the name of Clay Loveless nor the names of contributors |
  25. // | may be used to endorse or promote products derived from this |
  26. // | software without specific prior written permission. |
  27. // | |
  28. // | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
  29. // | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
  30. // | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
  31. // | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
  32. // | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
  33. // | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
  34. // | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
  35. // | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
  36. // | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
  37. // | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
  38. // | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
  39. // | POSSIBILITY OF SUCH DAMAGE. |
  40. // +----------------------------------------------------------------------+
  41. // | Author: Clay Loveless <clay@killersoft.com> |
  42. // +----------------------------------------------------------------------+
  43. //
  44. // $Id: Log.php 42 2004-04-26 09:39:59Z clay $
  45. //
  46. /**
  47. * @package VersionControl_SVN
  48. * @category VersionControl
  49. * @author Clay Loveless <clay@killersoft.com>
  50. */
  51. /**
  52. * VersionControl_SVN_Log allows for XML formatted output. XML_Parser is used to
  53. * manipulate that output.
  54. */
  55. require_once 'XML/Parser.php';
  56. /**
  57. * Class VersionControl_SVN_Log_Parser - XML Parser for Subversion Log output
  58. *
  59. * @package VersionControl_SVN
  60. * @version @version@
  61. * @category SCM
  62. * @author Clay Loveless <clay@killersoft.com>
  63. */
  64. class VersionControl_SVN_Log_Parser extends XML_Parser
  65. {
  66. var $cdata;
  67. var $revision;
  68. var $logentry;
  69. var $action;
  70. var $paths;
  71. var $pathentry;
  72. var $log;
  73. function startHandler($xp, $element, &$attribs)
  74. {
  75. switch ($element) {
  76. case 'LOGENTRY':
  77. $this->revision = $attribs['REVISION'];
  78. $this->logentry = array();
  79. break;
  80. case 'AUTHOR':
  81. case 'DATE':
  82. case 'MSG':
  83. $this->cdata = '';
  84. break;
  85. case 'PATHS':
  86. $this->paths = array();
  87. break;
  88. case 'PATH':
  89. $this->action = $attribs['ACTION'];
  90. $this->cdata = '';
  91. break;
  92. }
  93. }
  94. function cdataHandler($xp, $data)
  95. {
  96. $this->cdata .= $data;
  97. }
  98. function endHandler($xp, $element)
  99. {
  100. switch($element) {
  101. case 'AUTHOR':
  102. case 'DATE':
  103. case 'MSG':
  104. $this->logentry[$element] = $this->cdata;
  105. break;
  106. case 'PATH':
  107. $this->paths[] = array($element => $this->cdata, 'ACTION' => $this->action);
  108. break;
  109. case 'PATHS':
  110. $this->logentry[$element] = $this->paths;
  111. break;
  112. case 'LOGENTRY':
  113. $this->logentry['REVISION'] = $this->revision;
  114. $this->log[] = $this->logentry;
  115. break;
  116. }
  117. }
  118. }
  119. ?>