classes/PodsMigrate.php
public static function get_data_from_file( $file, $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(
			'single' => $single,
		);

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

		$raw_data = file_get_contents( $file );

		// Handle processing the raw data from the format needed.
		$data = $migrate->parse( $raw_data );

		return $data;

	}
public static function get_data_from_file( $file, $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(
			'single' => $single,
		);

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

		$raw_data = file_get_contents( $file );

		// Handle processing the raw data from the format needed.
		$data = $migrate->parse( $raw_data );

		return $data;

	}
public static function get_data_from_file ( $ file , $ 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 ( 'single' => $ single , ) ; $ migrate = new self ( $ format , null , $ migrate_data ) ; $ raw_data = file_get_contents ( $ file ) ; // Handle processing the raw data from the format needed. $ data = $ migrate -> parse ( $ raw_data ) ; return $ data ; }
Get data from a file.

@param string $file   File to get data from.
@param bool   $single Whether this is a single item.

@return mixed
Get data from a file .