<?php
// Функция перекодировки с windows-1251 в utf-8
function win_to_utf($text)
{
$text=iconv('windows-1251','utf-8',$text);
return $text;
}
// Функция выделяет контент и вырезает ява скрипты
function pages($text)
{
$text=explode('<!--CONTENT_OF_PAGE-->
',$text);
$text=$text[1];
$text=explode('<!--EOF_CONTENT_OF_PAGE-->
',$text);
$text=$text[0];
$text=preg_replace('|<center><script(.*)</script></center>|Uis','',$text);
$text=preg_replace('|<script(.*)</script>|Uis','',$text);
return $text;
}
// Функция замен
function obrezka($text)
{
$text=str_replace("<hr>
<hr>","",$text);
$text=str_replace('</index>','',$text);
$text=str_replace('/functions/','',$text);
$text=preg_replace('|<!--(.*)-->|Uis','',$text);
$text=str_replace(' TARGET="_BLANK"','',$text);
$text=str_replace('TARGET="_BLANK"','',$text);
$text=str_replace(' target="_blank"','',$text);
$text=str_replace(' TARGET="_top"','',$text);
$text=str_replace(' TARGET="_TOP"','',$text);
$text=str_replace(' target="_top"','',$text);
$text=str_replace('/learnphp/datatypes/','learnphp_datatypes.php',$text);
$text=str_replace('/prepare/','prepare.php',$text);
$text=str_replace('/php/intro/','php_intro.php',$text);
$text=str_replace('/learnphp/vars/','learnphp_vars.php',$text);
$text=str_replace('/learnphp/operators/','learnphp_operators.php',$text);
$text=str_replace('/learnphp/cs/','learnphp_cs.php',$text);
$text=str_replace('/learnphp/','learnphp.php',$text);
$text=str_replace('custom/','custom.php',$text);
$text=str_replace('/security/','security.php',$text);
$text=str_replace('/phphttp/','phphttp.php',$text);
$text=str_replace('PHP.SU',$_SERVER['HTTP_HOST'],$text);
$text=str_replace('<a href=""','<a href="index.php"',$text);
$text=str_replace('<input name="f" type="text" size="30" maxlength="50" class="mtx2">','<input name="f" type="text" size="30" maxlength="50" class="mtx2"><br/>',$text);
return $text;
}
?>