я пыталась вставить фавиконку,не получалось загрузить,расширения не было,я вставила в файл wp_config.php следующую строку:define( 'ALLOW_UNFILTERED_UPLOADS', true )
и добавила в код в functions.phpadd_filter( 'upload_mimes', 'my_myme_types', 1, 1 ); function my_myme_types( $mime_types ) { // Добавим формат ico $mime_types['ico'] = 'image/x-icon'; // Добавим.json формат для примера $mime_types['json'] = 'application/json'; // Удалим .xls формат для примера unset( $mime_types['xls'] ); return $mime_types; }
и все после этого началось
$even_img_diff = 100; // задайте тут число по вкусу. Это максимальная разница между шириной и высотой при которой картинка будет счиататься "квадратной".
$img_diff = abs($imgwidth_max-$imgheight);
if ($img_diff <= $even_img_diff ) {
// почти квадратная
} elseif ($imgwidth_max > $imgheight) {
$imgclass = '2';
} elseif ($imgwidth_max < $imgheight) {
$imgclass = '3';
}
function setValue($value, $key, array &$arr) {
foreach ($arr as $arrKey=>&$arrValue) {
if ($arrKey == $key) {
$arrValue = $value;
} elseif (is_array($arrValue)) {
setValue($value, $key, $arrValue);
} else {
throw new \InvalidArgumentException("Key {$key} not found in array");
}
}
return $arr;
}
// Check
$Arr['key1']['key2']['key3']['key4']['key5']['keyn'] = null;
setValue('Test Value', "keyn", $Arr);
var_dump($Arr);
/*
array(1) {
["key1"]=>
array(1) {
["key2"]=>
array(1) {
["key3"]=>
array(1) {
["key4"]=>
array(1) {
["key5"]=>
array(1) {
["keyn"]=>
string(10) "Test Value"
}
}
}
}
}
}
*/
$stmt = $conn->prepare("INSERT INTO MyGuests2 (text2) VALUES (?)");
$stmt->bind_param("s", $name);
$stmt->execute();
$stmt->close();
$data = [
["яблоко", "1-01-2019", "1"],
["апельсин", "2-01-2019", "2"],
["мандарин", "2-01-2019", "3"]
];
function buildTable($data) {
$html = "<table>";
/* Build header */
$html .= "<tr>
<td>Название</td>";
foreach ($data as $element) {
list($fruit, $date, $number) = $element;
$html .= "<td>{$date}</td>";
}
$html .= "</tr>";
/* Build body */
foreach ($data as $element) {
list($fruit, $date, $number) = $element;
$html .= "<tr>";
$html .= "<td>{$fruit}</td>";
foreach ($data as $index=>$el) {
$html .= "<td>";
$html .= ($index+1) == $number ? $number : null;
$html .= "</td>";
}
$html .= "</tr>";
}
$html .= "</table>";
return $html;
}
class X {
function index() {
var_dump(__CLASS__); // X
$a = function() {
var_dump(__CLASS__); // X
};
$a();
}
}
$calls = [
['prefix' => '+57'],
['prefix' => '+268'],
['prefix' => '+972'],
['prefix' => '+972'],
['prefix' => '+33'],
['prefix' => '+33'],
['prefix' => '+972'],
['prefix' => '+509'],
['prefix' => ''],
['prefix' => '+33'],
['prefix' => '+268'],
['prefix' => '+57'],
];
function calcPrefixStat($calls) {
$stat = [];
foreach($calls as $call) {
if (!array_key_exists($call['prefix'], $stat)) {
$stat[$call['prefix']] = 0;
}
$stat[$call['prefix']]++;
}
return $stat;
}
var_dump(calcPrefixStat($calls));
/*
array(6) {
["+57"]=>
int(2)
["+268"]=>
int(2)
["+972"]=>
int(3)
["+33"]=>
int(3)
["+509"]=>
int(1)
[""]=>
int(1)
}
*/
$('[id^="product"]').each(function() {
var card = $(this);
if (card.hasClass('category_2')) {
card.find('.after_price').text('Какой-то текст');
}
});
$('.category_2').each(function() {
$(this).find('.after_price').text('Какой-то текст');
});
1) Как отправлять цену каждой строки заказа, если она в теге p ? Рядом ставить скрытый input и делать связь?
2) Как отправлять выбранный выпадающий div? Рядом ставить скрытый input и делать связь?
3) Как правильно организовать отправку такой динамической формы?
$db->query('insert into ' . TABLE_OPTIONS . ' set `object_id` = \'' . $id . '\', `option` = \'' . $type . '\', `date_added` = \'' . $timestamp . '\\', ' . $str_expires . ' ');
return 1;
}
$table_options = TABLE_OPTIONS;
$db->query("
INSERT INTO {$table_options}
SET
`object_id`='{$id}',
`option`='{$type}',
`data_added`='{$timestamp}',
`date_expired`='{$str_expires}'
");
return true;
$result = @mysqli_query($this->link, $this->sql);
->query_count++;
$result = @mysqli_query($this->link, $this->sql);
$query_count++;
<?= time() ?>
ALTER TABLE `statistic` DROP INDEX `date`;
ALTER TABLE `statistic` ADD INDEX `date` (`date`);