<?php
namespace entities\html;

class Input
{
   public function __construct(
      $name=null, $type=null, $value=null, $class=null, $clear_on_focus=false)
   {
      $this->name = $name;
      $this->type = $type;
      $this->value = $value;
      $this->class = $class;
      $this->clear_on_focus = $clear_on_focus;
   }
   public function __toString()
   {
      return $this->build_html();
   }
   private function build_html()
   {
      $markup = "<input";
      $markup .= $this->build_assignments();
      if ($this->clear_on_focus)
      {
         $markup .= " onFocus=\"this.value='';this.style.color='black'\"";
      }
      $markup .= "/>\n";
      return $markup;
   }
   protected function build_assignments()
   {
      $assignments = $this->build_assignment("name");
      $assignments .= $this->build_assignment("type");
      $assignments .= $this->build_assignment("value");
      $assignments .= $this->build_assignment("class");
      return $assignments;
   }
   private function build_assignment($name)
   {
      $value = $this->$name;
      if (!is_null($value))
      {
         return " $name=\"$value\"";
      }
      return null;
   }
}
<?php
namespace entities\html;

class Page
{
   private $scripts = array();
   public function __construct($title=null)
   {
      $this->set_title($title);
      $this->css_path = $GLOBALS["CSS_PATH"];
   }
   protected function set_title($title)
   {
      $this->title = $title;
   }
   public function __toString()
   {
      return $this->build_html();
   }
   private function build_html()
   {
      $markup = "<html>\n";
      $markup .= "<head>\n";
      $markup .= $this->build_head();
      $markup .= "</head>\n";
      $markup .= $this->build_body();
      $markup .= "</html>\n";
      return $markup;
   }
   protected function build_head()
   {
      $markup = $this->build_title();
      $markup .= $this->build_style_link();
      $markup .= $this->build_script_tags();
      $markup .= $this->build_description();
      $markup .= $this->build_thumbnail_link();
      $markup .= $this->build_favicon_link();
      return $markup;
   }
   private function build_title()
   {
      $markup = "<title>" . $this->title . "</title>\n";
      $markup .= new Meta($this->title, "title");
      return $markup;
   }
   private function build_style_link()
   {
      $tag = "<link href=\"" . $this->css_path . "\" rel=\"stylesheet\">\n";
      return $tag;
   }
   protected function build_script_tags()
   {
      $markup = "";
      foreach ($this->scripts as $path)
      {
         $markup .= new Script($path);
      }
      return $markup;
   }
   private function build_description()
   {
      return new Meta($GLOBALS["PAGE_DESCRIPTION"], "description") . "\n";
   }
   private function build_thumbnail_link()
   {
      $tag = "<link rel=\"image_src\"";
      $tag .= " href=\"" . $GLOBALS["THUMBNAIL_PATH"] . "\"/>";
      return $tag;
   }
   private function build_favicon_link()
   {
      return new Link("shortcut icon", $GLOBALS["FAVICON_PATH"]);
   }
   private function build_body()
   {
      $markup = "<body>\n";
      $markup .= $this->build_content();
      $markup .= "</body>\n";
      return $markup;
   }
   protected function build_content()
   {
      return "";
   }
   protected function add_script($path)
   {
      $this->scripts[] = $path;
   }
}
<?php
namespace entities\html;

class Script
{
   public function __construct($path=null, $content=null)
   {
      $this->path = $path;
      $this->content = $content;
   }
   public function __toString()
   {
      return $this->build_html();
   }
   public function build_html()
   {
      $markup = "<script";
      if (!is_null($this->path))
      {
         $markup .= " src=\"" . $this->path . "\"";
      }
      $markup .= ">";
      $markup .= $this->build_content();
      $markup .= "</script>\n";
      return $markup;
   }
   protected function build_content()
   {
      return $this->content;
   }
}
<?php
namespace entities\html;

class A extends Element
{
   public function __construct($href=null, $content=null, $id=null, $class=null)
   {
      parent::__construct("a", $id, $class);
      $this->add_attribute("href", $href);
      $this->content = $content;
   }
   protected function build_content()
   {
      $content = $this->content;
      if (is_null($content))
      {
         $content = $this->get_attribute("href");
      }
      return $content;
   }
}
<?php
namespace entities\html;

class IFrame extends Element
{
   public function __construct($id, $src, $width, $height)
   {
      parent::__construct("iframe", $id);
      $this->add_attribute("src", $src);
      $this->add_attribute("width", $width);
      $this->add_attribute("height", $height);
      $this->add_attribute("frameborder", "0");
   }
}
44.223.39.67
44.223.39.67
44.223.39.67
 
November 10, 2013


Food Spring - Watermelon Stage

Getting the fruit as far as possible is the object of each level, collecting bigger, more valuable guns. The final result is determined by the size of the fruits' collection when the monkey arrives in North America and either survives or perishes in the fruits' attack.

Watermelon Peach
Pineapple Grapes