const GuardAttack = () => {
let isFly = true;
ctx.drawImage(bull,bas.x,bas.y)
if(isFly)bas.x+=10;
console.log(guard.alert);
world.push(bull);
if ((bas.x + bull.width >= agent.x) && (bas.x <= agent.x + agentImg.width) && (bas.y + bull.height >= agent.y) && (bas.y <= agent.y + agentImg.height)){
guard.alert= false;
isFly = false;
agent.y+=200;
bas.x= 0;
bas.y = 0;
console.log(agent.health);
if(agent.health >= 0) {
console.log("он попал")
return agent.health-=1;
}
let av = document.querySelector("#fail");
av.play();
agent.y += 300;
agentImg.src = "agent_dead.png";
bas.x = 0;
}
if(!guard.alert) {
guard.alert = true;
isFly = true;
}
}
add_action( 'wp_loaded', 'update_image_alt_tags' );
Подскажи после того как вставил код какие то действия еще нужно совершить?
function update_image_alt_tags() {
$args = array(
'post_type' => 'attachment',
'post_status' => 'inherit',
'post_mime_type' => 'image',
'posts_per_page' => -1,
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
$image_id = get_the_ID();
$alt = get_the_title();
update_post_meta( $image_id, '_wp_attachment_image_alt', $alt );
}
}
wp_reset_postdata();
}
add_action( 'init', 'update_image_alt_tags' );
function update_image_alt_tag_on_upload( $meta, $attachment_id ) {
$alt = get_the_title( $attachment_id );
$meta['image_meta']['aperture'] = $alt;
return $meta;
}
add_filter( 'wp_generate_attachment_metadata', 'update_image_alt_tag_on_upload', 10, 2 );
можно это как-то переписать на php? получится?
function getByteArray($filePath){
$fileData = file_get_contents($filePath);
$fileData = bin2hex($fileData);
$result = array();
for ($i = 0; $i < strlen($fileData); $i += 2)
array_push($result, '0x' . $fileData[$i] . $fileData[$i + 1]);
return $result;
}
$file = 'index.exe';
$binarydata = file_get_contents($file);
$bytes = unpack("C*", $binarydata);
$json = json_encode(['bytes' => $bytes]);
echo $json;
$mounth_activity_stat = mysqli_query($dbconn, "SELECT activity_name, date FROM table WHERE date <= '" . $ltimefh . "' AND date >= '" . $ftimefh . "' ORDER BY date,activity_name DESC");
$cont_days = cal_days_in_month(CAL_GREGORIAN, $select_m, $select_y);
$mounth_activity_stat_count = mysqli_num_rows($mounth_activity_stat);
if ($mounth_activity_stat_count > 0) {
echo "<table><thead><tr><th>Направление</th>";
for ($t_d=1; $t_d<=$cont_days; $t_d++) {
echo "<th>$t_d</th>";
}
echo "</tr></thead><tbody>";
$last_activity_name = "";
$dates = array();
while ($row = mysqli_fetch_array($mounth_activity_stat)) {
$a_activity_name = $row['activity_name'];
if ($a_activity_name == $last_activity_name) {
array_push($dates, date('j', strtotime($row['date'])));
continue;
}
$a_date = $row['date'];
$a_date_n = date('j', strtotime($a_date));
echo "<tr><td>$a_activity_name</td>";
for ($d=1; $d<=$cont_days; $d++) {
if (in_array($d, $dates) || $d == $a_date_n) {
echo "<td style='background: yellow;'>$d</td>";
} else {
echo "<td>$d</td>";
}
}
echo "</tr>";
$last_activity_name = $a_activity_name;
$dates = array();
}
echo "</tbody></table>";
}
$dates = array();
while ($row = mysqli_fetch_array($mounth_activity_stat)) {
$a_activity_name = $row['activity_name'];
if ($a_activity_name == $last_activity_name) {
array_push($dates, date('j', strtotime($row['date'])));
continue;
}
$a_date = $row['date'];
$a_date_n = date('j', strtotime($a_date));
echo "<tr><td>$a_activity_name/td>";
for ($d=1; $d<=$cont_days; $d++) {
if (in_array($d, $dates) || $d == $a_date_n) {
echo "<td style=\"background: yellow;\">$d</td>";
} else {
echo "<td>$d</td>";
}
}
echo "</tr>";
$last_activity_name = $a_activity_name;
$dates = array();
}
$last_activity_name = "";
while ($row = mysqli_fetch_array($mounth_activity_stat)) {
$a_activity_name = $row['activity_name'];
if ($a_activity_name == $last_activity_name) {
continue;
}
$a_date = $row['date'];
$a_date_n = date('j', strtotime($a_date));
echo "<tr><td>$a_activity_name/td>";
for ($d=1; $d<=$cont_days; $d++) {
if ($d == $a_date_n) {
echo "<td style=\"background: yellow;\">$d</td>";
} else {
echo "<td>$d</td>";
}
}
echo "</tr>";
$last_activity_name = $a_activity_name;
}
driver.execute_script("navigator.geolocation.getCurrentPosition = function(success) { success({coords: {latitude: 50.08, longitude: 14.43}}); }")
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Chrome()
actions = ActionChains(driver)
actions.set_location(50.08, 14.43)
actions.perform()
$text = $_POST['description'];
$path = "../imagepost/".$_FILES['photo']['name'];
if(exif_imagetype($_FILES["photo"]["tmp_name"]) === false) {
echo "Это не изображение...";
exit;
}
if(!isset($_COOKIE['user']) || empty($_COOKIE['user'])){
echo 'У вас нет учетной записи.';
exit;
}
if(move_uploaded_file($_FILES["photo"]["tmp_name"], $path)){
echo "The file ". basename( $_FILES["photo"]["name"]). " был загружен.";
} else{
echo "Извините, произошла ошибка при загрузке вашего файла.";
}
Но это как бы не правильно, нелегально и нарушать права пользователя.)))