Index: trunk/phase3/includes/api/ApiFormatBase.php |
— | — | @@ -75,40 +75,41 @@ |
76 | 76 | function initPrinter($isError) { |
77 | 77 | $isHtml = $this->getIsHtml(); |
78 | 78 | $mime = $isHtml ? 'text/html' : $this->getMimeType(); |
79 | | - |
| 79 | + |
80 | 80 | // Some printers (ex. Feed) do their own header settings, |
81 | 81 | // in which case $mime will be set to null |
82 | 82 | if (is_null($mime)) |
83 | | - return; // skip any initialization |
84 | | - |
| 83 | + return; // skip any initialization |
| 84 | + |
85 | 85 | header("Content-Type: $mime; charset=utf-8;"); |
86 | 86 | header("Cache-Control: private, s-maxage=0, max-age=0"); |
87 | | - |
| 87 | + |
88 | 88 | if ($isHtml) { |
89 | 89 | ?> |
90 | | - <html> |
91 | | - <head> |
92 | | - <title>MediaWiki API</title> |
93 | | - </head> |
94 | | - <body> |
| 90 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 91 | +<html> |
| 92 | +<head> |
| 93 | + <title>MediaWiki API</title> |
| 94 | +</head> |
| 95 | +<body> |
95 | 96 | <?php |
96 | 97 | |
97 | 98 | |
98 | 99 | if (!$isError) { |
99 | 100 | ?> |
100 | | - <br/> |
101 | | - <small> |
102 | | - You are looking at the HTML representation of the <?=$this->mFormat?> format.<br/> |
103 | | - HTML is good for debugging, but probably not suitable for your application.<br/> |
104 | | - Please see "format" parameter documentation at the <a href='api.php'>API help</a> |
105 | | - for more information.<br/> |
106 | | - </small> |
| 101 | +<br/> |
| 102 | +<small> |
| 103 | +You are looking at the HTML representation of the <?=$this->mFormat?> format.<br/> |
| 104 | +HTML is good for debugging, but probably not suitable for your application.<br/> |
| 105 | +Please see "format" parameter documentation at the <a href='api.php'>API help</a> |
| 106 | +for more information. |
| 107 | +</small> |
107 | 108 | <?php |
108 | 109 | |
109 | 110 | |
110 | 111 | } |
111 | 112 | ?> |
112 | | - <pre> |
| 113 | +<pre> |
113 | 114 | <?php |
114 | 115 | |
115 | 116 | |
— | — | @@ -121,8 +122,10 @@ |
122 | 123 | public function closePrinter() { |
123 | 124 | if ($this->getIsHtml()) { |
124 | 125 | ?> |
125 | | - </pre> |
126 | | - </body> |
| 126 | + |
| 127 | +</pre> |
| 128 | +</body> |
| 129 | +</html> |
127 | 130 | <?php |
128 | 131 | |
129 | 132 | |
— | — | @@ -142,7 +145,7 @@ |
143 | 146 | */ |
144 | 147 | protected function formatHTML($text) { |
145 | 148 | // encode all tags as safe blue strings |
146 | | - $text = ereg_replace('\<([^>]+)\>', '<font color=blue><\1></font>', $text); |
| 149 | + $text = ereg_replace('\<([^>]+)\>', '<span style="color:blue;"><\1></span>', $text); |
147 | 150 | // identify URLs |
148 | 151 | $text = ereg_replace("[a-zA-Z]+://[^ '\"()<\n]+", '<a href="\\0">\\0</a>', $text); |
149 | 152 | // identify requests to api.php |
— | — | @@ -182,7 +185,7 @@ |
183 | 186 | public static function setResult($result, $feed, $feedItems) { |
184 | 187 | // Store output in the Result data. |
185 | 188 | // This way we can check during execution if any error has occured |
186 | | - $data =& $result->getData(); |
| 189 | + $data = & $result->getData(); |
187 | 190 | $data['_feed'] = $feed; |
188 | 191 | $data['_feeditems'] = $feedItems; |
189 | 192 | } |
— | — | @@ -200,15 +203,15 @@ |
201 | 204 | public function getNeedsRawData() { |
202 | 205 | return true; |
203 | 206 | } |
204 | | - |
| 207 | + |
205 | 208 | public function execute() { |
206 | | - $data =& $this->getResultData(); |
207 | | - if (isset($data['_feed']) && isset($data['_feeditems'])) { |
208 | | - $feed =& $data['_feed']; |
209 | | - $items =& $data['_feeditems']; |
| 209 | + $data = & $this->getResultData(); |
| 210 | + if (isset ($data['_feed']) && isset ($data['_feeditems'])) { |
| 211 | + $feed = & $data['_feed']; |
| 212 | + $items = & $data['_feeditems']; |
210 | 213 | |
211 | 214 | $feed->outHeader(); |
212 | | - foreach($items as &$item) |
| 215 | + foreach ($items as & $item) |
213 | 216 | $feed->outItem($item); |
214 | 217 | $feed->outFooter(); |
215 | 218 | } else { |
Index: trunk/phase3/includes/api/ApiFeedWatchlist.php |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | 'wlstart' => wfTimestamp(TS_MW, time() - intval( 1 * 86400 )), // limit to 1 day |
55 | 55 | 'wllimit' => 50 |
56 | 56 | )); |
57 | | - |
| 57 | + |
58 | 58 | // Execute |
59 | 59 | $module = new ApiMain($params); |
60 | 60 | $module->execute(); |
Index: trunk/phase3/includes/api/ApiQueryWatchlist.php |
— | — | @@ -55,8 +55,8 @@ |
56 | 56 | $db = $this->getDB(); |
57 | 57 | |
58 | 58 | $dirNewer = ($dir === 'newer'); |
59 | | - $before = ($dirNewer ? '<=' : '>='); |
60 | | - $after = ($dirNewer ? '>=' : '<='); |
| 59 | + $after = ($dirNewer ? '<=' : '>='); |
| 60 | + $before = ($dirNewer ? '>=' : '<='); |
61 | 61 | |
62 | 62 | $tables = array ( |
63 | 63 | 'watchlist', |