<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Audio Context Example</title>
</head>
<body>
<input type="file" id="fileInput" accept=".mp3">
<audio id="audioElement" controls></audio>
<script>
const fileInput = document.getElementById('fileInput');
const audioElement = document.getElementById('audioElement');
const audioContext = new AudioContext();
fileInput.addEventListener('change', () => {
const file = fileInput.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function (e) {
audioElement.src = e.target.result;
const source = audioContext.createMediaElementSource(audioElement);
source.connect(audioContext.destination);
audioElement.play();
};
reader.readAsDataURL(file);
}
});
</script>
</body>
</html>
<?php
use Exception;
use Imagick;
abstract class NoBrightPixelsChecker
{
protected string $imagePath;
protected string $thresholdColor;
protected Imagick $imagick;
public function __construct(string $imagePath, string $thresholdColor = '#eeeeee')
{
$this->imagePath = $imagePath;
$this->thresholdColor = $thresholdColor;
$this->loadImage();
}
private function loadImage(): void
{
try {
$this->imagick = new Imagick($this->imagePath);
} catch (Exception $e) {
throw new Exception('Failed to load image: ' . $e->getMessage());
}
}
abstract public function checkImage(): bool;
}
class ThresholdMaskNoBrightPixelsChecker extends NoBrightPixelsChecker
{
public function checkImage(): bool
{
list($rThreshold, $gThreshold, $bThreshold) = sscanf($this->thresholdColor, "#%02x%02x%02x");
$imageClone = clone $this->imagick;
$thresholdColor = new ImagickPixel("rgb($rThreshold, $gThreshold, $bThreshold)");
$imageClone->thresholdImage($thresholdColor);
$histogram = $imageClone->getImageHistogram();
$whitePixelCount = 0;
foreach ($histogram as $pixel) {
$color = $pixel->getColor();
if ($color['r'] == 255 && $color['g'] == 255 && $color['b'] == 255) {
$whitePixelCount += $pixel->getColorCount();
}
}
return $whitePixelCount === 0;
}
}
// Пример использования
try {
$checker = new ThresholdMaskNoBrightPixelsChecker('path/to/your/image.jpg');
$result = $checker->checkImage();
echo $result ? 'No bright pixels found' : 'Bright pixels found';
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
function remove_vat_for_specific_role( $price, $product ) {
$target_role = 'custom_role';
$current_user = wp_get_current_user();
if ( in_array( $target_role, (array) $current_user->roles ) ) {
$price_excluding_tax = wc_get_price_excluding_tax( $product );
return wc_price( $price_excluding_tax );
}
return $price;
}
add_filter( 'woocommerce_get_price_html', 'remove_vat_for_specific_role', 10, 2 );
add_filter( 'woocommerce_cart_item_price', 'remove_vat_for_specific_role', 10, 2 );
add_filter( 'woocommerce_cart_item_subtotal', 'remove_vat_for_specific_role', 10, 2 );
add_filter( 'woocommerce_cart_subtotal', 'remove_vat_for_specific_role', 10, 2 );
add_filter( 'woocommerce_get_cart_total', 'remove_vat_for_specific_role', 10, 2 );
add_filter( 'woocommerce_cart_contents_total', 'remove_vat_for_specific_role', 10, 2 );
use libphonenumber\PhoneNumberUtil;
use libphonenumber\NumberParseException;
public function validatePhone($phone, $country): bool
{
$phoneUtil = PhoneNumberUtil::getInstance();
try {
$phoneNumber = $phoneUtil->parse($phone, strtoupper($country));
return $phoneUtil->isValidNumber($phoneNumber);
} catch (NumberParseException $e) {
return false;
}
}
import { parsePhoneNumberFromString } from 'libphonenumber-js';
$("#phoneinput").on('countrychange', function () {
const country = window.iti.getSelectedCountryData().iso2.toUpperCase();
const phone = $("#phoneinput").val();
const phoneNumber = parsePhoneNumberFromString(phone, country);
if (phoneNumber && phoneNumber.isValid()) {
// Номер телефона валиден
} else {
// Номер телефона не валиден
}
});
#include <iostream>
#include "Header.h"
using namespace std;
int BAZA[n][n1] = {
{35, 50, 60, 40, 27, 15, 50, 29, 37, 54},
{15, 25, 30, 20, 10, 6, 20, 15, 22, 26},
{10, 20, 15, 10, 15, 7, 25, 10, 10, 23},
{60, 45, 20, 40, 50, 60, 70, 80, 90, 100},
{60, 60, 80, 60, 40, 70, 50, 40, 60, 30},
{60, 75, 80, 80, 90, 50, 60, 60, 30, 50}
};
int main() {
int i, j;
for (i = 0; i < n; i++) {
for (j = 0; j < n1; j++) {
cout << BAZA[i][j] << "\t";
}
cout << endl;
}
return 0;
}
$folder = addslashes("\\assets\\img\\product\\");
$stmt = $mysql->prepare("INSERT INTO `catalog`(`Name_Product`, `Operator`, `Internet`, `Minuts`, `Sms`, `Price_tarif`, `Price_sim`, `image`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param("ssssssss", $Name_Product, $Operator, $Internet, $Minuts, $Sms, $Price_tarif, $Price_sim, $photoname);
$stmt->execute();
$current_user = wp_get_current_user(); // Получаем данные текущего пользователя
if ($current_user->ID != 0) { // Проверяем, залогинен ли пользователь
$user_reg = $current_user->user_registered;
$datetime = new DateTime($user_reg);
echo $datetime->format('Y-m-d'); // Выведет год-месяц-день
} else {
echo "Пользователь не залогинен";
}
И какая максимально-возможная длинна поддомена?
отправить пользователю сообщение