| <?php |
| /** |
| * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (http://www.eclipse.org/legal/epl-v10.html). |
| * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. |
| * |
| */ |
| |
| /** |
| * |
| */ |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/common/project.class.php"); |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/common/xml-to-array.class.php"); |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/common/release.class.php"); |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/common/blog.class.php"); |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/common/ships.class.php"); |
| require_once "/home/data/httpd/eclipse-php-classes/system/dbconnection.class.php"; |
| |
| |
| |
| /** |
| * Project Information parsed from projec-info/project-info.xml and the eclipse foundation database. |
| * |
| * This Class parses the project-info/project-info.xml of a given project, and creates an object |
| * to handle the project information easily. Basic information of the project is obtained from |
| * the Eclipse Foundation Database, extended information is parsed from the project's xml description |
| * file. The XML schema used is described in http://www.eclipse.org/projects/dev_process/project-status-infrastructure.php |
| * |
| * @license http://www.eclipse.org/legal/epl-v10.html Eclipse Public License - v 1.0 |
| * |
| * @author Bjorn Freeman-Benson |
| * @author Eduardo A. Romero Gomez |
| * |
| * @example project_info.php An Example of the usage of <b>project-info.class.php</b>, using the Eclipse Visual Style, CSS, Layout and Navigation |
| * @link /projects/common/doc/examples/project_info.php Working example using Eclipse Visuals & Layout |
| * @example simple_project.php A less sophisticated example |
| * @link /projects/common/doc/examples/simple_project.php Results of the less sophisticated example |
| */ |
| class ProjectInfo { |
| |
| var $dom = ""; |
| var $project; |
| |
| var $downloads_url = ""; |
| |
| /* simple vars */ |
| var $shortname = ""; |
| var $xml = ""; |
| var $name = ""; |
| var $project_id = ""; |
| var $parent = ""; |
| var $description = ""; |
| var $index_url = ""; |
| var $level = ""; |
| var $isArchived = false; |
| |
| /* tags with multiple options */ |
| var $releases = array(); |
| var $lists = array(); |
| var $bugzilla = array(); |
| var $newsgroup = array(); |
| var $blogs = array(); |
| var $shippings = array(); |
| var $cvsmodules = array(); |
| var $articles = array(); |
| |
| var $errors = array(); |
| |
| /* multiple options counts */ |
| var $num_releases = 0; |
| var $num_lists = 0; |
| var $num_bugzilla = 0; |
| var $num_newsgroup = 0; |
| var $num_blogs = 0; |
| var $num_shippings = 0; |
| var $num_cvsmodules = 0; |
| var $num_articles = 0; |
| |
| /* is serialized */ |
| var $serialized = 0; |
| var $xmlArray= array(); |
| |
| /* fetch from URL and temporary? */ |
| var $fetch_temporary = false; |
| var $fetch_temporary_only = false; |
| var $local = false; |
| |
| /* Dashboard information */ |
| var $dashboard_fetched = false; |
| var $dashboardinfo = null; |
| var $exclude_dashboard = false; |
| var $dashboard_week = ""; |
| |
| /* time stamps */ |
| var $timestamps = array(); |
| |
| /* xml source */ |
| var $xmlsource = ""; |
| |
| /** |
| * Constructor, it takes the Project Key (as in the Foundation Database) as a parameter |
| * |
| * Create a new ProjectInfo object. |
| * The ProjectInfo object aggregates data from a number of sources |
| * into one convenient object. |
| * |
| * @param string $projectkey the project's key as in the Eclipse Foundation's database |
| * of projects. These keys are assigned by the EMO. |
| * |
| * @param integer $temporary Defines wether to get the project-info data from the temporary repository, |
| * from web or both. When set to 0 the data will be gathered from the project's web page. When set to 1 |
| * it will be fetched from the local repository <u>only<u/>. When set to 2 it will try from both, first from |
| * web, if there's no project-info.xml on the page it will fallback to the temporary repository. This is the |
| * default behavior. This is intended to be used only for a while, just until every project has its project-info.xml |
| * on web and updated. |
| * |
| * @return ProjectInf A brand new ProjectInfo object |
| * |
| */ |
| function ProjectInfo( $projectkey, $temporary = 2) { |
| if($temporary == 1 || $temporary === true) |
| { |
| $this->fetch_temporary_only = true; |
| $this->fetch_temporary = true; |
| } |
| if($temporary == 2) |
| { |
| $this->fetch_temporary = true; |
| $this->fetch_temporary_only = false; |
| } |
| |
| $this->project = new Project_Project(); |
| $this->project->selectList( $projectkey ); |
| |
| /* Following vars are retrieved from the fundation db */ |
| |
| $this->downloads_url = $this->project->getUrlDownload(); |
| $this->index_url = $this->project->getUrlIndex(); |
| $this->parent = $this->project->getParentProjectID(); |
| $this->description = $this->project->getDescription(); |
| $this->project_id = $this->project->getProjectID(); |
| $this->name = $this->project->getName(); |
| $this->level = $this->project->getlevel(); |
| $this->isArchived= $this->project->getIsArchived(); |
| if($this->isArchived == 0) |
| $this->isArchived = true; |
| else |
| $this->isArchived = false; |
| |
| /* timestamps */ |
| $this->timestamps['downloads_url'] = time(); |
| $this->timestamps['index_url'] = time(); |
| $this->timestamps['name'] = time(); |
| $this->timestamps['level'] = time(); |
| $this->timestamps['isArchived'] = time(); |
| $this->timestamps['description'] = time(); |
| $this->timestamps['project_id'] = time(); |
| /* timestamps */ |
| |
| $this->getXML(); |
| } |
| |
| /** |
| * This method gets the XML from the proper source, if no XML is found |
| * it will call the getFromDatesFile() method. The XML will be available |
| * from the $this->xml variable since it's used in several place in this |
| * class. XML Comments will be excluded. |
| * |
| * @access private |
| */ |
| function getXML() |
| { |
| $source = $this->getXMLSource(); |
| if(isset($_REQUEST['debug'])) |
| echo $this->project_id .": xmlsource $source <br>"; |
| $xml = ""; |
| if(strlen($source)) |
| { |
| $xml = @file($source); |
| if(is_array($xml) && count($xml) > 0) |
| $xml = implode('',$xml); |
| $this->timestamps['project-info'] = time(); |
| $this->xmlsource = $source; |
| } |
| if(strlen($xml) <= 0) |
| { |
| /* no xml found, let's try dates */ |
| $this->getFromDatesFile(); |
| } else { |
| $this->dom = $xml; |
| $this->dom = preg_replace( "/\<\!--.*?--\>/s", "", $this->dom ); |
| $this->xml = $this->dom; |
| } |
| } |
| /** |
| * The XML can come from two sources, the project URL or the temporary files. This behavior is controled |
| * by $this->fetch_temporary and $this->fetch_temporary_only. The behavior of this goes as follows: |
| * |
| * When $this->fetch_temporary is set to FALSE, the XML will be fetch from the project URL <u>only</u> |
| * |
| * When $this->fetch_temporary is set to TRUE, we'll try to fetch the XML from the URL, if it fails it will |
| * fallback to the <i>temporary</i> directory. |
| * |
| * When $this->fetch_temporary_only is set to TRUE, We will fetch the local copy from the <i>temporary</i> |
| * directory |
| * |
| * @access private |
| */ |
| function getXMLSource() |
| { |
| $uri = ""; |
| $url = $this->getUrlIndex(); |
| $projectkey = $this->project_id; |
| |
| $url = str_replace("index.html","",$url); |
| $url = str_replace("index.htm","",$url); |
| $url = str_replace("main.html","",$url); |
| $url = str_replace("main.htm","",$url); |
| $url = str_replace("main.xml","",$url); |
| |
| if( substr($url,-1,1) != "/" ) |
| $url .= "/"; |
| |
| $projectinfo_path = "project-info/project-info.xml"; |
| $project_path = str_replace(".", "/", $projectkey); |
| |
| |
| /* Go Web */ |
| if(!$this->fetch_temporary_only) |
| { |
| |
| if (eregi("baueralonso.com",$_SERVER['SERVER_NAME']) || eregi("foxteck.homelinux.net", $_SERVER['SERVER_NAME'])) |
| { |
| if(isset($_REQUEST['TEST_DEBUG_LOCALLY'])) |
| $TEST_DEBUG_LOCALLY = true; |
| else |
| $TEST_DEBUG_LOCALLY = false; |
| } |
| |
| /* if on eclipse */ |
| if(eregi("eclipse.org", $_SERVER['SERVER_NAME']) || $TEST_DEBUG_LOCALLY) |
| { |
| if(eregi("eclipse.org", $url)) |
| { |
| $sites = array("http://eclipse.org", "http://www.eclipse.org"); |
| $oldurl = $url; |
| $url = str_replace($sites, $_SERVER['DOCUMENT_ROOT'], $url); |
| } |
| } |
| |
| |
| if ($buffer = @file($url . $projectinfo_path)) |
| { |
| if(is_array($buffer) && count($buffer) > 0) |
| $buffer = implode('',$buffer); |
| if(stristr($buffer,"404 file not found") || strlen($buffer) == 0) |
| { |
| $this->errors[] = "project-info.xml not found, please see http://www.eclipse.org/projects/dev_process/project-status-infrastructure-page2.php."; |
| if(isset($_REQUEST['debug'])) |
| echo $this->project_id .": project-info.xml not found, please see http://www.eclipse.org/projects/dev_process/project-status-infrastructure-page2.php.<br/>"; |
| } |
| else |
| { |
| $uri = $url . $projectinfo_path; |
| } |
| } |
| else |
| { |
| $this->errors[] = "couldn\'t open $url$projectinfo_path"; |
| if(isset($_REQUEST['debug'])) |
| echo $this->project_id .": couldn\'t open $url$projectinfo_path<br/>"; |
| } |
| } |
| |
| /* Go Local */ |
| $localfile = $_SERVER['DOCUMENT_ROOT'] . "/projects/temporary/" . $project_path ."/" .$projectinfo_path; |
| if($this->fetch_temporary_only || (strlen($uri)<= 0 && $this->fetch_temporary)) |
| { |
| if(!file_exists($localfile)) |
| { |
| if( $projectkey == "tools.cdt" ) |
| { |
| $cdt_localfile = "http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/cdt-home/project-info/project-info.xml?cvsroot=Tools_Project"; |
| $uri = $cdt_localfile; |
| $this->local = true; |
| } |
| } |
| else |
| { |
| $uri = $localfile; |
| $this->local = true; |
| } |
| } |
| return $uri; |
| } |
| |
| |
| /** |
| * This Method is called whenever no project-info.xml is found, it parses the old |
| * format found in the .dates.txt file. This is an old format and is intended to be |
| * deprecated by the new project-info.xml format. The old format only has the project name, |
| * project url and releases informaton, thus only those will be available when using |
| * .date.txt |
| * |
| * @access private |
| */ |
| function getFromDatesFile() |
| { |
| $url = $this->getUrlIndex(); |
| $projectkey = $this->project_id; |
| |
| $url = str_replace("index.html","",$url); |
| $url = str_replace("index.htm","",$url); |
| $url = str_replace("main.html","",$url); |
| $url = str_replace("main.htm","",$url); |
| $url = str_replace("main.xml","",$url); |
| |
| if( substr($url,-1,1) != "/" ) |
| $url .= "/"; |
| |
| /* XML NOT FOUND =( */ |
| /* We will try the old .dates.txt format before giving up */ |
| |
| $project_path = str_replace(".", "/", $this->project_id); |
| $file_found = false; |
| $releases = array(); |
| |
| |
| if (eregi("baueralonso.com",$_SERVER['SERVER_NAME']) || eregi("foxteck.homelinux.net", $_SERVER['SERVER_NAME'])) |
| { |
| if(isset($_REQUEST['TEST_DEBUG_LOCALLY'])) |
| $TEST_DEBUG_LOCALLY = true; |
| else |
| $TEST_DEBUG_LOCALLY = false; |
| } |
| |
| /* if on eclipse */ |
| if(eregi("eclipse.org", $_SERVER['SERVER_NAME']) || $TEST_DEBUG_LOCALLY) |
| { |
| if(eregi("eclipse.org", $url)) |
| { |
| $sites = array("http://eclipse.org", "http://www.eclipse.org"); |
| $oldurl = $url; |
| $url = str_replace($sites, $_SERVER['DOCUMENT_ROOT'], $url); |
| } |
| } |
| |
| /* |
| * First, we go to the project's URL http://eclipse.org/PROJECT_PATH/.dates.txt |
| */ |
| if ($buffer = @file($url . ".dates.txt")) |
| { |
| $strbuffer = implode("", $buffer); |
| if(stristr($strbuffer,"file not found") || strlen($strbuffer) == 0) |
| { |
| $this->errors[] = "dates.txt not found"; |
| if(isset($_REQUEST['debug'])) |
| echo $this->project_id . ":dates.txt not found"; |
| } |
| else |
| { |
| $this->timestamps['dates'] = time(); |
| $this->xmlsource = $url . ".dates.txt"; |
| $this->name = $buffer[0]; |
| $this->index_url = $buffer[1]; |
| $file_found = true; |
| for($i = 2; $i < count($buffer); $i++) |
| $releases[] = $buffer[$i]; |
| } |
| } |
| else |
| { |
| if($this->fetch_temporary) |
| { |
| |
| /* If not found, we try the local version of the file */ |
| if ($buffer = @file($_SERVER['DOCUMENT_ROOT'] . "/projects/temporary/" . $project_path ."/.dates.txt")) |
| { |
| $strbuffer = implode("", $buffer); |
| if(stristr($strbuffer,"file not found") || strlen($strbuffer) == 0) |
| { |
| $this->errors[] = "local dates.txt not found"; |
| if(isset($_REQUEST['debug'])) |
| echo $this->project_id . ":dates.txt not found"; |
| } |
| else |
| { |
| $this->xmlsource = $_SERVER['DOCUMENT_ROOT'] . "/projects/temporary/" . $project_path ."/.dates.txt"; |
| $this->timestamps['dates'] = time(); |
| $this->local = true; |
| $this->name = $buffer[0]; |
| $this->index_url = $buffer[1]; |
| $file_found = true; |
| for($i = 2; $i < count($buffer); $i++) |
| $releases[] = $buffer[$i]; |
| } |
| } |
| } |
| } |
| |
| /* If we're fetching temporary only, then overwrite the .dates.txt with the local copy */ |
| if($this->fetch_temporary_only) |
| { |
| |
| |
| if ($buffer = @file($_SERVER['DOCUMENT_ROOT'] . "/projects/temporary/" . $project_path ."/.dates.txt")) |
| { |
| $strbuffer = implode("", $buffer); |
| if(stristr($strbuffer,"file not found") || strlen($strbuffer) == 0) |
| { |
| $this->errors[] = "local dates.txt not found"; |
| if(isset($_REQUEST['debug'])) |
| echo $this->project_id . ":local dates.txt not found"; |
| } |
| else |
| { |
| $this->xmlsource = $_SERVER['DOCUMENT_ROOT'] . "/projects/temporary/" . $project_path ."/.dates.txt"; |
| $this->timestamps['dates'] = time(); |
| $this->name = $buffer[0]; |
| $this->index_url = $buffer[1]; |
| $file_found = true; |
| for($i = 2; $i < count($buffer); $i++) |
| $releases[] = $buffer[$i]; |
| } |
| } |
| /* clear releases added by fetch_temporary */ |
| $this->releases = array(); |
| $this->shippings = array(); |
| $this->num_releases = 0; |
| $this->num_shippings = 0; |
| } |
| |
| /* Now let's process the releases */ |
| $num_releases = count($releases); |
| |
| if($file_found && $num_releases > 0) |
| { |
| for($i = 0; $i<$num_releases; $i++) |
| { |
| |
| $rel = explode(" ", $releases[$i]); |
| $name = ""; |
| if(isset($rel[0])) |
| $name = $rel[0]; |
| $date = ""; |
| if(isset($rel[1])) |
| $date = $rel[1]; |
| $status = ""; |
| if(isset($rel[2])) |
| $status = $rel[2]; |
| $url = ""; |
| if(isset($rel[3])) |
| $url = $rel[3]; |
| $plan = ""; |
| if(isset($rel[4])) |
| $plan = $rel[4]; |
| |
| $status = strtolower($status); |
| |
| if($status == "completed") |
| { |
| $shipping = new Shipping($name, $date, $url); |
| $this->shippings[] = $shipping; |
| $this->num_shippings++; |
| } |
| else |
| { |
| $release = new Release($name, $date, $status, $plan , $url); |
| $this->releases[] = $release; |
| $this->num_releases = $this->num_releases + 1; |
| } |
| } |
| $this->timestamps['releases'] = time(); |
| } |
| |
| } |
| |
| /** |
| * The Project Name |
| * |
| * Returns the full name of the project. |
| * Source: Foundation database. |
| * |
| * @access public |
| * @return string The name of the Project as on the Foundation Database |
| */ |
| function get_name() { |
| return $this->project->getName(); |
| } |
| |
| |
| /** |
| * HTML fragment with the project name and a link to |
| * to the project's home page. |
| * Source: Foundation database. |
| */ |
| function linked_name() { |
| $url = $this->project->getUrlIndex(); |
| $projectName = $this->project->getName(); |
| $this->timestamp['linked_name'] = time(); |
| if( $url != "" ) { |
| return "<a href=\"$url\">" . $projectName . "</a>"; |
| } else { |
| return $projectName; |
| } |
| } |
| |
| /** |
| * The Project IP Log URL |
| * |
| * Each Eclipse project is required to maintain a current Project IP Log. |
| * See http://www.eclipse.org/projects/dev_process/project-log.php |
| * |
| * URL to the project's current Project IP Log. |
| * An absolute URL of the eclipse.org page (e.g., "/webtools/jst/index.php"), |
| * or NULL if there is no current Project IP Log. |
| * Source: project-info.xml |
| * |
| * @return string The URL of the Project IP Log. |
| * @access public |
| */ |
| function ip_log_url() { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| |
| $url = $this->xmlArray['project']['ip-log attr']['url']; |
| //$url = _getXpathValues($this->dom, "//project/ip-log/@url"); |
| |
| $this->timestamps['ip_log_url'] = time(); |
| |
| if(strlen($url)> 0 && !(stristr("http://", $url))) |
| $url = "http://eclipse.org". $url; |
| $url = _un_encode_url($url); |
| return $url; |
| } |
| |
| /** |
| * The Project Bug's URL |
| * |
| * Some Eclipse projects have a separate web page describing how to submit |
| * a bug, how bugs are prioritized, and other useful information. |
| * This is the URL of that page, if there's no such page, it will default to |
| * the first bugzilla product of this project. |
| * |
| * @return string The URL of the project's bugs |
| * @access public |
| * |
| */ |
| function bugs_url() { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| if(isset($this->xmlArray['project']['bugzilla attr']['url'])) |
| $url = $this->xmlArray['project']['bugzilla attr']['url']; |
| |
| //$url = _getXpathValues($this->dom, "//project/bugzilla/@url"); |
| if( isset($url) ){ |
| $url = _un_encode_url($url); |
| return $url; |
| } |
| $product = $this->getBugzillaProduct(0); |
| $this->timestamps['bugs_url'] = time(); |
| if( isset($product) ) |
| return "https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advanced&product=" . $product . "&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED"; |
| return NULL; |
| } |
| |
| /** |
| * The Project Committers URL |
| * |
| * Committers and non-committer Contributors are the raison d'etre of |
| * an Eclipse project, thus each project should list and acknowledge these |
| * developers. This is the URL of the project's page listing its committers. |
| * |
| * @access public |
| * @return string The URL of the project committer list. |
| */ |
| function committers_url() { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| $url = $this->xmlArray['project']['committers attr']['url']; |
| if(strlen($url)> 0 && !(stristr("http://", $url))) |
| $url = "http://eclipse.org". $url; |
| $url = _un_encode_url($url); |
| $this->timestamp['committers_url'] = time(); |
| return $url; |
| } |
| |
| /** |
| * The Project Contributors URL |
| * |
| * Committers and non-committer Contributors are the raison d'etre of |
| * an Eclipse project, thus each project should list and acknowledge these |
| * developers. This is the URL of the project's page listing its contributors. |
| * |
| * @access public |
| * @return string The URL of the project contributors list. |
| */ |
| function contributors_url() { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| $url = ""; |
| if(isset($this->xmlArray['project']['contributors attr']['url'])) |
| $url = $this->xmlArray['project']['contributors attr']['url']; |
| //$url = _getXpathValues($this->dom, "//project/contributors/@url"); |
| if(strlen($url)> 0 && !(stristr("http://", $url))) |
| $url = "http://eclipse.org". $url; |
| $url = _un_encode_url($url); |
| $this->timestamp['contributors_url'] = time(); |
| return $url; |
| } |
| |
| /** |
| * The Project CVS URL |
| * |
| * The source code of each Eclipse project is stored in CVS. Eclipse maintains |
| * a number of CVS repositories, this returns the URL this project's |
| * source code. |
| * |
| * @access public |
| * @return string The Project CVS URL |
| */ |
| function cvs_url() { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| if(isset($this->xmlArray['project']['cvs attr']['repository'])) |
| $repository = $this->xmlArray['project']['cvs attr']['repository']; |
| //$repository = _getXpathValues($this->dom, "//project/cvs/@repository"); |
| if(!isset($repository) ) |
| return NULL; |
| if( substr($repository,-1,1) != "/" ) |
| $repository .= "/"; |
| $viewrepository = ""; |
| if( $repository == "/cvsroot/eclipse/") $viewrepository = ""; |
| if( $repository == "/cvsroot/tools/") $viewrepository = "?cvsroot=Tools_Project"; |
| if( $repository == "/cvsroot/webtools/") $viewrepository = "?cvsroot=WebTools_Project"; |
| if( $repository == "/cvsroot/birt/") $viewrepository = "?cvsroot=BIRT_Project"; |
| if( $repository == "/cvsroot/technology/") $viewrepository = "?cvsroot=Technology_Project"; |
| if( $repository == "/cvsroot/tptp/") $viewrepository = "?cvsroot=TPTP_Project"; |
| if( $repository == "/cvsroot/dsdp/") $viewrepository = "?cvsroot=DSDP_Project"; |
| if( $repository == "/cvsroot/datatools/") $viewrepository = "?cvsroot=Datatools_Project"; |
| |
| if($this->num_cvsmodules >= 1) |
| $viewrepository = $this->cvsmodules[0] ."/". $viewrepository; |
| |
| $this->timestamp['cvs_url'] = time(); |
| return "http://dev.eclipse.org/viewcvs/index.cgi/" . $viewrepository; |
| } |
| |
| /** |
| * The Project Description URL |
| * |
| * The URL with the description of this Eclipse project, there you can find the full description |
| * of the project. |
| * |
| * @access public |
| * @return string The Project Description URL |
| */ |
| function description_url() { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| $url = ""; |
| if(isset($this->xmlArray['project']['description attr']['url'])) |
| $url = $this->xmlArray['project']['description attr']['url']; |
| //$url = _getXpathValues($this->dom, "//project/description/@url"); |
| if(strlen($url)> 0 && !(stristr("http://", $url))) |
| $url = "http://eclipse.org". $url; |
| $url = _un_encode_url($url); |
| $this->timestamp['description_url'] = time(); |
| return $url; |
| } |
| /** |
| * The Project's Description-in-a-paragraph URL |
| * |
| * The URL with the description of this Eclipse project in just a paragraph |
| * |
| * @access public |
| * @return string The Project's Description-in-a-paragraph URL |
| */ |
| function description_paragraph() { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| if(isset($this->xmlArray['project']['description attr']['paragraph-url'])) |
| $result = $this->_get_paragraph($this->xmlArray['project']['description attr']['paragraph-url']); |
| $this->timestamps['description_paragraph'] = time(); |
| if( isset($result) ) { |
| return $result; |
| } else { |
| return $this->linked_name(); |
| } |
| } |
| |
| /** |
| * The Project's Summary URL |
| * |
| * The Project Summary in a Paragraph. Each Eclipse project is required to |
| * provide an up-to-date status summary. This URL points to a file containing a number of |
| * simple HTML paragraphs with an executive summary of the project status. |
| * |
| * @access public |
| * @return string The Project's Summary URL |
| */ |
| function summary_paragraph() { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| |
| if(isset($this->xmlArray['project']['summary attr']['paragraph-url'])) |
| $result = $this->_get_paragraph( $this->xmlArray['project']['summary attr']['paragraph-url'] ); |
| $this->timestamps['summary_paragraph'] = time(); |
| if( isset($result) ) { |
| return $result; |
| } else { |
| return "<i>No Status Information</i>"; |
| } |
| } |
| |
| /** |
| * The Project Download URL |
| * |
| * The URL of the project downloads section |
| * |
| * @access public |
| * @return string The project download URL |
| */ |
| function downloads_url() { |
| return $this->downloads_url; |
| } |
| |
| /** |
| * The Project <i>Getting Started</i> URL |
| * |
| * It is important to help new users get started with an Eclipse project |
| * because most Eclipse projects are solving some difficult technical |
| * problem and thus are somewhat complex. This URLpoints to a web page on |
| * the project's site that describes how to |
| * get started using and extending the project's tools and frameworks. |
| * |
| * @access public |
| * @return string The project getting started URL |
| */ |
| function getting_started_url() { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| $url = ""; |
| if(isset($this->xmlArray['project']['getting-started attr']['url'])) |
| $url = $this->xmlArray['project']['getting-started attr']['url']; |
| $this->timestamps['getting_started_url'] = time(); |
| // $url = _getXpathValues($this->dom, "//project/getting-started/@url"); |
| if(strlen($url)> 0 && !(stristr("http://", $url))) |
| $url = "http://eclipse.org". $url; |
| $url = _un_encode_url($url); |
| return $url; |
| } |
| |
| /** |
| * The Project Leaders URL |
| * |
| * Committers and non-committer Contributors are the raison d'etre of |
| * an Eclipse project, thus each project should list and acknowledge these |
| * developers. Some of the Committers are 'special' in the sense that |
| * they are the project leaders. |
| * This is the URL of the project's leader page. |
| * |
| * @access public |
| * @return string The URL of the project leader page. |
| */ |
| function leaders_url() { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| $url = ""; |
| if(isset($this->xmlArray['project']['leaders attr']['url'])) |
| $url = $this->xmlArray['project']['leaders attr']['url']; |
| $this->timestamps['leaders_url'] = time(); |
| |
| //$url = _getXpathValues($this->dom, "//project/leaders/@url"); |
| if(strlen($url)> 0 && !(stristr("http://", $url))) |
| $url = "http://eclipse.org". $url; |
| $url = _un_encode_url($url); |
| return $url; |
| } |
| |
| /** |
| * The Project Mailing Lists home page |
| * |
| * Each Eclipse project has one or more mailing lists. |
| * Some projects also have a separate web page describing these lists |
| * while others rely on the main Eclipse mailing lists page. |
| * If there's no such page, the url will default to the Eclipse mailing lists page. |
| * |
| * @access public |
| * @return string The project mailinglist home page URL |
| * |
| */ |
| function mailing_lists_url() { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| if(isset($this->xmlArray['project']['mailing-lists attr']['url'])) |
| $url = $this->xmlArray['project']['mailing-lists attr']['url']; |
| $this->timestamps['mailing_lists_url'] = time(); |
| //$url = _getXpathValues($this->dom, "//project/mailing-lists/@url"); |
| if( isset($url) ) { |
| $url = _un_encode_url($url); |
| return $url; |
| } |
| $name = $this->getlist(0); |
| if( isset($name) ) { |
| return "http://dev.eclipse.org/mhonarc/lists/" . $name . "/maillist.html"; |
| } |
| return NULL; |
| } |
| /** |
| * The Project Plan URL |
| * |
| * Each Eclipse project needs to have a plan both for its internal purposes |
| * (to guide development and resource allocation) and for the larger Eclipse |
| * community and ecosystem to understand what will be delivered and when |
| * it will be delivered. This is the URL of the plan. |
| * |
| * @access public |
| * @return string The URL of the project's plan |
| */ |
| function project_plan_url() { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| $url = ""; |
| if(isset($this->xmlArray['project']['project-plan attr']['url'])) |
| $url = $this->xmlArray['project']['project-plan attr']['url']; |
| $this->timestamps['project_plan_url'] = time(); |
| //$url = _getXpathValues($this->dom, "//project/project-plan/@url"); |
| if(strlen($url)> 0 && !(stristr("http://", $url))) |
| $url = "http://eclipse.org". $url; |
| $url = _un_encode_url($url); |
| return $url; |
| } |
| /** |
| * new function needs documentation |
| */ |
| function team_url() { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| $url = ""; |
| if(isset($this->xmlArray['project']['team attr']['url'])) |
| $url = $this->xmlArray['project']['team attr']['url']; |
| //$url = _getXpathValues($this->dom, "//project/team/@url"); |
| if(strlen($url)> 0 && !(stristr("http://", $url))) |
| $url = "http://eclipse.org". $url; |
| $url = _un_encode_url($url); |
| return $url; |
| } |
| /** |
| * new function needs documentation |
| */ |
| function legal_url() { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| $url = ""; |
| if(isset($this->xmlArray['project']['legal attr']['url'])) |
| $url = $this->xmlArray['project']['legal attr']['url']; |
| //$url = _getXpathValues($this->dom, "//project/legal/@url"); |
| if(strlen($url)> 0 && !(stristr("http://", $url))) |
| $url = "http://eclipse.org". $url; |
| $url = _un_encode_url($url); |
| return $url; |
| } |
| /** |
| * new function needs documentation |
| */ |
| function contributing_url() { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| $url = ""; |
| if(isset($this->xmlArray['project']['contributing attr']['url'])) |
| $url = $this->xmlArray['project']['contributing attr']['url']; |
| //$url = _getXpathValues($this->dom, "//project/contributing/@url"); |
| if(strlen($url)> 0 && !(stristr("http://", $url))) |
| $url = "http://eclipse.org". $url; |
| $url = _un_encode_url($url); |
| return $url; |
| } |
| /** |
| * new function needs documentation |
| */ |
| function newsgroups_url() { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| $url = ""; |
| if(isset($this->xmlArray['project']['newsgroups attr']['url'])) { |
| $url = $this->xmlArray['project']['newsgroups attr']['url']; |
| if(strlen($url)> 0 && !(stristr("http://", $url))) |
| $url = "http://eclipse.org". $url; |
| $url = _un_encode_url($url); |
| return $url; |
| } |
| $name = $this->getNewsgroup(0); |
| if( isset($name) ) { |
| return "http://dev.eclipse.org/newslists/news." . $name . "/maillist.html"; |
| } |
| return NULL; |
| } |
| /** |
| * @access private |
| */ |
| function generate_common_nav( $thenav, $users = NULL, $integrators = NULL, $contributors = NULL ) { |
| global $Nav; |
| $Nav->setLinkList( array() ); |
| $Nav->addNavSeparator( $this->getShortName(), $this->getUrlIndex() ); |
| |
| $Nav->addCustomNav("About", $this->description_url(), "", 1); |
| if( $this->team_url() != "" |
| || ($this->leaders_url() == "" && $this->committers_url() == "" && $this->contributors_url() == "") ) { |
| $Nav->addCustomNav("Team", $this->team_url(), "", 2); |
| } else { /* old-style */ |
| $Nav->addCustomNav("Team", "#", "", 2); |
| $Nav->addCustomNav("Leaders", $this->leaders_url(), "", 3); |
| $Nav->addCustomNav("Committers", $this->committers_url(), "", 3); |
| $Nav->addCustomNav("Contributors", $this->contributors_url(), "", 3); |
| } |
| $Nav->addCustomNav("Plan", $this->project_plan_url(), "", 2); |
| if( $this->legal_url() != "" ) { |
| $Nav->addCustomNav("Legal", $this->legal_url(), "", 2); |
| } else { /* old-style */ |
| $Nav->addCustomNav("Legal", $this->ip_log_url(), "", 2); |
| } |
| $Nav->addCustomNav("Users", $this->getting_started_url(), "", 1); |
| $Nav->addCustomNav("Getting Started", $this->getting_started_url(), "", 2); |
| $Nav->addCustomNav("Downloads", $this->downloads_url(), "", 2); |
| $Nav->addCustomNav("Newsgroups", $this->newsgroups_url(), "", 2); |
| $Nav->addCustomNav("Bugs", $this->bugs_url(), "", 2); |
| if( !empty($users) ) { |
| $users($Nav); |
| } |
| $Nav->addCustomNav("Integrators", "", "", 1); |
| $Nav->addCustomNav("API Plan", $this->project_plan_url(), "", 2); |
| if( !empty($integrators) ) { |
| $integrators($Nav); |
| } |
| $Nav->addCustomNav("Contributors", $this->contributing_url(), "", 1); |
| $Nav->addCustomNav("Contributing", $this->contributing_url(), "", 2); |
| $Nav->addCustomNav("Mailing Lists", $this->mailing_lists_url(), "", 2); |
| if( !empty($contributors) ) { |
| $contributors($Nav); |
| } |
| } |
| |
| /** |
| * Gets The HTML from the given URL or file. |
| * |
| * @access private |
| */ |
| function _get_paragraph( $url_from_xml ) { |
| #$xx .= "<p>(1) <code>$xpath</code></p>"; |
| $url = $url_from_xml; |
| $url = _un_encode_url($url); |
| #$xx .= "<p>(2) <code>$url</code></p>"; |
| if( isset($url) ) { |
| $localfile = $_SERVER['DOCUMENT_ROOT'] . $url; |
| #$xx .= "<p>(3) <code>$localfile</code></p>"; |
| if (file_exists($localfile)) { |
| $result = ""; |
| $file = fopen($localfile,"r"); |
| while(!feof($file)){ |
| $buffer = fgets($file,2048); |
| $result .= $buffer; |
| } |
| fclose($file); |
| return $result; |
| } else { |
| # |
| # Special cases for looking in older viewcvs directories |
| # |
| if( preg_match("/cdt/", $url) ) { |
| $url = preg_replace( "/\/cdt\//", "", $url); |
| $localfile = "http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/cdt-home/$url?cvsroot=Tools_Project"; |
| #$xx .= "<p>(4) <code>$localfile</code></p>"; |
| return implode("\n", file($localfile)); |
| } |
| # |
| # End special cases |
| # |
| } |
| } |
| return NULL; |
| } |
| |
| /** |
| * Parses the XML into an Array so we can handle it "easily". It also populates the ProjecInfo object |
| * with the information parsed from the XML file. |
| * |
| * @access private |
| */ |
| function parseToArray() |
| { |
| if($this->serialized == 0) |
| { |
| $this->serialized = 1; |
| $this->xmlArray= XML_unserialize($this->xml); |
| } |
| else |
| $this->xmlArray= array(); |
| |
| if(count($this->xmlArray)>0) |
| { |
| // El XML esta en el arreglo. a procesar se ha dicho! |
| if(isset($this->xmlArray['project'])) |
| { |
| /* Project Basic Information */ |
| if(isset($this->xmlArray['project']['short-name'])) |
| { |
| $this->shortname = $this->xmlArray['project']['short-name']; |
| $this->timestamps['short-name'] = time(); |
| } |
| else |
| $this->errors[] = "The shortname of the project is missing, please add it enlcosed between <short-name></shortname> tags"; |
| |
| /* Project Basic Information Ends * |
| |
| /* Releases */ |
| if(isset($this->xmlArray['project']['releases']) && count($this->xmlArray['project']['releases']) > 0) |
| { |
| $arr = $this->xmlArray['project']['releases']['release']; |
| $num_lists = count($arr); |
| |
| if($num_lists == 1) |
| { |
| if(isset($this->xmlArray['project']['releases']['release attr']) && is_array($this->xmlArray['project']['releases']['release attr'])) |
| { |
| $arr[0] = $this->xmlArray['project']['releases']['release attr']; |
| $arr['0 attr'] = $this->xmlArray['project']['releases']['release attr']; |
| } |
| } |
| for($i=0; $i<$num_lists;$i++) |
| { |
| $name = ""; |
| $date = ""; |
| $status = ""; |
| $url = ""; |
| $plan = ""; |
| |
| if(isset($arr[$i])) |
| { |
| // Check if it has attribs |
| if(isset($arr[$i .' attr'])) |
| { |
| if(isset($arr[$i .' attr']['name'])) |
| $name = $arr[$i .' attr']['name']; |
| if(isset($arr[$i .' attr']['date'])) |
| $date = $arr[$i .' attr']['date']; |
| if(isset($arr[$i .' attr']['download'])) |
| $url = $arr[$i .' attr']['download']; |
| if(isset($arr[$i .' attr']['plan'])) |
| $plan = $arr[$i .' attr']['plan']; |
| if(isset($arr[$i .' attr']['status'])) |
| $status = $arr[$i .' attr']['status']; |
| |
| $status = strtolower($status); |
| $release = new Release($name, $date, $status, $url, $plan); |
| |
| if($status == "completed") |
| { |
| $shipping = new Shipping($name, $date, $url); |
| $this->shippings[] = $shipping; |
| $this->num_shippings++; |
| } |
| else |
| { |
| if(strlen($release->getName()) != 0) |
| { |
| $this->releases[] = $release; |
| $this->num_releases = $this->num_releases + 1; |
| } |
| } |
| } |
| } |
| } |
| $this->timestamps['releases'] = time(); |
| } |
| else |
| { |
| $this->errors[] = "No <releases> information was found, Releses are used to generate your project's timeline\n" . |
| "Please refer to http://www.eclipse.org/projects/dev_process/example-project-info.xml and http://www.eclipse.org/projects/dev_process/project-status-infrastructure-page2.php"; |
| } |
| /* Releases ends */ |
| |
| /* Mailing Lists */ |
| if(isset($this->xmlArray['project']['mailing-lists']) && count($this->xmlArray['project']['mailing-lists']) > 0) |
| { |
| $arr = $this->xmlArray['project']['mailing-lists']['list']; |
| $num_releases = count($arr); |
| $this->timestamps['mailing-lists'] = time(); |
| if($num_releases == 1) |
| { |
| if(isset($this->xmlArray['project']['mailing-lists']['list attr']) && is_array($this->xmlArray['project']['mailing-lists']['list attr'])) |
| { |
| $arr[0] = $this->xmlArray['project']['mailing-lists']['list attr']; |
| $arr['0 attr'] = $this->xmlArray['project']['mailing-lists']['list attr']; |
| } |
| } |
| for($i=0; $i<$num_releases;$i++) |
| { |
| $name = ""; |
| if(isset($arr[$i])) |
| { |
| // Check if it has attribs |
| if(isset($arr[$i .' attr'])) |
| { |
| if(isset($arr[$i .' attr']['name'])) |
| { |
| $name = $arr[$i .' attr']['name']; |
| $this->lists[] = $name; |
| $this->num_lists = $this->num_lists + 1; |
| } |
| } |
| } |
| |
| } |
| } |
| else |
| { |
| $this->errors[] = "No mailing list where found, The Dashboard is generated using this value\n" . |
| "please refer to http://www.eclipse.org/projects/dev_process/example-project-info.xml and http://www.eclipse.org/projects/dev_process/project-status-infrastructure-page2.php"; |
| } |
| /* Mailing Lists ends */ |
| |
| /* Bugzilla Products */ |
| if(isset($this->xmlArray['project']['bugzilla']) && count($this->xmlArray['project']['bugzilla']) > 0) |
| { |
| if(isset($this->xmlArray['project']['bugzilla']['product'])) |
| { |
| $arr = $this->xmlArray['project']['bugzilla']['product']; |
| $num_products = count($arr); |
| if($num_products == 1) |
| { |
| if(isset($this->xmlArray['project']['bugzilla']['product attr']) && is_array($this->xmlArray['project']['bugzilla']['product attr'])) |
| { |
| $arr[0] = $this->xmlArray['project']['bugzilla']['product attr']; |
| $arr['0 attr'] = $this->xmlArray['project']['bugzilla']['product attr']; |
| } |
| } |
| for($i=0; $i<$num_products;$i++) |
| { |
| $name = ""; |
| if(isset($arr[$i])) |
| { |
| // Check if it has attribs |
| if(isset($arr[$i .' attr'])) |
| { |
| if(isset($arr[$i .' attr']['name'])) |
| { |
| $name = $arr[$i .' attr']['name']; |
| $this->bugzilla[] = $name; |
| $this->num_bugzilla= $this->num_bugzilla+ 1; |
| } |
| } |
| } |
| |
| } |
| $this->timestamps['bugs'] = time(); |
| } |
| } |
| /* Bugzilla Products ends */ |
| |
| /* Newsgroups */ |
| if(isset($this->xmlArray['project']['newsgroups']) && count($this->xmlArray['project']['newsgroups']) > 0) |
| { |
| $arr = $this->xmlArray['project']['newsgroups']['newsgroup']; |
| $num_newsgroup= count($arr); |
| $this->timestamps['newsgroups'] = time(); |
| |
| if($num_newsgroup == 1) |
| { |
| if(isset($this->xmlArray['project']['newsgroups']['newsgroup attr']) && is_array($this->xmlArray['project']['newsgroups']['newsgroup attr'])) |
| { |
| $arr[0] = $this->xmlArray['project']['newsgroups']['newsgroup attr']; |
| $arr['0 attr'] = $this->xmlArray['project']['newsgroups']['newsgroup attr']; |
| } |
| } |
| for($i=0; $i<$num_newsgroup;$i++) |
| { |
| $name = ""; |
| if(isset($arr[$i])) |
| { |
| // Check if it has attribs |
| if(isset($arr[$i .' attr'])) |
| { |
| if(isset($arr[$i .' attr']['name'])) |
| { |
| $name = $arr[$i .' attr']['name']; |
| $this->newsgroup[] = $name; |
| $this->num_newsgroup = $this->num_newsgroup + 1; |
| } |
| } |
| } |
| |
| } |
| } |
| else |
| { |
| $this->errors[] = "No mailing list where found. The Dashboard is generated using this value\n" . |
| "please refer to http://www.eclipse.org/projects/dev_process/example-project-info.xml and http://www.eclipse.org/projects/dev_process/project-status-infrastructure-page2.php"; |
| } |
| |
| /* Newsgroups ends */ |
| |
| /* Blogs */ |
| |
| if(isset($this->xmlArray['project']['blogs']) && count($this->xmlArray['project']['blogs']) > 0) |
| { |
| if(isset($this->xmlArray['project']['blogs']['blog'])) |
| { |
| $arr = $this->xmlArray['project']['blogs']['blog']; |
| $num_blogs = count($arr); |
| if($num_blogs == 1) |
| { |
| if(isset($this->xmlArray['project']['blogs']['blog attr']) && is_array($this->xmlArray['project']['blogs']['blog attr'])) |
| { |
| $arr[0] = $this->xmlArray['project']['blogs']['blog attr']; |
| $arr['0 attr'] = $this->xmlArray['project']['blogs']['blog attr']; |
| } |
| } |
| for($i=0; $i<$num_blogs;$i++) |
| { |
| $name = ""; |
| if(isset($arr[$i])) |
| { |
| // Check if it has attribs |
| if(isset($arr[$i .' attr'])) |
| { |
| if(isset($arr[$i .' attr']['rss'])) |
| { |
| $rss = $arr[$i .' attr']['rss']; |
| $this->blogs[] = new Blog("", $rss); |
| $this->num_blogs++; |
| } |
| } |
| } |
| } |
| } |
| $this->timestamps['blogs'] = time(); |
| } |
| |
| /* Blogs Ends */ |
| |
| /* CVS Modules */ |
| if(isset($this->xmlArray['project']['cvs']) && count($this->xmlArray['project']['cvs']) > 0) |
| { |
| if(isset($this->xmlArray['project']['cvs']['module'])) |
| { |
| $arr = $this->xmlArray['project']['cvs']['module']; |
| |
| $num_cvs= count($arr); |
| if($num_cvs == 1) |
| { |
| if(isset($this->xmlArray['project']['cvs']['module attr']) && is_array($this->xmlArray['project']['cvs']['module attr'])) |
| { |
| $arr[0] = $this->xmlArray['project']['cvs']['module attr']; |
| $arr['0 attr'] = $this->xmlArray['project']['cvs']['module attr']; |
| } |
| } |
| for($i=0; $i<$num_cvs;$i++) |
| { |
| $name = ""; |
| if(isset($arr[$i])) |
| { |
| // Check if it has attribs |
| if(isset($arr[$i .' attr'])) |
| { |
| if(isset($arr[$i .' attr']['path'])) |
| { |
| $name = $arr[$i .' attr']['path']; |
| $this->cvsmodules[] = $name; |
| $this->num_cvsmodules++; |
| } |
| } |
| } |
| } |
| } |
| $this->timestamps['cvs'] = time(); |
| |
| } |
| /* CVS Modules ends */ |
| |
| /* Articulos */ |
| if(isset($this->xmlArray['project']['articles']) && count($this->xmlArray['project']['articles']) > 0) |
| { |
| if(isset($this->xmlArray['project']['articles']['article'])) |
| { |
| $arr = $this->xmlArray['project']['articles']['article']; |
| $num_blogs = count($arr); |
| if($num_blogs == 1) |
| { |
| if(isset($this->xmlArray['project']['articles']['article attr']) && is_array($this->xmlArray['project']['articles']['article attr'])) |
| { |
| $arr[0] = $this->xmlArray['project']['articles']['article attr']; |
| $arr['0 attr'] = $this->xmlArray['project']['articles']['article attr']; |
| } |
| } |
| for($i=0; $i<$num_blogs;$i++) |
| { |
| $name = ""; |
| if(isset($arr[$i])) |
| { |
| // Check if it has attribs |
| if(isset($arr[$i .' attr'])) |
| { |
| if(isset($arr[$i .' attr']['url'])) |
| { |
| $url = $arr[$i .' attr']['url']; |
| $this->articles[] = $url; |
| $this->num_articles = $this->num_articles + 1; |
| } |
| } |
| } |
| } |
| } |
| $this->timestamps['articles'] = time(); |
| } |
| else |
| { |
| $this->errors[] = "No articles list where found. The Dashboard is generated using this value\n" . |
| "please refer to http://www.eclipse.org/projects/dev_process/example-project-info.xml and http://www.eclipse.org/projects/dev_process/project-status-infrastructure-page2.php"; |
| } |
| /* Articulos ends */ |
| } |
| else |
| { |
| //$error = "No Project Found"; |
| $this->serialized = -2; |
| } |
| } |
| else |
| { |
| //$error = "No se pudo Serializar el XML"; |
| $this->serialized = -1; |
| } |
| } |
| |
| |
| /** |
| * This method fetchs the Dashboard information from the database, this is |
| * called by all the dashboard_* methods and shouldn't be used by itself |
| * since it may cause unnecessary overhead. |
| * |
| * @access private |
| */ |
| function getDashboard($_date = "") |
| { |
| require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/common/dashboardinfo.class.php"); |
| |
| $this->dashboard_week = $_date; |
| |
| $this->DashboardInfo = new DashboardInfo( $this->project_id, $_date); |
| |
| $this->dashboard_fetched = true; |
| $this->timestamps['dashboard'] = time(); |
| } |
| |
| /* Accessors */ |
| |
| /* easy getters */ |
| |
| /** |
| * @access public |
| * @return string The name of the project (from the Foundation DB) |
| */ |
| function getName() |
| { |
| return $this->name; |
| } |
| |
| /** |
| * @access public |
| * @return string The short name of the project (from the Foundation XML file) or the Project ID if no shortname was found. |
| */ |
| function getShortName() |
| { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| if(strlen($this->shortname)>0) |
| return $this->shortname; |
| else |
| return $this->project_id; |
| } |
| /** |
| * @access public |
| * @return string The description of the project (from the Foundation DB) |
| */ |
| function getDescription() { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| return $this->description; |
| } |
| |
| /** |
| * Returns the HTML of the project's project-page-paragraph.html This is fetch from |
| * project_index/project-info/project-page-paragraph.html unlike the description_pargraph() |
| * method which gets the one specified in the XML. |
| * |
| * @access public |
| * @return string The description of the project (from the project-page-paragraph.html) |
| */ |
| function getParagraph() { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| $url = $this->index_url . "project-info/project-page-paragraph.html"; |
| |
| |
| $description = ""; |
| if ($buffer = @file($url)) |
| { |
| $buffer = implode("", $buffer); |
| |
| if(stristr($buffer,"file not found") || strlen($buffer) == 0) |
| { |
| $description = |
| "<p><b><a href=\"".$this->index_url. "\">" . $this->name . "</a></b>". |
| " - " . $this->description . "</p>"; |
| } |
| else |
| { |
| $description = $buffer; |
| } |
| } |
| else |
| { |
| $description = |
| "<p><b><a href=\"".$this->index_url. "\">" . $this->name . "</a></b>". |
| " - " . $this->description . "</p>"; |
| } |
| |
| $this->timestamps['page-paragraph'] = time(); |
| return $description; |
| } |
| |
| /** |
| * @access public |
| * @return string The Project ID (from the Foundation DB) |
| */ |
| function getProjectID() { |
| return $this->project_id; |
| } |
| /** |
| * @access public |
| * @return integer The Project Level (from the Foundation DB) |
| */ |
| function getlevel() { |
| return $this->level; |
| } |
| |
| /** |
| * @access public |
| * @return string The Project Parent's ID (from the Foundation DB) |
| */ |
| function getParentProjectID() { |
| return $this->parent; |
| } |
| |
| /** |
| * @access public |
| * @return string The Project Download URL (from the Foundation DB) |
| */ |
| function getUrlDownload() { |
| return $this->downloads_url; |
| } |
| |
| /** |
| * @access public |
| * @return string The Project Home Page (from the Foundation DB) |
| */ |
| function getUrlIndex() { |
| return $this->index_url; |
| } |
| |
| /* get more cool stuff */ |
| |
| /** |
| * Returns the planed releases of this project. |
| * Planed Releases are those where status='scheduled' or status='tentative' |
| * |
| * @param integer $n The index of the release |
| * @access public |
| * @return Release The <i>n</i>th planned release of this project |
| */ |
| function getRelease($index) |
| { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| return $this->releases[$index]; |
| } |
| |
| /** |
| * Returns the releases Currently Shipping, those where status='completed' |
| * |
| * @param integer $n The index of the release |
| * @access public |
| * @return Shipping The <i>n</i>th currently shipping release of this project |
| */ |
| function getShipping($index) |
| { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| return $this->shippings[$index]; |
| } |
| |
| /** |
| * Returns the name of the mailing lists of this project |
| * |
| * @param integer $n The index of the mailing list |
| * @access public |
| * @return string The name of the <i>n</i>th mailing list of the project |
| */ |
| function getList($index) |
| { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| return $this->lists[$index]; |
| } |
| |
| /** |
| * Returns the name of the newsgroups of this project |
| * |
| * @param integer $n The index of the newsgroup |
| * @access public |
| * @return string The name of the <i>n</i>th newsgroup of the project |
| */ |
| function getNewsgroup($index) |
| { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| return $this->newsgroup[$index]; |
| } |
| |
| /** |
| * Returns the name of the Bugzilla Products of this project |
| * |
| * @param integer $n The index of the product |
| * @access public |
| * @return string The name of the <i>n</i>th Bugzilla Product of the project |
| */ |
| function getBugzillaProduct($index) |
| { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| if(isset($this->bugzilla[$index])) |
| return $this->bugzilla[$index]; |
| else |
| return ""; |
| } |
| |
| /** |
| * Returns the URL of the Bugzilla Products of this project |
| * |
| * @param integer $n The index of the product |
| * @access public |
| * @return string The URL of the <i>n</i>th Bugzilla Product of the project |
| */ |
| function getBugzilla($index) |
| { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| return "https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advanced&product=" . $this->bugzilla[$index] . "&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED"; |
| } |
| |
| /** |
| * From time to time members of the development team and other members of the eclipse community write Articles, |
| * articles related with this project can be retrieved here. |
| * |
| * The URL of an Article related to this project |
| * |
| * @param integer $n The index of the Blog |
| * @access public |
| * @return string The URL of the <i>n</i>th Article |
| */ |
| function getArticleAt($index) |
| { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| return $this->articles[$index]; |
| } |
| |
| /** |
| * Returns the Blog of this project |
| * |
| * @param integer $n The index of the Blog |
| * @access public |
| * @return Blog The <i>n</i>th Blog of the project |
| */ |
| function getBlog($index) |
| { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| return $this->blogs[$index]; |
| } |
| |
| /** |
| * Returns the name of the CVS Modules of this project |
| * |
| * @param integer $n The index of the CVS Module |
| * @access public |
| * @return string The name of the <i>n</i>th CVS Module of the project |
| */ |
| function getCVSModule($index) |
| { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| return $this->cvsmodules[$index]; |
| } |
| |
| /** |
| * Returns the erros encountered while trying to parse the XML Project Information |
| * |
| * @param integer $n The index of the error |
| * @access public |
| * @return string The <i>n</i>th error |
| */ |
| function getError($index) |
| { |
| return $this->errors[$index]; |
| } |
| |
| |
| |
| /** |
| * Returns the time() when the given key was fetched |
| * |
| * Mosts of the methods of the Project Info object save the time() when the data nessesary to fullfill the method |
| * was fetched, i.e. when the method summary_paragraph() is called it goes to the XML file reads the paragraph URL, |
| * then goes to that URL and saves its content, finnaly it saves the timestamp by calling the time() function in |
| * the timestamp array, using it's name as key: $this->timestamp['summary_paragraph'] = time() |
| * |
| * Possible keys are: |
| * <pre> |
| * project-info |
| * dates |
| * releases |
| * description_paragraph |
| * summary_paragraph |
| * getting_started_url |
| * leaders_url |
| * mailing_lists_url |
| * project_plan_url |
| * short-name |
| * releases |
| * mailing-lists |
| * newsgroups |
| * articles |
| * dashboard |
| * page-paragraph |
| * bugs_url |
| * committers_url |
| * contributors_url |
| * downloads_url |
| * index_url |
| * name |
| * level |
| * isArchived |
| * description |
| * project_id |
| * </pre> |
| * |
| * @param string $key one of the valid keys from the list above |
| * @returns int the timestamp in the time() format |
| */ |
| function getTimestamp($key) |
| { |
| return $this->timestamps[$key]; |
| } |
| |
| |
| /** |
| * Returns the isArchived value of the Foundation Database. |
| * |
| * Projects under the Eclipse Technology Project have limited lifecycles. |
| * Unlike the major top-level Projects, the Technology Projects are meant to be technology explorations or incubators. |
| * When these projects have explored, proved, or disproved their associated technologies, the project comes to its |
| * natural end. For some projects, this end is a paper publishing the research results; for others, this end is to |
| * be incorporated into the base technology of another top-level project, shuch projects are archived and described |
| * |
| * |
| * @access public |
| * @link http://www.eclipse.org/technology/archived.php Archived Technology Projects |
| * @return boolean true if the project is archived, false otherwise; |
| */ |
| function isArchived() |
| { |
| return $this->isArchived(); |
| } |
| |
| /* fetch temporary */ |
| /** |
| * When settemporary is called, the project will attempt to get the XML info from the Eclipse.org website, |
| * if it can't find it there, then it will fall back to the local temporary project-info XML. |
| * This is intended only for testing purposes. |
| * |
| */ |
| function settemporary($set = true) |
| { |
| $this->fetch_temporary = $set; |
| $this->getXML(); |
| } |
| |
| /* fetch temporary only */ |
| /** |
| * When settemporaryonly is called, the project will fetch the Project Information XML file |
| * from the local temporary project-info XML |
| * This is only for testing purposes. |
| */ |
| function settemporaryonly($set = true) |
| { |
| $this->fetch_temporary_only = $set; |
| $this->getXML(); |
| } |
| |
| /* has things */ |
| /** |
| * The number of Planned Releases for this project |
| * @access public |
| * @return integer The number of planned releases for this project |
| */ |
| function hasReleases() |
| { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| return $this->num_releases; |
| } |
| /** |
| * The number of Currently Shipping (completed) Releases for this project |
| * @access public |
| * @return integer The number of currently shipping releases for this project |
| */ |
| function hasShippings() |
| { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| return $this->num_shippings; |
| } |
| |
| /** |
| * The number of Mailing Lists for this project |
| * @access public |
| * @return integer The number of mailing lists for the project |
| */ |
| function hasLists() |
| { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| return $this->num_lists; |
| } |
| |
| /** |
| * The number of Bugzilla Products for this project |
| * @access public |
| * @return integer The number of bugzilla products for the project |
| */ |
| function hasBugzillaProducts() |
| { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| return $this->num_bugzilla; |
| } |
| |
| /** |
| * The number of Bugzilla Products for this project |
| * @access public |
| * @return integer The number of bugzilla products for the project |
| */ |
| function hasBugzilla() |
| { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| return $this->num_bugzilla; |
| } |
| /** |
| * The number of Newsgroups for this project |
| * @access public |
| * @return integer The number of newsgroups for the project |
| */ |
| function hasNewsgroups() |
| { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| return $this->num_newsgroup; |
| } |
| |
| /** |
| * The number of Blogs for the Project |
| * @access public |
| * @return integer The number of Blogs this project has |
| */ |
| function hasBlogs() |
| { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| return $this->num_blogs; |
| } |
| |
| /** |
| * The number of Articles related to this Project |
| * @access public |
| * @return integer The number of Articles related to this Project |
| */ |
| function hasArticles() |
| { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| return $this->num_articles; |
| } |
| |
| /** |
| * The number of CVS Modules of this project |
| * @access public |
| * @return integer The number of cvs modules for the project |
| */ |
| function hasCVSModules() |
| { |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| return $this->num_cvsmodules; |
| } |
| |
| /** |
| * The number of errors found while trying to process the XML Schema |
| * @access public |
| * @return integer The number of errors found while trying to process the project information |
| */ |
| function hasErrors() |
| { |
| return count($this->errors); |
| } |
| |
| /** |
| * Returns true if the project information is beein fetch from the local copy |
| * i.e. There was no project-info.xml file on the project's website. And false |
| * otherwise. |
| * |
| * This may be true only after calling settemporary(), and is always true after |
| * calling settemporaryonly(). |
| * |
| * @access public |
| * @return boolean True if the information was fetched from the local copy, false otherwise |
| */ |
| function isLocal() |
| { |
| return $this->local; |
| } |
| |
| /* |
| * Returns wether <exclude-from-dashboard/> was found in the XML file or not |
| * |
| * Returns true if the <exclude-from-dashboard/> tag was found in the XML file |
| * false otherwise. |
| * |
| * @return boolean true if <exclude-from-dashboard/> was set false otherwise |
| */ |
| function exclude_from_dashboard() |
| { |
| $found = false; |
| if($this->serialized == 0) |
| $this->parseToArray(); |
| |
| if(isset($this->xmlArray['project']['exclude-from-dashboard'])) |
| $found = true; |
| |
| return $found; |
| } |
| |
| /** |
| * Returns the Liveness of a project |
| * |
| * Returns the liveness of the project, according to the Project Dashboards calculations formula: |
| * <pre> |
| * 1 * log(last week change in number of bugs) + |
| * 1 * log(last week bug fix rate percentage) + |
| * 2 * log(last month bug fix rate percentage) + |
| * 1 * log(180 day bug fix rate percentage) + |
| * 2 * log(last week number of newsgroup postings) + |
| * 2 * 1/(last week newsgroup answers times) + |
| * 3 * log(last month number of newsgroup postings) + |
| * 3 * 1/(last month newsgroup answers times). |
| * </pre> |
| * Optionally you can pass a week in MySQL date format (yyyy-mm-dd) to fetch |
| * results for the week starting on that date. If no $_week is given current calculations are used. |
| * |
| * @link http://www.eclipse.org/projects/dashboard/descriptions.php |
| * @example examples/dashboard_lights.php A simple example |
| * @param string week The week of the calculations |
| * @access public |
| */ |
| function dashboard_liveness($_week = "") |
| { |
| if($this->dashboard_week != $_week || !$this->dashboard_fetched ) |
| $this->getDashboard($_week); |
| |
| return $this->DashboardInfo->getLiveness(); |
| } |
| |
| /** |
| * Returns the number of bugs this project has |
| * |
| * |
| * The number of bugs this project has in the Eclipse Bugzilla bug tracking system |
| * |
| * Optionally you can pass a week in MySQL date format (yyyy-mm-dd) to fetch |
| * results for the week starting on that date. If no $_week is given current calculations are used. |
| * |
| * @link http://bugs.eclipse.org |
| * @param string week The week of the calculations |
| * @access public |
| */ |
| function dashboard_bugs($_week = "") |
| { |
| if($this->dashboard_week != $_week || !$this->dashboard_fetched ) |
| $this->getDashboard($_week); |
| |
| return $this->DashboardInfo->getBugs(); |
| } |
| |
| |
| /** |
| * |
| * How the number number of bugs this project has changed in the past week |
| * |
| * Optionally you can pass a week in MySQL date format (yyyy-mm-dd) to fetch |
| * results for the week starting on that date. If no $_week is given current calculations are used. |
| * |
| * @link http://www.eclipse.org/projects/dashboard/descriptions.php |
| * @param string week The week of the calculations |
| * @access public |
| */ |
| function dashboard_bugs_7_delta($_week = "") |
| { |
| if($this->dashboard_week != $_week || !$this->dashboard_fetched ) |
| $this->getDashboard($_week); |
| |
| return $this->DashboardInfo->getBugs7Delta(); |
| } |
| |
| /** |
| * |
| * How the number number of bugs this project has changed in the past month |
| * |
| * Optionally you can pass a week in MySQL date format (yyyy-mm-dd) to fetch |
| * results for the week starting on that date. If no $_week is given current calculations are used. |
| * |
| * @link http://www.eclipse.org/projects/dashboard/descriptions.php |
| * @param string week The week of the calculations |
| * @access public |
| */ |
| function dashboard_bugs_30_delta($_week = "") |
| { |
| if($this->dashboard_week != $_week || !$this->dashboard_fetched ) |
| $this->getDashboard($_week); |
| |
| return $this->DashboardInfo->getBugs30Delta(); |
| } |
| |
| /** |
| * |
| * How the number number of bugs this project has changed in the past 180 days |
| * |
| * Optionally you can pass a week in MySQL date format (yyyy-mm-dd) to fetch |
| * results for the week starting on that date. If no $_week is given current calculations are used. |
| * |
| * @link http://www.eclipse.org/projects/dashboard/descriptions.php |
| * @param string week The week of the calculations |
| * @access public |
| */ |
| function dashboard_bugs_180_delta($_week = "") |
| { |
| if($this->dashboard_week != $_week || !$this->dashboard_fetched ) |
| $this->getDashboard($_week); |
| |
| return $this->DashboardInfo->getBugs180Delta(); |
| } |
| |
| /** |
| * Past 7 days Bug fix rate |
| * |
| * The difference in the number of closed (resolved, closed, and verified) bugs and |
| * enhancements to the number of open and active (P1, P2, P3) bugs for the <i>last week</i>. |
| * The goal is to keep the number positive because then the project is fixing bugs and |
| * implementing features faster than bugs are being reported. |
| * |
| * Optionally you can pass a week in MySQL date format (yyyy-mm-dd) to fetch |
| * results for the week starting on that date. If no $_week is given current calculations are used. |
| * |
| * @link http://www.eclipse.org/projects/dashboard/descriptions.php |
| * @param string week The week of the calculations |
| * @access public |
| */ |
| function dashboard_bugs_7_percentage($_week = "") |
| { |
| if($this->dashboard_week != $_week || !$this->dashboard_fetched ) |
| $this->getDashboard($_week); |
| |
| return $this->DashboardInfo->getBugs7Percentage(); |
| } |
| |
| /** |
| * Past 30 dyas Bug fix rate |
| * |
| * The difference in the number of closed (resolved, closed, and verified) bugs and |
| * enhancements to the number of open and active (P1, P2, P3) bugs for the <i>last month</i>. |
| * The goal is to keep the number positive because then the project is fixing bugs and |
| * implementing features faster than bugs are being reported. |
| * |
| * Optionally you can pass a week in MySQL date format (yyyy-mm-dd) to fetch |
| * results for the week starting on that date. If no $_week is given current calculations are used. |
| * |
| * @link http://www.eclipse.org/projects/dashboard/descriptions.php |
| * @param string week The week of the calculations |
| * @access public |
| */ |
| function dashboard_bugs_30_percentage($_week = "") |
| { |
| if($this->dashboard_week != $_week || !$this->dashboard_fetched ) |
| $this->getDashboard($_week); |
| |
| return $this->DashboardInfo->getBugs30Percentage(); |
| } |
| |
| /** |
| * Past 180 days Bug fix rate |
| * |
| * The difference in the number of closed (resolved, closed, and verified) bugs and |
| * enhancements to the number of open and active (P1, P2, P3) bugs for the past<i>180 days</i>. |
| * The goal is to keep the number positive because then the project is fixing bugs and |
| * implementing features faster than bugs are being reported. |
| * |
| * Optionally you can pass a week in MySQL date format (yyyy-mm-dd) to fetch |
| * results for the week starting on that date. If no $_week is given current calculations are used. |
| * |
| * @link http://www.eclipse.org/projects/dashboard/descriptions.php |
| * @param string week The week of the calculations |
| * @access public |
| */ |
| function dashboard_bugs_180_percentage($_week = "") |
| { |
| if($this->dashboard_week != $_week || !$this->dashboard_fetched ) |
| $this->getDashboard($_week); |
| |
| return $this->DashboardInfo->getBugs180Percentage(); |
| } |
| |
| |
| /** |
| * Number of posts in the past 7 days |
| * |
| * Total number of posts made in the last 7 days. The number of posts will be -1 when the |
| * newsgroup for a project does not exist and it is not possible to compute the statistics. |
| * When the group for the project exists but it is currently empty (no posts) or there are |
| * no posts for the last 7 days then it will be 0. |
| * |
| * Optionally you can pass a week in MySQL date format (yyyy-mm-dd) to fetch |
| * results for the week starting on that date. If no $_week is given current calculations are used. |
| * |
| * @link http://www.eclipse.org/projects/dashboard/descriptions.php |
| * @param string week The week of the calculations |
| * @access public |
| */ |
| function dashboard_news_7_number_posts($_week = "") |
| { |
| if($this->dashboard_week != $_week || !$this->dashboard_fetched ) |
| $this->getDashboard($_week); |
| |
| return $this->DashboardInfo->getNews7NumberPosts(); |
| } |
| |
| /** |
| * Number of posts in the past 30 days |
| * |
| * Total number of posts made in the last 30 days. The number of posts will be -1 when the |
| * newsgroup for a project does not exist and it is not possible to compute the statistics. |
| * When the group for the project exists but it is currently empty (no posts) or there are |
| * no posts for the last 30 days then it will be 0. |
| * |
| * Optionally you can pass a week in MySQL date format (yyyy-mm-dd) to fetch |
| * results for the week starting on that date. If no $_week is given current calculations are used. |
| * |
| * @link http://www.eclipse.org/projects/dashboard/descriptions.php |
| * @param string week The week of the calculations |
| * @access public |
| */ |
| function dashboard_news_30_number_posts($_week = "") |
| { |
| if($this->dashboard_week != $_week || !$this->dashboard_fetched ) |
| $this->getDashboard($_week); |
| |
| return $this->DashboardInfo->getNews30NumberPosts(); |
| } |
| |
| |
| /** |
| * Average time to response a post (past 7 days) |
| * |
| * Average time it takes for a post that was answered to be answered in the last 7 days. |
| * The Time To Reply (TTR) is computed as the difference between the time of the original |
| * post and the time of the reply using the NNTP-Posting-Date. If there were no answers for |
| * the specified period then the it will be 0. If the newsgroup does |
| * not exist then it will be -1. |
| * |
| * Optionally you can pass a week in MySQL date format (yyyy-mm-dd) to fetch |
| * results for the week starting on that date. If no $_week is given current calculations are used. |
| * |
| * @link http://www.eclipse.org/projects/dashboard/descriptions.php |
| * @param string week The week of the calculations |
| * @access public |
| */ |
| function dashboard_news_7_answer_average_time($_week = "") |
| { |
| if($this->dashboard_week != $_week || !$this->dashboard_fetched ) |
| $this->getDashboard($_week); |
| |
| return $this->DashboardInfo->getNews7AnswerAverageTime(); |
| } |
| |
| /** |
| * Average time to response a post (past 30 days) |
| * |
| * Average time it takes for a post that was answered to be answered in the last 30 days. |
| * The Time To Reply (TTR) is computed as the difference between the time of the original |
| * post and the time of the reply using the NNTP-Posting-Date. If there were no answers for |
| * the specified period then the it will be 0. If the newsgroup does |
| * not exist then it will be -1. |
| * |
| * Optionally you can pass a week in MySQL date format (yyyy-mm-dd) to fetch |
| * results for the week starting on that date. If no $_week is given current calculations are used. |
| * |
| * @link http://www.eclipse.org/projects/dashboard/descriptions.php |
| * @param string week The week of the calculations |
| * @access public |
| */ |
| function dashboard_news_30_answer_average_time($_week = "") |
| { |
| if($this->dashboard_week != $_week || !$this->dashboard_fetched ) |
| $this->getDashboard($_week); |
| |
| return $this->DashboardInfo->getNews30AnswerAverageTime(); |
| } |
| |
| |
| /** |
| * HTML dashboard-like Bug Lights |
| * <pre> |
| * |
| * There's 3 lights they represent last week, last month and last 180 days: |
| * |
| * <7> <30> <180> |
| * |
| * Light |
| * white light Regular |
| * green light Good |
| * red light Bad |
| * </pre> |
| * |
| * Optionally you can pass a week in MySQL date format (yyyy-mm-dd) to fetch |
| * results for the week starting on that date. If no $_week is given current calculations are used. |
| * |
| * @link http://www.eclipse.org/projects/dashboard/descriptions.php |
| * @param string week The week of the calculations |
| * @access public |
| * @example examples/dashboard_lights.php A simple example |
| * |
| */ |
| function dashboard_bugs_lights($_week = "") |
| { |
| if($this->dashboard_week != $_week || !$this->dashboard_fetched ) |
| $this->getDashboard($_week); |
| |
| $this->DashboardInfo->PrintBugsLights(); |
| |
| } |
| |
| /** |
| * HTML dashboard-like News Lights |
| * <pre> |
| * |
| * There's 4 lights they represent number of posts and average response time to a post |
| * for the last 7 and 30 days: |
| * |
| * <#posts_7> <#posts_30> <#avg_ttr_7> <#avg_ttr_30> |
| * |
| * Light |
| * white light Regular |
| * green light Good |
| * red light Bad |
| * </pre> |
| * |
| * Optionally you can pass a week in MySQL date format (yyyy-mm-dd) to fetch |
| * results for the week starting on that date. If no $_week is given current calculations are used. |
| * |
| * @link http://www.eclipse.org/projects/dashboard/descriptions.php |
| * @param string week The week of the calculations |
| * @access public |
| * @example examples/dashboard_lights.php A simple example |
| */ |
| function dashboard_news_lights($_week = "") |
| { |
| if($this->dashboard_week != $_week || !$this->dashboard_fetched ) |
| $this->getDashboard($_week); |
| |
| $this->DashboardInfo->PrintNewsLights(); |
| } |
| } |
| |
| /** |
| * Decodes an URL from its HTML character encoding to its ASCII equivalent |
| * @access private |
| */ |
| function _un_encode_url( $url ) { |
| if( !isset($url) ) return $url; |
| $url = preg_replace( "/\&/", "&", $url ); |
| $url = preg_replace( "/\"/", "\"", $url ); |
| $url = preg_replace( "/\</", "<", $url ); |
| $url = preg_replace( "/\>/", ">", $url ); |
| return $url; |
| } |
| ?> |