/
deprecatedWriter.php
200 lines (175 loc) · 7.48 KB
/
deprecatedWriter.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?php
/*
PHPDoctor: The PHP Documentation Creator
Copyright (C) 2005 Paul James <paul@peej.co.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/** This generates the deprecated elements index.
*
* @package PHPDoctor\Doclets\Github
*/
class DeprecatedWriter extends MDWriter {
/** Build the deprecated index.
*
* @param Doclet doclet
*/
function deprecatedWriter(&$doclet) {
parent::MDWriter($doclet);
//$this->_id = "definition";
$rootDoc = & $this->_doclet->rootDoc();
$deprecatedClasses = array();
$classes = & $rootDoc->classes();
$deprecatedFields = array();
$deprecatedMethods = array();
if ($classes) {
foreach ($classes as $class) {
if ($class->tags("@deprecated")) {
$deprecatedClasses[] = $class;
}
$fields = & $class->fields();
if ($fields) {
foreach ($fields as $field) {
if ($field->tags("@deprecated")) {
$deprecatedFields[] = $field;
}
}
}
$classes = & $class->methods();
if ($classes) {
foreach ($classes as $method) {
if ($method->tags("@deprecated")) {
$deprecatedMethods[] = $method;
}
}
}
}
}
$deprecatedGlobals = array();
$globals = & $rootDoc->globals();
if ($globals) {
foreach ($globals as $global) {
if ($global->tags("@deprecated")) {
$deprecatedGlobals[] = $global;
}
}
}
$deprecatedFunctions = array();
$functions = & $rootDoc->functions();
if ($functions) {
foreach ($functions as $function) {
if ($function->tags("@deprecated")) {
$deprecatedFunctions[] = $function;
}
}
}
ob_start();
echo "- - -\n\n";
echo "#Deprecated API#\n\n";
echo "- - -\n\n";
if ($deprecatedClasses || $deprecatedFields || $deprecatedMethods || $deprecatedGlobals || $deprecatedFunctions) {
echo "##Contents##\n\n";
if ($deprecatedClasses) {
echo "\n* <a href=\"#deprecated_class\">Deprecated Classes</a>";
}
if ($deprecatedFields) {
echo "\n* <a href=\"#deprecated_field\">Deprecated Fields</a>";
}
if ($deprecatedMethods) {
echo "\n* <a href=\"#deprecated_method\">Deprecated Methods</a>";
}
if ($deprecatedGlobals) {
echo "\n* <a href=\"#deprecated_global\">Deprecated Globals</a>";
}
if ($deprecatedFunctions) {
echo "\n* <a href=\"#deprecated_function\">Deprecated Functions</a>";
}
}
if ($deprecatedClasses) {
echo "\n\n<table id=\"deprecated_class\" class=\"detail\">", "\n";
echo "<tr><th colspan=\"2\">Deprecated Classes</th></tr>", "\n";
foreach ($deprecatedClasses as $class) {
$textTag = & $class->tags("@text");
echo "<tr><td class=\"name\"><a href=\"", $this->_asURL($class), "\">", $class->qualifiedName(), "</a></td>";
echo "<td class=\"description\">";
if ($textTag)
echo strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>");
echo "</td></tr>\n";
}
echo "</table>\n\n";
}
if ($deprecatedFields) {
echo "<table id=\"deprecated_field\" class=\"detail\">", "\n";
echo "<tr><th colspan=\"2\" class=\"title\">Deprecated Fields</th></tr>", "\n";
foreach ($deprecatedFields as $field) {
$textTag = & $field->tags("@text");
echo "<tr>\n";
echo "<td class=\"name\"><a href=\"", $this->_asURL($field), "\">", $field->qualifiedName(), "</a></td>\n";
echo "<td class=\"description\">";
if ($textTag)
echo strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>");
echo "</td>\n";
echo "</tr>\n";
}
echo "</table>\n\n";
}
if ($deprecatedMethods) {
echo "<table id=\"deprecated_method\" class=\"detail\">", "\n";
echo "<tr><th colspan=\"2\" class=\"title\">Deprecated Methods</th></tr>", "\n";
foreach ($deprecatedMethods as $method) {
$textTag = & $method->tags("@text");
echo "<tr>\n";
echo "<td class=\"name\"><a href=\"", $this->_asURL($method), "\">", $method->qualifiedName(), "</a></td>\n";
echo "<td class=\"description\">";
if ($textTag)
echo strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>");
echo "</td>\n";
echo "</tr>\n";
}
echo "</table>\n\n";
}
if ($deprecatedGlobals) {
echo "<table id=\"deprecated_global\" class=\"detail\">", "\n";
echo "<tr><th colspan=\"2\" class=\"title\">Deprecated Globals</th></tr>", "\n";
foreach ($deprecatedGlobals as $global) {
$textTag = & $global->tags("@text");
echo "<tr>\n";
echo "<td class=\"name\"><a href=\"", $this->_asURL($global), "\">", $global->qualifiedName(), "</a></td>\n";
echo "<td class=\"description\">";
if ($textTag)
echo strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>");
echo "</td>\n";
echo "</tr>\n";
}
echo "</table>\n\n";
}
if ($deprecatedFunctions) {
echo "<table id=\"deprecated_function\" class=\"detail\">", "\n";
echo "<tr><th colspan=\"2\" class=\"title\">Deprecated Functions</th></tr>", "\n";
foreach ($deprecatedFunctions as $function) {
$textTag = & $function->tags("@text");
echo "<tr>\n";
echo "<td class=\"name\"><a href=\"", $this->_asURL($function), "\">", $function->qualifiedName(), "</a></td>\n";
echo "<td class=\"description\">";
if ($textTag)
echo strip_tags($this->_processInlineTags($textTag, TRUE), "<a><b>**<u><em>");
echo "</td>\n";
echo "</tr>\n";
}
echo "</table>\n\n";
}
$this->_output = ob_get_contents();
ob_end_clean();
$this->_write("deprecated-list.md");
}
}
?>