Example #1
0
 protected function options_to_s($options)
 {
     if (!is_array($options)) {
         throw new HalfMoonException("invalid argument passed; expected " . "options array");
     }
     $opts_s = "";
     foreach ($options as $k => $v) {
         $opts_s .= " " . $k . "=\"" . raw_or_h($v) . "\"";
     }
     return $opts_s;
 }
Example #2
0
 public function link_to_function($text, $javascript, $options = array())
 {
     if (isset($options["onclick"])) {
         $options["onclick"] .= "; ";
     } else {
         $options["onclick"] = "";
     }
     $options["onclick"] .= $javascript . "; return false;";
     if (!isset($options["href"])) {
         $options["href"] = "#";
     }
     return "<a href=\"" . raw_or_h($options["href"]) . "\"" . $this->html_helper->options_for_link($options) . ">" . $text . "</a>";
 }
Example #3
0
 public function text_area_tag($field, $content = null, $options = array())
 {
     $options = FormTagHelper::set_field_id_and_name($field, $options);
     if (isset($options["size"])) {
         list($options["cols"], $options["rows"]) = explode("x", $options["size"], 2);
         unset($options["size"]);
     }
     return "<textarea " . $this->options_to_s($options) . ">" . raw_or_h($content) . "</textarea>";
 }
Example #4
0
 public function link_to($text, $obj_or_url, $options = array())
 {
     return "<a href=\"" . raw_or_h($this->link_from_obj_or_string($obj_or_url)) . "\"" . $this->options_for_link($options) . ">" . raw_or_h($text) . "</a>";
 }