add_filter('the_content', 'the_sub');
function the_sub($text) {
if (is_category()) {
$element_class = 'ваш-css-класс';
$dom = new DOMDocument();
libxml_use_internal_errors(true);
$dom->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'));
libxml_clear_errors();
$xpath = new DOMXPath($dom);
$elements = $xpath->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' $element_class ')]");
$new_content = '';
foreach ($elements as $element) {
$new_content .= $dom->saveHTML($element);
}
return $new_content;
}
return $text;
}
$make_key = 10;
$cs = 0; //счетчик вход. файлов
$files = file("./data/phone.dat") or die ("Нету файла для крон !...");
foreach ($files as $file) {
$cl = 0; //текущая строка
$cf = 0; //текущий файл (выходной)
$outdir = './data3/';
$source = fopen($file, 'r');
$outhndl = fopen($outdir.'phone-'.$cs.'-'.$cf.'.dat', 'w');
while (!feof($source)) {
fputs($outhndl, fgets($source, 4096)); //записываем в новый файл что считали с входного
$cl++;
if ($cl == $make_key) { //как только набралось N строк
$cl = 0;
$cf++;
fclose($outhndl); //закрываем выходной файл
$outhndl = fopen($outdir.'phone-'.$cs.'-'.$cf.'.dat', 'w'); //открываем новый...
} //end if
} //end while
$cs++;
fclose($source);
fclose($outhndl);
}
$_SERVER['HTTP_REFERER']
!==document.referrer
if (!isset($_COOKIE['referrer']) && (!isset($_SERVER['HTTP_CACHE_CONTROL']) || $_SERVER['HTTP_CACHE_CONTROL'] !== 'max-age=0')) {
$previousPageUrl = $_SERVER['HTTP_REFERER'] . $_SERVER['REQUEST_URI'];
setcookie('referrer', $previousPageUrl, time() + 3600, '/');
header('Location: ' . $previousPageUrl);
exit;
}
add_filter( 'show_admin_bar', '__return_false' );