Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

PHPTAL.php

Go to the documentation of this file.
00001 <?php 00002 /* vim: set expandtab tabstop=4 shiftwidth=4: */ 00003 // 00004 // Copyright (c) 2003 Laurent Bedubourg 00005 // 00006 // This library is free software; you can redistribute it and/or 00007 // modify it under the terms of the GNU Lesser General Public 00008 // License as published by the Free Software Foundation; either 00009 // version 2.1 of the License, or (at your option) any later version. 00010 // 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 // Lesser General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU Lesser General Public 00017 // License along with this library; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 // 00020 // Authors: Laurent Bedubourg <laurent.bedubourg@free.fr> 00021 // 00022 00023 /* 00024 * This file: 00025 * 00026 * - Include PHPTAL dependencies 00027 * - Define PHPTAL attributes 00028 * - Define PHPTAL aliases 00029 * - Define PHPTAL rules 00030 * 00031 * @author Laurent Bedubourg <laurent.bedubourg@free.fr> 00032 */ 00033 00034 $__d = dirname(__FILE__); 00035 define('PT_IP', $IP.'/PHPTAL-NP-0.7.0/libs'); 00036 require_once "PEAR.php"; 00037 00038 if (OS_WINDOWS) { 00039 define('PHPTAL_PATH_SEP', '\\'); 00040 } else { 00041 define('PHPTAL_PATH_SEP', '/'); 00042 } 00043 00044 function _phptal_os_path_join() 00045 { 00046 $args = func_get_args(); 00047 return join(PHPTAL_PATH_SEP, $args); 00048 } 00049 00050 require_once 'Types/Errors.php'; 00051 require_once 'Types/OString.php'; 00052 00053 require_once _phptal_os_path_join($__d, 'PHPTAL', 'Cache.php'); 00054 require_once _phptal_os_path_join($__d, 'PHPTAL', 'Context.php'); 00055 require_once _phptal_os_path_join($__d, 'PHPTAL', 'Filter.php'); 00056 require_once _phptal_os_path_join($__d, 'PHPTAL', 'LoopControler.php'); 00057 require_once _phptal_os_path_join($__d, 'PHPTAL', 'OutputControl.php'); 00058 require_once _phptal_os_path_join($__d, 'PHPTAL', 'Template.php'); 00059 require_once _phptal_os_path_join($__d, 'PHPTAL', 'Macro.php'); 00060 require_once _phptal_os_path_join($__d, 'PHPTAL', 'I18N.php'); 00061 00062 require_once _phptal_os_path_join($__d, 'PHPTAL', 'SourceResolver.php'); 00063 require_once _phptal_os_path_join($__d, 'PHPTAL', 'SourceLocator.php'); 00064 00065 00066 define('PHPTAL_VERSION', '0.7.0'); 00067 define('PHPTAL_MARK', str_replace('.', '_', PHPTAL_VERSION) . '_'); 00068 00069 if (strtoupper(substr(PHP_OS, 0, 3)) == "WIN") { 00070 define('PHPTAL_DEFAULT_CACHE_DIR', getenv("TMP") . "\\"); 00071 } else { 00072 define('PHPTAL_DEFAULT_CACHE_DIR', '/tmp/'); 00073 } 00074 00083 define('PHPTAL_XHTML', 1); 00084 00091 define('PHPTAL_XML', 2); 00092 00107 global $_phptal_namespaces; 00108 $_phptal_namespaces = array('TAL', 'METAL', 'I18N', 'PHPTAL'); 00109 00110 00111 define('_PHPTAL_SURROUND', 1); 00112 define('_PHPTAL_REPLACE', 2); 00113 define('_PHPTAL_CONTENT', 3); 00114 00128 global $_phptal_dictionary; 00129 $_phptal_dictionary = array( 00130 'TAL:DEFINE' => _PHPTAL_REPLACE, // set a context variable 00131 'TAL:CONDITION' => _PHPTAL_SURROUND, // print tag content only when condition true 00132 'TAL:REPEAT' => _PHPTAL_SURROUND, // repeat over an iterable 00133 'TAL:CONTENT' => _PHPTAL_CONTENT, // replace tag content 00134 'TAL:REPLACE' => _PHPTAL_REPLACE, // replace entire tag 00135 'TAL:ATTRIBUTES' => _PHPTAL_REPLACE, // dynamically set tag attributes 00136 'TAL:OMIT-TAG' => _PHPTAL_SURROUND, // omit to print tag but not its content 00137 'TAL:COMMENT' => _PHPTAL_SURROUND, // do nothing 00138 'TAL:ON-ERROR' => _PHPTAL_SURROUND, // replace content with this if error occurs 00139 00140 'METAL:DEFINE-MACRO' => _PHPTAL_SURROUND, // define a template macro 00141 'METAL:USE-MACRO' => _PHPTAL_REPLACE, // use a template macro 00142 'METAL:DEFINE-SLOT' => _PHPTAL_SURROUND, // define a macro slot 00143 'METAL:FILL-SLOT' => _PHPTAL_SURROUND, // fill a macro slot 00144 00145 'PHPTAL:INCLUDE' => _PHPTAL_REPLACE, // include an external template 00146 'PHPTAL:SRC-INCLUDE' => _PHPTAL_CONTENT, // include external file without parsing 00147 00148 'I18N:TRANSLATE' => _PHPTAL_CONTENT, // translate some data using GetText package 00149 'I18N:NAME' => _PHPTAL_SURROUND, // prepare a translation name 00150 'I18N:ATTRIBUTES' => _PHPTAL_REPLACE, // translate tag attributes values 00151 ); 00152 00163 global $_phptal_aliases; 00164 $_phptal_aliases = array( 00165 'TAL:INCLUDE' => 'PHPTAL:INCLUDE', 00166 'TAL:SRC-INCLUDE'=> 'PHPTAL:SRC-INCLUDE', 00167 ); 00168 00185 global $_phptal_rules_order; 00186 $_phptal_rules_order = array( 00187 'TAL:OMIT-TAG' => 0, // surround -> $tag->disableHeadFootPrint() 00188 00189 'TAL:ON-ERROR' => 1, // surround 00190 00191 'METAL:DEFINE-MACRO' => 3, // surround 00192 'TAL:DEFINE' => 3, // replace 00193 'I18N:NAME' => 3, // replace 00194 'I18N:TRANSLATE' => 3, // content 00195 00196 'TAL:CONDITION' => 4, // surround 00197 00198 'TAL:REPEAT' => 5, // surround 00199 00200 'I18N:ATTRIBUTES' => 6, // replace 00201 'TAL:ATTRIBUTES' => 6, // replace 00202 'TAL:REPLACE' => 6, // replace 00203 'METAL:USE-MACRO' => 6, // replace 00204 'PHPTAL:SRC-INCLUDE' => 6, // replace 00205 'PHPTAL:INCLUDE' => 6, // replace 00206 'METAL:DEFINE-SLOT' => 6, // replace 00207 'METAL:FILL-SLOT' => 6, // replace 00208 00209 'TAL:CONTENT' => 7, // content 00210 00211 'TAL:COMMENT' => 8, // surround 00212 ); 00213 00224 global $_phptal_xhtml_empty_tags; 00225 $_phptal_xhtml_empty_tags = array( 00226 'AREA', 00227 'BASE', 00228 'BASEFONT', 00229 'BR', 00230 'COL', 00231 'FRAME', 00232 'HR', 00233 'IMG', 00234 'INPUT', 00235 'ISINDEX', 00236 'LINK', 00237 'META', 00238 'PARAM', 00239 ); 00240 00252 global $_phptal_xhtml_boolean_attributes; 00253 $_phptal_xhtml_boolean_attributes = array( 00254 'compact', 00255 'nowrap', 00256 'ismap', 00257 'declare', 00258 'noshade', 00259 'checked', 00260 'disabled', 00261 'readonly', 00262 'multiple', 00263 'selected', 00264 'noresize', 00265 'defer' 00266 ); 00267 00271 class PHPTAL extends PHPTAL_Template {} 00272 00276 class HTML_Template_PHPTAL extends PHPTAL_Template {} 00277 00281 class HTML_Template_PHPTAL_Filter extends PHPTAL_Filter {} 00282 00286 class HTML_Template_PHPTAL_SourceLocator extends PHPTAL_SourceLocator {} 00287 00291 class HTML_Template_PHPTAL_SourceResolver extends PHPTAL_SourceResolver {} 00292 00293 00294 ?>

Generated on Tue Jun 29 23:40:06 2004 for Mediawiki by doxygen 1.3.7