PluginProbe
Translate and boost SEO – Automatic AI translation – wpLingua / 2.16.8
Translate and boost SEO – Automatic AI translation – wpLingua v2.16.8
2.16.8 2.16.7 2.16.6 2.16.5 2.16.4 2.16.3 2.16.2 2.16.1 2.16.0 2.15.2 2.15.1 2.15.0 2.14.3 2.14.2 2.14.1 2.14.0 2.13.1 2.13.0 2.12.3 2.12.2 2.12.1 trunk 1.0.3 1.0.4 1.0.5 All 113 releases
← All changes | inc/dom/translate-attr-html.php +54 -54 2.16.02.16.8 View file →
@@ -1,54 +1,54 @@
1 -<?php
2 -
3 -// If this file is called directly, abort.
4 -if ( ! defined( 'WPINC' ) ) {
5 - die;
6 -}
7 -
8 -
9 -/**
10 - * Translate HTML in attributes in dom for translated pages
11 - *
12 - * @param object $dom
13 - * @param array $args
14 - * @return object
15 - */
16 -function wplng_dom_translate_html_attr( $dom, $args ) {
17 -
18 - wplng_args_setup( $args );
19 -
20 - if ( empty( $args['translations'] ) ) {
21 - return $dom;
22 - }
23 -
24 - $attr_html_to_translate = wplng_data_attr_html_to_translate();
25 -
26 - foreach ( $attr_html_to_translate as $attr ) {
27 - foreach ( $dom->find( $attr['selector'] ) as $element ) {
28 -
29 - if ( empty( $element->attr[ $attr['attr'] ] ) ) {
30 - continue;
31 - }
32 -
33 - $html = wplng_text_esc( $element->attr[ $attr['attr'] ] );
34 -
35 - if ( empty( $html ) ) {
36 - continue;
37 - }
38 -
39 - $html = wp_specialchars_decode(
40 - $html,
41 - ENT_QUOTES | ENT_HTML5
42 - );
43 -
44 - $html = wplng_translate_html(
45 - $html,
46 - $args
47 - );
48 -
49 - $element->attr[ $attr['attr'] ] = esc_attr( $html );
50 - }
51 - }
52 -
53 - return $dom;
54 -}
1 +<?php
2 +
3 +// If this file is called directly, abort.
4 +if ( ! defined( 'WPINC' ) ) {
5 + die;
6 +}
7 +
8 +
9 +/**
10 + * Translate HTML in attributes in dom for translated pages
11 + *
12 + * @param object $dom
13 + * @param array $args
14 + * @return object
15 + */
16 +function wplng_dom_translate_html_attr( $dom, $args ) {
17 +
18 + wplng_args_setup( $args );
19 +
20 + if ( empty( $args['translations'] ) ) {
21 + return $dom;
22 + }
23 +
24 + $attr_html_to_translate = wplng_data_attr_html_to_translate();
25 +
26 + foreach ( $attr_html_to_translate as $attr ) {
27 + foreach ( $dom->find( $attr['selector'] ) as $element ) {
28 +
29 + if ( empty( $element->attr[ $attr['attr'] ] ) ) {
30 + continue;
31 + }
32 +
33 + $html = wplng_text_esc( $element->attr[ $attr['attr'] ] );
34 +
35 + if ( empty( $html ) ) {
36 + continue;
37 + }
38 +
39 + $html = wp_specialchars_decode(
40 + $html,
41 + ENT_QUOTES | ENT_HTML5
42 + );
43 +
44 + $html = wplng_translate_html(
45 + $html,
46 + $args
47 + );
48 +
49 + $element->attr[ $attr['attr'] ] = esc_attr( $html );
50 + }
51 + }
52 +
53 + return $dom;
54 +}