| @@ -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. |