cvs: doc-editor /php BugReader.php ExtJsController.php class.php
| From: | Yannick Torres | Date: | Sat, 18 Apr 2009 08:15:43 +0000 |
| Subject: | cvs: doc-editor /php BugReader.php ExtJsController.php class.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-3781@lists.php.net to get a copy of this message | ||
yannick Sat Apr 18 08:15:43 2009 UTC
Added files:
/doc-editor/php BugReader.php
Modified files:
/doc-editor/php class.php ExtJsController.php
Log:
Implemente new BugReader class
http://cvs.php.net/viewvc.cgi/doc-editor/php/class.php?r1=1.32&r2=1.33&diff_format=u
Index: doc-editor/php/class.php
diff -u doc-editor/php/class.php:1.32 doc-editor/php/class.php:1.33
--- doc-editor/php/class.php:1.32 Fri Apr 17 20:56:01 2009
+++ doc-editor/php/class.php Sat Apr 18 08:15:43 2009
@@ -1350,46 +1350,6 @@
}
/**
- * Get all open bugs for this LANG.
- * @return An indexed array (id, title, description, link, pubDate).
- */
- function get_last_bugs() {
-
- $url = 'http://bugs.php.net/rss/search.php?cmd=display&bug_type[]=Translation+problem&status=Open&search_for=&php_os=&php_os_not=0&boolean=1&author_email=&bug_age=0&by=&order_by=id&direction=DESC&phpver=&limit=All&assign=&format=rss';
-
- $r = file_get_contents($url);
-
- $xml = new SimpleXMLElement($r);
- $channel = $xml;
-
- $i=0;
- $result = array();
- foreach ($channel->item as $item) {
- $title = (string) $item->title;
- $description = $item->description;
-
- if (strstr($title, '['.strtoupper($this->cvsLang).']')) {
-
- $result[$i]['id'] = $i;
- $result[$i]['title'] = $title;
-
- $match = array();
- if (strstr($description, "Reproduce code:")) {
- preg_match_all('/Description:\s*?------------(.*?)Reproduce code:/s',
$description, $match);
- } else {
- preg_match_all('/Description:\s*?------------(.*)/s', $description,
$match);
- }
-
- $result[$i]['description'] = (isset($match[1][0])) ?
highlight_string(trim($match[1][0]), true) : '';
- $result[$i]['link'] = (string) $item->link;
- $i++;
- }
- }
- return $result;
-
- }
-
- /**
* Get encoding of a file, regarding his XML's header.
* @param $file The file to get encoding from.
* @param $mode The mode. Must be 'file' if $file is a path to the file, or
'content' if $file is the content of the file.
http://cvs.php.net/viewvc.cgi/doc-editor/php/ExtJsController.php?r1=1.12&r2=1.13&diff_format=u
Index: doc-editor/php/ExtJsController.php
diff -u doc-editor/php/ExtJsController.php:1.12 doc-editor/php/ExtJsController.php:1.13
--- doc-editor/php/ExtJsController.php:1.12 Fri Apr 17 20:56:01 2009
+++ doc-editor/php/ExtJsController.php Sat Apr 18 08:15:43 2009
@@ -10,6 +10,7 @@
*/
require_once './class.php';
require_once './LockFile.php';
+require_once './BugReader.php';
/**
* Ext JS controller class
@@ -302,7 +303,10 @@
public function get_open_bugs() {
$this->phpDoc->isLogged();
- $r = $this->phpDoc->get_last_bugs();
+
+ $bugs = new BugReader($this->phpDoc->cvsLang);
+ $r = $bugs->getLastBugs();
+
return $this->getResponse(array('nbItems' => count($r), 'Items'
=> $r));
}
http://cvs.php.net/viewvc.cgi/doc-editor/php/BugReader.php?view=markup&rev=1.1
Index: doc-editor/php/BugReader.php
+++ doc-editor/php/BugReader.php
<?php
/**
* A class for read bugs form http://bugs.php.net
*
*/
class BugReader {
/**
* The lang
*
* @var string
*/
private $lang;
/**
* Initialise
*
* @param string $lang
*/
function __construct($lang)
{
$this->lang = $lang;
}
/**
* Get all open bugs for this LANG.
*
* @return An indexed array (id, title, description, link, pubDate) readable by ExtJs
*/
function getLastBugs() {
$url = 'http://bugs.php.net/rss/search.php?cmd=display&bug_type[]=Translation+problem&status=Open&search_for=&php_os=&php_os_not=0&boolean=1&author_email=&bug_age=0&by=&order_by=id&direction=DESC&phpver=&limit=All&assign=&format=rss';
$r = file_get_contents($url);
$xml = new SimpleXMLElement($r);
$channel = $xml;
$i=0;
$result = array();
foreach ($channel->item as $item) {
$title = (string) $item->title;
$description = $item->description;
if (strstr($title, '['.strtoupper($this->lang).']')) {
$result[$i]['id'] = $i;
$result[$i]['title'] = $title;
$match = array();
if (strstr($description, "Reproduce code:")) {
preg_match_all('/Description:\s*?------------(.*?)Reproduce code:/s',
$description, $match);
} else {
preg_match_all('/Description:\s*?------------(.*)/s', $description,
$match);
}
$result[$i]['description'] = (isset($match[1][0])) ?
highlight_string(trim($match[1][0]), true) : '';
$result[$i]['link'] = (string) $item->link;
$i++;
}
}
return $result;
}
}