コード例 #1
0
ファイル: Mail.php プロジェクト: hypnomez/opir.org
 /**
  * @param string	$body
  * @param string	$signature
  *
  * @return string
  */
 protected function body_normalization($body, $signature)
 {
     if (strpos($body, '<!doctype') === 0 && strpos($body, '<body') !== false) {
         $body = "<!doctype html>\n{$body}";
     }
     if (strpos($body, '<html') === false) {
         if (substr($body, 0, 5) != '<body') {
             $body = h::body($body . $signature);
         } else {
             $body = str_replace('</body>', "{$signature}</body>", $body);
         }
         $body = h::html(h::{'head meta'}(['content' => 'text/html; charset=utf-8', 'http-equiv' => 'Content-Type']) . $body);
     } else {
         $body = str_replace('</body>', "{$signature}</body>", $body);
     }
     return $body;
 }
コード例 #2
0
ファイル: example.php プロジェクト: AndruxaSazonov/htmlgen
h::html(function () {
    h::head(function () {
        h::meta(array("charset" => "UTF-8"));
        h::link(array("rel" => "stylesheet", "type" => "text/css", "href" => "global.css"));
    });
    h::body(function () {
        h::div(array("id" => "wrapper"), function () {
            h::h1("Hello, World", array("class" => "title"));
            h::comment("navigation");
            h::ul(array("class" => "links"), function () {
                foreach (array(1, 2, 3) as $x) {
                    h::li(function () use($x) {
                        h::a("Link {$x}", "#{$x}");
                    });
                }
            });
            h::comment("let's see some text");
            h::p("Lorem ipsum dolor sit amet, consectetur adipisicing elit...");
            h::comment("now for a table");
            h::table(function () {
                $table_data = h::get_variable('table_data', array());
                h::tr(array("class" => "header"), function () {
                    h::th("key");
                    h::th("value");
                });
                foreach ($table_data as $k => $v) {
                    h::tr(array("class" => h::cycle(array("odd", "even"))), function () use($k, $v) {
                        h::td($k);
                        h::td($v);
                    });
                }
            });
        });
    });
});