library/Helper/AcfImportCleaner.php
public function acfLoadClean($paths)
    {
        $paths = array_unique($paths);

        foreach ($paths as $path) {
            foreach (@glob($path . '/*.json') as $file) {
                $json = json_decode(file_get_contents($file));

                if (!is_array($json)) {
                    continue;
                }

                $content = file($file);

                if (trim($content[0]) == '[') {
                    array_shift($content);
                    array_pop($content);
                }

                file_put_contents($file, $content);
            }
        }

        return $paths;
    }
public function acfLoadClean($paths)
    {
        $paths = array_unique($paths);

        foreach ($paths as $path) {
            foreach (@glob($path . '/*.json') as $file) {
                $json = json_decode(file_get_contents($file));

                if (!is_array($json)) {
                    continue;
                }

                $content = file($file);

                if (trim($content[0]) == '[') {
                    array_shift($content);
                    array_pop($content);
                }

                file_put_contents($file, $content);
            }
        }

        return $paths;
    }
public function acfLoadClean ( $ paths ) { $ paths = array_unique ( $ paths ) ; foreach ( $ paths as $ path ) { foreach ( @ glob ( $ path . '/*.json' ) as $ file ) { $ json = json_decode ( file_get_contents ( $ file ) ) ; if ( ! is_array ( $ json ) ) { continue ; } $ content = file ( $ file ) ; if ( trim ( $ content [ 0 ] ) == '[' ) { array_shift ( $ content ) ; array_pop ( $ content ) ; } file_put_contents ( $ file , $ content ) ; } } return $ paths ; }
Checks and cleans the formatting of the acf export files
@param  array $paths
@return array
Checks and cleans the formatting of the acf export files