| [ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 #!/usr/bin/env php 2 <?php 3 // 4 // Created on: <29-Jul-2004 13:53:15 amos> 5 // 6 // SOFTWARE NAME: eZ publish 7 // SOFTWARE RELEASE: 3.9.0 8 // BUILD VERSION: 17785 9 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 10 // SOFTWARE LICENSE: GNU General Public License v2.0 11 // NOTICE: > 12 // This program is free software; you can redistribute it and/or 13 // modify it under the terms of version 2.0 of the GNU General 14 // Public License as published by the Free Software Foundation. 15 // 16 // This program is distributed in the hope that it will be useful, 17 // but WITHOUT ANY WARRANTY; without even the implied warranty of 18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 // GNU General Public License for more details. 20 // 21 // You should have received a copy of version 2.0 of the GNU General 22 // Public License along with this program; if not, write to the Free 23 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 24 // MA 02110-1301, USA. 25 // 26 // 27 28 include_once ( 'lib/ezutils/classes/ezcli.php' ); 29 include_once ( 'kernel/classes/ezscript.php' ); 30 31 $cli =& eZCLI::instance(); 32 $script =& eZScript::instance( array( 'description' => ( "eZ publish Template Syntax Checker\n" . 33 "\n" . 34 "./bin/php/eztemplatecheck.php -sadmin\n" . 35 "or\n" . 36 "./bin/php/eztemplatecheck.php design/" ), 37 'use-session' => false, 38 'use-modules' => true, 39 'use-extensions' => true ) ); 40 41 $script->startup(); 42 43 $options = $script->getOptions( "", "[FILE*]", array() ); 44 $sys =& eZSys::instance(); 45 46 $script->initialize(); 47 48 $result = true; 49 50 if ( count( $options['arguments'] ) > 0 ) 51 { 52 $ini =& eZINI::instance(); 53 54 include_once ( 'kernel/common/template.php' ); 55 $tpl =& templateInit(); 56 57 $fileList = array(); 58 59 foreach ( $options['arguments'] as $file ) 60 { 61 if ( is_dir( $file ) ) 62 { 63 $fileList = array_merge( $fileList, eZDir::recursiveFindRelative( '', $file, "\.tpl" ) ); 64 } 65 else if ( is_file( $file ) ) 66 { 67 $fileList[] = $file; 68 } 69 } 70 $fileList = array_unique( $fileList ); 71 72 $script->setIterationData( '.', '~' ); 73 $script->setShowVerboseOutput( true ); 74 75 $files = array(); 76 foreach ( $fileList as $file ) 77 { 78 $filename = basename( $file ); 79 if ( preg_match( "!^.+~$|^/?#.+#$|^\..+$!", $filename ) ) 80 continue; 81 $files[] = $file; 82 } 83 84 $script->resetIteration( count( $files ) ); 85 foreach ( $files as $file ) 86 { 87 if ( is_dir( $file ) ) 88 { 89 $script->iterate( $cli, true, "Skipping directory: " . $cli->stylize( 'dir', $file ) ); 90 } 91 else 92 { 93 $status = $tpl->validateTemplateFile( $file ); 94 $text = false; 95 if ( $status ) 96 $text = "Template file valid: " . $cli->stylize( 'file', $file ); 97 else 98 $text = "Template file invalid: " . $cli->stylize( 'file', $file ); 99 if ( !$status ) 100 $result = false; 101 $script->iterate( $cli, $status, $text ); 102 } 103 } 104 } 105 else 106 { 107 $ini =& eZINI::instance(); 108 $standardDesign = $ini->variable( "DesignSettings", "StandardDesign" ); 109 $siteDesign = $ini->variable( "DesignSettings", "SiteDesign" ); 110 $additionalSiteDesignList = $ini->variable( "DesignSettings", "AdditionalSiteDesignList" ); 111 112 $designList = array_merge( array( $standardDesign ), $additionalSiteDesignList, array( $siteDesign ) ); 113 114 include_once ( 'kernel/common/template.php' ); 115 $tpl =& templateInit(); 116 117 $script->setIterationData( '.', '~' ); 118 $script->setShowVerboseOutput( true ); 119 120 foreach ( $designList as $design ) 121 { 122 $cli->output( "Validating in design " . $cli->stylize( 'emphasize', $design ) ); 123 $baseDir = 'design/' . $design; 124 $files = eZDir::recursiveFindRelative( $baseDir, 'templates', "\.tpl" ); 125 $files = array_merge( $files, eZDir::recursiveFindRelative( $baseDir, 'override/templates', "\.tpl" ) ); 126 $script->resetIteration( count( $files ) ); 127 foreach ( $files as $fileRelative ) 128 { 129 $file = $baseDir . '/' . $fileRelative; 130 $status = $tpl->validateTemplateFile( $file ); 131 $text = false; 132 if ( $status ) 133 $text = "Template file valid: " . $cli->stylize( 'file', $file ); 134 else 135 $text = "Template file invalid: " . $cli->stylize( 'file', $file ); 136 if ( !$status ) 137 $result = false; 138 $script->iterate( $cli, $status, $text ); 139 } 140 } 141 } 142 143 if ( !$result ) 144 { 145 $script->shutdown( 1, "Some templates did not validate" ); 146 } 147 else 148 { 149 $script->shutdown(); 150 } 151 152 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |