├── .gitignore ├── .gitmodules ├── .npmignore ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── bin └── fis ├── fis.js ├── package.json └── test ├── ft ├── FisOfLocation.js └── fis-quickstart-demo │ ├── README.md │ ├── demo.html │ ├── fis-conf-no-std.js │ ├── fis-conf-timestamp.js │ ├── fis-conf.js │ ├── index.html │ ├── lib │ ├── base.css │ ├── bg.png │ ├── demo.css │ ├── demo.js │ ├── icons │ │ ├── icon_01.gif │ │ ├── icon_02.gif │ │ ├── icon_03.gif │ │ ├── icon_04.png │ │ ├── icon_05.png │ │ └── icon_06.png │ ├── logo.gif │ ├── main.css │ ├── mod.js │ └── normalize.css │ ├── modules │ ├── backbone │ │ └── backbone.js │ ├── collections │ │ └── todos.js │ ├── common │ │ └── common.js │ ├── deptest.js │ ├── jquery │ │ └── jquery.js │ ├── main.js │ ├── models │ │ └── todo.js │ ├── routers │ │ └── router.js │ ├── test1.js │ ├── test2.css │ ├── underscore │ │ └── underscore.js │ ├── vendor │ │ └── backbone.localStorage.js │ └── views │ │ ├── app.js │ │ └── todos.js │ └── package.json └── libs └── smarty-3.1.5 ├── Smarty.class.php ├── SmartyBC.class.php ├── debug.tpl ├── plugins ├── block.textformat.php ├── function.counter.php ├── function.cycle.php ├── function.fetch.php ├── function.html_checkboxes.php ├── function.html_image.php ├── function.html_options.php ├── function.html_radios.php ├── function.html_select_date.php ├── function.html_select_time.php ├── function.html_table.php ├── function.mailto.php ├── function.math.php ├── modifier.capitalize.php ├── modifier.date_format.php ├── modifier.debug_print_var.php ├── modifier.escape.php ├── modifier.regex_replace.php ├── modifier.replace.php ├── modifier.spacify.php ├── modifier.truncate.php ├── modifiercompiler.cat.php ├── modifiercompiler.count_characters.php ├── modifiercompiler.count_paragraphs.php ├── modifiercompiler.count_sentences.php ├── modifiercompiler.count_words.php ├── modifiercompiler.default.php ├── modifiercompiler.escape.php ├── modifiercompiler.from_charset.php ├── modifiercompiler.indent.php ├── modifiercompiler.lower.php ├── modifiercompiler.noprint.php ├── modifiercompiler.string_format.php ├── modifiercompiler.strip.php ├── modifiercompiler.strip_tags.php ├── modifiercompiler.to_charset.php ├── modifiercompiler.unescape.php ├── modifiercompiler.upper.php ├── modifiercompiler.wordwrap.php ├── outputfilter.trimwhitespace.php ├── shared.escape_special_chars.php ├── shared.literal_compiler_param.php ├── shared.make_timestamp.php ├── shared.mb_str_replace.php ├── shared.mb_unicode.php ├── shared.mb_wordwrap.php └── variablefilter.htmlspecialchars.php └── sysplugins ├── smarty_cacheresource.php ├── smarty_cacheresource_custom.php ├── smarty_cacheresource_keyvaluestore.php ├── smarty_config_source.php ├── smarty_internal_cacheresource_file.php ├── smarty_internal_compile_append.php ├── smarty_internal_compile_assign.php ├── smarty_internal_compile_block.php ├── smarty_internal_compile_break.php ├── smarty_internal_compile_call.php ├── smarty_internal_compile_capture.php ├── smarty_internal_compile_config_load.php ├── smarty_internal_compile_continue.php ├── smarty_internal_compile_debug.php ├── smarty_internal_compile_eval.php ├── smarty_internal_compile_extends.php ├── smarty_internal_compile_for.php ├── smarty_internal_compile_foreach.php ├── smarty_internal_compile_function.php ├── smarty_internal_compile_if.php ├── smarty_internal_compile_include.php ├── smarty_internal_compile_include_php.php ├── smarty_internal_compile_insert.php ├── smarty_internal_compile_ldelim.php ├── smarty_internal_compile_nocache.php ├── smarty_internal_compile_private_block_plugin.php ├── smarty_internal_compile_private_function_plugin.php ├── smarty_internal_compile_private_modifier.php ├── smarty_internal_compile_private_object_block_function.php ├── smarty_internal_compile_private_object_function.php ├── smarty_internal_compile_private_print_expression.php ├── smarty_internal_compile_private_registered_block.php ├── smarty_internal_compile_private_registered_function.php ├── smarty_internal_compile_private_special_variable.php ├── smarty_internal_compile_rdelim.php ├── smarty_internal_compile_section.php ├── smarty_internal_compile_setfilter.php ├── smarty_internal_compile_while.php ├── smarty_internal_compilebase.php ├── smarty_internal_config.php ├── smarty_internal_config_file_compiler.php ├── smarty_internal_configfilelexer.php ├── smarty_internal_configfileparser.php ├── smarty_internal_data.php ├── smarty_internal_debug.php ├── smarty_internal_filter_handler.php ├── smarty_internal_function_call_handler.php ├── smarty_internal_get_include_path.php ├── smarty_internal_nocache_insert.php ├── smarty_internal_parsetree.php ├── smarty_internal_resource_eval.php ├── smarty_internal_resource_extends.php ├── smarty_internal_resource_file.php ├── smarty_internal_resource_php.php ├── smarty_internal_resource_registered.php ├── smarty_internal_resource_stream.php ├── smarty_internal_resource_string.php ├── smarty_internal_smartytemplatecompiler.php ├── smarty_internal_template.php ├── smarty_internal_templatebase.php ├── smarty_internal_templatecompilerbase.php ├── smarty_internal_templatelexer.php ├── smarty_internal_templateparser.php ├── smarty_internal_utility.php ├── smarty_internal_write_file.php ├── smarty_resource.php ├── smarty_resource_custom.php ├── smarty_resource_recompiled.php ├── smarty_resource_uncompiled.php └── smarty_security.php /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | node_modules/ 3 | 4 | .DS_Store 5 | *.db 6 | *.bak 7 | *.tmp 8 | *.cmd 9 | ~* 10 | 11 | upload.py -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "node_modules/fis-command-install"] 2 | path = node_modules/fis-command-install 3 | url = https://github.com/fex-team/fis-command-install.git 4 | [submodule "node_modules/fis-command-release"] 5 | path = node_modules/fis-command-release 6 | url = https://github.com/fex-team/fis-command-release 7 | [submodule "node_modules/fis-command-server"] 8 | path = node_modules/fis-command-server 9 | url = https://github.com/fex-team/fis-command-server 10 | [submodule "node_modules/fis-kernel"] 11 | path = node_modules/fis-kernel 12 | url = https://github.com/fex-team/fis-kernel 13 | [submodule "node_modules/fis-optimizer-clean-css"] 14 | path = node_modules/fis-optimizer-clean-css 15 | url = https://github.com/fex-team/fis-optimizer-clean-css 16 | [submodule "node_modules/fis-optimizer-png-compressor"] 17 | path = node_modules/fis-optimizer-png-compressor 18 | url = https://github.com/fex-team/fis-optimizer-png-compressor 19 | [submodule "node_modules/fis-optimizer-uglify-js"] 20 | path = node_modules/fis-optimizer-uglify-js 21 | url = https://github.com/fex-team/fis-optimizer-uglify-js 22 | [submodule "node_modules/fis-packager-map"] 23 | path = node_modules/fis-packager-map 24 | url = https://github.com/fex-team/fis-packager-map 25 | [submodule "node_modules/fis-postprocessor-jswrapper"] 26 | path = node_modules/fis-postprocessor-jswrapper 27 | url = https://github.com/fex-team/fis-postprocessor-jswrapper 28 | [submodule "node_modules/fis-spriter-csssprites"] 29 | path = node_modules/fis-spriter-csssprites 30 | url = https://github.com/fex-team/fis-spriter-csssprites 31 | [submodule "node_modules/fis-deploy-default"] 32 | path = node_modules/fis-deploy-default 33 | url = https://github.com/fex-team/fis-deploy-default 34 | [submodule "node_modules/fis-preprocessor-components"] 35 | path = node_modules/fis-preprocessor-components 36 | url = https://github.com/fex-team/fis-preprocessor-components 37 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | /.settings 3 | /.project 4 | /.gitignore 5 | /node_modules 6 | /test 7 | /.tmp 8 | 9 | .DS_Store 10 | 11 | *.db 12 | *.bak 13 | *.tmp 14 | *.cmd 15 | ~* 16 | 17 | upload.py -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013 baidu.com 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 14 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 15 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 17 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 18 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /bin/fis: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require('../fis.js').cli.run(process.argv); 4 | -------------------------------------------------------------------------------- /fis.js: -------------------------------------------------------------------------------- 1 | /* 2 | * fis 3 | * http://fis.baidu.com/ 4 | */ 5 | 6 | 'use strict'; 7 | 8 | //kernel 9 | var fis = module.exports = require('fis-kernel'); 10 | 11 | //merge standard conf 12 | fis.config.merge({ 13 | modules : { 14 | preprocessor: { 15 | js: 'components', 16 | css: 'components', 17 | html: 'components' 18 | }, 19 | postprocessor : { 20 | js : 'jswrapper' 21 | }, 22 | optimizer : { 23 | js : 'uglify-js', 24 | css : 'clean-css', 25 | png : 'png-compressor' 26 | }, 27 | spriter : 'csssprites', 28 | packager : 'map', 29 | deploy : 'default', 30 | prepackager: 'derived' 31 | } 32 | }); 33 | 34 | //exports cli object 35 | fis.cli = {}; 36 | 37 | fis.cli.name = 'fis'; 38 | 39 | //colors 40 | fis.cli.colors = require('colors'); 41 | 42 | //commander object 43 | fis.cli.commander = null; 44 | 45 | //package.json 46 | fis.cli.info = fis.util.readJSON(__dirname + '/package.json'); 47 | 48 | //output help info 49 | fis.cli.help = function(){ 50 | var content = [ 51 | '', 52 | ' Usage: ' + fis.cli.name + ' ', 53 | '', 54 | ' Commands:', 55 | '' 56 | ]; 57 | 58 | fis.cli.help.commands.forEach(function(name){ 59 | var cmd = fis.require('command', name); 60 | name = cmd.name || name; 61 | name = fis.util.pad(name, 12); 62 | content.push(' ' + name + (cmd.desc || '')); 63 | }); 64 | 65 | content = content.concat([ 66 | '', 67 | ' Options:', 68 | '', 69 | ' -h, --help output usage information', 70 | ' -v, --version output the version number', 71 | ' --no-color disable colored output', 72 | '' 73 | ]); 74 | console.log(content.join('\n')); 75 | }; 76 | 77 | fis.cli.help.commands = [ 'release', 'install', 'server' ]; 78 | 79 | //output version info 80 | fis.cli.version = function(){ 81 | var content = [ 82 | '', 83 | ' v' + fis.cli.info.version, 84 | '', 85 | ' __' + '/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'.bold.red + '__' + '/\\\\\\\\\\\\\\\\\\\\\\'.bold.yellow + '_____' + '/\\\\\\\\\\\\\\\\\\\\\\'.bold.green + '___', 86 | ' _' + '\\/\\\\\\///////////'.bold.red + '__' + '\\/////\\\\\\///'.bold.yellow + '____' + '/\\\\\\/////////\\\\\\'.bold.green + '_' + ' ', 87 | ' _' + '\\/\\\\\\'.bold.red + '_________________' + '\\/\\\\\\'.bold.yellow + '______' + '\\//\\\\\\'.bold.green + '______' + '\\///'.bold.green + '__', 88 | ' _' + '\\/\\\\\\\\\\\\\\\\\\\\\\'.bold.red + '_________' + '\\/\\\\\\'.bold.yellow + '_______' + '\\////\\\\\\'.bold.green + '_________' + ' ', 89 | ' _' + '\\/\\\\\\///////'.bold.red + '__________' + '\\/\\\\\\'.bold.yellow + '__________' + '\\////\\\\\\'.bold.green + '______' + ' ', 90 | ' _' + '\\/\\\\\\'.bold.red + '_________________' + '\\/\\\\\\'.bold.yellow + '_____________' + '\\////\\\\\\'.bold.green + '___' + ' ', 91 | ' _' + '\\/\\\\\\'.bold.red + '_________________' + '\\/\\\\\\'.bold.yellow + '______' + '/\\\\\\'.bold.green + '______' + '\\//\\\\\\'.bold.green + '__', 92 | ' _' + '\\/\\\\\\'.bold.red + '______________' + '/\\\\\\\\\\\\\\\\\\\\\\'.bold.yellow + '_' + '\\///\\\\\\\\\\\\\\\\\\\\\\/'.bold.green + '___', 93 | ' _' + '\\///'.bold.red + '______________' + '\\///////////'.bold.yellow + '____' + '\\///////////'.bold.green + '_____', 94 | '' 95 | ].join('\n'); 96 | console.log(content); 97 | }; 98 | 99 | function hasArgv(argv, search){ 100 | var pos = argv.indexOf(search); 101 | var ret = false; 102 | while(pos > -1){ 103 | argv.splice(pos, 1); 104 | pos = argv.indexOf(search); 105 | ret = true; 106 | } 107 | return ret; 108 | } 109 | 110 | //run cli tools 111 | fis.cli.run = function(argv){ 112 | 113 | fis.processCWD = process.cwd(); 114 | 115 | if(hasArgv(argv, '--no-color')){ 116 | fis.cli.colors.mode = 'none'; 117 | } 118 | 119 | var first = argv[2]; 120 | if(argv.length < 3 || first === '-h' || first === '--help'){ 121 | fis.cli.help(); 122 | } else if(first === '-v' || first === '--version'){ 123 | fis.cli.version(); 124 | } else if(first[0] === '-'){ 125 | fis.cli.help(); 126 | } else { 127 | //register command 128 | var commander = fis.cli.commander = require('commander'); 129 | var cmd = fis.require('command', argv[2]); 130 | cmd.register( 131 | commander 132 | .command(cmd.name || first) 133 | .usage(cmd.usage) 134 | .description(cmd.desc) 135 | ); 136 | commander.parse(argv); 137 | } 138 | }; 139 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fis", 3 | "description": "front-end integrated solution.", 4 | "version": "1.10.7", 5 | "author": "FIS Team ", 6 | "homepage": "http://fis.baidu.com/", 7 | "keywords": [ 8 | "fis" 9 | ], 10 | "license": "MIT", 11 | "bin": { 12 | "fis": "bin/fis" 13 | }, 14 | "engines": { 15 | "node": ">= 0.8.0" 16 | }, 17 | "main": "fis.js", 18 | "scripts": { 19 | "uninstall": "node -e \"var cp = require('child_process'); cp.exec('bin/fis server stop');\"", 20 | "test": "mocha test/ut --recursive" 21 | }, 22 | "repository": { 23 | "type": "git", 24 | "url": "https://github.com/fis-dev/fis.git" 25 | }, 26 | "preferGlobal": true, 27 | "dependencies": { 28 | "colors": "0.6.2", 29 | "commander": "1.3.2", 30 | "fis-command-install": "0.2.15", 31 | "fis-command-release": "0.13.0", 32 | "fis-command-server": "0.7.9", 33 | "fis-deploy-default": "0.1.4", 34 | "fis-kernel": "2.0.19", 35 | "fis-preprocessor-components": "1.0.19", 36 | "fis-optimizer-clean-css": "0.0.9", 37 | "fis-optimizer-png-compressor": "0.2.2", 38 | "fis-optimizer-uglify-js": "0.2.2", 39 | "fis-packager-map": "0.0.9", 40 | "fis-postprocessor-jswrapper": "0.0.12", 41 | "fis-spriter-csssprites": "0.4.1", 42 | "fis-prepackager-derived": "0.0.3" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/README.md: -------------------------------------------------------------------------------- 1 | fis-quickstart-demo 2 | =================== 3 | 4 | fis-quickstart-demo是FIS的快速上手示例,请配合[文档](http://fis.baidu.com/docs/beginning/getting-started.html)使用 5 | -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/demo.html: -------------------------------------------------------------------------------- 1 |

demo.html content

