Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/* vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +----------------------------------------------------------------------+
4
// | PHP version 5                                                        |
5
// +----------------------------------------------------------------------+
6
// | Copyright (c) 2004-2007, 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 286753 2009-08-03 19:37:03Z mrook $
45
//
46
 
47
/**
48
 * @package     VersionControl_SVN
49
 * @category    VersionControl
50
 * @author      Clay Loveless <clay@killersoft.com>
51
 */
52
 
53
/**
54
 * VersionControl_SVN_Log allows for XML formatted output. XML_Parser is used to
55
 * manipulate that output.
56
 */
57
require_once 'XML/Parser.php';
58
 
59
/**
60
 * Class VersionControl_SVN_Log_Parser - XML Parser for Subversion Log output
61
 *
62
 * @package  VersionControl_SVN
63
 * @version  0.3.4
64
 * @category SCM
65
 * @author   Clay Loveless <clay@killersoft.com>
66
 */
67
class VersionControl_SVN_Log_Parser extends XML_Parser
68
{
69
    var $cdata;
70
    var $revision;
71
    var $logentry;
72
    var $action;
73
    var $paths;
74
    var $pathentry;
75
    var $log;
76
 
77
    function startHandler($xp, $element, &$attribs)
78
    {
79
        switch ($element) {
80
            case 'LOGENTRY':
81
                $this->revision = $attribs['REVISION'];
82
                $this->logentry = array();
83
                break;
84
            case 'AUTHOR':
85
            case 'DATE':
86
            case 'MSG':
87
                $this->cdata = '';
88
                break;
89
            case 'PATHS':
90
                $this->paths = array();
91
                break;
92
            case 'PATH':
93
                $this->action = $attribs['ACTION'];
94
                $this->cdata = '';
95
                break;
96
        }
97
    }
98
 
99
    function cdataHandler($xp, $data)
100
    {
101
        $this->cdata .= $data;
102
    }
103
 
104
    function endHandler($xp, $element)
105
    {
106
        switch($element) {
107
            case 'AUTHOR':
108
            case 'DATE':
109
            case 'MSG':
110
                $this->logentry[$element] = $this->cdata;
111
                break;
112
            case 'PATH':
113
                $this->paths[] = array($element => $this->cdata, 'ACTION' => $this->action);
114
                break;
115
            case 'PATHS':
116
                $this->logentry[$element] = $this->paths;
117
                break;
118
            case 'LOGENTRY':
119
                $this->logentry['REVISION'] = $this->revision;
120
                $this->log[] = $this->logentry;
121
                break;
122
        }
123
    }
124
}
125
?>