PluginProbe
Polylang / 3.8.11
Polylang v3.8.11
3.8.11 3.8.10 3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 All 235 releases
← All changes | src/translated-object.php +7 -5 3.8.3 → 3.8.11 View file →
@@ -60,8 +60,10 @@
60 60 '_pll' => true,
61 61 'update_count_callback' => '_update_generic_term_count', // Count *all* objects to correctly detect unused terms.
62 62 )
63 63 );
64 +
65 + $this->add_sanitization_hooks( $this->tax_translations );
64 66 }
65 67
66 68 /**
67 69 * Returns the translations group taxonomy name.
@@ -128,9 +130,9 @@
128 130 return array();
129 131 }
130 132
131 133 // Lang slugs as array keys, translation IDs as array values.
132 - $translations = maybe_unserialize( $translations_term->description );
134 + $translations = pll_maybe_unserialize( $translations_term->description );
133 135 $translations = is_array( $translations ) ? $translations : array();
134 136
135 137 return $this->validate_translations( $translations, 0, 'display' );
136 138 }
@@ -185,9 +187,9 @@
185 187 wp_insert_term( $group, $this->tax_translations, array( 'description' => maybe_serialize( $translations ) ) );
186 188 } else {
187 189 // Take care not to overwrite extra data stored in the description field, if any.
188 190 $group = (int) $term->term_id;
189 - $descr = maybe_unserialize( $term->description );
191 + $descr = pll_maybe_unserialize( $term->description );
190 192 $descr = is_array( $descr ) ? array_diff_key( $descr, $old_translations ) : array(); // Remove old translations.
191 193 $descr = array_merge( $descr, $translations ); // Add new one.
192 194 wp_update_term( $group, $this->tax_translations, array( 'description' => maybe_serialize( $descr ) ) );
193 195 }
@@ -231,9 +233,9 @@
231 233 if ( empty( $term ) ) {
232 234 return;
233 235 }
234 236
235 - $descr = maybe_unserialize( $term->description );
237 + $descr = pll_maybe_unserialize( $term->description );
236 238
237 239 if ( ! empty( $descr ) && is_array( $descr ) ) {
238 240 $slug = array_search( $id, $this->get_translations( $id ) ); // In case some plugin stores the same value with different key.
239 241
@@ -451,9 +453,9 @@
451 453 $translations[ $id ] = array();
452 454 continue;
453 455 }
454 456
455 - $trans = maybe_unserialize( $terms[ $id ]->description );
457 + $trans = pll_maybe_unserialize( $terms[ $id ]->description );
456 458 $translations[ $id ] = is_array( $trans ) ? $trans : array();
457 459 }
458 460
459 461 return $translations;
@@ -624,9 +626,9 @@
624 626
625 627 // Prepare objects relationships.
626 628 if ( is_array( $terms ) ) {
627 629 foreach ( $terms as $term ) {
628 - $t = maybe_unserialize( $term->description );
630 + $t = pll_maybe_unserialize( $term->description );
629 631 if ( is_array( $t ) && in_array( $t, $translations ) ) {
630 632 foreach ( $t as $object_id ) {
631 633 if ( ! empty( $object_id ) ) {
632 634 $trs[] = array( $object_id, $term->term_taxonomy_id );