$str = 'мой-сайт.рф';
$pattern = '/([-а-яё.]+)/iu';
echo preg_replace_callback($pattern, function($matches){
return idn_to_ascii( $matches[0], IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46);
}, $str );
// на выходе
// xn----8sbzclmxk.xn--p1ai
<?xml version="1.0" encoding="UTF-8" ?>
<root xmlns:company="http://example.com/company" xmlns:customer="http://example.com/customer">
<company:company>
<company:name>ACME</company:name>
<customer:name>Vasya</customer:name>
<customer:name>Tom</customer:name>
</company:company>
<company:company>
<company:name>Scrooge McDuck Inc</company:name>
<customer:name>Mary</customer:name>
<customer:name>Bob</customer:name>
<customer:name>Rob</customer:name>
</company:company>
</root>
//company:name
//customer:name
//company:company[company:name = 'ACME']/customer:name
//company:company[customer:name = 'Vasya']/company:name
element.addEventListener('click', function (e) {
console.log(e.ctrlKey);
});
class Custom_WC_Widget_Product_Categories extends WC_Widget_Product_Categories {
function widget( $args, $instance ) {
// скопировать весь код метода из:
// woocommerce/includes/widgets/class-wc-widget-product-categories.php
// добавить нужный класс в строке с выводом открывающего тега списка
echo '<ul class="product-categories <b>my-class</b>">';
}
}
/**
* WC_Widget_Product_Categories widget override
*/
add_action( 'widgets_init', 'override_woocommerce_widgets', 15 );
function override_woocommerce_widgets() {
if ( class_exists( 'WC_Widget_Product_Categories' ) ) {
unregister_widget( 'WC_Widget_Product_Categories' );
include_once( 'widgets/widget-product_categories.php' );
register_widget( 'Custom_WC_Widget_Product_Categories' );
}
}
apt install gcc g++ pkg-config libncurses5-dev gawk build-essential autotools-dev bison re2c flex gperf libtool automake mc m4
apt install libxml2-dev
apt install php7.3-dev
wget https://downloads.php.net/~derick/php-7.4.0beta4.tar.gz
wget http://xmlsoft.org/sources/libxml2-2.9.9.tar.gz
cd libxml2-2.9.9
./configure --prefix=/home/koenig/test/xmllib
make
make install
cd ../php-7.4.0beta4
./configure --prefix=/home/koenig/test/php/ --enable-fpm --enable-dom=shared --enable-soap=shared --enable-xmlreader=shared --enable-xmlwriter=shared --enable-simplexml=shared --enable-xml=shared --with-libxml LDFLAGS="-L/home/koenig/test/xmllib" --disable-all
make
make install