├── .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 └── util ├── auto-plugin ├── TestAutoPlugin.php ├── TestReport.class.php └── start.sh ├── autopack ├── TestReport.class.php ├── TestStaticPack.php └── start.sh ├── diff ├── File.class.php ├── config.php ├── config_o.php ├── diff.class.php ├── diffall.class.php ├── inline_diff │ ├── inline_function.php │ └── inline_renderer.php ├── new_fis_ready.sh ├── old_fis_ready.sh ├── old_fis_scp.sh ├── product_code.sh ├── release.sh ├── release_o.sh ├── result │ ├── diffdetails.tpl │ ├── difflist.tpl │ └── productsdiff.tpl ├── result_o │ ├── diffdetails.tpl │ ├── difflist.tpl │ └── productsdiff.tpl └── start.sh └── md5 ├── test.sh └── tstRight.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 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fis", 3 | "description": "front-end integrated solution.", 4 | "version": "1.10.1", 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.0.6", 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.1.6", 38 | "fis-optimizer-uglify-js": "0.1.14", 39 | "fis-packager-map": "0.0.9", 40 | "fis-postprocessor-jswrapper": "0.0.12", 41 | "fis-spriter-csssprites": "0.3.11", 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 | 53 | 56 | 57 | -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/lib/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fis-dev/fis/ef72dabfaff53d01561c3ed457c08e444a8a4cf3/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/fis-dev/fis/ef72dabfaff53d01561c3ed457c08e444a8a4cf3/test/ft/fis-quickstart-demo/lib/icons/icon_01.gif -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/lib/icons/icon_02.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fis-dev/fis/ef72dabfaff53d01561c3ed457c08e444a8a4cf3/test/ft/fis-quickstart-demo/lib/icons/icon_02.gif -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/lib/icons/icon_03.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fis-dev/fis/ef72dabfaff53d01561c3ed457c08e444a8a4cf3/test/ft/fis-quickstart-demo/lib/icons/icon_03.gif -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/lib/icons/icon_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fis-dev/fis/ef72dabfaff53d01561c3ed457c08e444a8a4cf3/test/ft/fis-quickstart-demo/lib/icons/icon_04.png -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/lib/icons/icon_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fis-dev/fis/ef72dabfaff53d01561c3ed457c08e444a8a4cf3/test/ft/fis-quickstart-demo/lib/icons/icon_05.png -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/lib/icons/icon_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fis-dev/fis/ef72dabfaff53d01561c3ed457c08e444a8a4cf3/test/ft/fis-quickstart-demo/lib/icons/icon_06.png -------------------------------------------------------------------------------- /test/ft/fis-quickstart-demo/lib/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fis-dev/fis/ef72dabfaff53d01561c3ed457c08e444a8a4cf3/test/ft/fis-quickstart-demo/lib/logo.gif -------------------------------------------------------------------------------- /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.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.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_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_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_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_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 | ?> -------------------------------------------------------------------------------- /test/util/auto-plugin/TestReport.class.php: -------------------------------------------------------------------------------- 1 | data=array(); 12 | } 13 | public function setData($data){ 14 | $this->data=$data; 15 | } 16 | public function createTestReport(){ 17 | $dom = new DOMDocument("1.0","utf-8"); 18 | $xmlFile = dirname(__FILE__)."/result/report.xml"; 19 | $data=$this->data; 20 | $totalCount=0; 21 | $totalFailure=0; 22 | if(count($data)==0){ 23 | echo "no array data!"; 24 | exit; 25 | } 26 | $name=$data['name']; 27 | if(array_key_exists("success",$data)) 28 | $totalCount = count($data['success']); 29 | if(array_key_exists("fail",$data)){ 30 | $totalFailure = count($data['fail']); 31 | $totalCount+=count($data['fail']); 32 | } 33 | $testsuites = $dom->createElement("testsuites"); 34 | $dom->appendChild($testsuites); 35 | $testsuite = $dom->createElement("testsuite"); 36 | $testsuites->appendChild($testsuite); 37 | $testsuite->setAttribute("name","$name* "); 38 | $testsuite->setAttribute("tests",$totalCount); 39 | $testsuite->setAttribute("time",$totalCount); 40 | $testsuite->setAttribute("failures",$totalFailure); 41 | $testsuite->setAttribute("total",$totalCount); 42 | for($i=$totalFailure;$i<$totalCount;$i++){ 43 | $testcase=$dom->createElement("testcase"); 44 | $testsuite->appendChild($testcase); 45 | $testcase->setAttribute("name",key($data["success"][$i-$totalFailure])); 46 | $testcase->setAttribute("time","1"); 47 | $testcase->setAttribute("failures","0"); 48 | $testcase->setAttribute("total","1"); 49 | $testcase->setAttribute("type","OK"); 50 | $msgText = $dom->createTextNode(current($data["success"][$i-$totalFailure])); 51 | $testcase->appendChild($msgText); 52 | } 53 | for($i=0;$i<$totalFailure;$i++){ 54 | $testcase=$dom->createElement("testcase"); 55 | $testsuite->appendChild($testcase); 56 | $testcase->setAttribute("name",key($data["fail"][$i])); 57 | $testcase->setAttribute("time","1"); 58 | $testcase->setAttribute("failures","1"); 59 | $testcase->setAttribute("total","1"); 60 | 61 | $failure = $dom->createElement("failure"); 62 | $testcase->appendChild($failure); 63 | $failure->setAttribute("type","junit.framework.AssertionFailedError"); 64 | $msgText = $dom->createTextNode(current($data["fail"][$i])); 65 | $failure->appendChild($msgText); 66 | } 67 | $dom->save($xmlFile); 68 | } 69 | } -------------------------------------------------------------------------------- /test/util/auto-plugin/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | npm install -g fis-postpackager-ext-map 3 | npm install -g fis-packager-autopack 4 | npm isntall -g fis-parser-bainuo-less 5 | if [ -d "./svntest" ]; then 6 | rm -r svntest 7 | fi 8 | mkdir svntest 9 | cd ./svntest 10 | svn co --username $1 --password $2 https://svn.baidu.com/app/global/hao123/branches/fe/flat-home/hao123_1-0-988_BRANCH ./hao123 11 | svn co --username $1 --password $2 https://svn.baidu.com/app/search/tuangou/branches/mobile-bainuo/common/tuangou_4-3-102_BRANCH ./tuangou 12 | cd ./hao123 13 | fisp release -p -d ./output 14 | cd .. 15 | cd ./tuangou 16 | fisp release -p -d ./output 17 | cd ../.. 18 | if [ ! -d "./result" ]; then 19 | mkdir result 20 | fi 21 | php TestAutoPlugin.php 22 | npm uninstall -g fis-postpackager-ext-map 23 | npm uninstall -g fis-packager-autopack 24 | npm uninstall -g fis-parser-bainuo-less 25 | rm -r svntest -------------------------------------------------------------------------------- /test/util/autopack/TestReport.class.php: -------------------------------------------------------------------------------- 1 | Array 13 | ( 14 | [0] => Array 15 | ( 16 | [/widget/hot-site/hot-site-async.js] => diff 17 | ) 18 | 19 | [1] => Array 20 | ( 21 | [/widget/sidetoolbar/sidetoolbar-async.js] => diff 22 | ) 23 | 24 | [2] => Array 25 | ( 26 | [/widget/sort-area/shop/shop-async.js] => diff 27 | ) 28 | 29 | ) 30 | 31 | [success] => Array 32 | ( 33 | [0] => Array 34 | ( 35 | [diff autopack] => success 36 | ) 37 | ) 38 | 39 | [name] => autopack 40 | ) 41 | */ 42 | class TestReport { 43 | private $data; 44 | public function __construct(){ 45 | $this->data=array(); 46 | } 47 | public function setData($data){ 48 | $this->data=$data; 49 | print_r($data); 50 | } 51 | public function createTestReport(){ 52 | $dom = new DOMDocument("1.0","utf-8"); 53 | $xmlFile = dirname(__FILE__)."/result/report.xml"; 54 | $data=$this->data; 55 | $totalCount=0; 56 | $totalFailure=0; 57 | $Count = 0; 58 | $Failure = 0; 59 | if(file_exists($xmlFile)){ 60 | $dom->load($xmlFile); 61 | $testsuite = $dom->getElementsByTagName("testsuite")->item(0); 62 | $totalCount = $testsuite->getAttribute("tests"); 63 | $totalFailure = $testsuite->getAttribute("failures"); 64 | }else{ 65 | $testsuite = $dom->createElement("testsuite"); 66 | $dom->appendChild($testsuite); 67 | } 68 | $name=$data['name']; 69 | if(array_key_exists("success",$data)){ 70 | $Count = count($data['success']); 71 | $totalCount += $Count; 72 | } 73 | if(array_key_exists("fail",$data)){ 74 | $Failure = count($data['fail']); 75 | $Count += count($data['fail']); 76 | $totalFailure += $Failure; 77 | $totalCount += $Count; 78 | } 79 | $testsuite->setAttribute("name","$name* "); 80 | $testsuite->setAttribute("tests",$totalCount); 81 | $testsuite->setAttribute("time",$totalCount); 82 | $testsuite->setAttribute("failures",$totalFailure); 83 | $testsuite->setAttribute("total",$totalCount); 84 | for($i=$Failure;$i<$Count;$i++){ 85 | $testcase=$dom->createElement("testcase"); 86 | $testsuite->appendChild($testcase); 87 | $testcase->setAttribute("name",key($data["success"][$i-$Failure])); 88 | $testcase->setAttribute("time","1"); 89 | $testcase->setAttribute("failures","0"); 90 | $testcase->setAttribute("total","1"); 91 | $testcase->setAttribute("type","OK"); 92 | $msgText = $dom->createTextNode(current($data["success"][$i-$Failure])); 93 | $testcase->appendChild($msgText); 94 | } 95 | for($i=0;$i<$Failure;$i++){ 96 | $testcase=$dom->createElement("testcase"); 97 | $testsuite->appendChild($testcase); 98 | $testcase->setAttribute("name",key($data["fail"][$i])); 99 | $testcase->setAttribute("time","1"); 100 | $testcase->setAttribute("failures","1"); 101 | $testcase->setAttribute("total","1"); 102 | 103 | $failure = $dom->createElement("failure"); 104 | $testcase->appendChild($failure); 105 | $failure->setAttribute("type","junit.framework.AssertionFailedError"); 106 | $msgText = $dom->createTextNode(current($data["fail"][$i])); 107 | $failure->appendChild($msgText); 108 | } 109 | $dom->save($xmlFile); 110 | } 111 | } -------------------------------------------------------------------------------- /test/util/autopack/TestStaticPack.php: -------------------------------------------------------------------------------- 1 | data['fail'] = array(); 15 | } 16 | public function setFile($file1,$file2){ 17 | $this->fileData1=$file1; 18 | $this->fileData2=$file2; 19 | } 20 | private function getJsonData($filePath){ 21 | $fileData=file_get_contents($filePath); 22 | $fileData=json_decode($fileData,true); 23 | $arr = array(); 24 | foreach($fileData['data'] as $pack){ 25 | foreach($pack as $key=>$value){ 26 | $arr[$key]=$value; 27 | } 28 | } 29 | return $arr; 30 | } 31 | private function calculate($data1,$data2){ 32 | $data1=$this->getJsonData($data1); 33 | $data2=$this->getJsonData($data2); 34 | $hash=array(); 35 | foreach($data1 as $key1=>$arrValue1){ 36 | $max=0; 37 | $tmp=""; 38 | $outdata=array(); 39 | foreach($data2 as $key2=>$arrValue2){ 40 | if(array_key_exists($key2,$hash)) continue; 41 | $num=0; 42 | $data=array(); 43 | foreach($arrValue1 as $value1){ 44 | if(in_array($value1,$arrValue2)) 45 | $num++; 46 | else 47 | array_push($data,array($value1=>"diff")); 48 | } 49 | if($num>=(count($arrValue2)+1)/2){ 50 | foreach($data as $v){ 51 | array_push($this->data["fail"],$v); 52 | } 53 | $tmp = $key2; 54 | $hash[$key2]=1; 55 | break; 56 | } 57 | if($num>$max||$max == 0){ 58 | $max=$num; 59 | $outdata=$data; 60 | $tmp=$key2; 61 | } 62 | unset($data); 63 | } 64 | if(!array_key_exists($tmp,$hash)){ 65 | foreach($outdata as $v){ 66 | array_push($this->data["fail"],$v); 67 | } 68 | $hash[$tmp]=1; 69 | } 70 | unset($outdata); 71 | } 72 | } 73 | 74 | public function getResult(){ 75 | $this->calculate($this->fileData1,$this->fileData2); 76 | $this->data["name"]="autopack"; 77 | $this->data['success'][0]=array("diff autopack"=>"success"); 78 | } 79 | public function getData(){ 80 | return $this->data; 81 | } 82 | }; 83 | 84 | $case=new TestStaticPack(); 85 | $case->setFile("a.txt","b.txt"); 86 | $case->getResult(); 87 | $report=new TestReport(); 88 | $report->setData($case->getData()); 89 | $report->createTestReport(); 90 | ?> -------------------------------------------------------------------------------- /test/util/autopack/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | npm install -g fis-postpackager-ext-map 3 | npm install -g fis-packager-autopack 4 | npm isntall -g fis-parser-bainuo-less 5 | if [ -d "./result" ]; then 6 | rm -r result 7 | fi 8 | wget -O a.txt "http://fedev.baidu.com:8803/autopack?return=json&fid=baidunuomi&svn=https://svn.baidu.com/app/search/tuangou/branches/mobile-bainuo/common/tuangou_4-3-102_BRANCH" 9 | wget -O b.txt "http://solar.baidu.com/autopack?return=json&fid=baidunuomi&svn=https://svn.baidu.com/app/search/tuangou/branches/mobile-bainuo/common/tuangou_4-3-102_BRANCH" 10 | if [ ! -d "./result" ]; then 11 | mkdir result 12 | fi 13 | php TestStaticPack.php 14 | rm a.txt b.txt 15 | wget -O a.txt "http://fedev.baidu.com:8803/autopack?return=json&fid=globalhao123&svn=https://svn.baidu.com/app/global/hao123/branches/fe/flat-home/hao123_1-0-988_BRANCH" 16 | wget -O b.txt "http://solar.baidu.com/autopack?return=json&fid=globalhao123&svn=https://svn.baidu.com/app/global/hao123/branches/fe/flat-home/hao123_1-0-988_BRANCH" 17 | php TestStaticPack.php 18 | rm a.txt b.txt 19 | npm uninstall -g fis-postpackager-ext-map 20 | npm uninstall -g fis-packager-autopack 21 | npm uninstall -g fis-parser-bainuo-less -------------------------------------------------------------------------------- /test/util/diff/config.php: -------------------------------------------------------------------------------- 1 | array( //产品线目录 14 | 'wenku'=>array( 15 | 'name'=>'wenku', 16 | 'newoutputdir' => WENKU_PATH.'output_new', //使用新版本编译后的产出 17 | 'oldoutputdir' => WENKU_PATH.'output_old', //使用旧版本编译后的产出 18 | "modules" =>"bookeditor" //待编译的模块 19 | ), 20 | 'batman'=>array( 21 | 'name'=>'batman', 22 | 'newoutputdir' => BATMAN_PATH.'output_new', //使用新版本编译后的产出 23 | 'oldoutputdir' => BATMAN_PATH.'output_old', //使用旧版本编译后的产出 24 | "modules" =>"transit,place,common,index,addr,feedback,drive,walk" //待编译的模块 25 | ), 26 | 'tieba'=>array( 27 | 'name'=>'tieba', 28 | 'newoutputdir' => TIEBA_PATH.'output_new', //使用新版本编译后的产出 29 | 'oldoutputdir' => TIEBA_PATH.'output_old', //使用旧版本编译后的产出 30 | "modules" =>"xpb" //待编译的模块 31 | ), 32 | 'place'=>array( 33 | 'name'=>'place', 34 | 'newoutputdir' => PLACE_PATH.'output_new', //使用新版本编译后的产出 35 | 'oldoutputdir' => PLACE_PATH.'output_old', //使用旧版本编译后的产出 36 | "modules" =>"admin,beauty,cater,common,detail,hotel,movie,scope" //待编译的模块 37 | ), 38 | 'hao123'=>array( 39 | 'name'=>'hao123', 40 | 'newoutputdir' => HAO123_PATH.'output_new', //使用新版本编译后的产出 41 | 'oldoutputdir' => HAO123_PATH.'output_old', //使用旧版本编译后的产出 42 | "modules" =>"common,home,lv2" //待编译的模块 43 | ), 44 | 'superman'=>array( 45 | 'name'=>'superman', 46 | 'newoutputdir' => SUPERMAN_PATH.'output_new', //使用新版本编译后的产出 47 | 'oldoutputdir' => SUPERMAN_PATH.'output_old', //使用旧版本编译后的产出 48 | "modules" =>"transit,place,common,index,addr,feedback,drive,walk,third,taxi,user" //待编译的模块 49 | ) 50 | ), 51 | 'smarty' => array( 52 | 'dir' => DIFF_ROOT_PATH.'../../libs/smarty-3.1.5', 53 | 'templatedir' =>DIFF_ROOT_PATH. 'result/' 54 | ), 55 | 'url' =>"http://10.48.30.87:8088/" 56 | ); -------------------------------------------------------------------------------- /test/util/diff/config_o.php: -------------------------------------------------------------------------------- 1 | array( //产品线目录 14 | 'wenku'=>array( 15 | 'name'=>'wenku', 16 | 'newoutputdir' => WENKU_PATH.'output_o_new', //使用新版本编译后的产出 17 | 'oldoutputdir' => WENKU_PATH.'output_o_old', //使用旧版本编译后的产出 18 | "modules" =>"bookeditor" //待编译的模块 19 | ), 20 | 'batman'=>array( 21 | 'name'=>'batman', 22 | 'newoutputdir' => BATMAN_PATH.'output_o_new', //使用新版本编译后的产出 23 | 'oldoutputdir' => BATMAN_PATH.'output_o_old', //使用旧版本编译后的产出 24 | "modules" =>"transit,place,common,index,addr,feedback,drive,walk" //待编译的模块 25 | ), 26 | 'tieba'=>array( 27 | 'name'=>'tieba', 28 | 'newoutputdir' => TIEBA_PATH.'output_o_new', //使用新版本编译后的产出 29 | 'oldoutputdir' => TIEBA_PATH.'output_o_old', //使用旧版本编译后的产出 30 | "modules" =>"xpb" //待编译的模块 31 | ), 32 | 'place'=>array( 33 | 'name'=>'place', 34 | 'newoutputdir' => PLACE_PATH.'output_o_new', //使用新版本编译后的产出 35 | 'oldoutputdir' => PLACE_PATH.'output_o_old', //使用旧版本编译后的产出 36 | "modules" =>"admin,beauty,cater,common,detail,hotel,movie,scope" //待编译的模块 37 | ), 38 | 'hao123'=>array( 39 | 'name'=>'hao123', 40 | 'newoutputdir' => HAO123_PATH.'output_o_new', //使用新版本编译后的产出 41 | 'oldoutputdir' => HAO123_PATH.'output_o_old', //使用旧版本编译后的产出 42 | "modules" =>"common,home,lv2" //待编译的模块 43 | ), 44 | 'superman'=>array( 45 | 'name'=>'superman', 46 | 'newoutputdir' => SUPERMAN_PATH.'output_o_new', //使用新版本编译后的产出 47 | 'oldoutputdir' => SUPERMAN_PATH.'output_o_old', //使用旧版本编译后的产出 48 | "modules" =>"transit,place,common,index,addr,feedback,drive,walk,third,taxi,user" //待编译的模块 49 | ) 50 | ), 51 | 'smarty' => array( 52 | 'dir' => DIFF_ROOT_PATH.'../../libs/smarty-3.1.5', 53 | 'templatedir' =>DIFF_ROOT_PATH. 'result_o/' 54 | ), 55 | 'output' => array( 56 | 'newoutputdir' => 'output_o_new', //使用新版本编译后的产出 57 | 'oldoutputdir' => 'output_o_old', //使用旧版本编译后的产出 58 | ), 59 | 'url' =>"http://10.48.30.87:8088/" 60 | ); 61 | -------------------------------------------------------------------------------- /test/util/diff/diffall.class.php: -------------------------------------------------------------------------------- 1 | $value){ 12 | $diff = new Diff($pro); 13 | // $diff->build(); 14 | // $diff->analyze(); 15 | $diff->Display(); 16 | $productlist[$pro]['url'] = diff::getConfig('url').str_replace("/home/work/repos/","", 17 | $smartyConfig['templatedir'].$pro."_difflist.html"); 18 | } 19 | $smarty = new Smarty(); 20 | $smarty->assign('productsdiff',$productlist); 21 | $html = $smarty->fetch($smartyConfig['templatedir']."/productsdiff.tpl"); 22 | File::write($smartyConfig['templatedir']."productsdiff.html",$html); -------------------------------------------------------------------------------- /test/util/diff/inline_diff/inline_function.php: -------------------------------------------------------------------------------- 1 | render($diff); 63 | } -------------------------------------------------------------------------------- /test/util/diff/inline_diff/inline_renderer.php: -------------------------------------------------------------------------------- 1 | '; 18 | var $ins_suffix = ''; 19 | var $del_prefix = '
    '; 20 | var $del_suffix = '
    '; 21 | 22 | function Text_Diff_Renderer_inline($context_lines = 10000, $ins_prefix = '
    ', $ins_suffix = '
    ', $del_prefix = '
    ', $del_suffix = '
    ') 23 | { 24 | $this->$ins_prefix = $ins_prefix; 25 | $this->$ins_suffix = $ins_suffix; 26 | $this->$del_prefix = $del_prefix; 27 | $this->$del_suffix = $del_suffix; 28 | 29 | $this->_leading_context_lines = $context_lines; 30 | $this->_trailing_context_lines = $context_lines; 31 | } 32 | 33 | function _lines($lines) 34 | { 35 | $value=""; 36 | foreach ($lines as $line) { 37 | $value.="$line "; 38 | // FIXME: don't output space if it's the last line. 39 | } 40 | return "".$value.""; 41 | } 42 | 43 | function _blockHeader($xbeg, $xlen, $ybeg, $ylen) 44 | { 45 | return ''; 46 | } 47 | 48 | function _startBlock($header) 49 | { 50 | return $header; 51 | } 52 | 53 | function _context($lines) 54 | { 55 | return $this->_lines($lines, ' '); 56 | } 57 | function _added($lines) 58 | { 59 | return $this->ins_prefix.$this->_lines($lines).$this->ins_suffix; 60 | } 61 | 62 | function _deleted($lines) 63 | { 64 | return $this->del_prefix.$this->_lines($lines).$this->del_suffix; 65 | } 66 | 67 | function _changed($orig, $final) 68 | { 69 | return "

    ".$this->_deleted($orig) ."

    ". $this->_added($final)."

    "; 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /test/util/diff/new_fis_ready.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | TEST_PATH=/home/work/repos/fis/test/util/diff 4 | FIS_PATH=/home/work/repos/fis/ 5 | FISP_PATH=/home/work/lib/node_modules/fis-plus 6 | FISP_FIS_PATH=${FISP_PATH}/node_modules/fis 7 | 8 | cd ${FIS_PATH} 9 | rm -rf node_modules 10 | npm install --registry=https://registry.npm.taobao.org 11 | npm install fis-preprocessor-image-set --registry=https://registry.npm.taobao.org 12 | npm install fis-postpackager-ext-map --registry=https://registry.npm.taobao.org 13 | npm install fis-packager-autopack --registry=https://registry.npm.taobao.org 14 | 15 | npm cache clean 16 | npm update -g fis-plus --registry=https://registry.npm.taobao.org --prefix=/home/work/ 17 | 18 | rm -rf ${FISP_PATH}/node_modules/fis 19 | cp -r ${FIS_PATH} ${FISP_FIS_PATH} 20 | rm -rf ${FISP_FIS_PATH}/test 21 | 22 | sh ${TEST_PATH}/release$1.sh new 23 | -------------------------------------------------------------------------------- /test/util/diff/old_fis_ready.sh: -------------------------------------------------------------------------------- 1 | #!/home/work/.jumbo/bin/expect 2 | 3 | set timeout 480 4 | set p [lindex $argv 0] 5 | set o [lindex $argv 1] 6 | #send_user $s 7 | spawn su - fis -c "sh /home/work/repos/fis/test/util/diff/release$o.sh old" 8 | expect "Password:" 9 | send $p\r 10 | expect eof 11 | exit 12 | -------------------------------------------------------------------------------- /test/util/diff/old_fis_scp.sh: -------------------------------------------------------------------------------- 1 | #!/home/work/.jumbo/bin/expect 2 | 3 | set timeout 60 4 | set p [lindex $argv 0] 5 | spawn su - fis -c "sh /home/fis/npm/lib/upload.sh" 6 | expect "Password:" 7 | send $p\r 8 | expect "fis@fe's password:" 9 | send $p\r 10 | expect eof 11 | exit 12 | -------------------------------------------------------------------------------- /test/util/diff/product_code.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | TEST_PATH=/home/work/repos/fis/test/util/diff 4 | cd ${TEST_PATH} 5 | 6 | PLACE_SVN=https://svn.baidu.com/app/search/lbs-webapp/trunk/pcmap/place 7 | PLACE_DIR=./product_code/place 8 | 9 | BATMAN_SVN=https://svn.baidu.com/app/search/lbs-webapp/trunk/mmap/batman 10 | BATMAN_DIR=./product_code/batman 11 | 12 | WENKU_SVN=https://svn.baidu.com/app/search/wenku/branches/fe/bookeditor/wenku_1001-0-253_BRANCH 13 | WENKU_DIR=./product_code/wenku 14 | 15 | TIEBA_SVN=https://svn.baidu.com/app/search/forum/branches/fe/pad/xpad/pb/xpadpb_1-0-0_BRANCH 16 | TIEBA_DIR=./product_code/tieba 17 | 18 | HAO123_SVN=https://svn.baidu.com/app/global/hao123/trunk/fe 19 | HAO123_DIR=./product_code/hao123 20 | 21 | SUPERMAN_SVN=https://svn.baidu.com/app/search/lbs-webapp/trunk/mmap/superman 22 | SUPERMAN_DIR=./product_code/superman 23 | 24 | svn co ${PLACE_SVN} ${PLACE_DIR} 25 | svn co ${BATMAN_SVN} ${BATMAN_DIR} 26 | svn co ${WENKU_SVN} ${WENKU_DIR} 27 | svn co ${TIEBA_SVN} ${TIEBA_DIR} 28 | svn co ${HAO123_SVN}/common ${HAO123_DIR}/common 29 | svn co ${HAO123_SVN}/home ${HAO123_DIR}/home 30 | svn co ${HAO123_SVN}/lv2 ${HAO123_DIR}/lv2 31 | svn co ${SUPERMAN_SVN} ${SUPERMAN_DIR} 32 | -------------------------------------------------------------------------------- /test/util/diff/result/diffdetails.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | diff details 6 | 20 | 21 | 22 | 23 |

     

    24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 40 | 41 |
    红色代表老版本编译后的结果{$old}
    绿色代表新版本编译后的结果{$new}
    diff details
    36 |

    37 | {$diffdata} 38 |

    39 |
    42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /test/util/diff/result/difflist.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | diff file list 6 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 48 | 49 |
    {$productname} diff info:
    33 | 34 | 35 | 36 | 37 | 38 | 39 | {foreach $difflist as $value} 40 | 41 | 42 | 43 | 44 | 45 | {/foreach} 46 |
    file name new({$newversion}) old({$oldversion})
    {$value.name}{$value.new}{$value.old}
    47 |
    50 | 51 | 52 | -------------------------------------------------------------------------------- /test/util/diff/result/productsdiff.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | diff file list 6 | 19 | 20 | 21 | 22 |

    product difflist info:

    23 | 24 | 25 | 26 | 27 | 28 | {foreach $productsdiff as $value} 29 | 30 | 31 | 32 | 33 | 34 | {/foreach} 35 |
    product namediff result
    {$value.name}click here >>
    36 |

     

    37 |

     

    38 |

     

    39 | 40 | 41 | -------------------------------------------------------------------------------- /test/util/diff/result_o/diffdetails.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | diff details 6 | 20 | 21 | 22 | 23 |

     

    24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 40 | 41 |
    红色代表老版本编译后的结果{$old}
    绿色代表新版本编译后的结果{$new}
    diff details
    36 |

    37 | {$diffdata} 38 |

    39 |
    42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /test/util/diff/result_o/difflist.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | diff file list 6 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 48 | 49 |
    {$productname} diff info:
    33 | 34 | 35 | 36 | 37 | 38 | 39 | {foreach $difflist as $value} 40 | 41 | 42 | 43 | 44 | 45 | {/foreach} 46 |
    file name new({$newversion}) old({$oldversion})
    {$value.name}{$value.new}{$value.old}
    47 |
    50 | 51 | 52 | -------------------------------------------------------------------------------- /test/util/diff/result_o/productsdiff.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | diff file list 6 | 19 | 20 | 21 | 22 |

    product difflist info:

    23 | 24 | 25 | 26 | 27 | 28 | {foreach $productsdiff as $value} 29 | 30 | 31 | 32 | 33 | 34 | {/foreach} 35 |
    product namediff result
    {$value.name}click here >>
    36 |

     

    37 |

     

    38 |

     

    39 | 40 | 41 | -------------------------------------------------------------------------------- /test/util/diff/start.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | TEST_PATH=/home/work/repos/fis/test/util/diff 4 | cd ${TEST_PATH} 5 | if [ -f "result"$4"/report.xml" ] 6 | then 7 | rm "result"$4"/report.xml" 8 | fi 9 | sh product_code.sh $1 $2 10 | sh new_fis_ready.sh $4 11 | chmod +x old_fis_scp.sh 12 | ./old_fis_scp.sh $3 13 | chmod +x old_fis_ready.sh 14 | ./old_fis_ready.sh $3 $4 15 | rm -rf result$4/*.html 16 | sleep 2s 17 | php -f diffall.class.php $4 18 | -------------------------------------------------------------------------------- /test/util/md5/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | npm install -g lights 3 | lights install pc-demo 4 | cd ./pc-demo 5 | cd ./home 6 | fis release -m 7 | cd ../common 8 | fis release -m 9 | cd ../.. 10 | root="/home/work/.fis-tmp/www" 11 | if [ -z "$root" ]; then { 12 | echo "can't find project!" 13 | npm uninstall lights 14 | rm -r pc-demo 15 | exit; 16 | } 17 | fi 18 | touch exchange.txt 19 | echo "$root">exchange.txt 20 | if [ ! -d "./result" ]; then 21 | mkdir result 22 | fi 23 | php tstRight.php 24 | rm exchange.txt 25 | if [ -f "${root}/exchange.txt" ]; then { 26 | rm ${root}/exchange.txt 27 | } 28 | fi 29 | npm uninstall -g lights 30 | rm -r pc-demo -------------------------------------------------------------------------------- /test/util/md5/tstRight.php: -------------------------------------------------------------------------------- 1 | load($xmlFile); 38 | $testsuite = $dom->getElementsByTagName("testsuite")->item(0); 39 | $totalCount = $testsuite->getAttribute("tests"); 40 | $totalFailure = $testsuite->getAttribute("failures"); 41 | }else{ 42 | $testsuites = $dom->createElement("testsuites"); 43 | $dom->appendChild($testsuites); 44 | $testsuite = $dom->createElement("testsuite"); 45 | $testsuites->appendChild($testsuite); 46 | } 47 | if($flag){ 48 | $totalCount+=1; 49 | $totalFailure+=1; 50 | $testsuite->setAttribute("name","md5* "); 51 | $testsuite->setAttribute("tests",$totalCount); 52 | $testsuite->setAttribute("time",$totalCount); 53 | $testsuite->setAttribute("failures",$totalFailure); 54 | $testsuite->setAttribute("total",$totalCount); 55 | 56 | $testcase=$dom->createElement("testcase"); 57 | $testsuite->appendChild($testcase); 58 | $testcase->setAttribute("name","testcase0"); 59 | $testcase->setAttribute("time","1"); 60 | $testcase->setAttribute("failures","1"); 61 | $testcase->setAttribute("total","1"); 62 | }else{ 63 | $totalCount++; 64 | $testsuite->setAttribute("name","md5* "); 65 | $testsuite->setAttribute("tests",$totalCount); 66 | $testsuite->setAttribute("time",$totalCount); 67 | $testsuite->setAttribute("failures",$totalFailure); 68 | $testsuite->setAttribute("total",$totalCount); 69 | 70 | $testcase=$dom->createElement("testcase"); 71 | $testsuite->appendChild($testcase); 72 | $testcase->setAttribute("name","testcase0"); 73 | $testcase->setAttribute("time","1"); 74 | $testcase->setAttribute("failures",0); 75 | $testcase->setAttribute("total",1); 76 | } 77 | $dom->save($xmlFile); 78 | ?> 79 | --------------------------------------------------------------------------------