Beispiel #1
0
 /**
  *	Returns HTML-formatted RSS items
  *	@method		getHTMLTitlesFormatted
  *	@returns	string HTML-formatted RSS items
  */
 function getHTMLTitlesFormatted()
 {
     $itemBranchesXML = new XML("ul");
     reset($this->itemBranches);
     foreach ($this->itemBranches as $newsItem) {
         $itemXML = new XMLBranch("li");
         $itemLinkXML = new XMLBranch("a");
         $itemLinkXML->setTagContent($newsItem->getTagContent("item/title"));
         $itemLinkXML->setTagAttribute("href", $newsItem->getTagContent("item/link"));
         $itemXML->addXMLBranch($itemLinkXML);
         $itemBranchesXML->addXMLBranch($itemXML);
     }
     return $itemBranchesXML->getXMLString();
 }
Beispiel #2
0
 /**
  *	Returns class documentation as a string, formatted in HTML
  *	@method		getClassDocFromClass
  *	@param		object objClass
  *	@returns	string HTML-formatted documentation if successful, false otherwise
  */
 function getClassDocFromClass($objClass)
 {
     if (is_object($objClass) && get_class($objClass) == "phpclass") {
         $classDocXML = new XML("html");
         // ---------------------- HEAD ---------------------- //
         $headXML = new XMLBranch("head");
         $headXML->setTagContent($objClass->getInfo("name"), "head/title");
         $headXML->setTagContent("", "head/meta");
         $headXML->setTagAttribute("http-equiv", "content-type", "head/meta");
         $headXML->setTagAttribute("content", "text/html; charset=ISO-8859-1", "head/meta");
         $headXML->setTagContent($this->CSSStringDefault, "head/style");
         $headXML->setTagAttribute("type", "text/css", "head/style");
         // ---------------------- BODY ---------------------- //
         $bodyXML = new XMLBranch("body");
         $classTitleXML = new XMLBranch("h1");
         $classTitleXML->setTagAttribute("class", "classTitle");
         $classTitleXML->setTagContent($objClass->getInfo("name") . " Class");
         $bodyXML->addXMLBranch($classTitleXML);
         foreach ($objClass->info as $infoKey => $infoValue) {
             $brXML = new XMLBranch("br");
             $bodyXML->addXMLBranch($brXML);
             if (is_array($infoValue)) {
                 $spanXML = new XMLBranch("span");
                 $spanXML->setTagAttribute("class", $infoKey);
                 $spanXML->setTagContent(ucfirst($infoKey) . ":");
                 $ulXML = new XMLBranch("ul");
                 $ulXML->setTagAttribute("class", $infoKey);
                 foreach ($infoValue as $value) {
                     $liXML = new XMLBranch("li");
                     $liXML->setTagContent($value);
                     $ulXML->addXMLBranch($liXML);
                 }
                 $bodyXML->addXMLBranch($spanXML);
                 $bodyXML->addXMLBranch($ulXML);
             } else {
                 $spanXML = new XMLBranch("span");
                 $spanXML->setTagAttribute("class", $infoKey);
                 $spanXML->setTagContent(ucfirst($infoKey) . ": " . $infoValue);
                 $bodyXML->addXMLBranch($spanXML);
             }
         }
         $hrXML = new XMLBranch("hr");
         $bodyXML->addXMLBranch($hrXML);
         $h2XML = new XMLBranch("h2");
         $h2XML->setTagAttribute("class", "methodsTitle");
         $h2XML->setTagContent("All Methods");
         $bodyXML->addXMLBranch($h2XML);
         $spanXML = new XMLBranch("span");
         $spanXML->setTagAttribute("class", "methodList");
         foreach ($objClass->methods as $methodName => $method) {
             $aMethodXML = new XMLBranch("a");
             $aMethodXML->setTagAttribute("href", "#" . $methodName);
             $aMethodXML->setTagContent($methodName);
             $brXML = new XMLBranch("br");
             $spanXML->addXMLBranch($aMethodXML);
             $spanXML->addXMLBranch($brXML);
         }
         $bodyXML->addXMLBranch($spanXML);
         foreach ($objClass->methods as $methodName => $method) {
             $hrXML = new XMLBranch("hr");
             $bodyXML->addXMLBranch($hrXML);
             $pMethodXML = new XMLBranch("p");
             $aMethodXML = new XMLBranch("a");
             $aMethodXML->setTagAttribute("name", $methodName);
             $spanXMLName = new XMLBranch("span");
             $spanXMLName->setTagAttribute("class", "methodName");
             $spanXMLName->setTagContent($methodName);
             $spanXMLArgs = new XMLBranch("span");
             $tagContentArgs = " ( ";
             if (is_array($method->params) && count($method->params) > 0) {
                 $paramCount = 0;
                 foreach ($method->params as $key => $value) {
                     if ($paramCount > 0) {
                         $tagContentArgs .= ", ";
                     }
                     $tagContentArgs .= $key;
                     $paramCount++;
                 }
             }
             $tagContentArgs .= " )";
             $spanXMLArgs->setTagContent($tagContentArgs);
             $aMethodXML->addXMLBranch($spanXMLName);
             $aMethodXML->addXMLBranch($spanXMLArgs);
             $pMethodXML->addXMLBranch($aMethodXML);
             $bodyXML->addXMLBranch($pMethodXML);
             unset($method->info["name"]);
             foreach ($method->info as $infoKey => $infoValue) {
                 if (is_array($infoValue)) {
                     $pXML = new XMLBranch("p");
                     $pXML->setTagAttribute("class", $infoKey);
                     $pXML->setTagContent(ucfirst($infoKey) . ":");
                     $ulXML = new XMLBranch("ul");
                     $ulXML->setTagAttribute("class", $infoKey);
                     foreach ($infoValue as $value) {
                         $liXML = new XMLBranch("li");
                         $liXML->setTagContent($value);
                         $ulXML->addXMLBranch($liXML);
                     }
                     $bodyXML->addXMLBranch($pXML);
                     $bodyXML->addXMLBranch($ulXML);
                 } else {
                     $pXML = new XMLBranch("p");
                     $pXML->setTagAttribute("class", $infoKey);
                     $pXML->setTagContent(ucfirst($infoKey) . ": " . $infoValue);
                     $bodyXML->addXMLBranch($pXML);
                 }
             }
             if (is_array($method->params) && count($method->params) > 0) {
                 $pParamXML = new XMLBranch("p");
                 //$pParamXML->setTagAttribute("class", "param");
                 $paramTitleXML = new XMLBranch("span");
                 $paramTitleXML->setTagContent("Arguments:");
                 $pParamXML->addXMLBranch($paramTitleXML);
                 $paramListXML = new XMLBranch("ul");
                 foreach ($method->params as $key => $value) {
                     $paramItemXML = new XMLBranch("li");
                     $paramItemXML->setTagAttribute("class", "param");
                     $paramItemXML->setTagContent($key);
                     $paramListXML->addXMLBranch($paramItemXML);
                 }
                 $pParamXML->addXMLBranch($paramListXML);
                 $bodyXML->addXMLBranch($pParamXML);
             }
         }
         // ---------------------- END  ---------------------- //
         $classDocXML->addXMLBranch($headXML);
         $classDocXML->addXMLBranch($bodyXML);
         return $classDocXML->getXMLString(0);
     } else {
         return false;
     }
 }