[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Definition of eZOverride class 4 // 5 // Created on: <31-Oct-2002 09:18:07 amos> 6 // 7 // SOFTWARE NAME: eZ publish 8 // SOFTWARE RELEASE: 3.9.0 9 // BUILD VERSION: 17785 10 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 11 // SOFTWARE LICENSE: GNU General Public License v2.0 12 // NOTICE: > 13 // This program is free software; you can redistribute it and/or 14 // modify it under the terms of version 2.0 of the GNU General 15 // Public License as published by the Free Software Foundation. 16 // 17 // This program is distributed in the hope that it will be useful, 18 // but WITHOUT ANY WARRANTY; without even the implied warranty of 19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 // GNU General Public License for more details. 21 // 22 // You should have received a copy of version 2.0 of the GNU General 23 // Public License along with this program; if not, write to the Free 24 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 25 // MA 02110-1301, USA. 26 // 27 // 28 29 /*! \file ezoverride.php 30 */ 31 32 /*! 33 \class eZOverride ezoverride.php 34 \brief The class eZOverride does 35 36 */ 37 38 class eZOverride 39 { 40 /*! 41 Constructor 42 */ 43 function eZOverride() 44 { 45 } 46 47 function selectFile( $matches, $matchKeys, &$matchedKeys, $regexpMatch ) 48 { 49 $match = null; 50 foreach ( $matches as $templateMatch ) 51 { 52 $templatePath = $templateMatch["file"]; 53 $templateType = $templateMatch["type"]; 54 if ( $templateType == "normal" ) 55 { 56 if ( file_exists( $templatePath ) ) 57 { 58 $match = $templateMatch; 59 break; 60 } 61 } 62 else if ( $templateType == "override" ) 63 { 64 $foundOverrideFile = false; 65 if ( file_exists( $templatePath ) ) 66 { 67 $match = $templateMatch; 68 $match["file"] = $templatePath; 69 $foundOverrideFile = true; 70 } 71 if ( !$foundOverrideFile and 72 count( $matchKeys ) == 0 ) 73 continue; 74 if ( !$foundOverrideFile and 75 preg_match( $regexpMatch, $templatePath, $regs ) )// Check for dir/filebase_keyname_keyid.tpl, eg. content/view_section_1.tpl 76 { 77 foreach ( $matchKeys as $matchKeyName => $matchKeyValue ) 78 { 79 $file = $regs[1] . "/" . $regs[2] . "_$matchKeyName" . "_$matchKeyValue" . $regs[3]; 80 if ( file_exists( $file ) ) 81 { 82 $match = $templateMatch; 83 $match["file"] = $file; 84 $foundOverrideFile = true; 85 $matchedKeys[$matchKeyName] = $matchKeyValue; 86 // eZDebug::writeNotice( "Match found, using override " . $match["file"] ); 87 break; 88 } 89 } 90 } 91 if ( $match !== null ) 92 break; 93 } 94 } 95 return $match; 96 } 97 } 98 99 ?>
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 |