/** 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); } } }