View file k/function.lib.php

File size: 1.48Kb
<?php
  // библиотека перекодировки текста
  function unicode ($s) { if ( (ord($s)>=192) & (ord($s)<=255) ) $hexvalue=dechex(ord($s)+848); if ($s=="Ё") $hexvalue="401"; if ($s=="ё") $hexvalue="451"; return("&#x0".$hexvalue.";");} 
  function utf_encode ($s) { return(preg_replace("/[А-яЁё]/e","unicode('\\0')",$s));} 
  
  //wap загатовка
  function wml_begin ($header) {print utf_encode("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n
<wml>\n<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\"/>\n<meta http-equiv=\"Pragma\" content=\"no-cache\"/></head>\n
<card id=\"gb\" title=\"$header\">\n");}
  function wml_end ($copy) { print utf_encode("<p>$copy</p></card></wml>\n");}
  //p загатовка
function p_begin ($align) {print utf_encode("<p align = \"$align\">");}
function p_end (){print utf_encode("</p>");}
  //html загатовка
function html_begin ($header) {print utf_encode("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<HTML>\n<HEAD>\n<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n<LINK REL=STYLESHEET HREF=\"wap.css\" TYPE=\"text/css\">\n<TITLE>$header</TITLE>\n</HEAD>\n<BODY>");}
function html_end ($copy){print utf_encode("<div class=\"copy\">$copy</div></BODY></HTML>");} 

function div_begin ($class){print utf_encode("<div class=\"$class\">");}
function div_end () {print utf_encode("</div>");}








?>