PluginProbe
Polylang / trunk
Polylang vtrunk
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 3.0.2 All 234 releases
← All changes | src/modules/wpml/wpml-config.php +30 -0 3.8.3 → trunk View file →
@@ -508,8 +508,12 @@
508 508 continue;
509 509 }
510 510
511 511 foreach ( $block->children() as $child ) {
512 + if ( ! $this->is_supported_field( $child ) ) {
513 + continue;
514 + }
515 +
512 516 $rule = '';
513 517 $child_tag = $child->getName();
514 518
515 519 switch ( $child_tag ) {
@@ -669,8 +673,12 @@
669 673
670 674 $sub_attributes = array();
671 675
672 676 foreach ( $children as $child ) {
677 + if ( ! $this->is_supported_field( $child ) ) {
678 + continue;
679 + }
680 +
673 681 $sub = $this->get_field_attributes( $child );
674 682
675 683 if ( empty( $sub ) ) {
676 684 continue;
@@ -679,8 +687,30 @@
679 687 $sub_attributes[ $name ] = array_merge( $sub_attributes[ $name ] ?? array(), $sub );
680 688 }
681 689
682 690 return $sub_attributes;
691 + }
692 +
693 + /**
694 + * Tells if the given field is supported.
695 + *
696 + * @since 3.8.4
697 + *
698 + * @param SimpleXMLElement $field A XML node.
699 + * @return bool
700 + */
701 + private function is_supported_field( SimpleXMLElement $field ): bool {
702 + if ( $this->get_field_attribute( $field, 'type' ) !== '' ) {
703 + // No `type` supported for now.
704 + return false;
705 + }
706 +
707 + if ( $field->getName() === 'key' ) {
708 + // The only supported `search-method` is `wildcards` (which is the default value).
709 + return in_array( $this->get_field_attribute( $field, 'search-method' ), array( '', 'wildcards' ), true );
710 + }
711 +
712 + return true;
683 713 }
684 714
685 715 /**
686 716 * Returns all wpml-config.xml files in MU plugins.