style.class.php
Code:
<?php
// wml + xhtml style class By Midnex 2007
// Visit my site at [Only registered and activated users can see links. Click Here To Register...]
// Skype: midnex
// ICQ : 350-772-392
// Email: [Only registered and activated users can see links. Click Here To Register...]
class style {
var $style;
var $body = '';
//This is optional if you want to detect browser in other way, you can write line $style->style = 'wml'; in your index.php to change style
function style()
{
list($browser) = explode("/", $_SERVER['HTTP_USER_AGENT']);
$browser_array = array('Mozilla','Opera');
$style = 0;
for($i = 0; $i < count($browser_array); $i++)
{
if($browser == $browser_array[$i])
{
$style++;
}
}
if($style == 0)
{
$this->style = 'wml';
}
else
{
$this->style = 'xhtml';
}
}
function add_img($url,$text,$br)
{
if($this->style == 'wml')
{
$this->body .= '[img]'.$url.'[/img]';
if($br)
{
$this->body .= '
';
}
}
if($this->style == 'xhtml')
{
$this->body .= '[img]'.$url.'[/img]';
if($br)
{
$this->body .= '
';
}
}
$this->body .= "\n";
}
function start_p($align='left')
{
if($this->style == 'wml')
{
$this->body .= '<p align="'.$align.'">';
}
if($this->style == 'xhtml')
{
$this->body .= '<p class="'.$align.'">';
}
$this->body .= "\n";
}
function end_p()
{
$this->body .= '</p>';
}
function start_page($title)
{
if($this->style == 'wml')
{
$this->body .= '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml12.dtd">';
$this->body .= '<wml><card id="index" title="'.$title.'">';
$this->body .= "\n";
}
if($this->style == 'xhtml')
{
$this->body .= '<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<title>'.$title.'</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>';
$this->body .= "\n";
}
}
function end_page()
{
if($this->style == 'wml')
{
$this->body .= '</card></wml>';
}
if($this->style == 'xhtml')
{
$this->body .= '</body></html>';
}
$this->body .= "\n";
}
function headers()
{
if($this->style == 'wml')
{
header("Content-type: text/vnd.wap.wml;charset=utf-8");
header("Cache-Control: no-store, no-cache, must-revalidate");
}
if($this->style == 'xhtml')
{
header("Content-type: text/html");
header("Cache-Control: no-store, no-cache, must-revalidate");
}
}
function add_link($url,$text,$class='title',$br=true)
{
if($this->style == 'wml')
{
$this->body .= '<anchor>'.$text.'<go href="'.$url.'"></go></anchor>';
}
if($this->style == 'xhtml')
{
if(!empty($class))
{
$this->body .= '[Only registered and activated users can see links. Click Here To Register...]';
}
else
{
$this->body .= '[Only registered and activated users can see links. Click Here To Register...]';
}
}
if($br)
{
$this->body .= $this->do_br();
}
$this->body .= "\n";
}
function img_link($url,$img_url,$text,$br)
{
if($this->style == 'wml')
{
$this->body .= '<anchor>';
$this->body .= $this->add_img($img_url,$text,false);
$this->body .= '<go href="'.$url.'"></go></anchor>';
if($br)
{
$this->body .= '
';
}
}
if($this->style == 'xhtml')
{
$this->body .= '<a href="'.$url.'">';
$this->body .= $this->add_img($img_url,$text,false);
$this->body .= '</a>';
if($br)
{
$this->body .= '
';
}
}
$this->body .= "\n";
}
function do_br($sk=1)
{
$this->body .= str_repeat('
',$sk);
}
function simple_text($text,$br=false)
{
$this->body .= $text;
if($br)
{
$this->body .= $this->do_br();
}
$this->body .= "\n";
}
function show_body()
{
echo $this->body;
}
}
?> index.php
Code:
<?php
// wml + xhtml style class By Midnex 2007
// Visit my site at [Only registered and activated users can see links. Click Here To Register...]
// Skype: midnex
// ICQ : 350-772-392
// Email: [Only registered and activated users can see links. Click Here To Register...]
include('style.class.php');
$style = new style;
//Leave commented if you want the class will detect browser automatically.
//$style->style = $_GET['style']; wml/xhtml
//$style->style = 'wml';
//$style->style = 'xhtml';
$style->headers();
$style->start_page('Wap-Online.Net');
$style->start_p('center');
$style->add_img('[Only registered and activated users can see links. Click Here To Register...]);
$style->simple_text('Hello everyone, im glad you visited my site;)',true);
$style->add_link('[Only registered and activated users can see links. Click Here To Register...]);
$style->end_p();
$style->end_page();
$style->show_body();
?>
Got questions ?
Ask
Bookmarks