public static function replaceFilePlaceholders($filePath, $variables, $destPath = null, $pending = '$')
    {
        if (!$destPath) {
            $destPath = $filePath;
        }
        if (is_dir($filePath)) {
            $files = scandir($filePath);
            foreach ($files as $file) {
                if ($file != "." && $file != "..") {
                    Utils::replaceFilePlaceholders("$filePath" . DIRECTORY_SEPARATOR . "$file", $variables, $destPath,
                        $pending);
                }
            }
        } elseif (file_exists($filePath)) {
            $template = file_get_contents($filePath);
            $templateData = Utils::fillTemplate($variables, $template, $pending);
            $folder = dirname($destPath);
            if (!file_exists($folder)) {
                mkdir($folder, 0755, true);
            }
            file_put_contents($destPath, $templateData);
        }
    }
public static function replaceFilePlaceholders($filePath, $variables, $destPath = null, $pending = '$')
    {
        if (!$destPath) {
            $destPath = $filePath;
        }
        if (is_dir($filePath)) {
            $files = scandir($filePath);
            foreach ($files as $file) {
                if ($file != "." && $file != "..") {
                    Utils::replaceFilePlaceholders("$filePath" . DIRECTORY_SEPARATOR . "$file", $variables, $destPath,
                        $pending);
                }
            }
        } elseif (file_exists($filePath)) {
            $template = file_get_contents($filePath);
            $templateData = Utils::fillTemplate($variables, $template, $pending);
            $folder = dirname($destPath);
            if (!file_exists($folder)) {
                mkdir($folder, 0755, true);
            }
            file_put_contents($destPath, $templateData);
        }
    }
public static function replaceFilePlaceholders ( $ filePath , $ variables , $ destPath = null , $ pending = '$' ) { if ( ! $ destPath ) { $ destPath = $ filePath ; } if ( is_dir ( $ filePath ) ) { $ files = scandir ( $ filePath ) ; foreach ( $ files as $ file ) { if ( $ file != "." && $ file != ".." ) { Utils :: replaceFilePlaceholders ( "$filePath" . DIRECTORY_SEPARATOR . "$file" , $ variables , $ destPath , $ pending ) ; } } } elseif ( file_exists ( $ filePath ) ) { $ template = file_get_contents ( $ filePath ) ; $ templateData = Utils :: fillTemplate ( $ variables , $ template , $ pending ) ; $ folder = dirname ( $ destPath ) ; if ( ! file_exists ( $ folder ) ) { mkdir ( $ folder , 0755 , true ) ; } file_put_contents ( $ destPath , $ templateData ) ; } }
Replace and Save
@param $filePath
@param $variables
@param null $destPath
Replace and Save