@bot.callback_query_handler(func=lambda call: True)
def handle_callback_query(call):
if call.data == 'learn_words':
markup = types.InlineKeyboardMarkup(row_width=2)
button1 = types.InlineKeyboardButton("Легкий уровень", callback_data='easy_level')
button2 = types.InlineKeyboardButton("Дом и быт", callback_data='home_and_life')
markup.add(button1, button2)
bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id,
text="Отлично! Выберите какие слова вы будете изучать", reply_markup=markup)
elif call.data == 'easy_level':
markup = types.InlineKeyboardMarkup(row_width=5)
row = []
for i in range(1, 26):
button = types.InlineKeyboardButton(str(i), callback_data=f'word_{i}')
row.append(button)
if len(row) == 5:
markup.row(*row)
row = []
bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id,
text="Выберите слово:", reply_markup=markup)
elif call.data.startswith('word_'):
selected_word = call.data.split('_')[1]
bot.send_message(call.message.chat.id, f"Вы выбрали слово {selected_word}")
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' );