X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=DOCS%2Ftpl-validator.php;h=7921b08b04be4523d3d7b9ec27f0c749e4edb0d5;hb=8975d55c697ec1bec2cdacc2c3b965b6add16a03;hp=1bfedac7afe09818415b6367d82cf82f9d3b4f7a;hpb=263a089d8a499e0e26d0af9e7aa7639f88b8ca60;p=mailer.git diff --git a/DOCS/tpl-validator.php b/DOCS/tpl-validator.php index 1bfedac7af..7921b08b04 100644 --- a/DOCS/tpl-validator.php +++ b/DOCS/tpl-validator.php @@ -10,15 +10,9 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Validiert Templates auf korrektes HTML * * -------------------------------------------------------------------- * - * $Revision:: $ * - * $Date:: $ * - * $Tag:: 0.2.1-FINAL $ * - * $Author:: $ * - * Needs to be in all Files and every File needs "svn propset * - * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * - * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2015 by Mailer Developer Team * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -49,23 +43,23 @@ if ($_SERVER['argc'] < 2) { print "Validating template ".$_SERVER['argv'][1]."...\n"; $doc = new DOMDocument(); -$doc->formatOutput = true; -$doc->preserveWhiteSpace = false; -$doc->encoding = 'utf-8'; +$doc->formatOutput = TRUE; +$doc->preserveWhiteSpace = FALSE; +$doc->encoding = 'UTF-8'; $doc->xmlVersion = '1.1'; $doc->loadHTMLFile($_SERVER['argv'][1]); $data = $doc->saveHTML(); $newData = str_replace("
", "
\n", $data); -$newData = str_replace("\n\n", "\n", $newData); +$newData = str_replace(PHP_EOL . PHP_EOL, PHP_EOL, $newData); -$array = explode("\n", $newData); +$array = explode(PHP_EOL, $newData); array_shift($array); array_shift($array); unset($array[count($array) - 1]); unset($array[count($array) - 1]); -$newData = implode("\n", $array)."\n"; +$newData = implode(PHP_EOL, $array).PHP_EOL; // Has a template changed? if ($data != $newData) { @@ -76,7 +70,7 @@ if ($data != $newData) { print "Template ".$_SERVER['argv'][1]." might be issue-free.\n"; } -if (strtolower($_SERVER['arv'][2]) == '--write') { +if ((isset($_SERVER['arv'][2])) && (strtolower($_SERVER['arv'][2]) == '--write')) { print "Writing document...\n"; file_put_contents($_SERVER['argv'][1], $data); } // END - if