public function handleRequest($reqId, $reqSubId)
 {
     $output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
     switch ($reqId) {
         case "gallery":
             $photosPath = "gallery/{$reqSubId}";
             $listOfPhotos = $this->ioResource->getPhotosOfGallery($reqSubId);
             $output .= "<photos>\n";
             foreach ($listOfPhotos as $photo) {
                 $output .= "  <photo>{$photosPath}/{$photo}</photo>\n";
             }
             $output .= "</photos>\n";
             break;
         case "news":
             $output .= "<news>\n";
             $rawContents = $this->ioResource->getRawContents("news");
             foreach ($rawContents->unit as $thisItem) {
                 $output .= "  <item>\n";
                 $output .= "    <title><![CDATA[" . parent::lightCooking($thisItem->title) . "]]></title>\n";
                 $output .= "    <time><![CDATA[" . parent::lightCooking($thisItem->time) . "]]></time>\n";
                 $output .= "    <cathegory><![CDATA[" . parent::lightCooking($thisItem->cathegory) . "]]></cathegory>\n";
                 $output .= "    <description><![CDATA[" . parent::lightCooking($thisItem->description) . "]]></description>\n";
                 $output .= "  </item>\n";
             }
             $output .= "</news>\n";
             break;
     }
     return $output;
 }
 /** Completely cooks the body, applying every sort of transformation.
  */
 protected function bodyCook()
 {
     /* Applyies first simple cooking */
     $this->bodyCooked = parent::lightCooking($this->body->contents);
     /* Applyies bbcode formatting */
     $this->bodyCooked = parent::bbCodeCooking($this->bodyCooked);
     /* For every image it checks in the body if it's called and substitutes it. */
     if (is_array($this->images)) {
         for ($count = 0; $count <= max(array_keys($this->images)); $count++) {
             $isInTemplate = $this->images[$count]->template == "true";
             $needsHover = $this->images[$count]->hover == "true";
             $imageSrc = $isInTemplate ? $this->template : "";
             $imageSrc .= $this->images[$count]->src;
             if ($needsHover) {
                 $this->theHover->addHoveredImage($imageSrc, str_replace("normal", "hover", $imageSrc), "img{$count}");
             }
             $this->bodyCooked = str_replace("[img id={$count}]", "<img id=\"img{$count}\" alt=\"img{$count}\" src=\"{$imageSrc}" . "\" style=\"" . $this->images[$count]->style . '" ' . ($needsHover ? "onmouseover=\"mouseOver('img{$count}')\"" . " onmouseout=\"mouseOut('img{$count}')\"" : "") . " />", $this->bodyCooked);
         }
     }
 }