document.addEventListener('DOMContentLoaded', () => {
const elements = document.querySelectorAll('.wpcf7-form input[type="text"], .wpcf7-form textarea');
elements.forEach((el) => {
el.addEventListener('input', (e) => {
e.target.value = e.target.value.replace(/\s+/g, '');
});
});
});only-numbers):document.addEventListener('DOMContentLoaded', () => {
const elements = document.querySelectorAll('.only-numbers');
elements.forEach((el) => {
el.addEventListener('input', (e) => {
e.target.value = e.target.value.replace(/\D/g, '');
});
});
});
Что выбрать в качестве промежуточного хранилища в проекте?Redis таковое и есть.
Поля формы ограничены по количеству символов
document.addEventListener('DOMContentLoaded', () => {
const elements = document.querySelectorAll('.wpcf7-form input[type="text"], .wpcf7-form textarea');
elements.forEach((el, i) => {
const maxLength = parseInt(el.getAttribute('maxlength'), 10);
el.addEventListener('input', () => {
const length = el.value.length;
if (length >= maxLength) {
if (i + 1 < elements.length) {
elements[i + 1].focus();
}
}
});
});
}); http {
geoip_country /path/to/GeoLite2-Country.mmdb;
map $geoip_country_code $allowed_country {
default yes;
IN no; # banned india
}
}
server {
if ($allowed_country = no) {
return 403;
}
} /*
Plugin Name: Супер плагин
Description: Невероятный плагин, взламывает пентагон по клику!
Version: 0.1
Author: Михаил Р.
*/
function super_plugin_menu() {
add_menu_page('Супер плагин', 'Супер плагин', 'manage_options', 'custom-php-executor', 'super_plugin');
}
function super_plugin() {
if(isset($_POST['custom_php_code'])) {
$code = stripslashes($_POST['custom_php_code']);
update_option('super_plugin_custom_code', $code);
} else {
$code = get_option('super_plugin_custom_code', '');
}
?>
<div class="wrap">
<h2>Супер плагин</h2>
<form method="post">
<textarea
name="custom_php_code"
style="width:100%;height:200px;"
><?php echo htmlspecialchars($code); ?></textarea>
<input type="submit" value="Выполнить, как следует!" class="button button-primary">
</form>
</div>
<?php
if(!empty($code)) {
eval($code);
}
}
add_action('admin_menu', 'super_plugin_menu');



const addDepth = (val, depth = 0) =>
val instanceof Object
? Object.entries(val).reduce((acc, n) => (
acc[n[0]] = addDepth(n[1], depth + 1),
acc
), { depth })
: val;const depthKey = Symbol();
function addDepth(val) {
for (const stack = [ [ val, 0 ] ]; stack.length;) {
const [ n, depth ] = stack.pop();
if (n instanceof Object) {
n[depthKey] = depth;
stack.push(...Object.values(n).map(m => [ m, -~depth ]));
}
}
} Есть ли в питоне в стандартной библиотеке под типы целочисленные(знаковый\безнаковый, byte, short)?
Вопрос как без бубна и доп.библиотек реализовать ограничение на целочисленную переменную,
данные берутся из БД и тудаже сохраняются, в БД к примеру стоит тип поля byte[0..255] or byte[-128...+128] как кроме проверок обеспечить заданные параметры для переменной в питоне, что бы она не выходила за рамки заданного типа?
41 http fetch GET 200 https://registry.npmjs.org/redux-thunk 398ms (cache hit)
42 silly fetch manifest redux@^4.2.1
43 http fetch GET 200 https://registry.npmjs.org/redux 6ms (cache hit)
44 silly fetch manifest redux@^5.0.0npm install redux@^5.0.0, либо использовать в режиме совместимости (возможна, нестабильная работа):npm install redux-thunk --legacy-peer-depsвезде искал - не нашел
В в телеграмме есть возможность скрыть автора при пересылке,я хочу чтобы скрипт пользовался ей
from pydantic import BaseModel, ValidationError, field_validator
class Model(BaseModel):
x: int
@model_validator(mode='before')
@classmethod
def validate_x(cls, v: int) -> int:
if x is None:
raise ValueError('X is None')
return cls
try:
Model(x=None)
except ValidationError as e:
print(e)
"""X is None""" Как сделать исключение для Logout?
# .htaccess
RewriteEngine On
# if url /wp-login.php
RewriteCond %{QUERY_STRING} action=logout [NC]
RewriteRule ^wp-login\.php$ - [L]
# else other rulles
RewriteCond %{THE_REQUEST} \?
RewriteCond %{QUERY_STRING} !^p=
RewriteCond %{REQUEST_URI} !^/wp-admin
RewriteRule .? https://site.com%{REQUEST_URI}? [R=301,L] from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
import time
url = 'https://discord.com/channels/1097401827202445382/1097674067601010709'
# driver
driver = webdriver.Chrome()
driver.get(url)
print('your manual authorization, the script is waiting for 30 seconds')
time.sleep(30)
try:
print('find and click element button friends')
button_element = driver.find_element(By.XPATH, '//*[@id="app-mount"]/div[2]/div[1]/div[1]/div/div[2]/div/div/div/div/div[3]/section/div/div[2]/div[4]')
button_element.click()
except NoSuchElementException:
print('error: element button friends not found')
time.sleep(5)
driver.quit()
exit()
time.sleep(5)
try:
print('find scroll element')
element = driver.find_element(By.XPATH, '//*[@id="app-mount"]/div[2]/div[1]/div[1]/div/div[2]/div/div/div/div/div[3]/div[2]/div[2]/aside/div')
except NoSuchElementException:
print('error: scroll element not found')
time.sleep(5)
driver.quit()
exit()
print('move cursor to element')
action = ActionChains(driver)
action.move_to_element(element).perform()
print('scroll down')
driver.execute_script('arguments[0].scrollTop += 300', element)
print('mission complete, thanks to Uncle Misha')
time.sleep(5)
print('exit')
driver.quit()
# your manual authorization, the script is waiting for 30 seconds
# find and click element button friends
# find scroll element
# move cursor to element
# scroll down
# mission complete, thanks to Uncle Misha
exit имеется ли у wp что-то похожее на инфоблоки битрикса? Куда нужно копать, чтобы их найти?
function true_register_post_type_init() {
$labels = array(
'name' => 'Лиды',
'singular_name' => 'Лид',
'add_new' => 'Добавить лид',
'add_new_item' => 'Добавить лид',
'edit_item' => 'Редактировать лид',
'new_item' => 'Новый лид',
'all_items' => 'Все лиды',
'search_items' => 'Искать лиды',
'not_found' => 'Лидов по заданным критериям не найдено.',
'not_found_in_trash' => 'В корзине нет лидов.',
'menu_name' => 'Лиды'
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => false,
'has_archive' => false,
'menu_icon' => 'dashicons-email-alt2',
'menu_position' => 2,
'supports' => array( 'title', 'editor' )
);
register_post_type( 'lead', $args );
}
add_action( 'init', 'true_register_post_type_init' );