Files
poll/funcs/func.rewrite.php
2026-03-29 18:38:12 +05:00

26 lines
1.1 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
function PollRewrite($print_out)
{
// учитываем суффикс из настроек
$suff = (defined('URL_SUFF')) ? URL_SUFF : '';
// регулярка для Результатов (pid)
$print_out = preg_replace('/index\.php\?module=poll[&|&amp;]+action=result[&|&amp;]+pid=(\d+)/i', 'poll-$1' . $suff, $print_out);
// регулярка для Формы (pollcomment)
$print_out = preg_replace('/index\.php\?module=poll[&|&amp;]+action=form[&|&amp;]+pop=1[&|&amp;]+pid=(\d+)/i', 'pollcomment-$1' . $suff, $print_out);
// замена для Архива (учитываем оба варианта разделителя)
$print_out = preg_replace('/index\.php\?module=poll[&|&amp;]+action=archive/i', 'poll-archive' . $suff, $print_out);
// если есть ссылки на печать
if ($suff != '') {
$print_out = str_replace($suff . '&amp;print=1', '-print' . $suff, $print_out);
$print_out = str_replace($suff . '&print=1', '-print' . $suff, $print_out);
}
return $print_out;
}
?>