$_SESSION['last_submit'] = time();
if (isset($_SESSION['last_submit']) && time() - $_SESSION['last_submit'] <= 60 * 1000 * 10) {
return false;
}
(@\w+?)#(\d+)
<a href="/profile/$2" rel="nofollow">$1</a>
echo $out_data['age'];
print_r($out_data['home']['location']);
$out_data['work']['new'] = ['role' => 'new_work_role', 'address' => 'homeland'];
print_r($out_data['work']['new']);
$out_data = array(
'home' => ['city' => 'Miami', 'state' => 'FL', 'location' => ['lat' => '40.00', 'long' => '50.00']],
'work' => ['main' => ['role' => 'cheif', 'address' => 'Miami, FL'], 'hobby' => ['role' => 'painter', 'address' => null]],
'age' => 68
);
function get_data($data, $param) {
$param = explode('\\', $param);
$result = $data[$param[0]];
for ($i = 1; $i < count($param); $i++) {
$result = $result[$param[$i]];
}
return $result;
}
print_r(get_data($out_data, 'age'));
print_r(get_data($out_data, 'home\location'));
print_r(get_data($out_data, 'work\main\address'));
function set_data(&$arr, $data, $param) {
$param = explode('\\', $param);
$result = &$arr[$param[0]];
for ($i = 1; $i < count($param); $i++) {
$result = &$result[$param[$i]];
}
$result = $data;
}
set_data($out_data, ['role' => 'boss', 'address' => 'Secret Base 1'], 'work\main\secret_job\project_1\state\city\street');
print_r($out_data);
Array
(
[home] => Array
(
[city] => Miami
[state] => FL
[location] => Array
(
[lat] => 40.00
[long] => 50.00
)
)
[work] => Array
(
[main] => Array
(
[role] => cheif
[address] => Miami, FL
[secret_job] => Array
(
[project_1] => Array
(
[state] => Array
(
[city] => Array
(
[street] => Array
(
[role] => boss
[address] => Secret Base 1
)
)
)
)
)
)
[hobby] => Array
(
[role] => painter
[address] =>
)
)
[age] => 68
)
$(".cart-store").click(function() {
// здесь будет функция вызова модального окна
$("#callme").bind("submit", function(){
$.ajax({
type: "POST",
url: "/wp-content/themes/bonasfide/assets/js/form/callme.php",
data: $(this).serialize(),
}).done(function() {
alert("Спасибо! Мы скоро с вами свяжемся.");
$("#callme").trigger("reset");
});
return false;
});
});