classes/PodsMigrate.php
public static function export_data_to_file( $file, $data, $single = false ) {

		$path = ABSPATH;

		// Detect path if it is set in the file param.
		if ( false !== strpos( $file, '/' ) ) {
			$path = dirname( $file );
			$file = basename( $file );
		}

		$format = 'json';

		// Detect the export format.
		if ( false !== strpos( $file, '.' ) ) {
			$format = explode( '.', $file );
			$format = end( $format );
		}

		$migrate_data = array(
			'items'  => array( $data ),
			'single' => $single,
		);

		$migrate = new self( $format, null, $migrate_data );

		// Handle processing the data into the format needed.
		$migrate->export();

		$save_params = array(
			'path'   => $path,
			'file'   => $file,
			'attach' => true,
		);

		return $migrate->save( $save_params );

	}
public static function export_data_to_file( $file, $data, $single = false ) {

		$path = ABSPATH;

		// Detect path if it is set in the file param.
		if ( false !== strpos( $file, '/' ) ) {
			$path = dirname( $file );
			$file = basename( $file );
		}

		$format = 'json';

		// Detect the export format.
		if ( false !== strpos( $file, '.' ) ) {
			$format = explode( '.', $file );
			$format = end( $format );
		}

		$migrate_data = array(
			'items'  => array( $data ),
			'single' => $single,
		);

		$migrate = new self( $format, null, $migrate_data );

		// Handle processing the data into the format needed.
		$migrate->export();

		$save_params = array(
			'path'   => $path,
			'file'   => $file,
			'attach' => true,
		);

		return $migrate->save( $save_params );

	}
public static function export_data_to_file ( $ file , $ data , $ single = false ) { $ path = ABSPATH ; // Detect path if it is set in the file param. if ( false !== strpos ( $ file , '/' ) ) { $ path = dirname ( $ file ) ; $ file = basename ( $ file ) ; } $ format = 'json' ; // Detect the export format. if ( false !== strpos ( $ file , '.' ) ) { $ format = explode ( '.' , $ file ) ; $ format = end ( $ format ) ; } $ migrate_data = array ( 'items' => array ( $ data ) , 'single' => $ single , ) ; $ migrate = new self ( $ format , null , $ migrate_data ) ; // Handle processing the data into the format needed. $ migrate -> export ( ) ; $ save_params = array ( 'path' => $ path , 'file' => $ file , 'attach' => true , ) ; return $ migrate -> save ( $ save_params ) ; }
Export data to a file.

@param string $file   File to export to.
@param array  $data   Data to export.
@param bool   $single Whether this is a single item export.

@return mixed
Export data to a file .