add_filter( 'woocommerce_credit_card_form_fields', 'customize_credit_card_fields', 10, 2 );
function customize_credit_card_fields( $fields, $gateway_id ) {
$fields['card-number-field'] = '<p class="form-row form-row-wide">
<label for="' . esc_attr( $gateway_id ) . '-card-number">' . esc_html__( 'Номер карты', 'woocommerce' ) . ' <span class="required">*</span></label>
<input id="' . esc_attr( $gateway_id ) . '-card-number" class="input-text wc-credit-card-form-card-number" inputmode="numeric" autocomplete="cc-number" autocorrect="no" autocapitalize="no" spellcheck="no" type="tel" maxlength="20" placeholder="•••• •••• •••• ••••" ' . $this->field_name( 'card-number' ) . ' />
</p>';
$fields['card-expiry-field'] = '<p class="form-row form-row-first">
<label for="' . esc_attr( $gateway_id ) . '-card-expiry">' . esc_html__( 'Срок действия', 'woocommerce' ) . ' <span class="required">*</span></label>
<input id="' . esc_attr( $gateway_id ) . '-card-expiry" class="input-text wc-credit-card-form-card-expiry" inputmode="numeric" autocomplete="cc-exp" autocorrect="no" autocapitalize="no" spellcheck="no" type="tel" maxlength="7" placeholder="ММ / ГГ" ' . $this->field_name( 'card-expiry' ) . ' />
</p>';
$fields['card-cvc-field'] = '<p class="form-row form-row-last">
<label for="' . esc_attr( $gateway_id ) . '-card-cvc">' . esc_html__( 'Код безопасности', 'woocommerce' ) . ' <span class="required">*</span></label>
<input id="' . esc_attr( $gateway_id ) . '-card-cvc" class="input-text wc-credit-card-form-card-cvc" inputmode="numeric" autocomplete="off" autocorrect="no" autocapitalize="no" spellcheck="no" type="tel" maxlength="4" placeholder="•••" ' . $this->field_name( 'card-cvc' ) . ' />
</p>';
return $fields;
}
function calc_hypotenuse($a, $b) {
$x = $a > $b ? $a : $b;
$y = $a < $b ? $a : $b;
$z = $y;
while(abs($x - $z) > 0.0001) {
$x = ($x + $z) / 2;
$z = $y * $y / $x;
}
return $x;
}
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
brew install autoconf automake libtool bison re2c pkg-config icu4c
curl -L https://www.php.net/distributions/php-8.0.3.tar.gz | tar xz
cd php-8.0.3
./buildconf
./configure --enable-maintainer-zts --enable-intl --with-icu-dir=$(brew --prefix icu4c)
make
sudo make install
php -v
php -i | grep "Thread Safety"
<?php
// Настройки подключения к базе данных
$servername = "localhost";
$username = "your_username";
$password = "your_password";
$dbname = "your_database_name";
// Создание подключения к базе данных
$conn = new mysqli($servername, $username, $password, $dbname);
// Проверка соединения
if ($conn->connect_error) {
die("Ошибка подключения: " . $conn->connect_error);
}
// Запрос SQL для выборки данных
$sql = "SELECT * FROM your_table_name";
$result = $conn->query($sql);
// Установка заголовков для экспорта CSV-файла
header('Content-Type: text/csv');
header('Content-Disposition: attachment;filename=data_export.csv');
// Открытие файла
$fp = fopen('php://output', 'w');
// Получение и запись данных в файл
if ($result->num_rows > 0) {
// Запись заголовков столбцов (если необходимо)
$row = $result->fetch_assoc();
fputcsv($fp, array_keys($row));
// Запись данных
fputcsv($fp, $row);
while($row = $result->fetch_assoc()) {
fputcsv($fp, $row);
}
} else {
echo "0 results";
}
// Закрытие файла и соединения с базой данных
fclose($fp);
$conn->close();
?>
<?php
// Настройка параметров
$siteUrl = 'https://example.com';
$login = 'your_username';
$password = 'your_password';
$cookieFile = 'dle_cookies.txt';
// Функция для работы с cURL
function curlRequest($url, $postData, $cookieFile) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFile);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieFile);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
// Функция для авторизации
function loginDLE($siteUrl, $login, $password, $cookieFile) {
$url = $siteUrl . '/index.php?do=auth';
$postData = 'login_name=' . urlencode($login) . '&login_password=' . urlencode($password) . '&login=submit';
return curlRequest($url, $postData, $cookieFile);
}
// Функция для добавления новости
function addNewsDLE($siteUrl, $title, $short_story, $full_story, $category, $cookieFile) {
$url = $siteUrl . '/admin.php?mod=addnews&action=addnews';
$postData = 'title=' . urlencode($title) . '&short_story=' . urlencode($short_story) . '&full_story=' . urlencode($full_story) . '&catlist[]=' . urlencode($category) . '&allow_main=1&allow_rating=1&allow_comm=1&approve=1&mod=addnews&action=doaddnews&user_hash=';
return curlRequest($url, $postData, $cookieFile);
}
// Выполнение авторизации
loginDLE($siteUrl, $login, $password, $cookieFile);
// Добавление новости
$title = 'Новость 1';
$short_story = 'Краткое описание новости...';
$full_story = 'Полный текст новости...';
$category = 1; // ID категории
addNewsDLE($siteUrl, $title, $short_story, $full_story, $category, $cookieFile);
?>
<?php
require_once 'vendor/autoload.php';
$client = new Google_Client();
$client->setApplicationName('My YouTube Client');
$client->setDeveloperKey('YOUR_DEVELOPER_KEY');
$youtube = new Google_Service_YouTube($client);
$videoId = 'VIDEO_ID';
$videoResponse = $youtube->videos->listVideos('statistics', array(
'id' => $videoId,
));
$video = $videoResponse[0];
$likes = $video->getStatistics()->getLikeCount();
$dislikes = $video->getStatistics()->getDislikeCount();
echo "Likes: $likes, Dislikes: $dislikes";
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "variable.other.php",
"settings": {
"foreground": "#c82829",
"fontStyle": "italic"
}
}
]
}
var $boxes = $('.boxes');
$boxes.on('DOMNodeInserted DOMNodeRemoved', function() {
var amountBoxes = $boxes[0].childElementCount;
console.log('Количество дочерних элементов: ' + amountBoxes);
});