<?php
define('SSOL_SITEURL', 'https://test.ru');
$text = '<p>Текст с ссылками для замены, эту <a target="_blank" rel="nofollow noopener noreferrer" href="https://test.ru">меняем</a>, а эту <a target="_blank" rel="nofollow noopener noreferrer" href="http://google.com">нет</a>.</p>';
$domain = str_replace('http://', '', SSOL_SITEURL);
$domain = str_replace('https://', '', $domain);
$pattern = '/<a target="_blank" rel="nofollow noopener noreferrer" href="https:\/\/'.$domain.'/';
$replacement = '<a href="'.SSOL_SITEURL;
$text = preg_replace($pattern, $replacement, $text);
echo $text;
add_filter("wpcf7_validate", function ($result, $tags) {
$ncard = sanitize_text_field( $_POST['ncard'] );
global $wpdb;
$cardsLists = $wpdb->get_results("SELECT form_value FROM wp_db7_forms WHERE form_post_id='6' ORDER BY form_date DESC", 'OBJECT');
foreach ($cardsLists as $cardsList){
$crd = ( unserialize($cardsList->form_value) )['ncard'];
if($ncard == $crd){
$result->offsetSet("reason", ["ncard" => "Такая карта уже зарегистрирована"]);
}
}
return $result;
}, 10, 2);
function maybe_skip_mail( $skip_mail)
{
if ( ! empty( $_POST['ncard'] ) ) {
$cardsLists = $wpdb->get_results("SELECT form_value FROM wp_db7_forms WHERE form_post_id='6' ORDER BY form_date DESC", 'OBJECT');
// Use appropriate sanitization method.
$value = sanitize_text_field( $_POST['ncard'] );
foreach ($cardsLists as $cardsList){
$pieces = explode("s:", $cardsList->form_value);
$piece = explode('"', $pieces[6])[1];
if($piece == $value) {
$result = true;
echo '<script>alert("Такая есть уже");</script>';
}
return $result;
}
}
return $skip_mail;
}
add_filter( 'wpcf7_skip_mail', 'maybe_skip_mail' );
Warning: SimpleXMLElement::__construct(): Entity: line 1: parser error : Start tag expected, '<' not found in W:\domains\test\index.php on line 10
Warning: SimpleXMLElement::__construct(): <?xml version="1.0"?> in W:\domains\test\index.php on line 10
Warning: SimpleXMLElement::__construct(): ^ in W:\domains\test\index.php on line 10
Fatal error: Uncaught Exception: String could not be parsed as XML in W:\domains\test\index.php:10 Stack trace: #0 W:\domains\test\index.php(10): SimpleXMLElement->__construct('<?xml versio...') #1 {main} thrown in W:\domains\test\index.php on line 10
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://***.ru/api/***?IdCard=261207&Sign=36eb2f3610afbb18fa1a3f0ab2ac960e');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$string = curl_exec($curl);
curl_close($curl);
$movies = new SimpleXMLElement($string);
print_r($movies);
let str = '';
arrData.forEach(function (element) {
str += (element.id + ': ' + element.count + '<br>');
});
alert(str);