<?php

echo "Trimming within ". getcwd()." ...\n";
$source = file_get_contents('tableeditpop_orig.tpl');

echo "File size ".strlen($source)."\n";

$source = preg_replace('/\{\*(?:.|[\r\n])*?\*\}/', ' ', $source);
echo "Error: ".preg_last_error()."\n";

$source = preg_replace('/(?:(?<!\?>)\n)[\s]+/m', '\1', $source);
echo "Error: ".preg_last_error()."\n";

$source = preg_replace('/\n/', '', $source);
echo "Error: ".preg_last_error()."\n";

file_put_contents('tableeditpop.tpl', trim($source) );
echo "DONE!\n";