
Человеки напишите мне регулярные выражения!

Ну вот вы замутите свои регулярные выражения, исправите чегонить. Вы свой мод и файл который правите знаете прекрасно, а допустим мне придется откатывать весь мод и ставить новую версию. Или отыскивать изменения в новой версии относительно старой. А вот если бы был файлик update ... to ... Вот для этого я и думаю не стоит отделять TEMPLATE.TXT от INSTALL.TXT, лучше в коде мода написать что для ленивцев у которых TEMPLATE стадартный можно такие то действия пропустить и просто заменить файл.CodeWorld писал(а):Т.е.?
Код: Выделить всё
#-----[ OPEN ]------------------------------------------
#
admin/page_footer_admin.php
Код: Выделить всё
if ( $do_gzip_compress )
Код: Выделить всё
if( $do_gzip_compress )
Завтра попробую поставить, у нас уже ночь спать охотоCodeWorld писал(а):ох незнаю, будет ли это работатьа это всё из этого мода? всмысле других изменений для работы eXtreme Styles mod не надо?
Код: Выделить всё
{
eval($code);
}
Код: Выделить всё
//------------------------------------------------
if (defined('IN_ADMIN')) eval($code);
else {
// Run the compiled code.
ob_start();
eval($code);
$this->content.=ob_get_clean();
}
//------------------------------------------------
Код: Выделить всё
function _unserialize($str)
{
$array = array();
$list = explode('|', $str);
for($i=0; $i<count($list); $i++)
{
$row = explode('=', $list[$i], 2);
if(count($row) == 2)
{
$array[$row[0]] = $row[1];
}
}
return $array;
}
Код: Выделить всё
function show()
{
$start_time = microtime();
$start_array = explode(" ",$start_time);
$start_time = $start_array[1] + $start_array[0];
$output=$this->content;
$page_byte=strlen($output);
$output=str_replace('<TEXTAREA','<textarea',$output);
$output=str_replace('</TEXTAREA>','</textarea>',$output);
$mas=explode("<textarea", $output);
$i=0;
if (count($mas)<2) $output=clearp($output);
else {
$output='';
while ($i<count($mas))
{
$output.=clearp($mas[$i]).'<textarea';
$i++;
$temp=explode("</textarea>",$mas[$i]);
$output.=$temp[0]."</textarea>".clearp($temp[1]);
$i++;
}
}
// calculate some nice looking numbers :-)
$pagenew_byte = strlen($output);
$page_kilobyte = @number_format(($page_byte/1024),2);
$pagenew_kilobyte = @number_format(($pagenew_byte/1024),2);
$pagesaved_byte = $page_byte - $pagenew_byte;
$pagesaved_kilobyte = @number_format((($pagesaved_byte)/1024),2);
$pagesaved_perc = @number_format(((100*$pagesaved_byte)/$page_byte),2);
$this->content=$output;
if (!defined('IN_ADMIN')) {
$myfoot="[ Realtime Page Compressor: ".$pagesaved_perc."% (saved ".$pagesaved_kilobyte." kb) ";
$end_time = microtime();
$end_array = explode(" ",$end_time);
$end_time = $end_array[1] + $end_array[0];
$time = $end_time - $start_time;
$myfoot.=" per ".(substr($time,0,6))." sec ]<br><br>";
$this->content = str_replace("%RPC%" ,$myfoot ,$this->content );
}
return $this->content;
}
Код: Выделить всё
function xs_switch($tpl, $name)
{
return (isset($tpl->_tpldata[$name.'.']) && count($tpl->_tpldata[$name.'.']) > 0);
}
Код: Выделить всё
function clearp($output)
{
// strip all whitespace at the beginning of every new line (but leave the linebreak intact)
$output=preg_replace('/(\r)?\n(\s*)/', "\n", $output);
// strip all linebreaks and HTML-Comments from the output
// (since we first strip all linebreaks, even multi-line comments will get striped this way! :-))
$output = str_replace("\n" ," " ,$output );
$output = preg_replace('/\/\*.*?[^\b\*\/\b]*?.*?\*\//',"" , $output);
$output = preg_replace('/<!--[^\{\[]*?-->/i', "", $output); // We exclude HTML comments containing "{" and "["
// this way CSS definitions and AnyMedia stuff won't get striped
// last not least: strip any remaining multiple spaces between tags...
$output = preg_replace('/>[\s]+</', "> <" ,$output );
//added by CodeWorld. I dont know correct it or not, but it is work - >1kb
$output = str_replace(" />" ,">" ,$output );
$output = str_replace('="0"' ,"=0" ,$output );
$output = str_replace('align="center"' ,"align=center" ,$output );
$output = str_replace("width=\"100%\"" ,"width=100%" ,$output );
return $output;
}