Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Automator_Send_Webhook::array_to_xml( $data,  $xml_data )

Convert nested array in to XML


Parameters Parameters

$data

(Required)

$xml_data

(Required)


Top ↑

Return Return

(void)


Source Source

File: src/core/lib/webhooks/class-automator-send-webhook.php

	private function array_to_xml( $data, &$xml_data ) {
		foreach ( $data as $key => $value ) {
			if ( is_array( $value ) ) {
				if ( is_numeric( $key ) ) {
					$key = 'item' . $key; //dealing with <0/>..<n/> issues
				}
				$subnode = $xml_data->addChild( $key );
				$this->array_to_xml( $value, $subnode );
			} else {
				$xml_data->addChild( "$key", htmlspecialchars( "$value" ) );
			}
		}
	}