-------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/fis-conf-no-std.js: -------------------------------------------------------------------------------- 1 | fis.config.set('roadmap.path', [ 2 | { 3 | reg: '**', 4 | useStandard: false 5 | } 6 | ]); -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/fis-conf-timestamp.js: -------------------------------------------------------------------------------- 1 | var now = new Date(); 2 | fis.config.set('timestamp', [now.getFullYear(), now.getMonth()+1, now.getDate(), now.getHours()].join('')); 3 | 4 | fis.config.set('roadmap.path', [ 5 | { 6 | reg: /.*\.(js|css)$/, 7 | query: '?t=${timestamp}' 8 | }, 9 | { 10 | reg: '**.html', 11 | useCache: false 12 | } 13 | ]); -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/fis-conf.js: -------------------------------------------------------------------------------- 1 | //Step 1. 取消下面的注释开启simple插件,注意需要先进行插件安装 npm install -g fis-postpackager-simple 2 | fis.config.set('modules.postpackager', 'simple'); 3 | 4 | //通过pack设置干预自动合并结果,将公用资源合并成一个文件,更加利于页面间的共用 5 | 6 | //Step 2. 取消下面的注释开启pack人工干预 7 | fis.config.merge({ 8 | roadmap : { 9 | path : [ 10 | { 11 | //所有的js文件 12 | reg : '**.js', 13 | //发布到/static/js/xxx目录下 14 | release : '/static/js/$&' 15 | }, 16 | { 17 | //所有的css文件 18 | reg : '**.css', 19 | //发布到/static/css/xxx目录下 20 | release : '/static/css$&' 21 | }, 22 | { 23 | reg : /(.*\.(?:png|gif))/i, 24 | //发布到/static/pic/xxx目录下 25 | release : '/static/pic/$&' 26 | }, 27 | { 28 | reg : '**.html', 29 | useMap : true 30 | } 31 | ] 32 | } 33 | }); 34 | fis.config.set('project.md5Length', 8); 35 | //Step 3. 取消下面的注释可以开启simple对零散资源的自动合并 36 | // fis.config.set('settings.postpackager.simple.autoCombine', true); 37 | 38 | 39 | //Step 4. 取消下面的注释开启图片合并功能 40 | // fis.config.set('roadmap.path', [{ 41 | // reg: '**.css', 42 | // useSprite: true 43 | // }]); 44 | // fis.config.set('settings.spriter.csssprites.margin', 20); -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | Todo 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 35 |
36 | 40 |
41 | 42 | 43 |
    44 |
    45 |
    46 |
    47 |
    48 |

    Double-click to edit a todo

    49 |

    Originated by Addy Osmani

    50 |

    Part of TodoMVC

    51 |

    Modified by LinkGod in March 2013

    52 |
    53 | 56 | 57 | -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/lib/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fex-team/fis/df24309102602bf32485e8e32f6bb20a9333a999/test/ft/fis-quickstart-demo/lib/bg.png -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/lib/demo.css: -------------------------------------------------------------------------------- 1 | img { border: 5px solid #ccc; } -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/lib/demo.js: -------------------------------------------------------------------------------- 1 | console.log('inline file'); -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/lib/icons/icon_01.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fex-team/fis/df24309102602bf32485e8e32f6bb20a9333a999/test/ft/fis-quickstart-demo/lib/icons/icon_01.gif -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/lib/icons/icon_02.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fex-team/fis/df24309102602bf32485e8e32f6bb20a9333a999/test/ft/fis-quickstart-demo/lib/icons/icon_02.gif -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/lib/icons/icon_03.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fex-team/fis/df24309102602bf32485e8e32f6bb20a9333a999/test/ft/fis-quickstart-demo/lib/icons/icon_03.gif -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/lib/icons/icon_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fex-team/fis/df24309102602bf32485e8e32f6bb20a9333a999/test/ft/fis-quickstart-demo/lib/icons/icon_04.png -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/lib/icons/icon_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fex-team/fis/df24309102602bf32485e8e32f6bb20a9333a999/test/ft/fis-quickstart-demo/lib/icons/icon_05.png -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/lib/icons/icon_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fex-team/fis/df24309102602bf32485e8e32f6bb20a9333a999/test/ft/fis-quickstart-demo/lib/icons/icon_06.png -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/lib/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fex-team/fis/df24309102602bf32485e8e32f6bb20a9333a999/test/ft/fis-quickstart-demo/lib/logo.gif -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/lib/mod.js: -------------------------------------------------------------------------------- 1 | /** 2 | * file: mod.js 3 | * ver: 1.0.3 4 | * auth: zhangjiachen@baidu.com 5 | * update: 11:48 2013/7/10 6 | */ 7 | var require, define; 8 | 9 | (function(self) { 10 | var head = document.getElementsByTagName('head')[0], 11 | loadingMap = {}, 12 | factoryMap = {}, 13 | modulesMap = {}, 14 | scriptsMap = {}, 15 | resMap, pkgMap; 16 | 17 | 18 | function loadScript(id, callback) { 19 | var queue = loadingMap[id] || (loadingMap[id] = []); 20 | queue.push(callback); 21 | 22 | // 23 | // load this script 24 | // 25 | var res = resMap[id] || {}; 26 | var url = res.pkg 27 | ? pkgMap[res.pkg].url 28 | : (res.url || id); 29 | 30 | if (! (url in scriptsMap)) { 31 | scriptsMap[url] = true; 32 | 33 | var script = document.createElement('script'); 34 | script.type = 'text/javascript'; 35 | script.src = url; 36 | head.appendChild(script); 37 | } 38 | } 39 | 40 | define = function(id, factory) { 41 | factoryMap[id] = factory; 42 | 43 | var queue = loadingMap[id]; 44 | if (queue) { 45 | for(var i = queue.length - 1; i >= 0; --i) { 46 | queue[i](); 47 | } 48 | delete loadingMap[id]; 49 | } 50 | }; 51 | 52 | require = function(id) { 53 | id = require.alias(id); 54 | 55 | var mod = modulesMap[id]; 56 | if (mod) { 57 | return mod.exports; 58 | } 59 | 60 | // 61 | // init module 62 | // 63 | var factory = factoryMap[id]; 64 | if (!factory) { 65 | throw Error('Cannot find module `' + id + '`'); 66 | } 67 | 68 | mod = modulesMap[id] = { 69 | 'exports': {} 70 | }; 71 | 72 | // 73 | // factory: function OR value 74 | // 75 | var ret = (typeof factory == 'function') 76 | ? factory.apply(mod, [require, mod.exports, mod]) 77 | : factory; 78 | 79 | if (ret) { 80 | mod.exports = ret; 81 | } 82 | return mod.exports; 83 | }; 84 | 85 | require.async = function(names, callback) { 86 | if (typeof names == 'string') { 87 | names = [names]; 88 | } 89 | 90 | for(var i = names.length - 1; i >= 0; --i) { 91 | names[i] = require.alias(names[i]); 92 | } 93 | 94 | var needMap = {}; 95 | var needNum = 0; 96 | 97 | function findNeed(depArr) { 98 | for(var i = depArr.length - 1; i >= 0; --i) { 99 | // 100 | // skip loading or loaded 101 | // 102 | var dep = depArr[i]; 103 | if (dep in factoryMap || dep in needMap) { 104 | continue; 105 | } 106 | 107 | needMap[dep] = true; 108 | needNum++; 109 | loadScript(dep, updateNeed); 110 | 111 | var child = resMap[dep]; 112 | if (child && 'deps' in child) { 113 | findNeed(child.deps); 114 | } 115 | } 116 | } 117 | 118 | function updateNeed() { 119 | if (0 == needNum--) { 120 | var i, n, args = []; 121 | for(i = 0, n = names.length; i < n; ++i) { 122 | args[i] = require(names[i]); 123 | } 124 | callback && callback.apply(self, args); 125 | } 126 | } 127 | 128 | findNeed(names); 129 | updateNeed(); 130 | }; 131 | 132 | require.resourceMap = function(obj) { 133 | resMap = obj['res'] || {}; 134 | pkgMap = obj['pkg'] || {}; 135 | }; 136 | 137 | require.alias = function(id) {return id}; 138 | 139 | })(this); 140 | -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/modules/collections/todos.js: -------------------------------------------------------------------------------- 1 | define('collections/todos', function(require, exports, module){ 2 | 3 | var Backbone, TodoModel, TodosCollection; 4 | 5 | Backbone = require('backbone'); 6 | require('vendor/backbone.localStorage'); 7 | 8 | var $ = require('jquery'); 9 | var _ = require('underscore'); 10 | 11 | TodoModel = require('models/todo'); 12 | 13 | TodosCollection = Backbone.Collection.extend({ 14 | model: TodoModel, 15 | 16 | localStorage: new Backbone.LocalStorage('todos-backbone'), 17 | 18 | completed: function () { 19 | return this.filter(function (todo) { 20 | return todo.get('completed'); 21 | }); 22 | }, 23 | 24 | remaining: function () { 25 | return this.without.apply(this, this.completed()); 26 | }, 27 | 28 | nextOrder: function () { 29 | if (!this.length) { 30 | return 1; 31 | } 32 | return this.last().get('order') + 1; 33 | }, 34 | 35 | comparator: function (todo) { 36 | return todo.get('order'); 37 | } 38 | }); 39 | 40 | module.exports = new TodosCollection(); 41 | 42 | }); -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/modules/common/common.js: -------------------------------------------------------------------------------- 1 | define('common', function(require, exports, module){ 2 | 3 | module.exports = { 4 | // Which filter are we using? 5 | TodoFilter: '', // empty, active, completed 6 | 7 | // What is the enter key constant? 8 | ENTER_KEY: 13 9 | }; 10 | 11 | }); -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/modules/deptest.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by wangfangguo on 14-7-30. 3 | */ 4 | //demo.js 5 | /** 6 | * @require test1.js 7 | * @require test2.css 8 | */ 9 | -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/modules/main.js: -------------------------------------------------------------------------------- 1 | define('main', function(require, exports, module){ 2 | 3 | var Backbone, Workspace, app; 4 | 5 | Backbone = require('backbone'); 6 | 7 | Backbone.$ = require('jquery'); 8 | 9 | app = require('views/app'); 10 | 11 | Workspace = require('routers/router'); 12 | 13 | new Workspace(); 14 | 15 | Backbone.history.start(); 16 | 17 | new app(); 18 | 19 | var i = 2; 20 | do{ 21 | 22 | }while (i--); return 1; 23 | 24 | 25 | }); 26 | 27 | var img =__uri('/lib/bg.png'); 28 | var css =__uri('/lib/base.css'); 29 | var js =__uri('/modules/views/app.js'); 30 | __inline('/lib/demo.js'); 31 | var img =__inline('/lib/logo.gif'); -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/modules/models/todo.js: -------------------------------------------------------------------------------- 1 | define('models/todo', function(require, exports, module){ 2 | 3 | var Backbone = require('backbone'); 4 | var TodoModel = Backbone.Model.extend({ 5 | defaults: { 6 | title: '', 7 | completed: false 8 | }, 9 | 10 | toggle: function(){ 11 | this.save({ 12 | completed: !this.get('completed') 13 | }); 14 | } 15 | }); 16 | 17 | module.exports = TodoModel; 18 | 19 | }); -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/modules/routers/router.js: -------------------------------------------------------------------------------- 1 | define('routers/router', function(require, exports, module){ 2 | 3 | var Backbone, Workspace, todos, common; 4 | 5 | Backbone = require('backbone'); 6 | common = require('common'); 7 | todos = require('collections/todos'); 8 | 9 | Workspace = Backbone.Router.extend({ 10 | routes: { 11 | '*filter': 'setFilter' 12 | }, 13 | 14 | setFilter: function (param) { 15 | // Set the current filter to be used 16 | common.TodoFilter = param && param.trim() || ''; 17 | 18 | // Trigger a collection filter event, causing hiding/unhiding 19 | // of Todo view items 20 | todos.trigger('filter'); 21 | } 22 | }); 23 | 24 | module.exports = Workspace; 25 | 26 | }); -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/modules/test1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by wangfangguo on 14-7-30. 3 | */ 4 | -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/modules/test2.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by wangfangguo on 14-7-30. 3 | */ 4 | -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/modules/views/app.js: -------------------------------------------------------------------------------- 1 | define('views/app', function(require, exports, module){ 2 | 3 | var Backbone, TodoView, todos, common, AppView; 4 | 5 | var $ = require('jquery'); 6 | var _ = require('underscore'); 7 | 8 | Backbone = require('backbone'); 9 | common = require('common'); 10 | TodoView = require('views/todos'); 11 | todos = require('collections/todos'); 12 | 13 | AppView = Backbone.View.extend({ 14 | 15 | el: '#todoapp', 16 | 17 | statsTemplate: function(obj){ 18 | var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');}; 19 | with(obj||{}){ 20 | __p+=''+ 21 | ((__t=( remaining ))==null?'':__t)+ 22 | ' '+ 23 | ((__t=( remaining === 1 ? 'item' : 'items' ))==null?'':__t)+ 24 | ' left\n\n'; 25 | if (completed) { 26 | __p+='\n\n'; 29 | } 30 | __p+=''; 31 | } 32 | return __p; 33 | }, 34 | 35 | events: { 36 | 'keypress #new-todo': 'createOnEnter', 37 | 'click #clear-completed': 'clearCompleted', 38 | 'click #toggle-all': 'toggleAllComplete' 39 | }, 40 | 41 | initialize: function () { 42 | this.allCheckbox = this.$('#toggle-all')[0]; 43 | this.$input = this.$('#new-todo'); 44 | this.$footer = this.$('#footer'); 45 | this.$main = this.$('#main'); 46 | 47 | this.listenTo(todos, 'add', this.addOne); 48 | this.listenTo(todos, 'reset', this.addAll); 49 | this.listenTo(todos, 'change:completed', this.filterOne); 50 | this.listenTo(todos, 'filter', this.filterAll); 51 | this.listenTo(todos, 'all', this.render); 52 | 53 | todos.fetch(); 54 | }, 55 | 56 | render: function () { 57 | var completed = todos.completed().length; 58 | var remaining = todos.remaining().length; 59 | 60 | if (todos.length) { 61 | this.$main.show(); 62 | this.$footer.show(); 63 | 64 | this.$footer.html(this.statsTemplate({ 65 | completed: completed, 66 | remaining: remaining 67 | })); 68 | 69 | this.$('#filters li a') 70 | .removeClass('selected') 71 | .filter('[href="#/' + (common.TodoFilter || '') + '"]') 72 | .addClass('selected'); 73 | } else { 74 | this.$main.hide(); 75 | this.$footer.hide(); 76 | } 77 | 78 | this.allCheckbox.checked = !remaining; 79 | }, 80 | 81 | addOne: function (todo) { 82 | var view = new TodoView({ model: todo }); 83 | $('#todo-list').append(view.render().el); 84 | }, 85 | 86 | addAll: function () { 87 | this.$('#todo-list').html(''); 88 | todos.each(this.addOne, this); 89 | }, 90 | 91 | filterOne: function (todo) { 92 | todo.trigger('visible'); 93 | }, 94 | 95 | filterAll: function () { 96 | todos.each(this.filterOne, this); 97 | }, 98 | 99 | newAttributes: function () { 100 | return { 101 | title: this.$input.val().trim(), 102 | order: todos.nextOrder(), 103 | completed: false 104 | }; 105 | }, 106 | 107 | createOnEnter: function (e) { 108 | if (e.which !== common.ENTER_KEY || !this.$input.val().trim()) { 109 | return; 110 | } 111 | 112 | todos.create(this.newAttributes()); 113 | this.$input.val(''); 114 | }, 115 | 116 | clearCompleted: function () { 117 | _.invoke(todos.completed(), 'destroy'); 118 | return false; 119 | }, 120 | 121 | toggleAllComplete: function () { 122 | var completed = this.allCheckbox.checked; 123 | 124 | todos.each(function (todo) { 125 | todo.save({ 126 | 'completed': completed 127 | }); 128 | }); 129 | } 130 | }); 131 | 132 | module.exports = AppView; 133 | 134 | }); -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/modules/views/todos.js: -------------------------------------------------------------------------------- 1 | define('views/todos', function(require, exports, module){ 2 | 3 | var Backbone, common, TodoView; 4 | 5 | Backbone = require('backbone'); 6 | common = require('common'); 7 | 8 | var $ = require('jquery'); 9 | var _ = require('underscore'); 10 | 11 | TodoView = Backbone.View.extend({ 12 | tagName: 'li', 13 | 14 | template: function(obj){ 15 | var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');}; 16 | with(obj||{}){ 17 | __p+='
    \n \n \n \n
    \n'; 26 | } 27 | return __p; 28 | }, 29 | 30 | events: { 31 | 'click .toggle': 'toggleCompleted', 32 | 'dblclick label': 'edit', 33 | 'click .destroy': 'clear', 34 | 'keypress .edit': 'updateOnEnter', 35 | 'blur .edit': 'close' 36 | }, 37 | 38 | initialize: function () { 39 | this.listenTo(this.model, 'change', this.render); 40 | this.listenTo(this.model, 'destroy', this.remove); 41 | this.listenTo(this.model, 'visible', this.toggleVisible); 42 | }, 43 | 44 | render: function () { 45 | this.$el.html(this.template(this.model.toJSON())); 46 | this.$el.toggleClass('completed', this.model.get('completed')); 47 | this.toggleVisible(); 48 | this.$input = this.$('.edit'); 49 | return this; 50 | }, 51 | 52 | toggleVisible: function () { 53 | this.$el.toggleClass('hidden', this.isHidden()); 54 | }, 55 | 56 | isHidden: function () { 57 | var isCompleted = this.model.get('completed'); 58 | return (// hidden cases only 59 | (!isCompleted && common.TodoFilter === 'completed') || 60 | (isCompleted && common.TodoFilter === 'active') 61 | ); 62 | }, 63 | 64 | toggleCompleted: function () { 65 | this.model.toggle(); 66 | }, 67 | 68 | edit: function () { 69 | this.$el.addClass('editing'); 70 | this.$input.focus(); 71 | }, 72 | 73 | close: function () { 74 | var value = this.$input.val().trim(); 75 | 76 | if (value) { 77 | this.model.save({ title: value }); 78 | } else { 79 | this.clear(); 80 | } 81 | 82 | this.$el.removeClass('editing'); 83 | }, 84 | 85 | updateOnEnter: function (e) { 86 | if (e.which === common.ENTER_KEY) { 87 | this.close(); 88 | } 89 | }, 90 | 91 | clear: function () { 92 | this.model.destroy(); 93 | } 94 | }); 95 | 96 | module.exports = TodoView; 97 | 98 | }); -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fis-quickstart-demo", 3 | "version": "0.0.9", 4 | "description": "a fis quick get started demo", 5 | "keywords": [ 6 | "fis", 7 | "demo" 8 | ], 9 | "repository": "https://github.com/hefangshi/fis-quickstart-demo", 10 | "license": "MIT" 11 | } 12 | -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/debug.tpl: -------------------------------------------------------------------------------- 1 | {capture name='_smarty_debug' assign=debug_output} 2 | 3 | 4 | 5 | Smarty Debug Console 6 | 86 | 87 | 88 | 89 |

    Smarty Debug Console - {if isset($template_name)}{$template_name|debug_print_var nofilter}{else}Total Time {$execution_time|string_format:"%.5f"}{/if}

    90 | 91 | {if !empty($template_data)} 92 |

    included templates & config files (load time in seconds)

    93 | 94 |
    95 | {foreach $template_data as $template} 96 | {$template.name} 97 | 98 | (compile {$template['compile_time']|string_format:"%.5f"}) (render {$template['render_time']|string_format:"%.5f"}) (cache {$template['cache_time']|string_format:"%.5f"}) 99 | 100 |
    101 | {/foreach} 102 |
    103 | {/if} 104 | 105 |

    assigned template variables

    106 | 107 | 108 | {foreach $assigned_vars as $vars} 109 | 110 | 111 | 112 | {/foreach} 113 |
    ${$vars@key|escape:'html'}{$vars|debug_print_var nofilter}
    114 | 115 |

    assigned config file variables (outer template scope)

    116 | 117 | 118 | {foreach $config_vars as $vars} 119 | 120 | 121 | 122 | {/foreach} 123 | 124 |
    {$vars@key|escape:'html'}{$vars|debug_print_var nofilter}
    125 | 126 | 127 | {/capture} 128 | 134 | -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/block.textformat.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: textformat
    14 | * Purpose: format text a certain way with preset styles 15 | * or custom wrap/indent settings
    16 | * Params: 17 | *
     18 |  * - style         - string (email)
     19 |  * - indent        - integer (0)
     20 |  * - wrap          - integer (80)
     21 |  * - wrap_char     - string ("\n")
     22 |  * - indent_char   - string (" ")
     23 |  * - wrap_boundary - boolean (true)
     24 |  * 
    25 | * 26 | * @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat} 27 | * (Smarty online manual) 28 | * @param array $params parameters 29 | * @param string $content contents of the block 30 | * @param Smarty_Internal_Template $template template object 31 | * @param boolean &$repeat repeat flag 32 | * @return string content re-formatted 33 | * @author Monte Ohrt 34 | */ 35 | function smarty_block_textformat($params, $content, $template, &$repeat) 36 | { 37 | if (is_null($content)) { 38 | return; 39 | } 40 | 41 | $style = null; 42 | $indent = 0; 43 | $indent_first = 0; 44 | $indent_char = ' '; 45 | $wrap = 80; 46 | $wrap_char = "\n"; 47 | $wrap_cut = false; 48 | $assign = null; 49 | 50 | foreach ($params as $_key => $_val) { 51 | switch ($_key) { 52 | case 'style': 53 | case 'indent_char': 54 | case 'wrap_char': 55 | case 'assign': 56 | $$_key = (string)$_val; 57 | break; 58 | 59 | case 'indent': 60 | case 'indent_first': 61 | case 'wrap': 62 | $$_key = (int)$_val; 63 | break; 64 | 65 | case 'wrap_cut': 66 | $$_key = (bool)$_val; 67 | break; 68 | 69 | default: 70 | trigger_error("textformat: unknown attribute '$_key'"); 71 | } 72 | } 73 | 74 | if ($style == 'email') { 75 | $wrap = 72; 76 | } 77 | // split into paragraphs 78 | $_paragraphs = preg_split('![\r\n]{2}!', $content); 79 | $_output = ''; 80 | 81 | 82 | foreach ($_paragraphs as &$_paragraph) { 83 | if (!$_paragraph) { 84 | continue; 85 | } 86 | // convert mult. spaces & special chars to single space 87 | $_paragraph = preg_replace(array('!\s+!u', '!(^\s+)|(\s+$)!u'), array(' ', ''), $_paragraph); 88 | // indent first line 89 | if ($indent_first > 0) { 90 | $_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph; 91 | } 92 | // wordwrap sentences 93 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 94 | require_once(SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php'); 95 | $_paragraph = smarty_mb_wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut); 96 | } else { 97 | $_paragraph = wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut); 98 | } 99 | // indent lines 100 | if ($indent > 0) { 101 | $_paragraph = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraph); 102 | } 103 | } 104 | $_output = implode($wrap_char . $wrap_char, $_paragraphs); 105 | 106 | if ($assign) { 107 | $template->assign($assign, $_output); 108 | } else { 109 | return $_output; 110 | } 111 | } 112 | 113 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/function.counter.php: -------------------------------------------------------------------------------- 1 | 12 | * Name: counter
    13 | * Purpose: print out a counter value 14 | * 15 | * @author Monte Ohrt 16 | * @link http://www.smarty.net/manual/en/language.function.counter.php {counter} 17 | * (Smarty online manual) 18 | * @param array $params parameters 19 | * @param Smarty_Internal_Template $template template object 20 | * @return string|null 21 | */ 22 | function smarty_function_counter($params, $template) 23 | { 24 | static $counters = array(); 25 | 26 | $name = (isset($params['name'])) ? $params['name'] : 'default'; 27 | if (!isset($counters[$name])) { 28 | $counters[$name] = array( 29 | 'start'=>1, 30 | 'skip'=>1, 31 | 'direction'=>'up', 32 | 'count'=>1 33 | ); 34 | } 35 | $counter =& $counters[$name]; 36 | 37 | if (isset($params['start'])) { 38 | $counter['start'] = $counter['count'] = (int)$params['start']; 39 | } 40 | 41 | if (!empty($params['assign'])) { 42 | $counter['assign'] = $params['assign']; 43 | } 44 | 45 | if (isset($counter['assign'])) { 46 | $template->assign($counter['assign'], $counter['count']); 47 | } 48 | 49 | if (isset($params['print'])) { 50 | $print = (bool)$params['print']; 51 | } else { 52 | $print = empty($counter['assign']); 53 | } 54 | 55 | if ($print) { 56 | $retval = $counter['count']; 57 | } else { 58 | $retval = null; 59 | } 60 | 61 | if (isset($params['skip'])) { 62 | $counter['skip'] = $params['skip']; 63 | } 64 | 65 | if (isset($params['direction'])) { 66 | $counter['direction'] = $params['direction']; 67 | } 68 | 69 | if ($counter['direction'] == "down") 70 | $counter['count'] -= $counter['skip']; 71 | else 72 | $counter['count'] += $counter['skip']; 73 | 74 | return $retval; 75 | 76 | } 77 | 78 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/function.cycle.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: cycle
    14 | * Date: May 3, 2002
    15 | * Purpose: cycle through given values
    16 | * Params: 17 | *
     18 |  * - name      - name of cycle (optional)
     19 |  * - values    - comma separated list of values to cycle, or an array of values to cycle
     20 |  *               (this can be left out for subsequent calls)
     21 |  * - reset     - boolean - resets given var to true
     22 |  * - print     - boolean - print var or not. default is true
     23 |  * - advance   - boolean - whether or not to advance the cycle
     24 |  * - delimiter - the value delimiter, default is ","
     25 |  * - assign    - boolean, assigns to template var instead of printed.
     26 |  * 
    27 | * Examples:
    28 | *
     29 |  * {cycle values="#eeeeee,#d0d0d0d"}
     30 |  * {cycle name=row values="one,two,three" reset=true}
     31 |  * {cycle name=row}
     32 |  * 
    33 | * 34 | * @link http://www.smarty.net/manual/en/language.function.cycle.php {cycle} 35 | * (Smarty online manual) 36 | * @author Monte Ohrt 37 | * @author credit to Mark Priatel 38 | * @author credit to Gerard 39 | * @author credit to Jason Sweat 40 | * @version 1.3 41 | * @param array $params parameters 42 | * @param Smarty_Internal_Template $template template object 43 | * @return string|null 44 | */ 45 | 46 | function smarty_function_cycle($params, $template) 47 | { 48 | static $cycle_vars; 49 | 50 | $name = (empty($params['name'])) ? 'default' : $params['name']; 51 | $print = (isset($params['print'])) ? (bool)$params['print'] : true; 52 | $advance = (isset($params['advance'])) ? (bool)$params['advance'] : true; 53 | $reset = (isset($params['reset'])) ? (bool)$params['reset'] : false; 54 | 55 | if (!isset($params['values'])) { 56 | if(!isset($cycle_vars[$name]['values'])) { 57 | trigger_error("cycle: missing 'values' parameter"); 58 | return; 59 | } 60 | } else { 61 | if(isset($cycle_vars[$name]['values']) 62 | && $cycle_vars[$name]['values'] != $params['values'] ) { 63 | $cycle_vars[$name]['index'] = 0; 64 | } 65 | $cycle_vars[$name]['values'] = $params['values']; 66 | } 67 | 68 | if (isset($params['delimiter'])) { 69 | $cycle_vars[$name]['delimiter'] = $params['delimiter']; 70 | } elseif (!isset($cycle_vars[$name]['delimiter'])) { 71 | $cycle_vars[$name]['delimiter'] = ','; 72 | } 73 | 74 | if(is_array($cycle_vars[$name]['values'])) { 75 | $cycle_array = $cycle_vars[$name]['values']; 76 | } else { 77 | $cycle_array = explode($cycle_vars[$name]['delimiter'],$cycle_vars[$name]['values']); 78 | } 79 | 80 | if(!isset($cycle_vars[$name]['index']) || $reset ) { 81 | $cycle_vars[$name]['index'] = 0; 82 | } 83 | 84 | if (isset($params['assign'])) { 85 | $print = false; 86 | $template->assign($params['assign'], $cycle_array[$cycle_vars[$name]['index']]); 87 | } 88 | 89 | if($print) { 90 | $retval = $cycle_array[$cycle_vars[$name]['index']]; 91 | } else { 92 | $retval = null; 93 | } 94 | 95 | if($advance) { 96 | if ( $cycle_vars[$name]['index'] >= count($cycle_array) -1 ) { 97 | $cycle_vars[$name]['index'] = 0; 98 | } else { 99 | $cycle_vars[$name]['index']++; 100 | } 101 | } 102 | 103 | return $retval; 104 | } 105 | 106 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/function.html_image.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: html_image
    14 | * Date: Feb 24, 2003
    15 | * Purpose: format HTML tags for the image
    16 | * Examples: {html_image file="/images/masthead.gif"}
    17 | * Output:
    18 | * Params: 19 | *
     20 |  * - file        - (required) - file (and path) of image
     21 |  * - height      - (optional) - image height (default actual height)
     22 |  * - width       - (optional) - image width (default actual width)
     23 |  * - basedir     - (optional) - base directory for absolute paths, default is environment variable DOCUMENT_ROOT
     24 |  * - path_prefix - prefix for path output (optional, default empty)
     25 |  * 
    26 | * 27 | * @link http://www.smarty.net/manual/en/language.function.html.image.php {html_image} 28 | * (Smarty online manual) 29 | * @author Monte Ohrt 30 | * @author credits to Duda 31 | * @version 1.0 32 | * @param array $params parameters 33 | * @param Smarty_Internal_Template $template template object 34 | * @return string 35 | * @uses smarty_function_escape_special_chars() 36 | */ 37 | function smarty_function_html_image($params, $template) 38 | { 39 | require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'); 40 | 41 | $alt = ''; 42 | $file = ''; 43 | $height = ''; 44 | $width = ''; 45 | $extra = ''; 46 | $prefix = ''; 47 | $suffix = ''; 48 | $path_prefix = ''; 49 | $server_vars = $_SERVER; 50 | $basedir = isset($server_vars['DOCUMENT_ROOT']) ? $server_vars['DOCUMENT_ROOT'] : ''; 51 | foreach($params as $_key => $_val) { 52 | switch ($_key) { 53 | case 'file': 54 | case 'height': 55 | case 'width': 56 | case 'dpi': 57 | case 'path_prefix': 58 | case 'basedir': 59 | $$_key = $_val; 60 | break; 61 | 62 | case 'alt': 63 | if (!is_array($_val)) { 64 | $$_key = smarty_function_escape_special_chars($_val); 65 | } else { 66 | throw new SmartyException ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE); 67 | } 68 | break; 69 | 70 | case 'link': 71 | case 'href': 72 | $prefix = ''; 73 | $suffix = ''; 74 | break; 75 | 76 | default: 77 | if (!is_array($_val)) { 78 | $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; 79 | } else { 80 | throw new SmartyException ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE); 81 | } 82 | break; 83 | } 84 | } 85 | 86 | if (empty($file)) { 87 | trigger_error("html_image: missing 'file' parameter", E_USER_NOTICE); 88 | return; 89 | } 90 | 91 | if (substr($file, 0, 1) == '/') { 92 | $_image_path = $basedir . $file; 93 | } else { 94 | $_image_path = $file; 95 | } 96 | 97 | if (!isset($params['width']) || !isset($params['height'])) { 98 | if (!$_image_data = @getimagesize($_image_path)) { 99 | if (!file_exists($_image_path)) { 100 | trigger_error("html_image: unable to find '$_image_path'", E_USER_NOTICE); 101 | return; 102 | } else if (!is_readable($_image_path)) { 103 | trigger_error("html_image: unable to read '$_image_path'", E_USER_NOTICE); 104 | return; 105 | } else { 106 | trigger_error("html_image: '$_image_path' is not a valid image file", E_USER_NOTICE); 107 | return; 108 | } 109 | } 110 | if (isset($template->smarty->security_policy)) { 111 | if (!$template->smarty->security_policy->isTrustedResourceDir($_image_path)) { 112 | return; 113 | } 114 | } 115 | 116 | if (!isset($params['width'])) { 117 | $width = $_image_data[0]; 118 | } 119 | if (!isset($params['height'])) { 120 | $height = $_image_data[1]; 121 | } 122 | } 123 | 124 | if (isset($params['dpi'])) { 125 | if (strstr($server_vars['HTTP_USER_AGENT'], 'Mac')) { 126 | $dpi_default = 72; 127 | } else { 128 | $dpi_default = 96; 129 | } 130 | $_resize = $dpi_default / $params['dpi']; 131 | $width = round($width * $_resize); 132 | $height = round($height * $_resize); 133 | } 134 | 135 | return $prefix . '' . $alt . '' . $suffix; 136 | } 137 | 138 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/function.math.php: -------------------------------------------------------------------------------- 1 | 14 | * Name: math
    15 | * Purpose: handle math computations in template 16 | * 17 | * @link http://www.smarty.net/manual/en/language.function.math.php {math} 18 | * (Smarty online manual) 19 | * @author Monte Ohrt 20 | * @param array $params parameters 21 | * @param Smarty_Internal_Template $template template object 22 | * @return string|null 23 | */ 24 | function smarty_function_math($params, $template) 25 | { 26 | static $_allowed_funcs = array( 27 | 'int' => true, 'abs' => true, 'ceil' => true, 'cos' => true, 'exp' => true, 'floor' => true, 28 | 'log' => true, 'log10' => true, 'max' => true, 'min' => true, 'pi' => true, 'pow' => true, 29 | 'rand' => true, 'round' => true, 'sin' => true, 'sqrt' => true, 'srand' => true ,'tan' => true 30 | ); 31 | // be sure equation parameter is present 32 | if (empty($params['equation'])) { 33 | trigger_error("math: missing equation parameter",E_USER_WARNING); 34 | return; 35 | } 36 | 37 | $equation = $params['equation']; 38 | 39 | // make sure parenthesis are balanced 40 | if (substr_count($equation,"(") != substr_count($equation,")")) { 41 | trigger_error("math: unbalanced parenthesis",E_USER_WARNING); 42 | return; 43 | } 44 | 45 | // match all vars in equation, make sure all are passed 46 | preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]*)!",$equation, $match); 47 | 48 | foreach($match[1] as $curr_var) { 49 | if ($curr_var && !isset($params[$curr_var]) && !isset($_allowed_funcs[$curr_var])) { 50 | trigger_error("math: function call $curr_var not allowed",E_USER_WARNING); 51 | return; 52 | } 53 | } 54 | 55 | foreach($params as $key => $val) { 56 | if ($key != "equation" && $key != "format" && $key != "assign") { 57 | // make sure value is not empty 58 | if (strlen($val)==0) { 59 | trigger_error("math: parameter $key is empty",E_USER_WARNING); 60 | return; 61 | } 62 | if (!is_numeric($val)) { 63 | trigger_error("math: parameter $key: is not numeric",E_USER_WARNING); 64 | return; 65 | } 66 | $equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation); 67 | } 68 | } 69 | $smarty_math_result = null; 70 | eval("\$smarty_math_result = ".$equation.";"); 71 | 72 | if (empty($params['format'])) { 73 | if (empty($params['assign'])) { 74 | return $smarty_math_result; 75 | } else { 76 | $template->assign($params['assign'],$smarty_math_result); 77 | } 78 | } else { 79 | if (empty($params['assign'])){ 80 | printf($params['format'],$smarty_math_result); 81 | } else { 82 | $template->assign($params['assign'],sprintf($params['format'],$smarty_math_result)); 83 | } 84 | } 85 | } 86 | 87 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifier.capitalize.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: capitalize
    14 | * Purpose: capitalize words in the string 15 | * 16 | * {@internal {$string|capitalize:true:true} is the fastest option for MBString enabled systems }} 17 | * 18 | * @param string $string string to capitalize 19 | * @param boolean $uc_digits also capitalize "x123" to "X123" 20 | * @param boolean $lc_rest capitalize first letters, lowercase all following letters "aAa" to "Aaa" 21 | * @return string capitalized string 22 | * @author Monte Ohrt 23 | * @author Rodney Rehm 24 | */ 25 | function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = false) 26 | { 27 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 28 | if ($lc_rest) { 29 | // uppercase (including hyphenated words) 30 | $upper_string = mb_convert_case( $string, MB_CASE_TITLE, SMARTY_RESOURCE_CHAR_SET ); 31 | } else { 32 | // uppercase word breaks 33 | $upper_string = preg_replace("!(^|[^\p{L}'])([\p{Ll}])!ueS", "stripslashes('\\1').mb_convert_case(stripslashes('\\2'),MB_CASE_UPPER, SMARTY_RESOURCE_CHAR_SET)", $string); 34 | } 35 | // check uc_digits case 36 | if (!$uc_digits) { 37 | if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!u", $string, $matches, PREG_OFFSET_CAPTURE)) { 38 | foreach($matches[1] as $match) { 39 | $upper_string = substr_replace($upper_string, mb_strtolower($match[0], SMARTY_RESOURCE_CHAR_SET), $match[1], strlen($match[0])); 40 | } 41 | } 42 | } 43 | $upper_string = preg_replace("!((^|\s)['\"])(\w)!ue", "stripslashes('\\1').mb_convert_case(stripslashes('\\3'),MB_CASE_UPPER, SMARTY_RESOURCE_CHAR_SET)", $upper_string); 44 | return $upper_string; 45 | } 46 | 47 | // lowercase first 48 | if ($lc_rest) { 49 | $string = strtolower($string); 50 | } 51 | // uppercase (including hyphenated words) 52 | $upper_string = preg_replace("!(^|[^\p{L}'])([\p{Ll}])!ueS", "stripslashes('\\1').ucfirst(stripslashes('\\2'))", $string); 53 | // check uc_digits case 54 | if (!$uc_digits) { 55 | if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!u", $string, $matches, PREG_OFFSET_CAPTURE)) { 56 | foreach($matches[1] as $match) { 57 | $upper_string = substr_replace($upper_string, strtolower($match[0]), $match[1], strlen($match[0])); 58 | } 59 | } 60 | } 61 | $upper_string = preg_replace("!((^|\s)['\"])(\w)!ue", "stripslashes('\\1').strtoupper(stripslashes('\\3'))", $upper_string); 62 | return $upper_string; 63 | } 64 | 65 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifier.date_format.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: date_format
    14 | * Purpose: format datestamps via strftime
    15 | * Input:
    16 | * - string: input date string 17 | * - format: strftime format for output 18 | * - default_date: default date if $string is empty 19 | * 20 | * @link http://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual) 21 | * @author Monte Ohrt 22 | * @param string $string input date string 23 | * @param string $format strftime format for output 24 | * @param string $default_date default date if $string is empty 25 | * @param string $formatter either 'strftime' or 'auto' 26 | * @return string |void 27 | * @uses smarty_make_timestamp() 28 | */ 29 | function smarty_modifier_date_format($string, $format = SMARTY_RESOURCE_DATE_FORMAT, $default_date = '',$formatter='auto') 30 | { 31 | /** 32 | * Include the {@link shared.make_timestamp.php} plugin 33 | */ 34 | require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'); 35 | if ($string != '') { 36 | $timestamp = smarty_make_timestamp($string); 37 | } elseif ($default_date != '') { 38 | $timestamp = smarty_make_timestamp($default_date); 39 | } else { 40 | return; 41 | } 42 | if($formatter=='strftime'||($formatter=='auto'&&strpos($format,'%')!==false)) { 43 | if (DS == '\\') { 44 | $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T'); 45 | $_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S'); 46 | if (strpos($format, '%e') !== false) { 47 | $_win_from[] = '%e'; 48 | $_win_to[] = sprintf('%\' 2d', date('j', $timestamp)); 49 | } 50 | if (strpos($format, '%l') !== false) { 51 | $_win_from[] = '%l'; 52 | $_win_to[] = sprintf('%\' 2d', date('h', $timestamp)); 53 | } 54 | $format = str_replace($_win_from, $_win_to, $format); 55 | } 56 | return strftime($format, $timestamp); 57 | } else { 58 | return date($format, $timestamp); 59 | } 60 | } 61 | 62 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifier.debug_print_var.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: debug_print_var
    14 | * Purpose: formats variable contents for display in the console 15 | * 16 | * @author Monte Ohrt 17 | * @param array|object $var variable to be formatted 18 | * @param integer $depth maximum recursion depth if $var is an array 19 | * @param integer $length maximum string length if $var is a string 20 | * @return string 21 | */ 22 | function smarty_modifier_debug_print_var ($var, $depth = 0, $length = 40) 23 | { 24 | $_replace = array("\n" => '\n', 25 | "\r" => '\r', 26 | "\t" => '\t' 27 | ); 28 | 29 | switch (gettype($var)) { 30 | case 'array' : 31 | $results = 'Array (' . count($var) . ')'; 32 | foreach ($var as $curr_key => $curr_val) { 33 | $results .= '
    ' . str_repeat(' ', $depth * 2) 34 | . '' . strtr($curr_key, $_replace) . ' => ' 35 | . smarty_modifier_debug_print_var($curr_val, ++$depth, $length); 36 | $depth--; 37 | } 38 | break; 39 | 40 | case 'object' : 41 | $object_vars = get_object_vars($var); 42 | $results = '' . get_class($var) . ' Object (' . count($object_vars) . ')'; 43 | foreach ($object_vars as $curr_key => $curr_val) { 44 | $results .= '
    ' . str_repeat(' ', $depth * 2) 45 | . ' ->' . strtr($curr_key, $_replace) . ' = ' 46 | . smarty_modifier_debug_print_var($curr_val, ++$depth, $length); 47 | $depth--; 48 | } 49 | break; 50 | 51 | case 'boolean' : 52 | case 'NULL' : 53 | case 'resource' : 54 | if (true === $var) { 55 | $results = 'true'; 56 | } elseif (false === $var) { 57 | $results = 'false'; 58 | } elseif (null === $var) { 59 | $results = 'null'; 60 | } else { 61 | $results = htmlspecialchars((string) $var); 62 | } 63 | $results = '' . $results . ''; 64 | break; 65 | 66 | case 'integer' : 67 | case 'float' : 68 | $results = htmlspecialchars((string) $var); 69 | break; 70 | 71 | case 'string' : 72 | $results = strtr($var, $_replace); 73 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 74 | if (mb_strlen($var, SMARTY_RESOURCE_CHAR_SET) > $length) { 75 | $results = mb_substr($var, 0, $length - 3, SMARTY_RESOURCE_CHAR_SET) . '...'; 76 | } 77 | } else { 78 | if (isset($var[$length])) { 79 | $results = substr($var, 0, $length - 3) . '...'; 80 | } 81 | } 82 | 83 | $results = htmlspecialchars('"' . $results . '"'); 84 | break; 85 | 86 | case 'unknown type' : 87 | default : 88 | $results = strtr((string) $var, $_replace); 89 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 90 | if (mb_strlen($results, SMARTY_RESOURCE_CHAR_SET) > $length) { 91 | $results = mb_substr($results, 0, $length - 3, SMARTY_RESOURCE_CHAR_SET) . '...'; 92 | } 93 | } else { 94 | if (strlen($results) > $length) { 95 | $results = substr($results, 0, $length - 3) . '...'; 96 | } 97 | } 98 | 99 | $results = htmlspecialchars($results); 100 | } 101 | 102 | return $results; 103 | } 104 | 105 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifier.regex_replace.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: regex_replace
    14 | * Purpose: regular expression search/replace 15 | * 16 | * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php 17 | * regex_replace (Smarty online manual) 18 | * @author Monte Ohrt 19 | * @param string $string input string 20 | * @param string|array $search regular expression(s) to search for 21 | * @param string|array $replace string(s) that should be replaced 22 | * @return string 23 | */ 24 | function smarty_modifier_regex_replace($string, $search, $replace) 25 | { 26 | if(is_array($search)) { 27 | foreach($search as $idx => $s) { 28 | $search[$idx] = _smarty_regex_replace_check($s); 29 | } 30 | } else { 31 | $search = _smarty_regex_replace_check($search); 32 | } 33 | return preg_replace($search, $replace, $string); 34 | } 35 | 36 | /** 37 | * @param string $search string(s) that should be replaced 38 | * @return string 39 | * @ignore 40 | */ 41 | function _smarty_regex_replace_check($search) 42 | { 43 | // null-byte injection detection 44 | // anything behind the first null-byte is ignored 45 | if (($pos = strpos($search,"\0")) !== false) { 46 | $search = substr($search,0,$pos); 47 | } 48 | // remove eval-modifier from $search 49 | if (preg_match('!([a-zA-Z\s]+)$!s', $search, $match) && (strpos($match[1], 'e') !== false)) { 50 | $search = substr($search, 0, -strlen($match[1])) . preg_replace('![e\s]+!', '', $match[1]); 51 | } 52 | return $search; 53 | } 54 | 55 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifier.replace.php: -------------------------------------------------------------------------------- 1 | 12 | * Name: replace
    13 | * Purpose: simple search/replace 14 | * 15 | * @link http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual) 16 | * @author Monte Ohrt 17 | * @author Uwe Tews 18 | * @param string $string input string 19 | * @param string $search text to search for 20 | * @param string $replace replacement text 21 | * @return string 22 | */ 23 | function smarty_modifier_replace($string, $search, $replace) 24 | { 25 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 26 | require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php'); 27 | return smarty_mb_str_replace($search, $replace, $string); 28 | } 29 | 30 | return str_replace($search, $replace, $string); 31 | } 32 | 33 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifier.spacify.php: -------------------------------------------------------------------------------- 1 | 12 | * Name: spacify
    13 | * Purpose: add spaces between characters in a string 14 | * 15 | * @link http://smarty.php.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual) 16 | * @author Monte Ohrt 17 | * @param string $string input string 18 | * @param string $spacify_char string to insert between characters. 19 | * @return string 20 | */ 21 | function smarty_modifier_spacify($string, $spacify_char = ' ') 22 | { 23 | // well… what about charsets besides latin and UTF-8? 24 | return implode($spacify_char, preg_split('//u', $string, -1, PREG_SPLIT_NO_EMPTY)); 25 | } 26 | 27 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifier.truncate.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: truncate
    14 | * Purpose: Truncate a string to a certain length if necessary, 15 | * optionally splitting in the middle of a word, and 16 | * appending the $etc string or inserting $etc into the middle. 17 | * 18 | * @link http://smarty.php.net/manual/en/language.modifier.truncate.php truncate (Smarty online manual) 19 | * @author Monte Ohrt 20 | * @param string $string input string 21 | * @param integer $length length of truncated text 22 | * @param string $etc end string 23 | * @param boolean $break_words truncate at word boundary 24 | * @param boolean $middle truncate in the middle of text 25 | * @return string truncated string 26 | */ 27 | function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false) { 28 | if ($length == 0) 29 | return ''; 30 | 31 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 32 | if (mb_strlen($string, SMARTY_RESOURCE_CHAR_SET) > $length) { 33 | $length -= min($length, mb_strlen($etc, SMARTY_RESOURCE_CHAR_SET)); 34 | if (!$break_words && !$middle) { 35 | $string = preg_replace('/\s+?(\S+)?$/u', '', mb_substr($string, 0, $length + 1, SMARTY_RESOURCE_CHAR_SET)); 36 | } 37 | if (!$middle) { 38 | return mb_substr($string, 0, $length, SMARTY_RESOURCE_CHAR_SET) . $etc; 39 | } 40 | return mb_substr($string, 0, $length / 2, SMARTY_RESOURCE_CHAR_SET) . $etc . mb_substr($string, - $length / 2, $length, SMARTY_RESOURCE_CHAR_SET); 41 | } 42 | return $string; 43 | } 44 | 45 | // no MBString fallback 46 | if (isset($string[$length])) { 47 | $length -= min($length, strlen($etc)); 48 | if (!$break_words && !$middle) { 49 | $string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length + 1)); 50 | } 51 | if (!$middle) { 52 | return substr($string, 0, $length) . $etc; 53 | } 54 | return substr($string, 0, $length / 2) . $etc . substr($string, - $length / 2); 55 | } 56 | return $string; 57 | } 58 | 59 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifiercompiler.cat.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: cat
    14 | * Date: Feb 24, 2003
    15 | * Purpose: catenate a value to a variable
    16 | * Input: string to catenate
    17 | * Example: {$var|cat:"foo"} 18 | * 19 | * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat 20 | * (Smarty online manual) 21 | * @author Uwe Tews 22 | * @param array $params parameters 23 | * @return string with compiled code 24 | */ 25 | function smarty_modifiercompiler_cat($params, $compiler) 26 | { 27 | return '('.implode(').(', $params).')'; 28 | } 29 | 30 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifiercompiler.count_characters.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: count_characteres
    14 | * Purpose: count the number of characters in a text 15 | * 16 | * @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual) 17 | * @author Uwe Tews 18 | * @param array $params parameters 19 | * @return string with compiled code 20 | */ 21 | function smarty_modifiercompiler_count_characters($params, $compiler) 22 | { 23 | if (!isset($params[1]) || $params[1] != 'true') { 24 | return 'preg_match_all(\'/[^\s]/u\',' . $params[0] . ', $tmp)'; 25 | } 26 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 27 | return 'mb_strlen(' . $params[0] . ', SMARTY_RESOURCE_CHAR_SET)'; 28 | } 29 | // no MBString fallback 30 | return 'strlen(' . $params[0] . ')'; 31 | } 32 | 33 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifiercompiler.count_paragraphs.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: count_paragraphs
    14 | * Purpose: count the number of paragraphs in a text 15 | * 16 | * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php 17 | * count_paragraphs (Smarty online manual) 18 | * @author Uwe Tews 19 | * @param array $params parameters 20 | * @return string with compiled code 21 | */ 22 | function smarty_modifiercompiler_count_paragraphs($params, $compiler) 23 | { 24 | // count \r or \n characters 25 | return '(preg_match_all(\'#[\r\n]+#\', ' . $params[0] . ', $tmp)+1)'; 26 | } 27 | 28 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifiercompiler.count_sentences.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: count_sentences 14 | * Purpose: count the number of sentences in a text 15 | * 16 | * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php 17 | * count_sentences (Smarty online manual) 18 | * @author Uwe Tews 19 | * @param array $params parameters 20 | * @return string with compiled code 21 | */ 22 | function smarty_modifiercompiler_count_sentences($params, $compiler) 23 | { 24 | // find periods, question marks, exclamation marks with a word before but not after. 25 | return 'preg_match_all("#\w[\.\?\!](\W|$)#uS", ' . $params[0] . ', $tmp)'; 26 | } 27 | 28 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifiercompiler.count_words.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: count_words
    14 | * Purpose: count the number of words in a text 15 | * 16 | * @link http://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual) 17 | * @author Uwe Tews 18 | * @param array $params parameters 19 | * @return string with compiled code 20 | */ 21 | function smarty_modifiercompiler_count_words($params, $compiler) 22 | { 23 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 24 | // return 'preg_match_all(\'#[\w\pL]+#u\', ' . $params[0] . ', $tmp)'; 25 | // expression taken from http://de.php.net/manual/en/function.str-word-count.php#85592 26 | return 'preg_match_all(\'/\p{L}[\p{L}\p{Mn}\p{Pd}\\\'\x{2019}]*/u\', ' . $params[0] . ', $tmp)'; 27 | } 28 | // no MBString fallback 29 | return 'str_word_count(' . $params[0] . ')'; 30 | } 31 | 32 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifiercompiler.default.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: default
    14 | * Purpose: designate default value for empty variables 15 | * 16 | * @link http://www.smarty.net/manual/en/language.modifier.default.php default (Smarty online manual) 17 | * @author Uwe Tews 18 | * @param array $params parameters 19 | * @return string with compiled code 20 | */ 21 | function smarty_modifiercompiler_default ($params, $compiler) 22 | { 23 | $output = $params[0]; 24 | if (!isset($params[1])) { 25 | $params[1] = "''"; 26 | } 27 | 28 | array_shift($params); 29 | foreach ($params as $param) { 30 | $output = '(($tmp = @' . $output . ')===null||$tmp===\'\' ? ' . $param . ' : $tmp)'; 31 | } 32 | return $output; 33 | } 34 | 35 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifiercompiler.escape.php: -------------------------------------------------------------------------------- 1 | 18 | * Name: escape
    19 | * Purpose: escape string for output 20 | * 21 | * @link http://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual) 22 | * @author Rodney Rehm 23 | * @param array $params parameters 24 | * @return string with compiled code 25 | */ 26 | function smarty_modifiercompiler_escape($params, $compiler) 27 | { 28 | try { 29 | $esc_type = smarty_literal_compiler_param($params, 1, 'html'); 30 | $char_set = smarty_literal_compiler_param($params, 2, SMARTY_RESOURCE_CHAR_SET); 31 | $double_encode = smarty_literal_compiler_param($params, 3, true); 32 | 33 | if (!$char_set) { 34 | $char_set = SMARTY_RESOURCE_CHAR_SET; 35 | } 36 | 37 | switch ($esc_type) { 38 | case 'html': 39 | return 'htmlspecialchars(' 40 | . $params[0] .', ENT_QUOTES, ' 41 | . var_export($char_set, true) . ', ' 42 | . var_export($double_encode, true) . ')'; 43 | 44 | case 'htmlall': 45 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 46 | return 'mb_convert_encoding(htmlspecialchars(' 47 | . $params[0] .', ENT_QUOTES, ' 48 | . var_export($char_set, true) . ', ' 49 | . var_export($double_encode, true) 50 | . '), "HTML-ENTITIES", ' 51 | . var_export($char_set, true) . ')'; 52 | } 53 | 54 | // no MBString fallback 55 | return 'htmlentities(' 56 | . $params[0] .', ENT_QUOTES, ' 57 | . var_export($char_set, true) . ', ' 58 | . var_export($double_encode, true) . ')'; 59 | 60 | case 'url': 61 | return 'rawurlencode(' . $params[0] . ')'; 62 | 63 | case 'urlpathinfo': 64 | return 'str_replace("%2F", "/", rawurlencode(' . $params[0] . '))'; 65 | 66 | case 'quotes': 67 | // escape unescaped single quotes 68 | return 'preg_replace("%(? "\\\\\\\\", "\'" => "\\\\\'", "\"" => "\\\\\"", "\\r" => "\\\\r", "\\n" => "\\\n", " "<\/" ))'; 73 | 74 | } 75 | } catch(SmartyException $e) { 76 | // pass through to regular plugin fallback 77 | } 78 | 79 | // could not optimize |escape call, so fallback to regular plugin 80 | if ($compiler->tag_nocache | $compiler->nocache) { 81 | $compiler->template->required_plugins['nocache']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR .'modifier.escape.php'; 82 | $compiler->template->required_plugins['nocache']['escape']['modifier']['function'] = 'smarty_modifier_escape'; 83 | } else { 84 | $compiler->template->required_plugins['compiled']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR .'modifier.escape.php'; 85 | $compiler->template->required_plugins['compiled']['escape']['modifier']['function'] = 'smarty_modifier_escape'; 86 | } 87 | return 'smarty_modifier_escape(' . join( ', ', $params ) . ')'; 88 | } 89 | 90 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifiercompiler.from_charset.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: from_charset
    14 | * Purpose: convert character encoding from $charset to internal encoding 15 | * 16 | * @author Rodney Rehm 17 | * @param array $params parameters 18 | * @return string with compiled code 19 | */ 20 | function smarty_modifiercompiler_from_charset($params, $compiler) 21 | { 22 | if (!SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 23 | // FIXME: (rodneyrehm) shouldn't this throw an error? 24 | return $params[0]; 25 | } 26 | 27 | if (!isset($params[1])) { 28 | $params[1] = '"ISO-8859-1"'; 29 | } 30 | 31 | return 'mb_convert_encoding(' . $params[0] . ', SMARTY_RESOURCE_CHAR_SET, ' . $params[1] . ')'; 32 | } 33 | 34 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifiercompiler.indent.php: -------------------------------------------------------------------------------- 1 | 12 | * Name: indent
    13 | * Purpose: indent lines of text 14 | * 15 | * @link http://www.smarty.net/manual/en/language.modifier.indent.php indent (Smarty online manual) 16 | * @author Uwe Tews 17 | * @param array $params parameters 18 | * @return string with compiled code 19 | */ 20 | 21 | function smarty_modifiercompiler_indent($params, $compiler) 22 | { 23 | if (!isset($params[1])) { 24 | $params[1] = 4; 25 | } 26 | if (!isset($params[2])) { 27 | $params[2] = "' '"; 28 | } 29 | return 'preg_replace(\'!^!m\',str_repeat(' . $params[2] . ',' . $params[1] . '),' . $params[0] . ')'; 30 | } 31 | 32 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifiercompiler.lower.php: -------------------------------------------------------------------------------- 1 | 12 | * Name: lower
    13 | * Purpose: convert string to lowercase 14 | * 15 | * @link http://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual) 16 | * @author Monte Ohrt 17 | * @author Uwe Tews 18 | * @param array $params parameters 19 | * @return string with compiled code 20 | */ 21 | 22 | function smarty_modifiercompiler_lower($params, $compiler) 23 | { 24 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 25 | return 'mb_strtolower(' . $params[0] . ',SMARTY_RESOURCE_CHAR_SET)' ; 26 | } 27 | // no MBString fallback 28 | return 'strtolower(' . $params[0] . ')'; 29 | } 30 | 31 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifiercompiler.noprint.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: noprint
    14 | * Purpose: return an empty string 15 | * 16 | * @author Uwe Tews 17 | * @param array $params parameters 18 | * @return string with compiled code 19 | */ 20 | function smarty_modifiercompiler_noprint($params, $compiler) 21 | { 22 | return "''"; 23 | } 24 | 25 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifiercompiler.string_format.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: string_format
    14 | * Purpose: format strings via sprintf 15 | * 16 | * @link http://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual) 17 | * @author Uwe Tews 18 | * @param array $params parameters 19 | * @return string with compiled code 20 | */ 21 | function smarty_modifiercompiler_string_format($params, $compiler) 22 | { 23 | return 'sprintf(' . $params[1] . ',' . $params[0] . ')'; 24 | } 25 | 26 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifiercompiler.strip.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: strip
    14 | * Purpose: Replace all repeated spaces, newlines, tabs 15 | * with a single space or supplied replacement string.
    16 | * Example: {$var|strip} {$var|strip:" "}
    17 | * Date: September 25th, 2002 18 | * 19 | * @link http://www.smarty.net/manual/en/language.modifier.strip.php strip (Smarty online manual) 20 | * @author Uwe Tews 21 | * @param array $params parameters 22 | * @return string with compiled code 23 | */ 24 | 25 | function smarty_modifiercompiler_strip($params, $compiler) 26 | { 27 | if (!isset($params[1])) { 28 | $params[1] = "' '"; 29 | } 30 | return "preg_replace('!\s+!u', {$params[1]},{$params[0]})"; 31 | } 32 | 33 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifiercompiler.strip_tags.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: strip_tags
    14 | * Purpose: strip html tags from text 15 | * 16 | * @link http://www.smarty.net/manual/en/language.modifier.strip.tags.php strip_tags (Smarty online manual) 17 | * @author Uwe Tews 18 | * @param array $params parameters 19 | * @return string with compiled code 20 | */ 21 | function smarty_modifiercompiler_strip_tags($params, $compiler) 22 | { 23 | if (!isset($params[1])) { 24 | $params[1] = true; 25 | } 26 | if ($params[1] === true) { 27 | return "preg_replace('!<[^>]*?>!', ' ', {$params[0]})"; 28 | } else { 29 | return 'strip_tags(' . $params[0] . ')'; 30 | } 31 | } 32 | 33 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifiercompiler.to_charset.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: to_charset
    14 | * Purpose: convert character encoding from internal encoding to $charset 15 | * 16 | * @author Rodney Rehm 17 | * @param array $params parameters 18 | * @return string with compiled code 19 | */ 20 | function smarty_modifiercompiler_to_charset($params, $compiler) 21 | { 22 | if (!SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 23 | // FIXME: (rodneyrehm) shouldn't this throw an error? 24 | return $params[0]; 25 | } 26 | 27 | if (!isset($params[1])) { 28 | $params[1] = '"ISO-8859-1"'; 29 | } 30 | 31 | return 'mb_convert_encoding(' . $params[0] . ', ' . $params[1] . ', SMARTY_RESOURCE_CHAR_SET)'; 32 | } 33 | 34 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifiercompiler.unescape.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: unescape
    14 | * Purpose: unescape html entities 15 | * 16 | * @author Rodney Rehm 17 | * @param array $params parameters 18 | * @return string with compiled code 19 | */ 20 | function smarty_modifiercompiler_unescape($params, $compiler) 21 | { 22 | if (!isset($params[1])) { 23 | $params[1] = 'html'; 24 | } 25 | if (!isset($params[2])) { 26 | $params[2] = "SMARTY_RESOURCE_CHAR_SET"; 27 | } else { 28 | $params[2] = "'" . $params[2] . "'"; 29 | } 30 | 31 | switch (trim($params[1], '"\'')) { 32 | case 'entity': 33 | return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \'HTML-ENTITIES\')'; 34 | case 'htmlall': 35 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 36 | return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \'HTML-ENTITIES\')'; 37 | } 38 | return 'html_entity_decode(' . $params[0] . ', ENT_QUOTES, ' . $params[2] . ')'; 39 | 40 | case 'html': 41 | return 'htmlspecialchars_decode(' . $params[0] . ', ENT_QUOTES)'; 42 | 43 | default: 44 | return $params[0]; 45 | } 46 | } 47 | 48 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifiercompiler.upper.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: lower
    14 | * Purpose: convert string to uppercase 15 | * 16 | * @link http://smarty.php.net/manual/en/language.modifier.upper.php lower (Smarty online manual) 17 | * @author Uwe Tews 18 | * @param array $params parameters 19 | * @return string with compiled code 20 | */ 21 | function smarty_modifiercompiler_upper($params, $compiler) 22 | { 23 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 24 | return 'mb_strtoupper(' . $params[0] . ',SMARTY_RESOURCE_CHAR_SET)' ; 25 | } 26 | // no MBString fallback 27 | return 'strtoupper(' . $params[0] . ')'; 28 | } 29 | 30 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/modifiercompiler.wordwrap.php: -------------------------------------------------------------------------------- 1 | 13 | * Name: wordwrap
    14 | * Purpose: wrap a string of text at a given length 15 | * 16 | * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual) 17 | * @author Uwe Tews 18 | * @param array $params parameters 19 | * @return string with compiled code 20 | */ 21 | function smarty_modifiercompiler_wordwrap($params, $compiler) 22 | { 23 | if (!isset($params[1])) { 24 | $params[1] = 80; 25 | } 26 | if (!isset($params[2])) { 27 | $params[2] = '"\n"'; 28 | } 29 | if (!isset($params[3])) { 30 | $params[3] = 'false'; 31 | } 32 | $function = 'wordwrap'; 33 | if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) { 34 | if ($compiler->tag_nocache | $compiler->nocache) { 35 | $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR .'shared.mb_wordwrap.php'; 36 | $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap'; 37 | } else { 38 | $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR .'shared.mb_wordwrap.php'; 39 | $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap'; 40 | } 41 | $function = 'smarty_mb_wordwrap'; 42 | } 43 | return $function . '(' . $params[0] . ',' . $params[1] . ',' . $params[2] . ',' . $params[3] . ')'; 44 | } 45 | 46 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/outputfilter.trimwhitespace.php: -------------------------------------------------------------------------------- 1 | .*?#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { 30 | foreach ($matches as $match) { 31 | $store[] = $match[0][0]; 32 | $_length = strlen($match[0][0]); 33 | $replace = '@!@SMARTY:' . $_store . ':SMARTY@!@'; 34 | $source = substr_replace($source, $replace, $match[0][1] - $_offset, $_length); 35 | 36 | $_offset += $_length - strlen($replace); 37 | $_store++; 38 | } 39 | } 40 | 41 | // Strip all HTML-Comments 42 | $source = preg_replace( '##ms', '', $source ); 43 | 44 | // capture html elements not to be messed with 45 | $_offset = 0; 46 | if (preg_match_all('#<(script|pre|textarea)[^>]*>.*?#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { 47 | foreach ($matches as $match) { 48 | $store[] = $match[0][0]; 49 | $_length = strlen($match[0][0]); 50 | $replace = '@!@SMARTY:' . $_store . ':SMARTY@!@'; 51 | $source = substr_replace($source, $replace, $match[0][1] - $_offset, $_length); 52 | 53 | $_offset += $_length - strlen($replace); 54 | $_store++; 55 | } 56 | } 57 | 58 | $expressions = array( 59 | // replace multiple spaces between tags by a single space 60 | // can't remove them entirely, becaue that might break poorly implemented CSS display:inline-block elements 61 | '#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s' => '\1 \2', 62 | // remove spaces between attributes (but not in attribute values!) 63 | '#(([a-z0-9]\s*=\s*(["\'])[^\3]*?\3)|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \4', 64 | // note: for some very weird reason trim() seems to remove spaces inside attributes. 65 | // maybe a \0 byte or something is interfering? 66 | '#^\s+<#Ss' => '<', 67 | '#>\s+$#Ss' => '>', 68 | ); 69 | 70 | $source = preg_replace( array_keys($expressions), array_values($expressions), $source ); 71 | // note: for some very weird reason trim() seems to remove spaces inside attributes. 72 | // maybe a \0 byte or something is interfering? 73 | // $source = trim( $source ); 74 | 75 | // capture html elements not to be messed with 76 | $_offset = 0; 77 | if (preg_match_all('#@!@SMARTY:([0-9]+):SMARTY@!@#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { 78 | foreach ($matches as $match) { 79 | $store[] = $match[0][0]; 80 | $_length = strlen($match[0][0]); 81 | $replace = array_shift($store); 82 | $source = substr_replace($source, $replace, $match[0][1] + $_offset, $_length); 83 | 84 | $_offset += strlen($replace) - $_length; 85 | $_store++; 86 | } 87 | } 88 | 89 | return $source; 90 | } 91 | 92 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/shared.escape_special_chars.php: -------------------------------------------------------------------------------- 1 | =')) { 10 | /** 11 | * escape_special_chars common function 12 | * 13 | * Function: smarty_function_escape_special_chars
    14 | * Purpose: used by other smarty functions to escape 15 | * special chars except for already escaped ones 16 | * 17 | * @author Monte Ohrt 18 | * @param string $string text that should by escaped 19 | * @return string 20 | */ 21 | function smarty_function_escape_special_chars($string) 22 | { 23 | if (!is_array($string)) { 24 | $string = htmlspecialchars($string, ENT_COMPAT, SMARTY_RESOURCE_CHAR_SET, false); 25 | } 26 | return $string; 27 | } 28 | } else { 29 | /** 30 | * escape_special_chars common function 31 | * 32 | * Function: smarty_function_escape_special_chars
    33 | * Purpose: used by other smarty functions to escape 34 | * special chars except for already escaped ones 35 | * 36 | * @author Monte Ohrt 37 | * @param string $string text that should by escaped 38 | * @return string 39 | */ 40 | function smarty_function_escape_special_chars($string) 41 | { 42 | if (!is_array($string)) { 43 | $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); 44 | $string = htmlspecialchars($string); 45 | $string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string); 46 | } 47 | return $string; 48 | } 49 | } 50 | 51 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/shared.literal_compiler_param.php: -------------------------------------------------------------------------------- 1 | 11 | * Purpose: used by other smarty functions to make a timestamp from a string. 12 | * 13 | * @author Monte Ohrt 14 | * @param DateTime|int|string $string date object, timestamp or string that can be converted using strtotime() 15 | * @return int 16 | */ 17 | function smarty_make_timestamp($string) 18 | { 19 | if (empty($string)) { 20 | // use "now": 21 | return time(); 22 | } elseif ($string instanceof DateTime) { 23 | return $string->getTimestamp(); 24 | } elseif (strlen($string) == 14 && ctype_digit($string)) { 25 | // it is mysql timestamp format of YYYYMMDDHHMMSS? 26 | return mktime(substr($string, 8, 2),substr($string, 10, 2),substr($string, 12, 2), 27 | substr($string, 4, 2),substr($string, 6, 2),substr($string, 0, 4)); 28 | } elseif (is_numeric($string)) { 29 | // it is a numeric string, we handle it as timestamp 30 | return (int) $string; 31 | } else { 32 | // strtotime should handle it 33 | $time = strtotime($string); 34 | if ($time == -1 || $time === false) { 35 | // strtotime() was not able to parse $string, use "now": 36 | return time(); 37 | } 38 | return $time; 39 | } 40 | } 41 | 42 | ?> 43 | -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/shared.mb_str_replace.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/shared.mb_unicode.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/shared.mb_wordwrap.php: -------------------------------------------------------------------------------- 1 | $width) { 34 | // remove last space 35 | $t = mb_substr($t, 0, -1, SMARTY_RESOURCE_CHAR_SET); 36 | $_previous = false; 37 | $length = 0; 38 | 39 | if ($cut) { 40 | $_tokens = preg_split('!(.{' . $width . '})!uS', $_token, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE); 41 | // broken words go on a new line 42 | $t .= $break; 43 | } 44 | } 45 | 46 | foreach ($_tokens as $token) { 47 | $_space = !!preg_match('!^\s$!uS', $token); 48 | $token_length = mb_strlen($token, SMARTY_RESOURCE_CHAR_SET); 49 | $length += $token_length; 50 | 51 | if ($length > $width) { 52 | // remove space before inserted break 53 | if ($_previous && $token_length < $width) { 54 | $t = mb_substr($t, 0, -1, SMARTY_RESOURCE_CHAR_SET); 55 | } 56 | 57 | // add the break before the token 58 | $t .= $break; 59 | $length = $token_length; 60 | 61 | // skip space after inserting a break 62 | if ($_space) { 63 | $length = 0; 64 | continue; 65 | } 66 | } else if ($token == "\n") { 67 | // hard break must reset counters 68 | $_previous = 0; 69 | $length = 0; 70 | } else { 71 | // remember if we had a space or not 72 | $_previous = $_space; 73 | } 74 | // add the token 75 | $t .= $token; 76 | } 77 | } 78 | 79 | return $t; 80 | } 81 | 82 | } 83 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/plugins/variablefilter.htmlspecialchars.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_config_source.php: -------------------------------------------------------------------------------- 1 | handler = $handler; // Note: prone to circular references 37 | 38 | // Note: these may be ->config_compiler_class etc in the future 39 | //$this->config_compiler_class = $handler->config_compiler_class; 40 | //$this->config_lexer_class = $handler->config_lexer_class; 41 | //$this->config_parser_class = $handler->config_parser_class; 42 | 43 | $this->smarty = $smarty; 44 | $this->resource = $resource; 45 | $this->type = $type; 46 | $this->name = $name; 47 | $this->unique_resource = $unique_resource; 48 | } 49 | 50 | /** 51 | * <> Generic setter. 52 | * 53 | * @param string $property_name valid: content, timestamp, exists 54 | * @param mixed $value newly assigned value (not check for correct type) 55 | * @throws SmartyException when the given property name is not valid 56 | */ 57 | public function __set($property_name, $value) 58 | { 59 | switch ($property_name) { 60 | case 'content': 61 | case 'timestamp': 62 | case 'exists': 63 | $this->$property_name = $value; 64 | break; 65 | 66 | default: 67 | throw new SmartyException("invalid config property '$property_name'."); 68 | } 69 | } 70 | 71 | /** 72 | * <> Generic getter. 73 | * 74 | * @param string $property_name valid: content, timestamp, exists 75 | * @throws SmartyException when the given property name is not valid 76 | */ 77 | public function __get($property_name) 78 | { 79 | switch ($property_name) { 80 | case 'timestamp': 81 | case 'exists': 82 | $this->handler->populateTimestamp($this); 83 | return $this->$property_name; 84 | 85 | case 'content': 86 | return $this->content = $this->handler->getContent($this); 87 | 88 | default: 89 | throw new SmartyException("config property '$property_name' does not exist."); 90 | } 91 | } 92 | 93 | } 94 | 95 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_append.php: -------------------------------------------------------------------------------- 1 | required_attributes = array('var', 'value'); 32 | $this->shorttag_order = array('var', 'value'); 33 | $this->optional_attributes = array('scope', 'index'); 34 | // check and get attributes 35 | $_attr = $this->getAttributes($compiler, $args); 36 | // map to compile assign attributes 37 | if (isset($_attr['index'])) { 38 | $_params['smarty_internal_index'] = '[' . $_attr['index'] . ']'; 39 | unset($_attr['index']); 40 | } else { 41 | $_params['smarty_internal_index'] = '[]'; 42 | } 43 | $_new_attr = array(); 44 | foreach ($_attr as $key => $value) { 45 | $_new_attr[] = array($key => $value); 46 | } 47 | // call compile assign 48 | return parent::compile($_new_attr, $compiler, $_params); 49 | } 50 | 51 | } 52 | 53 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_assign.php: -------------------------------------------------------------------------------- 1 | required_attributes = array('var', 'value'); 32 | $this->shorttag_order = array('var', 'value'); 33 | $this->optional_attributes = array('scope'); 34 | $_nocache = 'null'; 35 | $_scope = Smarty::SCOPE_LOCAL; 36 | // check and get attributes 37 | $_attr = $this->getAttributes($compiler, $args); 38 | // nocache ? 39 | if ($compiler->tag_nocache || $compiler->nocache) { 40 | $_nocache = 'true'; 41 | // create nocache var to make it know for further compiling 42 | $compiler->template->tpl_vars[trim($_attr['var'], "'")] = new Smarty_variable(null, true); 43 | } 44 | // scope setup 45 | if (isset($_attr['scope'])) { 46 | $_attr['scope'] = trim($_attr['scope'], "'\""); 47 | if ($_attr['scope'] == 'parent') { 48 | $_scope = Smarty::SCOPE_PARENT; 49 | } elseif ($_attr['scope'] == 'root') { 50 | $_scope = Smarty::SCOPE_ROOT; 51 | } elseif ($_attr['scope'] == 'global') { 52 | $_scope = Smarty::SCOPE_GLOBAL; 53 | } else { 54 | $compiler->trigger_template_error('illegal value for "scope" attribute', $compiler->lex->taglineno); 55 | } 56 | } 57 | // compiled output 58 | if (isset($parameter['smarty_internal_index'])) { 59 | $output = "createLocalArrayVariable($_attr[var], $_nocache, $_scope);\n\$_smarty_tpl->tpl_vars[$_attr[var]]->value$parameter[smarty_internal_index] = $_attr[value];"; 60 | } else { 61 | $output = "tpl_vars[$_attr[var]] = new Smarty_variable($_attr[value], $_nocache, $_scope);"; 62 | } 63 | if ($_scope == Smarty::SCOPE_PARENT) { 64 | $output .= "\nif (\$_smarty_tpl->parent != null) \$_smarty_tpl->parent->tpl_vars[$_attr[var]] = clone \$_smarty_tpl->tpl_vars[$_attr[var]];"; 65 | } elseif ($_scope == Smarty::SCOPE_ROOT || $_scope == Smarty::SCOPE_GLOBAL) { 66 | $output .= "\n\$_ptr = \$_smarty_tpl->parent; while (\$_ptr != null) {\$_ptr->tpl_vars[$_attr[var]] = clone \$_smarty_tpl->tpl_vars[$_attr[var]]; \$_ptr = \$_ptr->parent; }"; 67 | } 68 | if ( $_scope == Smarty::SCOPE_GLOBAL) { 69 | $output .= "\nSmarty::\$global_tpl_vars[$_attr[var]] = clone \$_smarty_tpl->tpl_vars[$_attr[var]];"; 70 | } 71 | $output .= '?>'; 72 | return $output; 73 | } 74 | 75 | } 76 | 77 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_break.php: -------------------------------------------------------------------------------- 1 | true, 'foreach' => true, 'while' => true, 'section' => true); 45 | // check and get attributes 46 | $_attr = $this->getAttributes($compiler, $args); 47 | 48 | if ($_attr['nocache'] === true) { 49 | $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno); 50 | } 51 | 52 | if (isset($_attr['levels'])) { 53 | if (!is_numeric($_attr['levels'])) { 54 | $compiler->trigger_template_error('level attribute must be a numeric constant', $compiler->lex->taglineno); 55 | } 56 | $_levels = $_attr['levels']; 57 | } else { 58 | $_levels = 1; 59 | } 60 | $level_count = $_levels; 61 | $stack_count = count($compiler->_tag_stack) - 1; 62 | while ($level_count > 0 && $stack_count >= 0) { 63 | if (isset($_is_loopy[$compiler->_tag_stack[$stack_count][0]])) { 64 | $level_count--; 65 | } 66 | $stack_count--; 67 | } 68 | if ($level_count != 0) { 69 | $compiler->trigger_template_error("cannot break {$_levels} level(s)", $compiler->lex->taglineno); 70 | } 71 | $compiler->has_code = true; 72 | return ""; 73 | } 74 | 75 | } 76 | 77 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_call.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 54 | // save possible attributes 55 | if (isset($_attr['assign'])) { 56 | // output will be stored in a smarty variable instead of beind displayed 57 | $_assign = $_attr['assign']; 58 | } 59 | $_name = $_attr['name']; 60 | if ($compiler->compiles_template_function) { 61 | $compiler->called_functions[] = trim($_name, "'\""); 62 | } 63 | unset($_attr['name'], $_attr['assign'], $_attr['nocache']); 64 | // set flag (compiled code of {function} must be included in cache file 65 | if ($compiler->nocache || $compiler->tag_nocache) { 66 | $_nocache = 'true'; 67 | } else { 68 | $_nocache = 'false'; 69 | } 70 | $_paramsArray = array(); 71 | foreach ($_attr as $_key => $_value) { 72 | if (is_int($_key)) { 73 | $_paramsArray[] = "$_key=>$_value"; 74 | } else { 75 | $_paramsArray[] = "'$_key'=>$_value"; 76 | } 77 | } 78 | if (isset($compiler->template->properties['function'][$_name]['parameter'])) { 79 | foreach ($compiler->template->properties['function'][$_name]['parameter'] as $_key => $_value) { 80 | if (!isset($_attr[$_key])) { 81 | if (is_int($_key)) { 82 | $_paramsArray[] = "$_key=>$_value"; 83 | } else { 84 | $_paramsArray[] = "'$_key'=>$_value"; 85 | } 86 | } 87 | } 88 | } elseif (isset($compiler->smarty->template_functions[$_name]['parameter'])) { 89 | foreach ($compiler->smarty->template_functions[$_name]['parameter'] as $_key => $_value) { 90 | if (!isset($_attr[$_key])) { 91 | if (is_int($_key)) { 92 | $_paramsArray[] = "$_key=>$_value"; 93 | } else { 94 | $_paramsArray[] = "'$_key'=>$_value"; 95 | } 96 | } 97 | } 98 | } 99 | //varibale name? 100 | if (!(strpos($_name, '$') === false)) { 101 | $call_cache = $_name; 102 | $call_function = '$tmp = "smarty_template_function_".' . $_name . '; $tmp'; 103 | } else { 104 | $_name = trim($_name, "'\""); 105 | $call_cache = "'{$_name}'"; 106 | $call_function = 'smarty_template_function_' . $_name; 107 | } 108 | 109 | $_params = 'array(' . implode(",", $_paramsArray) . ')'; 110 | $_hash = str_replace('-', '_', $compiler->template->properties['nocache_hash']); 111 | // was there an assign attribute 112 | if (isset($_assign)) { 113 | if ($compiler->template->caching) { 114 | $_output = "assign({$_assign}, ob_get_clean());?>\n"; 115 | } else { 116 | $_output = "assign({$_assign}, ob_get_clean());?>\n"; 117 | } 118 | } else { 119 | if ($compiler->template->caching) { 120 | $_output = "\n"; 121 | } else { 122 | $_output = "\n"; 123 | } 124 | } 125 | return $_output; 126 | } 127 | 128 | } 129 | 130 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_capture.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 46 | 47 | $buffer = isset($_attr['name']) ? $_attr['name'] : "'default'"; 48 | $assign = isset($_attr['assign']) ? $_attr['assign'] : 'null'; 49 | $append = isset($_attr['append']) ? $_attr['append'] : 'null'; 50 | 51 | $compiler->_capture_stack[] = array($buffer, $assign, $append, $compiler->nocache); 52 | // maybe nocache because of nocache variables 53 | $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; 54 | $_output = "_capture_stack[] = array($buffer, $assign, $append); ob_start(); ?>"; 55 | 56 | return $_output; 57 | } 58 | 59 | } 60 | 61 | /** 62 | * Smarty Internal Plugin Compile Captureclose Class 63 | * 64 | * @package Smarty 65 | * @subpackage Compiler 66 | */ 67 | class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase { 68 | 69 | /** 70 | * Compiles code for the {/capture} tag 71 | * 72 | * @param array $args array with attributes from parser 73 | * @param object $compiler compiler object 74 | * @return string compiled code 75 | */ 76 | public function compile($args, $compiler) 77 | { 78 | // check and get attributes 79 | $_attr = $this->getAttributes($compiler, $args); 80 | // must endblock be nocache? 81 | if ($compiler->nocache) { 82 | $compiler->tag_nocache = true; 83 | } 84 | 85 | list($buffer, $assign, $append, $compiler->nocache) = array_pop($compiler->_capture_stack); 86 | 87 | $_output = "_capture_stack);\n"; 88 | $_output .= "if (!empty(\$_capture_buffer)) {\n"; 89 | $_output .= " if (isset(\$_capture_assign)) \$_smarty_tpl->assign(\$_capture_assign, ob_get_contents());\n"; 90 | $_output .= " if (isset( \$_capture_append)) \$_smarty_tpl->append( \$_capture_append, ob_get_contents());\n"; 91 | $_output .= " Smarty::\$_smarty_vars['capture'][\$_capture_buffer]=ob_get_clean();\n"; 92 | $_output .= "} else \$_smarty_tpl->capture_error();?>"; 93 | return $_output; 94 | } 95 | 96 | } 97 | 98 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_config_load.php: -------------------------------------------------------------------------------- 1 | true,'parent' => true,'root' => true,'global' => true); 52 | // check and get attributes 53 | $_attr = $this->getAttributes($compiler, $args); 54 | 55 | if ($_attr['nocache'] === true) { 56 | $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno); 57 | } 58 | 59 | 60 | // save posible attributes 61 | $conf_file = $_attr['file']; 62 | if (isset($_attr['section'])) { 63 | $section = $_attr['section']; 64 | } else { 65 | $section = 'null'; 66 | } 67 | $scope = 'local'; 68 | // scope setup 69 | if (isset($_attr['scope'])) { 70 | $_attr['scope'] = trim($_attr['scope'], "'\""); 71 | if (isset($_is_legal_scope[$_attr['scope']])) { 72 | $scope = $_attr['scope']; 73 | } else { 74 | $compiler->trigger_template_error('illegal value for "scope" attribute', $compiler->lex->taglineno); 75 | } 76 | } 77 | // create config object 78 | $_output = "smarty, \$_smarty_tpl);"; 79 | $_output .= "\$_config->loadConfigVars($section, '$scope'); ?>"; 80 | return $_output; 81 | } 82 | 83 | } 84 | 85 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_continue.php: -------------------------------------------------------------------------------- 1 | true, 'foreach' => true, 'while' => true, 'section' => true); 46 | // check and get attributes 47 | $_attr = $this->getAttributes($compiler, $args); 48 | 49 | if ($_attr['nocache'] === true) { 50 | $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno); 51 | } 52 | 53 | if (isset($_attr['levels'])) { 54 | if (!is_numeric($_attr['levels'])) { 55 | $compiler->trigger_template_error('level attribute must be a numeric constant', $compiler->lex->taglineno); 56 | } 57 | $_levels = $_attr['levels']; 58 | } else { 59 | $_levels = 1; 60 | } 61 | $level_count = $_levels; 62 | $stack_count = count($compiler->_tag_stack) - 1; 63 | while ($level_count > 0 && $stack_count >= 0) { 64 | if (isset($_is_loopy[$compiler->_tag_stack[$stack_count][0]])) { 65 | $level_count--; 66 | } 67 | $stack_count--; 68 | } 69 | if ($level_count != 0) { 70 | $compiler->trigger_template_error("cannot continue {$_levels} level(s)", $compiler->lex->taglineno); 71 | } 72 | $compiler->has_code = true; 73 | return ""; 74 | } 75 | 76 | } 77 | 78 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_debug.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 32 | 33 | // compile always as nocache 34 | $compiler->tag_nocache = true; 35 | 36 | // display debug template 37 | $_output = "smarty->loadPlugin('Smarty_Internal_Debug'); Smarty_Internal_Debug::display_debug(\$_smarty_tpl); ?>"; 38 | return $_output; 39 | } 40 | 41 | } 42 | 43 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_eval.php: -------------------------------------------------------------------------------- 1 | required_attributes = array('var'); 52 | $this->optional_attributes = array('assign'); 53 | // check and get attributes 54 | $_attr = $this->getAttributes($compiler, $args); 55 | if (isset($_attr['assign'])) { 56 | // output will be stored in a smarty variable instead of beind displayed 57 | $_assign = $_attr['assign']; 58 | } 59 | 60 | // create template object 61 | $_output = "\$_template = new {$compiler->smarty->template_class}('eval:'.".$_attr['var'].", \$_smarty_tpl->smarty, \$_smarty_tpl);"; 62 | //was there an assign attribute? 63 | if (isset($_assign)) { 64 | $_output .= "\$_smarty_tpl->assign($_assign,\$_template->fetch());"; 65 | } else { 66 | $_output .= "echo \$_template->fetch();"; 67 | } 68 | return ""; 69 | } 70 | 71 | } 72 | 73 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_include_php.php: -------------------------------------------------------------------------------- 1 | smarty instanceof SmartyBC)) { 52 | throw new SmartyException("{include_php} is deprecated, use SmartyBC class to enable"); 53 | } 54 | // check and get attributes 55 | $_attr = $this->getAttributes($compiler, $args); 56 | 57 | $_output = 'template; 60 | $_filepath = false; 61 | eval('$_file = ' . $_attr['file'] . ';'); 62 | if (!isset($compiler->smarty->security_policy) && file_exists($_file)) { 63 | $_filepath = $_file; 64 | } else { 65 | if (isset($compiler->smarty->security_policy)) { 66 | $_dir = $compiler->smarty->security_policy->trusted_dir; 67 | } else { 68 | $_dir = $compiler->smarty->trusted_dir; 69 | } 70 | if (!empty($_dir)) { 71 | foreach((array)$_dir as $_script_dir) { 72 | $_script_dir = rtrim($_script_dir, '/\\') . DS; 73 | if (file_exists($_script_dir . $_file)) { 74 | $_filepath = $_script_dir . $_file; 75 | break; 76 | } 77 | } 78 | } 79 | } 80 | if ($_filepath == false) { 81 | $compiler->trigger_template_error("{include_php} file '{$_file}' is not readable", $compiler->lex->taglineno); 82 | } 83 | 84 | if (isset($compiler->smarty->security_policy)) { 85 | $compiler->smarty->security_policy->isTrustedPHPDir($_filepath); 86 | } 87 | 88 | if (isset($_attr['assign'])) { 89 | // output will be stored in a smarty variable instead of being displayed 90 | $_assign = $_attr['assign']; 91 | } 92 | $_once = '_once'; 93 | if (isset($_attr['once'])) { 94 | if ($_attr['once'] == 'false') { 95 | $_once = ''; 96 | } 97 | } 98 | 99 | if (isset($_assign)) { 100 | return "assign({$_assign},ob_get_contents()); ob_end_clean();?>"; 101 | } else { 102 | return "\n"; 103 | } 104 | } 105 | 106 | } 107 | 108 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_ldelim.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 31 | if ($_attr['nocache'] === true) { 32 | $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno); 33 | } 34 | // this tag does not return compiled code 35 | $compiler->has_code = true; 36 | return $compiler->smarty->left_delimiter; 37 | } 38 | 39 | } 40 | 41 | ?> 42 | -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_nocache.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 32 | if ($_attr['nocache'] === true) { 33 | $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno); 34 | } 35 | // enter nocache mode 36 | $compiler->nocache = true; 37 | // this tag does not return compiled code 38 | $compiler->has_code = false; 39 | return true; 40 | } 41 | 42 | } 43 | 44 | /** 45 | * Smarty Internal Plugin Compile Nocacheclose Class 46 | * 47 | * @package Smarty 48 | * @subpackage Compiler 49 | */ 50 | class Smarty_Internal_Compile_Nocacheclose extends Smarty_Internal_CompileBase { 51 | 52 | /** 53 | * Compiles code for the {/nocache} tag 54 | * 55 | * This tag does not generate compiled output. It only sets a compiler flag. 56 | * 57 | * @param array $args array with attributes from parser 58 | * @param object $compiler compiler object 59 | * @return bool 60 | */ 61 | public function compile($args, $compiler) 62 | { 63 | $_attr = $this->getAttributes($compiler, $args); 64 | // leave nocache mode 65 | $compiler->nocache = false; 66 | // this tag does not return compiled code 67 | $compiler->has_code = false; 68 | return true; 69 | } 70 | 71 | } 72 | 73 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_private_block_plugin.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 44 | if ($_attr['nocache'] === true) { 45 | $compiler->tag_nocache = true; 46 | } 47 | unset($_attr['nocache']); 48 | // convert attributes into parameter array string 49 | $_paramsArray = array(); 50 | foreach ($_attr as $_key => $_value) { 51 | if (is_int($_key)) { 52 | $_paramsArray[] = "$_key=>$_value"; 53 | } else { 54 | $_paramsArray[] = "'$_key'=>$_value"; 55 | } 56 | } 57 | $_params = 'array(' . implode(",", $_paramsArray) . ')'; 58 | 59 | $this->openTag($compiler, $tag, array($_params, $compiler->nocache)); 60 | // maybe nocache because of nocache variables or nocache plugin 61 | $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; 62 | // compile code 63 | $output = "smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; echo {$function}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>"; 64 | } else { 65 | // must endblock be nocache? 66 | if ($compiler->nocache) { 67 | $compiler->tag_nocache = true; 68 | } 69 | // closing tag of block plugin, restore nocache 70 | list($_params, $compiler->nocache) = $this->closeTag($compiler, substr($tag, 0, -5)); 71 | // This tag does create output 72 | $compiler->has_output = true; 73 | // compile code 74 | if (!isset($parameter['modifier_list'])) { 75 | $mod_pre = $mod_post =''; 76 | } else { 77 | $mod_pre = ' ob_start(); '; 78 | $mod_post = 'echo '.$compiler->compileTag('private_modifier',array(),array('modifierlist'=>$parameter['modifier_list'],'value'=>'ob_get_clean()')).';'; 79 | } 80 | $output = "smarty->_tag_stack);?>"; 81 | } 82 | return $output . "\n"; 83 | } 84 | 85 | } 86 | 87 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_private_function_plugin.php: -------------------------------------------------------------------------------- 1 | has_output = true; 49 | 50 | // check and get attributes 51 | $_attr = $this->getAttributes($compiler, $args); 52 | if ($_attr['nocache'] === true) { 53 | $compiler->tag_nocache = true; 54 | } 55 | unset($_attr['nocache']); 56 | // convert attributes into parameter array string 57 | $_paramsArray = array(); 58 | foreach ($_attr as $_key => $_value) { 59 | if (is_int($_key)) { 60 | $_paramsArray[] = "$_key=>$_value"; 61 | } else { 62 | $_paramsArray[] = "'$_key'=>$_value"; 63 | } 64 | } 65 | $_params = 'array(' . implode(",", $_paramsArray) . ')'; 66 | // compile code 67 | $output = "\n"; 68 | return $output; 69 | } 70 | 71 | } 72 | 73 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_private_modifier.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 33 | $output = $parameter['value']; 34 | // loop over list of modifiers 35 | foreach ($parameter['modifierlist'] as $single_modifier) { 36 | $modifier = $single_modifier[0]; 37 | $single_modifier[0] = $output; 38 | $params = implode(',', $single_modifier); 39 | // check for registered modifier 40 | if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier])) { 41 | $function = $compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0]; 42 | if (!is_array($function)) { 43 | $output = "{$function}({$params})"; 44 | } else { 45 | if (is_object($function[0])) { 46 | $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')'; 47 | } else { 48 | $output = $function[0] . '::' . $function[1] . '(' . $params . ')'; 49 | } 50 | } 51 | } else if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0])) { 52 | $output = call_user_func($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0], $single_modifier, $compiler->smarty); 53 | // check for plugin modifiercompiler 54 | } else if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) { 55 | // check if modifier allowed 56 | if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) { 57 | $plugin = 'smarty_modifiercompiler_' . $modifier; 58 | $output = $plugin($single_modifier, $compiler); 59 | } 60 | // check for plugin modifier 61 | } else if ($function = $compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) { 62 | // check if modifier allowed 63 | if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) { 64 | $output = "{$function}({$params})"; 65 | } 66 | // check if trusted PHP function 67 | } else if (is_callable($modifier)) { 68 | // check if modifier allowed 69 | if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)) { 70 | $output = "{$modifier}({$params})"; 71 | } 72 | } else { 73 | $compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", $compiler->lex->taglineno); 74 | } 75 | } 76 | return $output; 77 | } 78 | 79 | } 80 | 81 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_private_object_block_function.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 44 | if ($_attr['nocache'] === true) { 45 | $compiler->tag_nocache = true; 46 | } 47 | unset($_attr['nocache']); 48 | // convert attributes into parameter array string 49 | $_paramsArray = array(); 50 | foreach ($_attr as $_key => $_value) { 51 | if (is_int($_key)) { 52 | $_paramsArray[] = "$_key=>$_value"; 53 | } else { 54 | $_paramsArray[] = "'$_key'=>$_value"; 55 | } 56 | } 57 | $_params = 'array(' . implode(",", $_paramsArray) . ')'; 58 | 59 | $this->openTag($compiler, $tag . '->' . $method, array($_params, $compiler->nocache)); 60 | // maybe nocache because of nocache variables or nocache plugin 61 | $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; 62 | // compile code 63 | $output = "smarty->_tag_stack[] = array('{$tag}->{$method}', {$_params}); \$_block_repeat=true; echo \$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>"; 64 | } else { 65 | $base_tag = substr($tag, 0, -5); 66 | // must endblock be nocache? 67 | if ($compiler->nocache) { 68 | $compiler->tag_nocache = true; 69 | } 70 | // closing tag of block plugin, restore nocache 71 | list($_params, $compiler->nocache) = $this->closeTag($compiler, $base_tag . '->' . $method); 72 | // This tag does create output 73 | $compiler->has_output = true; 74 | // compile code 75 | if (!isset($parameter['modifier_list'])) { 76 | $mod_pre = $mod_post = ''; 77 | } else { 78 | $mod_pre = ' ob_start(); '; 79 | $mod_post = 'echo ' . $compiler->compileTag('private_modifier', array(), array('modifierlist' => $parameter['modifier_list'], 'value' => 'ob_get_clean()')) . ';'; 80 | } 81 | $output = "smarty->registered_objects['{$base_tag}'][0]->{$method}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); " . $mod_post . " } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>"; 82 | } 83 | return $output . "\n"; 84 | } 85 | 86 | } 87 | 88 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_private_object_function.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 42 | if ($_attr['nocache'] === true) { 43 | $compiler->tag_nocache = true; 44 | } 45 | unset($_attr['nocache']); 46 | $_assign = null; 47 | if (isset($_attr['assign'])) { 48 | $_assign = $_attr['assign']; 49 | unset($_attr['assign']); 50 | } 51 | // convert attributes into parameter array string 52 | if ($compiler->smarty->registered_objects[$tag][2]) { 53 | $_paramsArray = array(); 54 | foreach ($_attr as $_key => $_value) { 55 | if (is_int($_key)) { 56 | $_paramsArray[] = "$_key=>$_value"; 57 | } else { 58 | $_paramsArray[] = "'$_key'=>$_value"; 59 | } 60 | } 61 | $_params = 'array(' . implode(",", $_paramsArray) . ')'; 62 | $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params},\$_smarty_tpl)"; 63 | } else { 64 | $_params = implode(",", $_attr); 65 | $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params})"; 66 | } 67 | if (empty($_assign)) { 68 | // This tag does create output 69 | $compiler->has_output = true; 70 | $output = "\n"; 71 | } else { 72 | $output = "assign({$_assign},{$return});?>\n"; 73 | } 74 | return $output; 75 | } 76 | 77 | } 78 | 79 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_private_registered_function.php: -------------------------------------------------------------------------------- 1 | has_output = true; 41 | // check and get attributes 42 | $_attr = $this->getAttributes($compiler, $args); 43 | if ($_attr['nocache']) { 44 | $compiler->tag_nocache = true; 45 | } 46 | unset($_attr['nocache']); 47 | if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION][$tag])) { 48 | $tag_info = $compiler->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION][$tag]; 49 | } else { 50 | $tag_info = $compiler->default_handler_plugins[Smarty::PLUGIN_FUNCTION][$tag]; 51 | } 52 | // not cachable? 53 | $compiler->tag_nocache = $compiler->tag_nocache || !$tag_info[1]; 54 | // convert attributes into parameter array string 55 | $_paramsArray = array(); 56 | foreach ($_attr as $_key => $_value) { 57 | if (is_int($_key)) { 58 | $_paramsArray[] = "$_key=>$_value"; 59 | } elseif ($compiler->template->caching && in_array($_key,$tag_info[2])) { 60 | $_value = str_replace("'","^#^",$_value); 61 | $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^"; 62 | } else { 63 | $_paramsArray[] = "'$_key'=>$_value"; 64 | } 65 | } 66 | $_params = 'array(' . implode(",", $_paramsArray) . ')'; 67 | $function = $tag_info[0]; 68 | // compile code 69 | if (!is_array($function)) { 70 | $output = "\n"; 71 | } else if (is_object($function[0])) { 72 | $output = "smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0][0]->{$function[1]}({$_params},\$_smarty_tpl);?>\n"; 73 | } else { 74 | $output = "\n"; 75 | } 76 | return $output; 77 | } 78 | 79 | } 80 | 81 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_private_special_variable.php: -------------------------------------------------------------------------------- 1 | getVariable('smarty')->value$parameter"; 35 | case 'section': 36 | return "\$_smarty_tpl->getVariable('smarty')->value$parameter"; 37 | case 'capture': 38 | return "Smarty::\$_smarty_vars$parameter"; 39 | case 'now': 40 | return 'time()'; 41 | case 'cookies': 42 | if (isset($compiler->smarty->security_policy) && !$compiler->smarty->security_policy->allow_super_globals) { 43 | $compiler->trigger_template_error("(secure mode) super globals not permitted"); 44 | break; 45 | } 46 | $compiled_ref = '$_COOKIE'; 47 | break; 48 | 49 | case 'get': 50 | case 'post': 51 | case 'env': 52 | case 'server': 53 | case 'session': 54 | case 'request': 55 | if (isset($compiler->smarty->security_policy) && !$compiler->smarty->security_policy->allow_super_globals) { 56 | $compiler->trigger_template_error("(secure mode) super globals not permitted"); 57 | break; 58 | } 59 | $compiled_ref = '$_'.strtoupper($variable); 60 | break; 61 | 62 | case 'template': 63 | return 'basename($_smarty_tpl->source->filepath)'; 64 | 65 | case 'current_dir': 66 | return 'dirname($_smarty_tpl->source->filepath)'; 67 | 68 | case 'version': 69 | $_version = Smarty::SMARTY_VERSION; 70 | return "'$_version'"; 71 | 72 | case 'const': 73 | if (isset($compiler->smarty->security_policy) && !$compiler->smarty->security_policy->allow_constants) { 74 | $compiler->trigger_template_error("(secure mode) constants not permitted"); 75 | break; 76 | } 77 | return '@' . trim($_index[1], "'"); 78 | 79 | case 'config': 80 | return "\$_smarty_tpl->getConfigVariable($_index[1])"; 81 | case 'ldelim': 82 | $_ldelim = $compiler->smarty->left_delimiter; 83 | return "'$_ldelim'"; 84 | 85 | case 'rdelim': 86 | $_rdelim = $compiler->smarty->right_delimiter; 87 | return "'$_rdelim'"; 88 | 89 | default: 90 | $compiler->trigger_template_error('$smarty.' . trim($_index[0], "'") . ' is invalid'); 91 | break; 92 | } 93 | if (isset($_index[1])) { 94 | array_shift($_index); 95 | foreach ($_index as $_ind) { 96 | $compiled_ref = $compiled_ref . "[$_ind]"; 97 | } 98 | } 99 | return $compiled_ref; 100 | } 101 | 102 | } 103 | 104 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_rdelim.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 31 | if ($_attr['nocache'] === true) { 32 | $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno); 33 | } 34 | // this tag does not return compiled code 35 | $compiler->has_code = true; 36 | return $compiler->smarty->right_delimiter; 37 | } 38 | 39 | } 40 | 41 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_setfilter.php: -------------------------------------------------------------------------------- 1 | variable_filter_stack[] = $compiler->template->variable_filters; 31 | $compiler->template->variable_filters = $parameter['modifier_list']; 32 | // this tag does not return compiled code 33 | $compiler->has_code = false; 34 | return true; 35 | } 36 | 37 | } 38 | 39 | /** 40 | * Smarty Internal Plugin Compile Setfilterclose Class 41 | * 42 | * @package Smarty 43 | * @subpackage Compiler 44 | */ 45 | class Smarty_Internal_Compile_Setfilterclose extends Smarty_Internal_CompileBase { 46 | 47 | /** 48 | * Compiles code for the {/setfilter} tag 49 | * 50 | * This tag does not generate compiled output. It resets variable filter. 51 | * 52 | * @param array $args array with attributes from parser 53 | * @param object $compiler compiler object 54 | * @return string compiled code 55 | */ 56 | public function compile($args, $compiler) 57 | { 58 | $_attr = $this->getAttributes($compiler, $args); 59 | // reset variable filter to previous state 60 | if (count($compiler->variable_filter_stack)) { 61 | $compiler->template->variable_filters = array_pop($compiler->variable_filter_stack); 62 | } else { 63 | $compiler->template->variable_filters = array(); 64 | } 65 | // this tag does not return compiled code 66 | $compiler->has_code = false; 67 | return true; 68 | } 69 | 70 | } 71 | 72 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_compile_while.php: -------------------------------------------------------------------------------- 1 | getAttributes($compiler, $args); 32 | $this->openTag($compiler, 'while', $compiler->nocache); 33 | 34 | if (!array_key_exists("if condition",$parameter)) { 35 | $compiler->trigger_template_error("missing while condition", $compiler->lex->taglineno); 36 | } 37 | 38 | // maybe nocache because of nocache variables 39 | $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; 40 | if (is_array($parameter['if condition'])) { 41 | if ($compiler->nocache) { 42 | $_nocache = ',true'; 43 | // create nocache var to make it know for further compiling 44 | if (is_array($parameter['if condition']['var'])) { 45 | $compiler->template->tpl_vars[trim($parameter['if condition']['var']['var'], "'")] = new Smarty_variable(null, true); 46 | } else { 47 | $compiler->template->tpl_vars[trim($parameter['if condition']['var'], "'")] = new Smarty_variable(null, true); 48 | } 49 | } else { 50 | $_nocache = ''; 51 | } 52 | if (is_array($parameter['if condition']['var'])) { 53 | $_output = "tpl_vars[" . $parameter['if condition']['var']['var'] . "]) || !is_array(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value)) \$_smarty_tpl->createLocalArrayVariable(" . $parameter['if condition']['var']['var'] . "$_nocache);\n"; 54 | $_output .= "while (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value" . $parameter['if condition']['var']['smarty_internal_index'] . " = " . $parameter['if condition']['value'] . "){?>"; 55 | } else { 56 | $_output = "tpl_vars[" . $parameter['if condition']['var'] . "])) \$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "] = new Smarty_Variable(null{$_nocache});"; 57 | $_output .= "while (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "]->value = " . $parameter['if condition']['value'] . "){?>"; 58 | } 59 | return $_output; 60 | } else { 61 | return ""; 62 | } 63 | } 64 | 65 | } 66 | 67 | /** 68 | * Smarty Internal Plugin Compile Whileclose Class 69 | * 70 | * @package Smarty 71 | * @subpackage Compiler 72 | */ 73 | class Smarty_Internal_Compile_Whileclose extends Smarty_Internal_CompileBase { 74 | 75 | /** 76 | * Compiles code for the {/while} tag 77 | * 78 | * @param array $args array with attributes from parser 79 | * @param object $compiler compiler object 80 | * @return string compiled code 81 | */ 82 | public function compile($args, $compiler) 83 | { 84 | // must endblock be nocache? 85 | if ($compiler->nocache) { 86 | $compiler->tag_nocache = true; 87 | } 88 | $compiler->nocache = $this->closeTag($compiler, array('while')); 89 | return ""; 90 | } 91 | 92 | } 93 | 94 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_config_file_compiler.php: -------------------------------------------------------------------------------- 1 | smarty = $smarty; 64 | $this->config_data['sections'] = array(); 65 | $this->config_data['vars'] = array(); 66 | } 67 | 68 | /** 69 | * Method to compile a Smarty template. 70 | * 71 | * @param Smarty_Internal_Config $config config object 72 | * @return bool true if compiling succeeded, false if it failed 73 | */ 74 | public function compileSource(Smarty_Internal_Config $config) 75 | { 76 | /* here is where the compiling takes place. Smarty 77 | tags in the templates are replaces with PHP code, 78 | then written to compiled files. */ 79 | $this->config = $config; 80 | // get config file source 81 | $_content = $config->source->content . "\n"; 82 | // on empty template just return 83 | if ($_content == '') { 84 | return true; 85 | } 86 | // init the lexer/parser to compile the config file 87 | $lex = new Smarty_Internal_Configfilelexer($_content, $this->smarty); 88 | $parser = new Smarty_Internal_Configfileparser($lex, $this); 89 | if ($this->smarty->_parserdebug) $parser->PrintTrace(); 90 | // get tokens from lexer and parse them 91 | while ($lex->yylex()) { 92 | if ($this->smarty->_parserdebug) echo "
    Parsing {$parser->yyTokenName[$lex->token]} Token {$lex->value} Line {$lex->line} \n"; 93 | $parser->doParse($lex->token, $lex->value); 94 | } 95 | // finish parsing process 96 | $parser->doParse(0, 0); 97 | $config->compiled_config = 'config_data, true) . '; ?>'; 98 | } 99 | 100 | /** 101 | * display compiler error messages without dying 102 | * 103 | * If parameter $args is empty it is a parser detected syntax error. 104 | * In this case the parser is called to obtain information about exspected tokens. 105 | * 106 | * If parameter $args contains a string this is used as error message 107 | * 108 | * @param string $args individual error message or null 109 | */ 110 | public function trigger_config_file_error($args = null) 111 | { 112 | $this->lex = Smarty_Internal_Configfilelexer::instance(); 113 | $this->parser = Smarty_Internal_Configfileparser::instance(); 114 | // get template source line which has error 115 | $line = $this->lex->line; 116 | if (isset($args)) { 117 | // $line--; 118 | } 119 | $match = preg_split("/\n/", $this->lex->data); 120 | $error_text = "Syntax error in config file '{$this->config->source->filepath}' on line {$line} '{$match[$line-1]}' "; 121 | if (isset($args)) { 122 | // individual error message 123 | $error_text .= $args; 124 | } else { 125 | // exspected token from parser 126 | foreach ($this->parser->yy_get_expected_tokens($this->parser->yymajor) as $token) { 127 | $exp_token = $this->parser->yyTokenName[$token]; 128 | if (isset($this->lex->smarty_token_names[$exp_token])) { 129 | // token type from lexer 130 | $expect[] = '"' . $this->lex->smarty_token_names[$exp_token] . '"'; 131 | } else { 132 | // otherwise internal token name 133 | $expect[] = $this->parser->yyTokenName[$token]; 134 | } 135 | } 136 | // output parser error message 137 | $error_text .= ' - Unexpected "' . $this->lex->value . '", expected one of: ' . implode(' , ', $expect); 138 | } 139 | throw new SmartyCompilerException($error_text); 140 | } 141 | 142 | } 143 | 144 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_filter_handler.php: -------------------------------------------------------------------------------- 1 | smarty->autoload_filters[$type])) { 38 | foreach ((array)$template->smarty->autoload_filters[$type] as $name) { 39 | $plugin_name = "Smarty_{$type}filter_{$name}"; 40 | if ($template->smarty->loadPlugin($plugin_name)) { 41 | if (function_exists($plugin_name)) { 42 | // use loaded Smarty2 style plugin 43 | $output = $plugin_name($output, $template); 44 | } elseif (class_exists($plugin_name, false)) { 45 | // loaded class of filter plugin 46 | $output = call_user_func(array($plugin_name, 'execute'), $output, $template); 47 | } 48 | } else { 49 | // nothing found, throw exception 50 | throw new SmartyException("Unable to load filter {$plugin_name}"); 51 | } 52 | } 53 | } 54 | // loop over registerd filters of specified type 55 | if (!empty($template->smarty->registered_filters[$type])) { 56 | foreach ($template->smarty->registered_filters[$type] as $key => $name) { 57 | if (is_array($template->smarty->registered_filters[$type][$key])) { 58 | $output = call_user_func($template->smarty->registered_filters[$type][$key], $output, $template); 59 | } else { 60 | $output = $template->smarty->registered_filters[$type][$key]($output, $template); 61 | } 62 | } 63 | } 64 | // return filtered output 65 | return $output; 66 | } 67 | 68 | } 69 | 70 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_function_call_handler.php: -------------------------------------------------------------------------------- 1 | tpl_vars; 38 | foreach (\$_smarty_tpl->smarty->template_functions['{$_name}']['parameter'] as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(\$value);}; 39 | foreach (\$params as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(\$value);}?>"; 40 | if ($_nocache) { 41 | $_code .= preg_replace(array("!<\?php echo \\'/\*%%SmartyNocache:{$_template->smarty->template_functions[$_name]['nocache_hash']}%%\*/|/\*/%%SmartyNocache:{$_template->smarty->template_functions[$_name]['nocache_hash']}%%\*/\\';\?>!", 42 | "!\\\'!"), array('', "'"), $_template->smarty->template_functions[$_name]['compiled']); 43 | $_template->smarty->template_functions[$_name]['called_nocache'] = true; 44 | } else { 45 | $_code .= preg_replace("/{$_template->smarty->template_functions[$_name]['nocache_hash']}/", $_template->properties['nocache_hash'], $_template->smarty->template_functions[$_name]['compiled']); 46 | } 47 | $_code .= "tpl_vars = \$saved_tpl_vars;}"; 48 | eval($_code); 49 | } 50 | $_function($_template, $_params); 51 | } 52 | 53 | } 54 | 55 | ?> 56 | -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_get_include_path.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_nocache_insert.php: -------------------------------------------------------------------------------- 1 | assign('{$_assign}' , {$_function} (" . var_export($_attr, true) . ",\$_smarty_tpl), true);?>"; 41 | } else { 42 | $_output .= "echo {$_function}(" . var_export($_attr, true) . ",\$_smarty_tpl);?>"; 43 | } 44 | $_tpl = $_template; 45 | while ($_tpl->parent instanceof Smarty_Internal_Template) { 46 | $_tpl = $_tpl->parent; 47 | } 48 | return "/*%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/" . $_output . "/*/%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/"; 49 | } 50 | 51 | } 52 | 53 | ?> 54 | -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_resource_eval.php: -------------------------------------------------------------------------------- 1 | uid = $source->filepath = sha1($source->name); 33 | $source->timestamp = false; 34 | $source->exists = true; 35 | } 36 | 37 | /** 38 | * Load template's source from $resource_name into current template object 39 | * 40 | * @uses decode() to decode base64 and urlencoded template_resources 41 | * @param Smarty_Template_Source $source source object 42 | * @return string template source 43 | */ 44 | public function getContent(Smarty_Template_Source $source) 45 | { 46 | return $this->decode($source->name); 47 | } 48 | 49 | /** 50 | * decode base64 and urlencode 51 | * 52 | * @param string $string template_resource to decode 53 | * @return string decoded template_resource 54 | */ 55 | protected function decode($string) 56 | { 57 | // decode if specified 58 | if (($pos = strpos($string, ':')) !== false) { 59 | if (!strncmp($string, 'base64', 6)) { 60 | return base64_decode(substr($string, 7)); 61 | } elseif (!strncmp($string, 'urlencode', 9)) { 62 | return urldecode(substr($string, 10)); 63 | } 64 | } 65 | 66 | return $string; 67 | } 68 | 69 | /** 70 | * modify resource_name according to resource handlers specifications 71 | * 72 | * @param Smarty $smarty Smarty instance 73 | * @param string $resource_name resource_name to make unique 74 | * @return string unique resource name 75 | */ 76 | protected function buildUniqueResourceName(Smarty $smarty, $resource_name) 77 | { 78 | return get_class($this) . '#' .$this->decode($resource_name); 79 | } 80 | 81 | /** 82 | * Determine basename for compiled filename 83 | * 84 | * @param Smarty_Template_Source $source source object 85 | * @return string resource's basename 86 | */ 87 | protected function getBasename(Smarty_Template_Source $source) 88 | { 89 | return ''; 90 | } 91 | 92 | } 93 | 94 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_resource_file.php: -------------------------------------------------------------------------------- 1 | filepath = $this->buildFilepath($source, $_template); 30 | 31 | if ($source->filepath !== false) { 32 | if (is_object($source->smarty->security_policy)) { 33 | $source->smarty->security_policy->isTrustedResourceDir($source->filepath); 34 | } 35 | 36 | $source->uid = sha1($source->filepath); 37 | if ($source->smarty->compile_check && !isset($source->timestamp)) { 38 | $source->timestamp = @filemtime($source->filepath); 39 | $source->exists = !!$source->timestamp; 40 | } 41 | } 42 | } 43 | 44 | /** 45 | * populate Source Object with timestamp and exists from Resource 46 | * 47 | * @param Smarty_Template_Source $source source object 48 | */ 49 | public function populateTimestamp(Smarty_Template_Source $source) 50 | { 51 | $source->timestamp = @filemtime($source->filepath); 52 | $source->exists = !!$source->timestamp; 53 | } 54 | 55 | /** 56 | * Load template's source from file into current template object 57 | * 58 | * @param Smarty_Template_Source $source source object 59 | * @return string template source 60 | * @throws SmartyException if source cannot be loaded 61 | */ 62 | public function getContent(Smarty_Template_Source $source) 63 | { 64 | if ($source->timestamp) { 65 | return file_get_contents($source->filepath); 66 | } 67 | if ($source instanceof Smarty_Config_Source) { 68 | throw new SmartyException("Unable to read config {$source->type} '{$source->name}'"); 69 | } 70 | throw new SmartyException("Unable to read template {$source->type} '{$source->name}'"); 71 | } 72 | 73 | /** 74 | * Determine basename for compiled filename 75 | * 76 | * @param Smarty_Template_Source $source source object 77 | * @return string resource's basename 78 | */ 79 | public function getBasename(Smarty_Template_Source $source) 80 | { 81 | $_file = $source->name; 82 | if (($_pos = strpos($_file, ']')) !== false) { 83 | $_file = substr($_file, $_pos + 1); 84 | } 85 | return basename($_file); 86 | } 87 | 88 | } 89 | 90 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_resource_php.php: -------------------------------------------------------------------------------- 1 | short_open_tag = ini_get( 'short_open_tag' ); 27 | } 28 | 29 | /** 30 | * populate Source Object with meta data from Resource 31 | * 32 | * @param Smarty_Template_Source $source source object 33 | * @param Smarty_Internal_Template $_template template object 34 | * @return void 35 | */ 36 | public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null) 37 | { 38 | $source->filepath = $this->buildFilepath($source, $_template); 39 | 40 | if ($source->filepath !== false) { 41 | if (is_object($source->smarty->security_policy)) { 42 | $source->smarty->security_policy->isTrustedResourceDir($source->filepath); 43 | } 44 | 45 | $source->uid = sha1($source->filepath); 46 | if ($source->smarty->compile_check) { 47 | $source->timestamp = @filemtime($source->filepath); 48 | $source->exists = !!$source->timestamp; 49 | } 50 | } 51 | } 52 | 53 | /** 54 | * populate Source Object with timestamp and exists from Resource 55 | * 56 | * @param Smarty_Template_Source $source source object 57 | * @return void 58 | */ 59 | public function populateTimestamp(Smarty_Template_Source $source) 60 | { 61 | $source->timestamp = @filemtime($source->filepath); 62 | $source->exists = !!$source->timestamp; 63 | } 64 | 65 | /** 66 | * Load template's source from file into current template object 67 | * 68 | * @param Smarty_Template_Source $source source object 69 | * @return string template source 70 | * @throws SmartyException if source cannot be loaded 71 | */ 72 | public function getContent(Smarty_Template_Source $source) 73 | { 74 | if ($source->timestamp) { 75 | return ''; 76 | } 77 | throw new SmartyException("Unable to read template {$source->type} '{$source->name}'"); 78 | } 79 | 80 | /** 81 | * Render and output the template (without using the compiler) 82 | * 83 | * @param Smarty_Template_Source $source source object 84 | * @param Smarty_Internal_Template $_template template object 85 | * @return void 86 | * @throws SmartyException if template cannot be loaded or allow_php_templates is disabled 87 | */ 88 | public function renderUncompiled(Smarty_Template_Source $source, Smarty_Internal_Template $_template) 89 | { 90 | $_smarty_template = $_template; 91 | 92 | if (!$source->smarty->allow_php_templates) { 93 | throw new SmartyException("PHP templates are disabled"); 94 | } 95 | if (!$source->exists) { 96 | if ($_template->parent instanceof Smarty_Internal_Template) { 97 | $parent_resource = " in '{$_template->parent->template_resource}'"; 98 | } else { 99 | $parent_resource = ''; 100 | } 101 | throw new SmartyException("Unable to load template {$source->type} '{$source->name}'{$parent_resource}"); 102 | } 103 | 104 | // prepare variables 105 | extract($_template->getTemplateVars()); 106 | 107 | // include PHP template with short open tags enabled 108 | ini_set( 'short_open_tag', '1' ); 109 | include($source->filepath); 110 | ini_set( 'short_open_tag', $this->short_open_tag ); 111 | } 112 | } 113 | 114 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_resource_registered.php: -------------------------------------------------------------------------------- 1 | filepath = $source->type . ':' . $source->name; 32 | $source->uid = sha1($source->filepath); 33 | if ($source->smarty->compile_check) { 34 | $source->timestamp = $this->getTemplateTimestamp($source); 35 | $source->exists = !!$source->timestamp; 36 | } 37 | } 38 | 39 | /** 40 | * populate Source Object with timestamp and exists from Resource 41 | * 42 | * @param Smarty_Template_Source $source source object 43 | * @return void 44 | */ 45 | public function populateTimestamp(Smarty_Template_Source $source) 46 | { 47 | $source->timestamp = $this->getTemplateTimestamp($source); 48 | $source->exists = !!$source->timestamp; 49 | } 50 | 51 | /** 52 | * Get timestamp (epoch) the template source was modified 53 | * 54 | * @param Smarty_Template_Source $source source object 55 | * @return integer|boolean timestamp (epoch) the template was modified, false if resources has no timestamp 56 | */ 57 | public function getTemplateTimestamp(Smarty_Template_Source $source) 58 | { 59 | // return timestamp 60 | $time_stamp = false; 61 | call_user_func_array($source->smarty->registered_resources[$source->type][0][1], array($source->name, &$time_stamp, $source->smarty)); 62 | return is_numeric($time_stamp) ? (int) $time_stamp : $time_stamp; 63 | } 64 | 65 | /** 66 | * Load template's source by invoking the registered callback into current template object 67 | * 68 | * @param Smarty_Template_Source $source source object 69 | * @return string template source 70 | * @throws SmartyException if source cannot be loaded 71 | */ 72 | public function getContent(Smarty_Template_Source $source) 73 | { 74 | // return template string 75 | $t = call_user_func_array($source->smarty->registered_resources[$source->type][0][0], array($source->name, &$source->content, $source->smarty)); 76 | if (is_bool($t) && !$t) { 77 | throw new SmartyException("Unable to read template {$source->type} '{$source->name}'"); 78 | } 79 | return $source->content; 80 | } 81 | 82 | /** 83 | * Determine basename for compiled filename 84 | * 85 | * @param Smarty_Template_Source $source source object 86 | * @return string resource's basename 87 | */ 88 | protected function getBasename(Smarty_Template_Source $source) 89 | { 90 | return basename($source->name); 91 | } 92 | 93 | } 94 | 95 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_resource_stream.php: -------------------------------------------------------------------------------- 1 | filepath = str_replace(':', '://', $source->resource); 34 | $source->uid = false; 35 | $source->content = $this->getContent($source); 36 | $source->timestamp = false; 37 | $source->exists = !!$source->content; 38 | } 39 | 40 | /** 41 | * Load template's source from stream into current template object 42 | * 43 | * @param Smarty_Template_Source $source source object 44 | * @return string template source 45 | * @throws SmartyException if source cannot be loaded 46 | */ 47 | public function getContent(Smarty_Template_Source $source) 48 | { 49 | $t = ''; 50 | // the availability of the stream has already been checked in Smarty_Resource::fetch() 51 | $fp = fopen($source->filepath, 'r+'); 52 | if ($fp) { 53 | while (!feof($fp) && ($current_line = fgets($fp)) !== false) { 54 | $t .= $current_line; 55 | } 56 | fclose($fp); 57 | return $t; 58 | } else { 59 | return false; 60 | } 61 | } 62 | 63 | /** 64 | * modify resource_name according to resource handlers specifications 65 | * 66 | * @param Smarty $smarty Smarty instance 67 | * @param string $resource_name resource_name to make unique 68 | * @return string unique resource name 69 | */ 70 | protected function buildUniqueResourceName(Smarty $smarty, $resource_name) 71 | { 72 | return get_class($this) . '#' . $resource_name; 73 | } 74 | } 75 | 76 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_resource_string.php: -------------------------------------------------------------------------------- 1 | uid = $source->filepath = sha1($source->name); 33 | $source->timestamp = 0; 34 | $source->exists = true; 35 | } 36 | 37 | /** 38 | * Load template's source from $resource_name into current template object 39 | * 40 | * @uses decode() to decode base64 and urlencoded template_resources 41 | * @param Smarty_Template_Source $source source object 42 | * @return string template source 43 | */ 44 | public function getContent(Smarty_Template_Source $source) 45 | { 46 | return $this->decode($source->name); 47 | } 48 | 49 | /** 50 | * decode base64 and urlencode 51 | * 52 | * @param string $string template_resource to decode 53 | * @return string decoded template_resource 54 | */ 55 | protected function decode($string) 56 | { 57 | // decode if specified 58 | if (($pos = strpos($string, ':')) !== false) { 59 | if (!strncmp($string, 'base64', 6)) { 60 | return base64_decode(substr($string, 7)); 61 | } elseif (!strncmp($string, 'urlencode', 9)) { 62 | return urldecode(substr($string, 10)); 63 | } 64 | } 65 | 66 | return $string; 67 | } 68 | 69 | /** 70 | * modify resource_name according to resource handlers specifications 71 | * 72 | * @param Smarty $smarty Smarty instance 73 | * @param string $resource_name resource_name to make unique 74 | * @return string unique resource name 75 | */ 76 | protected function buildUniqueResourceName(Smarty $smarty, $resource_name) 77 | { 78 | return get_class($this) . '#' .$this->decode($resource_name); 79 | } 80 | 81 | /** 82 | * Determine basename for compiled filename 83 | * 84 | * Always returns an empty string. 85 | * 86 | * @param Smarty_Template_Source $source source object 87 | * @return string resource's basename 88 | */ 89 | protected function getBasename(Smarty_Template_Source $source) 90 | { 91 | return ''; 92 | } 93 | 94 | } 95 | 96 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_smartytemplatecompiler.php: -------------------------------------------------------------------------------- 1 | smarty = $smarty; 77 | parent::__construct(); 78 | // get required plugins 79 | $this->lexer_class = $lexer_class; 80 | $this->parser_class = $parser_class; 81 | } 82 | 83 | /** 84 | * Methode to compile a Smarty template 85 | * 86 | * @param mixed $_content template source 87 | * @return bool true if compiling succeeded, false if it failed 88 | */ 89 | protected function doCompile($_content) 90 | { 91 | /* here is where the compiling takes place. Smarty 92 | tags in the templates are replaces with PHP code, 93 | then written to compiled files. */ 94 | // init the lexer/parser to compile the template 95 | $this->lex = new $this->lexer_class($_content, $this); 96 | $this->parser = new $this->parser_class($this->lex, $this); 97 | if ($this->smarty->_parserdebug) 98 | $this->parser->PrintTrace(); 99 | // get tokens from lexer and parse them 100 | while ($this->lex->yylex() && !$this->abort_and_recompile) { 101 | if ($this->smarty->_parserdebug) { 102 | echo "
    Line {$this->lex->line} Parsing  {$this->parser->yyTokenName[$this->lex->token]} Token " .
    103 |                     htmlentities($this->lex->value) . "
    "; 104 | } 105 | $this->parser->doParse($this->lex->token, $this->lex->value); 106 | } 107 | 108 | if ($this->abort_and_recompile) { 109 | // exit here on abort 110 | return false; 111 | } 112 | // finish parsing process 113 | $this->parser->doParse(0, 0); 114 | // check for unclosed tags 115 | if (count($this->_tag_stack) > 0) { 116 | // get stacked info 117 | list($openTag, $_data) = array_pop($this->_tag_stack); 118 | $this->trigger_template_error("unclosed {" . $openTag . "} tag"); 119 | } 120 | // return compiled code 121 | // return str_replace(array("? >\nparser->retvalue); 122 | return $this->parser->retvalue; 123 | } 124 | 125 | } 126 | 127 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_internal_write_file.php: -------------------------------------------------------------------------------- 1 | _file_perms !== null) { 31 | $old_umask = umask(0); 32 | } 33 | 34 | $_dirpath = dirname($_filepath); 35 | // if subdirs, create dir structure 36 | if ($_dirpath !== '.' && !file_exists($_dirpath)) { 37 | mkdir($_dirpath, $smarty->_dir_perms === null ? 0777 : $smarty->_dir_perms, true); 38 | } 39 | 40 | // write to tmp file, then move to overt file lock race condition 41 | $_tmp_file = $_dirpath . DS . uniqid('wrt'); 42 | if (!file_put_contents($_tmp_file, $_contents)) { 43 | error_reporting($_error_reporting); 44 | throw new SmartyException("unable to write file {$_tmp_file}"); 45 | return false; 46 | } 47 | 48 | // remove original file 49 | @unlink($_filepath); 50 | 51 | // rename tmp file 52 | $success = rename($_tmp_file, $_filepath); 53 | if (!$success) { 54 | error_reporting($_error_reporting); 55 | throw new SmartyException("unable to write file {$_filepath}"); 56 | return false; 57 | } 58 | 59 | if ($smarty->_file_perms !== null) { 60 | // set file permissions 61 | chmod($_filepath, $smarty->_file_perms); 62 | umask($old_umask); 63 | } 64 | error_reporting($_error_reporting); 65 | return true; 66 | } 67 | 68 | } 69 | 70 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_resource_custom.php: -------------------------------------------------------------------------------- 1 | filepath = strtolower($source->type . ':' . $source->name); 52 | $source->uid = sha1($source->type . ':' . $source->name); 53 | 54 | $mtime = $this->fetchTimestamp($source->name); 55 | if ($mtime !== null) { 56 | $source->timestamp = $mtime; 57 | } else { 58 | $this->fetch($source->name, $content, $timestamp); 59 | $source->timestamp = isset($timestamp) ? $timestamp : false; 60 | if( isset($content) ) 61 | $source->content = $content; 62 | } 63 | $source->exists = !!$source->timestamp; 64 | } 65 | 66 | /** 67 | * Load template's source into current template object 68 | * 69 | * @param Smarty_Template_Source $source source object 70 | * @return string template source 71 | * @throws SmartyException if source cannot be loaded 72 | */ 73 | public function getContent(Smarty_Template_Source $source) 74 | { 75 | $this->fetch($source->name, $content, $timestamp); 76 | if (isset($content)) { 77 | return $content; 78 | } 79 | 80 | throw new SmartyException("Unable to read template {$source->type} '{$source->name}'"); 81 | } 82 | 83 | /** 84 | * Determine basename for compiled filename 85 | * 86 | * @param Smarty_Template_Source $source source object 87 | * @return string resource's basename 88 | */ 89 | protected function getBasename(Smarty_Template_Source $source) 90 | { 91 | return basename($source->name); 92 | } 93 | 94 | } 95 | 96 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_resource_recompiled.php: -------------------------------------------------------------------------------- 1 | filepath = false; 30 | $compiled->timestamp = false; 31 | $compiled->exists = false; 32 | } 33 | 34 | } 35 | 36 | ?> -------------------------------------------------------------------------------- /test/libs/smarty-3.1.5/sysplugins/smarty_resource_uncompiled.php: -------------------------------------------------------------------------------- 1 | filepath = false; 38 | $compiled->timestamp = false; 39 | $compiled->exists = false; 40 | } 41 | 42 | } 43 | 44 | ?> --------------------------------------------------------------------------------