diff options
Diffstat (limited to 'vendor')
294 files changed, 16572 insertions, 5073 deletions
diff --git a/vendor/blueimp/jquery-file-upload/.gitignore b/vendor/blueimp/jquery-file-upload/.gitignore new file mode 100644 index 000000000..29a41a8c4 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +*.pyc +node_modules diff --git a/vendor/blueimp/jquery-file-upload/.jshintrc b/vendor/blueimp/jquery-file-upload/.jshintrc new file mode 100644 index 000000000..4ad82e664 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/.jshintrc @@ -0,0 +1,81 @@ +{ + "bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.) + "camelcase" : true, // true: Identifiers must be in camelCase + "curly" : true, // true: Require {} for every new block or scope + "eqeqeq" : true, // true: Require triple equals (===) for comparison + "forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty() + "immed" : true, // true: Require immediate invocations to be wrapped in parens + // e.g. `(function () { } ());` + "indent" : 4, // {int} Number of spaces to use for indentation + "latedef" : true, // true: Require variables/functions to be defined before being used + "newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()` + "noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee` + "noempty" : true, // true: Prohibit use of empty blocks + "nonew" : true, // true: Prohibit use of constructors for side-effects (without assignment) + "plusplus" : false, // true: Prohibit use of `++` & `--` + "quotmark" : "single", // Quotation mark consistency: + // false : do nothing (default) + // true : ensure whatever is used is consistent + // "single" : require single quotes + // "double" : require double quotes + "undef" : true, // true: Require all non-global variables to be declared (prevents global leaks) + "unused" : true, // true: Require all defined variables be used + "strict" : true, // true: Requires all functions run in ES5 Strict Mode + "trailing" : true, // true: Prohibit trailing whitespaces + "maxparams" : false, // {int} Max number of formal params allowed per function + "maxdepth" : false, // {int} Max depth of nested blocks (within functions) + "maxstatements" : false, // {int} Max number statements per function + "maxcomplexity" : false, // {int} Max cyclomatic complexity per function + "maxlen" : false, // {int} Max number of characters per line + + // Relaxing + "asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons) + "boss" : false, // true: Tolerate assignments where comparisons would be expected + "debug" : false, // true: Allow debugger statements e.g. browser breakpoints. + "eqnull" : false, // true: Tolerate use of `== null` + "es5" : false, // true: Allow ES5 syntax (ex: getters and setters) + "esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`) + "moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features) + // (ex: `for each`, multiple try/catch, function expression…) + "evil" : false, // true: Tolerate use of `eval` and `new Function()` + "expr" : false, // true: Tolerate `ExpressionStatement` as Programs + "funcscope" : false, // true: Tolerate defining variables inside control statements" + "globalstrict" : false, // true: Allow global "use strict" (also enables 'strict') + "iterator" : false, // true: Tolerate using the `__iterator__` property + "lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block + "laxbreak" : false, // true: Tolerate possibly unsafe line breakings + "laxcomma" : false, // true: Tolerate comma-first style coding + "loopfunc" : false, // true: Tolerate functions being defined in loops + "multistr" : false, // true: Tolerate multi-line strings + "proto" : false, // true: Tolerate using the `__proto__` property + "scripturl" : false, // true: Tolerate script-targeted URLs + "smarttabs" : false, // true: Tolerate mixed tabs/spaces when used for alignment + "shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;` + "sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation + "supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;` + "validthis" : false, // true: Tolerate using this in a non-constructor function + + // Environments + "browser" : false, // Web Browser (window, document, etc) + "couch" : false, // CouchDB + "devel" : false, // Development/debugging (alert, confirm, etc) + "dojo" : false, // Dojo Toolkit + "jquery" : false, // jQuery + "mootools" : false, // MooTools + "node" : false, // Node.js + "nonstandard" : false, // Widely adopted globals (escape, unescape, etc) + "prototypejs" : false, // Prototype and Scriptaculous + "rhino" : false, // Rhino + "worker" : false, // Web Workers + "wsh" : false, // Windows Scripting Host + "yui" : false, // Yahoo User Interface + + // Legacy + "nomen" : true, // true: Prohibit dangling `_` in variables + "onevar" : true, // true: Allow only one `var` statement per function + "passfail" : false, // true: Stop on first error + "white" : true, // true: Check against strict whitespace and indentation rules + + // Custom Globals + "globals" : {} // additional predefined global variables +} diff --git a/vendor/blueimp/jquery-file-upload/.npmignore b/vendor/blueimp/jquery-file-upload/.npmignore new file mode 100644 index 000000000..0530f5dbd --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/.npmignore @@ -0,0 +1,20 @@ +* +!css/jquery.fileupload-noscript.css +!css/jquery.fileupload-ui-noscript.css +!css/jquery.fileupload-ui.css +!css/jquery.fileupload.css +!img/loading.gif +!img/progressbar.gif +!js/cors/jquery.postmessage-transport.js +!js/cors/jquery.xdr-transport.js +!js/vendor/jquery.ui.widget.js +!js/jquery.fileupload-angular.js +!js/jquery.fileupload-audio.js +!js/jquery.fileupload-image.js +!js/jquery.fileupload-jquery-ui.js +!js/jquery.fileupload-process.js +!js/jquery.fileupload-ui.js +!js/jquery.fileupload-validate.js +!js/jquery.fileupload-video.js +!js/jquery.fileupload.js +!js/jquery.iframe-transport.js diff --git a/vendor/blueimp/jquery-file-upload/CONTRIBUTING.md b/vendor/blueimp/jquery-file-upload/CONTRIBUTING.md new file mode 100644 index 000000000..e182f9b37 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/CONTRIBUTING.md @@ -0,0 +1,15 @@ +Please follow these pull request guidelines: + +1. Update your fork to the latest upstream version. + +2. Follow the coding conventions of the original source files (indentation, spaces, brackets layout). + +3. Code changes must pass JSHint validation with the `.jshintrc` settings of this project. + +4. Code changes must pass the QUnit tests defined in the `test` folder. + +5. New features should be covered by accompanying QUnit tests. + +6. Keep your commits as atomic as possible, i.e. create a new commit for every single bug fix or feature added. + +7. Always add meaningful commit messages. diff --git a/vendor/blueimp/jquery-file-upload/LICENSE.txt b/vendor/blueimp/jquery-file-upload/LICENSE.txt new file mode 100644 index 000000000..87a644638 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright © 2010 Sebastian Tschan, https://blueimp.net + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/blueimp/jquery-file-upload/README.md b/vendor/blueimp/jquery-file-upload/README.md new file mode 100644 index 000000000..d2f104d5c --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/README.md @@ -0,0 +1,117 @@ +# jQuery File Upload Plugin + +## Description +File Upload widget with multiple file selection, drag&drop support, progress bars, validation and preview images, audio and video for jQuery. +Supports cross-domain, chunked and resumable file uploads and client-side image resizing. Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads. + +## Demo +[Demo File Upload](https://blueimp.github.io/jQuery-File-Upload/) + +## ⚠️ Security Notice +Security related releases: + +* [v9.25.1](https://github.com/blueimp/jQuery-File-Upload/releases/tag/v9.25.1) Mitigates some [Potential vulnerabilities with PHP+ImageMagick](VULNERABILITIES.md#potential-vulnerabilities-with-php+imagemagick). +* [v9.24.1](https://github.com/blueimp/jQuery-File-Upload/releases/tag/v9.24.1) Fixes a [Remote code execution vulnerability in the PHP component](VULNERABILITIES.md#remote-code-execution-vulnerability-in-the-php-component). +* v[9.10.1](https://github.com/blueimp/jQuery-File-Upload/releases/tag/9.10.1) Fixes an [Open redirect vulnerability in the GAE components](VULNERABILITIES.md#open-redirect-vulnerability-in-the-gae-components). +* Commit [4175032](https://github.com/blueimp/jQuery-File-Upload/commit/41750323a464e848856dc4c5c940663498beb74a) (*fixed in all tagged releases*) Fixes a [Cross-site scripting vulnerability in the Iframe Transport](VULNERABILITIES.md#cross-site-scripting-vulnerability-in-the-iframe-transport). + +Please read the [SECURITY](SECURITY.md) document for instructions on how to securely configure your Webserver for file uploads. + +## Setup +* [How to setup the plugin on your website](https://github.com/blueimp/jQuery-File-Upload/wiki/Setup) +* [How to use only the basic plugin (minimal setup guide).](https://github.com/blueimp/jQuery-File-Upload/wiki/Basic-plugin) + +## Features +* **Multiple file upload:** + Allows to select multiple files at once and upload them simultaneously. +* **Drag & Drop support:** + Allows to upload files by dragging them from your desktop or file manager and dropping them on your browser window. +* **Upload progress bar:** + Shows a progress bar indicating the upload progress for individual files and for all uploads combined. +* **Cancelable uploads:** + Individual file uploads can be canceled to stop the upload progress. +* **Resumable uploads:** + Aborted uploads can be resumed with browsers supporting the Blob API. +* **Chunked uploads:** + Large files can be uploaded in smaller chunks with browsers supporting the Blob API. +* **Client-side image resizing:** + Images can be automatically resized on client-side with browsers supporting the required JS APIs. +* **Preview images, audio and video:** + A preview of image, audio and video files can be displayed before uploading with browsers supporting the required APIs. +* **No browser plugins (e.g. Adobe Flash) required:** + The implementation is based on open standards like HTML5 and JavaScript and requires no additional browser plugins. +* **Graceful fallback for legacy browsers:** + Uploads files via XMLHttpRequests if supported and uses iframes as fallback for legacy browsers. +* **HTML file upload form fallback:** + Allows progressive enhancement by using a standard HTML file upload form as widget element. +* **Cross-site file uploads:** + Supports uploading files to a different domain with cross-site XMLHttpRequests or iframe redirects. +* **Multiple plugin instances:** + Allows to use multiple plugin instances on the same webpage. +* **Customizable and extensible:** + Provides an API to set individual options and define callback methods for various upload events. +* **Multipart and file contents stream uploads:** + Files can be uploaded as standard "multipart/form-data" or file contents stream (HTTP PUT file upload). +* **Compatible with any server-side application platform:** + Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads. + +## Requirements + +### Mandatory requirements +* [jQuery](https://jquery.com/) v. 1.6+ +* [jQuery UI widget factory](https://api.jqueryui.com/jQuery.widget/) v. 1.9+ (included): Required for the basic File Upload plugin, but very lightweight without any other dependencies from the jQuery UI suite. +* [jQuery Iframe Transport plugin](https://github.com/blueimp/jQuery-File-Upload/blob/master/js/jquery.iframe-transport.js) (included): Required for [browsers without XHR file upload support](https://github.com/blueimp/jQuery-File-Upload/wiki/Browser-support). + +### Optional requirements +* [JavaScript Templates engine](https://github.com/blueimp/JavaScript-Templates) v. 2.5.4+: Used to render the selected and uploaded files for the Basic Plus UI and jQuery UI versions. +* [JavaScript Load Image library](https://github.com/blueimp/JavaScript-Load-Image) v. 1.13.0+: Required for the image previews and resizing functionality. +* [JavaScript Canvas to Blob polyfill](https://github.com/blueimp/JavaScript-Canvas-to-Blob) v. 2.1.1+:Required for the image previews and resizing functionality. +* [blueimp Gallery](https://github.com/blueimp/Gallery) v. 2.15.1+: Used to display the uploaded images in a lightbox. +* [Bootstrap](http://getbootstrap.com/) v. 3.2.0+ +* [Glyphicons](http://glyphicons.com/) + +The user interface of all versions, except the jQuery UI version, is built with [Bootstrap](http://getbootstrap.com/) and icons from [Glyphicons](http://glyphicons.com/). + +### Cross-domain requirements +[Cross-domain File Uploads](https://github.com/blueimp/jQuery-File-Upload/wiki/Cross-domain-uploads) using the [Iframe Transport plugin](https://github.com/blueimp/jQuery-File-Upload/blob/master/js/jquery.iframe-transport.js) require a redirect back to the origin server to retrieve the upload results. The [example implementation](https://github.com/blueimp/jQuery-File-Upload/blob/master/js/main.js) makes use of [result.html](https://github.com/blueimp/jQuery-File-Upload/blob/master/cors/result.html) as a static redirect page for the origin server. + +The repository also includes the [jQuery XDomainRequest Transport plugin](https://github.com/blueimp/jQuery-File-Upload/blob/master/js/cors/jquery.xdr-transport.js), which enables limited cross-domain AJAX requests in Microsoft Internet Explorer 8 and 9 (IE 10 supports cross-domain XHR requests). +The XDomainRequest object allows GET and POST requests only and doesn't support file uploads. It is used on the [Demo](https://blueimp.github.io/jQuery-File-Upload/) to delete uploaded files from the cross-domain demo file upload service. + +### Custom Backends + +You can add support for various backends by adhering to the specification [outlined here](https://github.com/blueimp/jQuery-File-Upload/wiki/JSON-Response). + +## Browsers + +### Desktop browsers +The File Upload plugin is regularly tested with the latest browser versions and supports the following minimal versions: + +* Google Chrome +* Apple Safari 4.0+ +* Mozilla Firefox 3.0+ +* Opera 11.0+ +* Microsoft Internet Explorer 6.0+ + +### Mobile browsers +The File Upload plugin has been tested with and supports the following mobile browsers: + +* Apple Safari on iOS 6.0+ +* Google Chrome on iOS 6.0+ +* Google Chrome on Android 4.0+ +* Default Browser on Android 2.3+ +* Opera Mobile 12.0+ + +### Supported features +For a detailed overview of the features supported by each browser version, please have a look at the [Extended browser support information](https://github.com/blueimp/jQuery-File-Upload/wiki/Browser-support). + +## Contributing +**Bug fixes** and **new features** can be proposed using [pull requests](https://github.com/blueimp/jQuery-File-Upload/pulls). +Please read the [contribution guidelines](https://github.com/blueimp/jQuery-File-Upload/blob/master/CONTRIBUTING.md) before submitting a pull request. + +## Support +This project is actively maintained, but there is no official support channel. +If you have a question that another developer might help you with, please post to [Stack Overflow](http://stackoverflow.com/questions/tagged/blueimp+jquery+file-upload) and tag your question with `blueimp jquery file upload`. + +## License +Released under the [MIT license](https://opensource.org/licenses/MIT). diff --git a/vendor/blueimp/jquery-file-upload/SECURITY.md b/vendor/blueimp/jquery-file-upload/SECURITY.md new file mode 100644 index 000000000..db58f7dd7 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/SECURITY.md @@ -0,0 +1,133 @@ +# File Upload Security +For an in-depth understanding of the potential security risks of providing file uploads and possible mitigations, please refer to the [OWASP - Unrestricted File Upload](https://www.owasp.org/index.php/Unrestricted_File_Upload) documentation. + +To securely setup the project to serve uploaded files, please refer to the sample [Secure file upload serving configurations](#secure-file-upload-serving-configurations). + +To mitigate potential vulnerabilities in image processing libraries, please refer to the [Secure image processing configurations](#secure-image-processing-configurations). + +By default, all sample upload handlers allow only upload of image files, which mitigates some attack vectors, but should not be relied on as the only protection. + +Please also have a look at the [list of fixed vulnerabilities](VULNERABILITIES.md) in jQuery File Upload, which relates mostly to the sample server-side upload handlers and how they have been configured. + +## Purpose of this project +Please note that this project is not a complete file management product, but foremost a client-side file upload library for [jQuery](https://jquery.com/). +The server-side sample upload handlers are just examples to demonstrate the client-side file upload functionality. + +To make this very clear, there is **no user authentication** by default: +* **everyone can upload files** +* **everyone can delete uploaded files** + +In some cases this can be acceptable, but for most projects you will want to extend the sample upload handlers to integrate user authentication, or implement your own. + +It is also up to you to configure your Webserver to securely serve the uploaded files, e.g. using the [sample server configurations](#secure-file-upload-serving-configurations). + +## Mitigations against file upload risks + +### Prevent code execution on the server +To prevent execution of scripts or binaries on server-side, the upload directory must be configured to not execute files in the upload directory (e.g. `server/php/files` as the default for the PHP upload handler) and only treat uploaded files as static content. + +The recommended way to do this is to configure the upload directory path to point outside of the web application root. +Then the Webserver can be configured to serve files from the upload directory with their default static files handler only. + +Limiting file uploads to a whitelist of safe file types (e.g. image files) also mitigates this issue, but should not be the only protection. + +### Prevent code execution in the browser +To prevent execution of scripts on client-side, the following headers must +be sent when delivering generic uploaded files to the client: + +``` +Content-Type: application/octet-stream +X-Content-Type-Options: nosniff +``` + +The `Content-Type: application/octet-stream` header instructs browsers to display a download dialog instead of parsing it and possibly executing script content e.g. in HTML files. + +The `X-Content-Type-Options: nosniff` header prevents browsers to try to detect the file mime type despite the given content-type header. + +For known safe files, the content-type header can be adjusted using a **whitelist**, e.g. sending `Content-Type: image/png` for PNG files. + +### Prevent distribution of malware +To prevent attackers from uploading and distributing malware (e.g. computer viruses), it is recommended to limit file uploads only to a whitelist of safe file types. + +Please note that the detection of file types in the sample file upload handlers is based on the file extension and not the actual file content. This makes it still possible for attackers to upload malware by giving their files an image file extension, but should prevent automatic execution on client computers when opening those files. + +It does not protect at all from exploiting vulnerabilities in image display programs, nor from users renaming file extensions to inadvertently execute the contained malicious code. + +## Secure file upload serving configurations +The following configurations serve uploaded files as static files with the proper headers as [mitigation against file upload risks](#mitigations-against-file-upload-risks). +Please do not simply copy&paste these configurations, but make sure you understand what they are doing and that you have implemented them correctly. + +> Always test your own setup and make sure that it is secure! + +e.g. try uploading PHP scripts (as "example.php", "example.php.png" and "example.png") to see if they get executed by your Webserver. + +### Apache config +Add the following directive to the Apache config, replacing the directory path with the absolute path to the upload directory: + +```ApacheConf +<Directory "/path/to/project/server/php/files"> + # To enable the Headers module, execute the following command and reload Apache: + # sudo a2enmod headers + + # The following directives prevent the execution of script files + # in the context of the website. + # They also force the content-type application/octet-stream and + # force browsers to display a download dialog for non-image files. + SetHandler default-handler + ForceType application/octet-stream + Header set Content-Disposition attachment + + # The following unsets the forced type and Content-Disposition headers + # for known image files: + <FilesMatch "(?i)\.(gif|jpe?g|png)$"> + ForceType none + Header unset Content-Disposition + </FilesMatch> + + # The following directive prevents browsers from MIME-sniffing the content-type. + # This is an important complement to the ForceType directive above: + Header set X-Content-Type-Options nosniff +</Directory> +``` + +### NGINX config +Add the following directive to the NGINX config, replacing the directory path with the absolute path to the upload directory: + +```Nginx +location ^~ /path/to/project/server/php/files { + root html; + default_type application/octet-stream; + types { + image/gif gif; + image/jpeg jpg; + image/png png; + } + add_header X-Content-Type-Options 'nosniff'; + if ($request_filename ~ /(((?!\.(jpg)|(png)|(gif)$)[^/])+$)) { + add_header Content-Disposition 'attachment; filename="$1"'; + # Add X-Content-Type-Options again, as using add_header in a new context + # dismisses all previous add_header calls: + add_header X-Content-Type-Options 'nosniff'; + } +} +``` + +## Secure image processing configurations +The following configuration mitigates [potential image processing vulnerabilities with ImageMagick](VULNERABILITIES.md#potential-vulnerabilities-with-php+imagemagick) by limiting the attack vectors to a small subset of image types (`GIF/JPEG/PNG`). + +Please also consider using alternative, safer image processing libraries like [libvips](https://github.com/libvips/libvips) or [imageflow](https://github.com/imazen/imageflow). + +## ImageMagick config +It is recommended to disable all non-required ImageMagick coders via [policy.xml](https://wiki.debian.org/imagemagick/security). +To do so, locate the ImageMagick `policy.xml` configuration file and add the following policies: + +```xml +<?xml version="1.0" encoding="UTF-8"?> +<!-- ... --> +<policymap> + <!-- ... --> + <policy domain="delegate" rights="none" pattern="*" /> + <policy domain="coder" rights="none" pattern="*" /> + <policy domain="coder" rights="read | write" pattern="{GIF,JPEG,PNG}" /> +</policymap> +``` diff --git a/vendor/blueimp/jquery-file-upload/VULNERABILITIES.md b/vendor/blueimp/jquery-file-upload/VULNERABILITIES.md new file mode 100644 index 000000000..1561a1401 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/VULNERABILITIES.md @@ -0,0 +1,65 @@ +# ⚠️ List of fixed vulnerabilities + +## Potential vulnerabilities with PHP+ImageMagick +> Mitigated: 2018-10-25 (GMT) + +The sample [PHP upload handler](server/php/UploadHandler.php) before [v9.25.1](https://github.com/blueimp/jQuery-File-Upload/releases/tag/v9.25.1) did not validate file signatures before invoking [ImageMagick](https://www.imagemagick.org/) (via [Imagick](http://php.net/manual/en/book.imagick.php)). +Verifying those [magic bytes](https://en.wikipedia.org/wiki/List_of_file_signatures) mitigates potential vulnerabilities when handling input files other than `GIF/JPEG/PNG`. + +Please also configure ImageMagick to only enable the coders required for `GIF/JPEG/PNG` processing, e.g. with the sample [ImageMagick config](SECURITY.md#imagemagick-config). + +**Further information:** +* Commit containing the mitigation: [fe44d34](https://github.com/blueimp/jQuery-File-Upload/commit/fe44d34be43be32c6b8d507932f318dababb25dd) +* [ImageTragick](https://imagetragick.com/) +* [CERT Vulnerability Note VU#332928](https://www.kb.cert.org/vuls/id/332928) +* [ImageMagick CVE entries](https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=imagemagick) + +## Remote code execution vulnerability in the PHP component +> Fixed: 2018-10-23 (GMT) + +The sample [PHP upload handler](server/php/UploadHandler.php) before [v9.24.1](https://github.com/blueimp/jQuery-File-Upload/releases/tag/v9.24.1) allowed to upload all file types by default. +This opens up a remote code execution vulnerability, unless the server is configured to not execute (PHP) files in the upload directory (`server/php/files`). + +The provided [.htaccess](server/php/files/.htaccess) file includes instructions for Apache to disable script execution, however [.htaccess support](https://httpd.apache.org/docs/current/howto/htaccess.html) is disabled by default since Apache `v2.3.9` via [AllowOverride Directive](https://httpd.apache.org/docs/current/mod/core.html#allowoverride). + +**You are affected if you:** +1. A) Uploaded jQuery File Upload < `v9.24.1` on a Webserver that executes files with `.php` as part of the file extension (e.g. "example.php.png"), e.g. Apache with `mod_php` enabled and the following directive (*not a recommended configuration*): + ```ApacheConf + AddHandler php5-script .php + ``` + B) Uploaded jQuery File Upload < `v9.22.1` on a Webserver that executes files with the file extension `.php`, e.g. Apache with `mod_php` enabled and the following directive: + ```ApacheConf + <FilesMatch \.php$> + SetHandler application/x-httpd-php + </FilesMatch> + ``` +2. Did not actively configure your Webserver to not execute files in the upload directory (`server/php/files`). +3. Are running Apache `v2.3.9+` with the default `AllowOverride` Directive set to `None` or another Webserver with no `.htaccess` support. + +**How to fix it:** +1. Upgrade to the latest version of jQuery File Upload. +2. Configure your Webserver to not execute files in the upload directory, e.g. with the [sample Apache configuration](SECURITY.md#apache-config) + +**Further information:** +* Commits containing the security fix: [aeb47e5](https://github.com/blueimp/jQuery-File-Upload/commit/aeb47e51c67df8a504b7726595576c1c66b5dc2f), [ad4aefd](https://github.com/blueimp/jQuery-File-Upload/commit/ad4aefd96e4056deab6fea2690f0d8cf56bb2d7d) +* [Full disclosure post on Hacker News](https://news.ycombinator.com/item?id=18267309). +* [CVE-2018-9206](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-9206) +* [OWASP - Unrestricted File Upload](https://www.owasp.org/index.php/Unrestricted_File_Upload) + +## Open redirect vulnerability in the GAE components +> Fixed: 2015-06-12 (GMT) + +The sample Google App Engine upload handlers before v[9.10.1](https://github.com/blueimp/jQuery-File-Upload/releases/tag/9.10.1) accepted any URL as redirect target, making it possible to use the Webserver's domain for phishing attacks. + +**Further information:** +* Commit containing the security fix: [f74d2a8](https://github.com/blueimp/jQuery-File-Upload/commit/f74d2a8c3e3b1e8e336678d2899facd5bcdb589f) +* [OWASP - Unvalidated Redirects and Forwards Cheat Sheet](https://www.owasp.org/index.php/Unvalidated_Redirects_and_Forwards_Cheat_Sheet) + +## Cross-site scripting vulnerability in the Iframe Transport +> Fixed: 2012-08-09 (GMT) + +The [redirect page](cors/result.html) for the [Iframe Transport](js/jquery.iframe-transport.js) before commit [4175032](https://github.com/blueimp/jQuery-File-Upload/commit/41750323a464e848856dc4c5c940663498beb74a) (*fixed in all tagged releases*) allowed executing arbitrary JavaScript in the context of the Webserver. + +**Further information:** +* Commit containing the security fix: [4175032](https://github.com/blueimp/jQuery-File-Upload/commit/41750323a464e848856dc4c5c940663498beb74a) +* [OWASP - Cross-site Scripting (XSS)](https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)) diff --git a/vendor/blueimp/jquery-file-upload/angularjs.html b/vendor/blueimp/jquery-file-upload/angularjs.html new file mode 100644 index 000000000..2051bbf79 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/angularjs.html @@ -0,0 +1,211 @@ +<!DOCTYPE HTML> +<!-- +/* + * jQuery File Upload Plugin AngularJS Demo + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ +--> +<html lang="en"> +<head> +<!-- Force latest IE rendering engine or ChromeFrame if installed --> +<!--[if IE]> +<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> +<![endif]--> +<meta charset="utf-8"> +<title>jQuery File Upload Demo - AngularJS version</title> +<meta name="description" content="File Upload widget with multiple file selection, drag&drop support, progress bars, validation and preview images, audio and video for AngularJS. Supports cross-domain, chunked and resumable file uploads and client-side image resizing. Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads."> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<!-- Bootstrap styles --> +<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> +<!-- Generic page styles --> +<link rel="stylesheet" href="css/style.css"> +<!-- blueimp Gallery styles --> +<link rel="stylesheet" href="https://blueimp.github.io/Gallery/css/blueimp-gallery.min.css"> +<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars --> +<link rel="stylesheet" href="css/jquery.fileupload.css"> +<link rel="stylesheet" href="css/jquery.fileupload-ui.css"> +<!-- CSS adjustments for browsers with JavaScript disabled --> +<noscript><link rel="stylesheet" href="css/jquery.fileupload-noscript.css"></noscript> +<noscript><link rel="stylesheet" href="css/jquery.fileupload-ui-noscript.css"></noscript> +<style> +/* Hide Angular JS elements before initializing */ +.ng-cloak { + display: none; +} +</style> +</head> +<body> +<div class="navbar navbar-default navbar-fixed-top"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-fixed-top .navbar-collapse"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="https://github.com/blueimp/jQuery-File-Upload">jQuery File Upload</a> + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li><a href="https://github.com/blueimp/jQuery-File-Upload/tags">Download</a></li> + <li><a href="https://github.com/blueimp/jQuery-File-Upload">Source Code</a></li> + <li><a href="https://github.com/blueimp/jQuery-File-Upload/wiki">Documentation</a></li> + <li><a href="https://blueimp.net">© Sebastian Tschan</a></li> + </ul> + </div> + </div> +</div> +<div class="container"> + <h1>jQuery File Upload Demo</h1> + <h2 class="lead">AngularJS version</h2> + <ul class="nav nav-tabs"> + <li><a href="basic.html">Basic</a></li> + <li><a href="basic-plus.html">Basic Plus</a></li> + <li><a href="index.html">Basic Plus UI</a></li> + <li class="active"><a href="angularjs.html">AngularJS</a></li> + <li><a href="jquery-ui.html">jQuery UI</a></li> + </ul> + <br> + <blockquote> + <p>File Upload widget with multiple file selection, drag&drop support, progress bars, validation and preview images, audio and video for AngularJS.<br> + Supports cross-domain, chunked and resumable file uploads and client-side image resizing.<br> + Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.</p> + </blockquote> + <br> + <!-- The file upload form used as target for the file upload widget --> + <form id="fileupload" action="https://jquery-file-upload.appspot.com/" method="POST" enctype="multipart/form-data" data-ng-app="demo" data-ng-controller="DemoFileUploadController" data-file-upload="options" data-ng-class="{'fileupload-processing': processing() || loadingFiles}"> + <!-- Redirect browsers with JavaScript disabled to the origin page --> + <noscript><input type="hidden" name="redirect" value="https://blueimp.github.io/jQuery-File-Upload/"></noscript> + <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload --> + <div class="row fileupload-buttonbar"> + <div class="col-lg-7"> + <!-- The fileinput-button span is used to style the file input field as button --> + <span class="btn btn-success fileinput-button" ng-class="{disabled: disabled}"> + <i class="glyphicon glyphicon-plus"></i> + <span>Add files...</span> + <input type="file" name="files[]" multiple ng-disabled="disabled"> + </span> + <button type="button" class="btn btn-primary start" data-ng-click="submit()"> + <i class="glyphicon glyphicon-upload"></i> + <span>Start upload</span> + </button> + <button type="button" class="btn btn-warning cancel" data-ng-click="cancel()"> + <i class="glyphicon glyphicon-ban-circle"></i> + <span>Cancel upload</span> + </button> + <!-- The global file processing state --> + <span class="fileupload-process"></span> + </div> + <!-- The global progress state --> + <div class="col-lg-5 fade" data-ng-class="{in: active()}"> + <!-- The global progress bar --> + <div class="progress progress-striped active" data-file-upload-progress="progress()"><div class="progress-bar progress-bar-success" data-ng-style="{width: num + '%'}"></div></div> + <!-- The extended global progress state --> + <div class="progress-extended"> </div> + </div> + </div> + <!-- The table listing the files available for upload/download --> + <table class="table table-striped files ng-cloak"> + <tr data-ng-repeat="file in queue" data-ng-class="{'processing': file.$processing()}"> + <td data-ng-switch data-on="!!file.thumbnailUrl"> + <div class="preview" data-ng-switch-when="true"> + <a data-ng-href="{{file.url}}" title="{{file.name}}" download="{{file.name}}" data-gallery><img data-ng-src="{{file.thumbnailUrl}}" alt=""></a> + </div> + <div class="preview" data-ng-switch-default data-file-upload-preview="file"></div> + </td> + <td> + <p class="name" data-ng-switch data-on="!!file.url"> + <span data-ng-switch-when="true" data-ng-switch data-on="!!file.thumbnailUrl"> + <a data-ng-switch-when="true" data-ng-href="{{file.url}}" title="{{file.name}}" download="{{file.name}}" data-gallery>{{file.name}}</a> + <a data-ng-switch-default data-ng-href="{{file.url}}" title="{{file.name}}" download="{{file.name}}">{{file.name}}</a> + </span> + <span data-ng-switch-default>{{file.name}}</span> + </p> + <strong data-ng-show="file.error" class="error text-danger">{{file.error}}</strong> + </td> + <td> + <p class="size">{{file.size | formatFileSize}}</p> + <div class="progress progress-striped active fade" data-ng-class="{pending: 'in'}[file.$state()]" data-file-upload-progress="file.$progress()"><div class="progress-bar progress-bar-success" data-ng-style="{width: num + '%'}"></div></div> + </td> + <td> + <button type="button" class="btn btn-primary start" data-ng-click="file.$submit()" data-ng-hide="!file.$submit || options.autoUpload" data-ng-disabled="file.$state() == 'pending' || file.$state() == 'rejected'"> + <i class="glyphicon glyphicon-upload"></i> + <span>Start</span> + </button> + <button type="button" class="btn btn-warning cancel" data-ng-click="file.$cancel()" data-ng-hide="!file.$cancel"> + <i class="glyphicon glyphicon-ban-circle"></i> + <span>Cancel</span> + </button> + <button data-ng-controller="FileDestroyController" type="button" class="btn btn-danger destroy" data-ng-click="file.$destroy()" data-ng-hide="!file.$destroy"> + <i class="glyphicon glyphicon-trash"></i> + <span>Delete</span> + </button> + </td> + </tr> + </table> + </form> + <br> + <div class="panel panel-default"> + <div class="panel-heading"> + <h3 class="panel-title">Demo Notes</h3> + </div> + <div class="panel-body"> + <ul> + <li>The maximum file size for uploads in this demo is <strong>999 KB</strong> (default file size is unlimited).</li> + <li>Only image files (<strong>JPG, GIF, PNG</strong>) are allowed in this demo (by default there is no file type restriction).</li> + <li>Uploaded files will be deleted automatically after <strong>5 minutes or less</strong> (demo files are stored in memory).</li> + <li>You can <strong>drag & drop</strong> files from your desktop on this webpage (see <a href="https://github.com/blueimp/jQuery-File-Upload/wiki/Browser-support">Browser support</a>).</li> + <li>Please refer to the <a href="https://github.com/blueimp/jQuery-File-Upload">project website</a> and <a href="https://github.com/blueimp/jQuery-File-Upload/wiki">documentation</a> for more information.</li> + <li>Built with the <a href="http://getbootstrap.com/">Bootstrap</a> CSS framework and Icons from <a href="http://glyphicons.com/">Glyphicons</a>.</li> + </ul> + </div> + </div> +</div> +<!-- The blueimp Gallery widget --> +<div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls" data-filter=":even"> + <div class="slides"></div> + <h3 class="title"></h3> + <a class="prev">‹</a> + <a class="next">›</a> + <a class="close">×</a> + <a class="play-pause"></a> + <ol class="indicator"></ol> +</div> +<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> +<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script> +<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included --> +<script src="js/vendor/jquery.ui.widget.js"></script> +<!-- The Load Image plugin is included for the preview images and image resizing functionality --> +<script src="https://blueimp.github.io/JavaScript-Load-Image/js/load-image.all.min.js"></script> +<!-- The Canvas to Blob plugin is included for image resizing functionality --> +<script src="https://blueimp.github.io/JavaScript-Canvas-to-Blob/js/canvas-to-blob.min.js"></script> +<!-- Bootstrap JS is not required, but included for the responsive demo navigation --> +<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> +<!-- blueimp Gallery script --> +<script src="https://blueimp.github.io/Gallery/js/jquery.blueimp-gallery.min.js"></script> +<!-- The Iframe Transport is required for browsers without support for XHR file uploads --> +<script src="js/jquery.iframe-transport.js"></script> +<!-- The basic File Upload plugin --> +<script src="js/jquery.fileupload.js"></script> +<!-- The File Upload processing plugin --> +<script src="js/jquery.fileupload-process.js"></script> +<!-- The File Upload image preview & resize plugin --> +<script src="js/jquery.fileupload-image.js"></script> +<!-- The File Upload audio preview plugin --> +<script src="js/jquery.fileupload-audio.js"></script> +<!-- The File Upload video preview plugin --> +<script src="js/jquery.fileupload-video.js"></script> +<!-- The File Upload validation plugin --> +<script src="js/jquery.fileupload-validate.js"></script> +<!-- The File Upload Angular JS module --> +<script src="js/jquery.fileupload-angular.js"></script> +<!-- The main application script --> +<script src="js/app.js"></script> +</body> +</html> diff --git a/vendor/blueimp/jquery-file-upload/basic-plus.html b/vendor/blueimp/jquery-file-upload/basic-plus.html new file mode 100644 index 000000000..acee24843 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/basic-plus.html @@ -0,0 +1,226 @@ +<!DOCTYPE HTML> +<!-- +/* + * jQuery File Upload Plugin Basic Plus Demo + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ +--> +<html lang="en"> +<head> +<!-- Force latest IE rendering engine or ChromeFrame if installed --> +<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><![endif]--> +<meta charset="utf-8"> +<title>jQuery File Upload Demo - Basic Plus version</title> +<meta name="description" content="File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads."> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<!-- Bootstrap styles --> +<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> +<!-- Generic page styles --> +<link rel="stylesheet" href="css/style.css"> +<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars --> +<link rel="stylesheet" href="css/jquery.fileupload.css"> +</head> +<body> +<div class="navbar navbar-default navbar-fixed-top"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-fixed-top .navbar-collapse"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="https://github.com/blueimp/jQuery-File-Upload">jQuery File Upload</a> + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li><a href="https://github.com/blueimp/jQuery-File-Upload/tags">Download</a></li> + <li><a href="https://github.com/blueimp/jQuery-File-Upload">Source Code</a></li> + <li><a href="https://github.com/blueimp/jQuery-File-Upload/wiki">Documentation</a></li> + <li><a href="https://blueimp.net">© Sebastian Tschan</a></li> + </ul> + </div> + </div> +</div> +<div class="container"> + <h1>jQuery File Upload Demo</h1> + <h2 class="lead">Basic Plus version</h2> + <ul class="nav nav-tabs"> + <li><a href="basic.html">Basic</a></li> + <li class="active"><a href="basic-plus.html">Basic Plus</a></li> + <li><a href="index.html">Basic Plus UI</a></li> + <li><a href="angularjs.html">AngularJS</a></li> + <li><a href="jquery-ui.html">jQuery UI</a></li> + </ul> + <br> + <blockquote> + <p>File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery.<br> + Supports cross-domain, chunked and resumable file uploads and client-side image resizing.<br> + Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.</p> + </blockquote> + <br> + <!-- The fileinput-button span is used to style the file input field as button --> + <span class="btn btn-success fileinput-button"> + <i class="glyphicon glyphicon-plus"></i> + <span>Add files...</span> + <!-- The file input field used as target for the file upload widget --> + <input id="fileupload" type="file" name="files[]" multiple> + </span> + <br> + <br> + <!-- The global progress bar --> + <div id="progress" class="progress"> + <div class="progress-bar progress-bar-success"></div> + </div> + <!-- The container for the uploaded files --> + <div id="files" class="files"></div> + <br> + <div class="panel panel-default"> + <div class="panel-heading"> + <h3 class="panel-title">Demo Notes</h3> + </div> + <div class="panel-body"> + <ul> + <li>The maximum file size for uploads in this demo is <strong>999 KB</strong> (default file size is unlimited).</li> + <li>Only image files (<strong>JPG, GIF, PNG</strong>) are allowed in this demo (by default there is no file type restriction).</li> + <li>Uploaded files will be deleted automatically after <strong>5 minutes or less</strong> (demo files are stored in memory).</li> + <li>You can <strong>drag & drop</strong> files from your desktop on this webpage (see <a href="https://github.com/blueimp/jQuery-File-Upload/wiki/Browser-support">Browser support</a>).</li> + <li>Please refer to the <a href="https://github.com/blueimp/jQuery-File-Upload">project website</a> and <a href="https://github.com/blueimp/jQuery-File-Upload/wiki">documentation</a> for more information.</li> + <li>Built with the <a href="http://getbootstrap.com/">Bootstrap</a> CSS framework and Icons from <a href="http://glyphicons.com/">Glyphicons</a>.</li> + </ul> + </div> + </div> +</div> +<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> +<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included --> +<script src="js/vendor/jquery.ui.widget.js"></script> +<!-- The Load Image plugin is included for the preview images and image resizing functionality --> +<script src="https://blueimp.github.io/JavaScript-Load-Image/js/load-image.all.min.js"></script> +<!-- The Canvas to Blob plugin is included for image resizing functionality --> +<script src="https://blueimp.github.io/JavaScript-Canvas-to-Blob/js/canvas-to-blob.min.js"></script> +<!-- Bootstrap JS is not required, but included for the responsive demo navigation --> +<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> +<!-- The Iframe Transport is required for browsers without support for XHR file uploads --> +<script src="js/jquery.iframe-transport.js"></script> +<!-- The basic File Upload plugin --> +<script src="js/jquery.fileupload.js"></script> +<!-- The File Upload processing plugin --> +<script src="js/jquery.fileupload-process.js"></script> +<!-- The File Upload image preview & resize plugin --> +<script src="js/jquery.fileupload-image.js"></script> +<!-- The File Upload audio preview plugin --> +<script src="js/jquery.fileupload-audio.js"></script> +<!-- The File Upload video preview plugin --> +<script src="js/jquery.fileupload-video.js"></script> +<!-- The File Upload validation plugin --> +<script src="js/jquery.fileupload-validate.js"></script> +<script> +/*jslint unparam: true, regexp: true */ +/*global window, $ */ +$(function () { + 'use strict'; + // Change this to the location of your server-side upload handler: + var url = window.location.hostname === 'blueimp.github.io' ? + '//jquery-file-upload.appspot.com/' : 'server/php/', + uploadButton = $('<button/>') + .addClass('btn btn-primary') + .prop('disabled', true) + .text('Processing...') + .on('click', function () { + var $this = $(this), + data = $this.data(); + $this + .off('click') + .text('Abort') + .on('click', function () { + $this.remove(); + data.abort(); + }); + data.submit().always(function () { + $this.remove(); + }); + }); + $('#fileupload').fileupload({ + url: url, + dataType: 'json', + autoUpload: false, + acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, + maxFileSize: 999000, + // Enable image resizing, except for Android and Opera, + // which actually support image resizing, but fail to + // send Blob objects via XHR requests: + disableImageResize: /Android(?!.*Chrome)|Opera/ + .test(window.navigator.userAgent), + previewMaxWidth: 100, + previewMaxHeight: 100, + previewCrop: true + }).on('fileuploadadd', function (e, data) { + data.context = $('<div/>').appendTo('#files'); + $.each(data.files, function (index, file) { + var node = $('<p/>') + .append($('<span/>').text(file.name)); + if (!index) { + node + .append('<br>') + .append(uploadButton.clone(true).data(data)); + } + node.appendTo(data.context); + }); + }).on('fileuploadprocessalways', function (e, data) { + var index = data.index, + file = data.files[index], + node = $(data.context.children()[index]); + if (file.preview) { + node + .prepend('<br>') + .prepend(file.preview); + } + if (file.error) { + node + .append('<br>') + .append($('<span class="text-danger"/>').text(file.error)); + } + if (index + 1 === data.files.length) { + data.context.find('button') + .text('Upload') + .prop('disabled', !!data.files.error); + } + }).on('fileuploadprogressall', function (e, data) { + var progress = parseInt(data.loaded / data.total * 100, 10); + $('#progress .progress-bar').css( + 'width', + progress + '%' + ); + }).on('fileuploaddone', function (e, data) { + $.each(data.result.files, function (index, file) { + if (file.url) { + var link = $('<a>') + .attr('target', '_blank') + .prop('href', file.url); + $(data.context.children()[index]) + .wrap(link); + } else if (file.error) { + var error = $('<span class="text-danger"/>').text(file.error); + $(data.context.children()[index]) + .append('<br>') + .append(error); + } + }); + }).on('fileuploadfail', function (e, data) { + $.each(data.files, function (index) { + var error = $('<span class="text-danger"/>').text('File upload failed.'); + $(data.context.children()[index]) + .append('<br>') + .append(error); + }); + }).prop('disabled', !$.support.fileInput) + .parent().addClass($.support.fileInput ? undefined : 'disabled'); +}); +</script> +</body> +</html> diff --git a/vendor/blueimp/jquery-file-upload/basic.html b/vendor/blueimp/jquery-file-upload/basic.html new file mode 100644 index 000000000..232a24624 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/basic.html @@ -0,0 +1,136 @@ +<!DOCTYPE HTML> +<!-- +/* + * jQuery File Upload Plugin Basic Demo + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ +--> +<html lang="en"> +<head> +<!-- Force latest IE rendering engine or ChromeFrame if installed --> +<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><![endif]--> +<meta charset="utf-8"> +<title>jQuery File Upload Demo - Basic version</title> +<meta name="description" content="File Upload widget with multiple file selection, drag&drop support and progress bar for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads."> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<!-- Bootstrap styles --> +<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> +<!-- Generic page styles --> +<link rel="stylesheet" href="css/style.css"> +<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars --> +<link rel="stylesheet" href="css/jquery.fileupload.css"> +</head> +<body> +<div class="navbar navbar-default navbar-fixed-top"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-fixed-top .navbar-collapse"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="https://github.com/blueimp/jQuery-File-Upload">jQuery File Upload</a> + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li><a href="https://github.com/blueimp/jQuery-File-Upload/tags">Download</a></li> + <li><a href="https://github.com/blueimp/jQuery-File-Upload">Source Code</a></li> + <li><a href="https://github.com/blueimp/jQuery-File-Upload/wiki">Documentation</a></li> + <li><a href="https://blueimp.net">© Sebastian Tschan</a></li> + </ul> + </div> + </div> +</div> +<div class="container"> + <h1>jQuery File Upload Demo</h1> + <h2 class="lead">Basic version</h2> + <ul class="nav nav-tabs"> + <li class="active"><a href="basic.html">Basic</a></li> + <li><a href="basic-plus.html">Basic Plus</a></li> + <li><a href="index.html">Basic Plus UI</a></li> + <li><a href="angularjs.html">AngularJS</a></li> + <li><a href="jquery-ui.html">jQuery UI</a></li> + </ul> + <br> + <blockquote> + <p>File Upload widget with multiple file selection, drag&drop support and progress bar for jQuery.<br> + Supports cross-domain, chunked and resumable file uploads.<br> + Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.</p> + </blockquote> + <br> + <!-- The fileinput-button span is used to style the file input field as button --> + <span class="btn btn-success fileinput-button"> + <i class="glyphicon glyphicon-plus"></i> + <span>Select files...</span> + <!-- The file input field used as target for the file upload widget --> + <input id="fileupload" type="file" name="files[]" multiple> + </span> + <br> + <br> + <!-- The global progress bar --> + <div id="progress" class="progress"> + <div class="progress-bar progress-bar-success"></div> + </div> + <!-- The container for the uploaded files --> + <div id="files" class="files"></div> + <br> + <div class="panel panel-default"> + <div class="panel-heading"> + <h3 class="panel-title">Demo Notes</h3> + </div> + <div class="panel-body"> + <ul> + <li>The maximum file size for uploads in this demo is <strong>999 KB</strong> (default file size is unlimited).</li> + <li>Only image files (<strong>JPG, GIF, PNG</strong>) are allowed in this demo (by default there is no file type restriction).</li> + <li>Uploaded files will be deleted automatically after <strong>5 minutes or less</strong> (demo files are stored in memory).</li> + <li>You can <strong>drag & drop</strong> files from your desktop on this webpage (see <a href="https://github.com/blueimp/jQuery-File-Upload/wiki/Browser-support">Browser support</a>).</li> + <li>Please refer to the <a href="https://github.com/blueimp/jQuery-File-Upload">project website</a> and <a href="https://github.com/blueimp/jQuery-File-Upload/wiki">documentation</a> for more information.</li> + <li>Built with the <a href="http://getbootstrap.com/">Bootstrap</a> CSS framework and Icons from <a href="http://glyphicons.com/">Glyphicons</a>.</li> + </ul> + </div> + </div> +</div> +<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> +<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included --> +<script src="js/vendor/jquery.ui.widget.js"></script> +<!-- The Iframe Transport is required for browsers without support for XHR file uploads --> +<script src="js/jquery.iframe-transport.js"></script> +<!-- The basic File Upload plugin --> +<script src="js/jquery.fileupload.js"></script> +<!-- Bootstrap JS is not required, but included for the responsive demo navigation --> +<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> +<script> +/*jslint unparam: true */ +/*global window, $ */ +$(function () { + 'use strict'; + // Change this to the location of your server-side upload handler: + var url = window.location.hostname === 'blueimp.github.io' ? + '//jquery-file-upload.appspot.com/' : 'server/php/'; + $('#fileupload').fileupload({ + url: url, + dataType: 'json', + done: function (e, data) { + $.each(data.result.files, function (index, file) { + $('<p/>').text(file.name).appendTo('#files'); + }); + }, + progressall: function (e, data) { + var progress = parseInt(data.loaded / data.total * 100, 10); + $('#progress .progress-bar').css( + 'width', + progress + '%' + ); + } + }).prop('disabled', !$.support.fileInput) + .parent().addClass($.support.fileInput ? undefined : 'disabled'); +}); +</script> +</body> +</html> diff --git a/vendor/blueimp/jquery-file-upload/bower-version-update.js b/vendor/blueimp/jquery-file-upload/bower-version-update.js new file mode 100755 index 000000000..09ce3927e --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/bower-version-update.js @@ -0,0 +1,16 @@ +#!/usr/bin/env node + +'use strict'; + +var path = require('path'); +var packageJSON = require(path.join(__dirname, 'package.json')); +var bowerFile = path.join(__dirname, 'bower.json'); +var bowerJSON = require('bower-json').parse( + require(bowerFile), + {normalize: true} +); +bowerJSON.version = packageJSON.version; +require('fs').writeFileSync( + bowerFile, + JSON.stringify(bowerJSON, null, 2) + '\n' +); diff --git a/vendor/blueimp/jquery-file-upload/bower.json b/vendor/blueimp/jquery-file-upload/bower.json new file mode 100644 index 000000000..34594a32f --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/bower.json @@ -0,0 +1,64 @@ +{ + "name": "blueimp-file-upload", + "version": "9.25.1", + "title": "jQuery File Upload", + "description": "File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images.", + "keywords": [ + "jquery", + "file", + "upload", + "widget", + "multiple", + "selection", + "drag", + "drop", + "progress", + "preview", + "cross-domain", + "cross-site", + "chunk", + "resume", + "gae", + "go", + "python", + "php", + "bootstrap" + ], + "homepage": "https://github.com/blueimp/jQuery-File-Upload", + "author": { + "name": "Sebastian Tschan", + "url": "https://blueimp.net" + }, + "maintainers": [ + { + "name": "Sebastian Tschan", + "url": "https://blueimp.net" + } + ], + "repository": { + "type": "git", + "url": "git://github.com/blueimp/jQuery-File-Upload.git" + }, + "bugs": "https://github.com/blueimp/jQuery-File-Upload/issues", + "license": "MIT", + "dependencies": { + "jquery": ">=1.6", + "blueimp-tmpl": ">=2.5.4", + "blueimp-load-image": ">=1.13.0", + "blueimp-canvas-to-blob": ">=2.1.1" + }, + "main": [ + "js/jquery.fileupload.js" + ], + "ignore": [ + "/*.*", + "/cors", + "css/jquery-ui-demo-ie8.css", + "css/jquery-ui-demo.css", + "css/style.css", + "js/app.js", + "js/main.js", + "server", + "test" + ] +} diff --git a/vendor/blueimp/jquery-file-upload/composer.json b/vendor/blueimp/jquery-file-upload/composer.json new file mode 100644 index 000000000..d17f4ff9e --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/composer.json @@ -0,0 +1,39 @@ +{ + "name": "blueimp/jquery-file-upload" + , "description": "File Upload widget for jQuery." + , "keywords": ["jquery", + "file", + "upload", + "widget", + "multiple", + "selection", + "drag", + "drop", + "progress", + "preview", + "cross-domain", + "cross-site", + "chunk", + "resume", + "gae", + "go", + "python", + "php", + "bootstrap"] + , "homepage": "https://github.com/blueimp/jQuery-File-Upload" + , "authors": [ + { + "name": "Sebastian Tschan", + "homepage": "https://blueimp.net" + } + ] + , "support": { + "forum": "https://groups.google.com/forum/#!forum/jquery-fileupload" + } + , "license": "MIT" + , "autoload": { + "classmap": [ + "server/php/UploadHandler.php" + ] + } +} diff --git a/vendor/blueimp/jquery-file-upload/cors/postmessage.html b/vendor/blueimp/jquery-file-upload/cors/postmessage.html new file mode 100644 index 000000000..6a56cf0b6 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/cors/postmessage.html @@ -0,0 +1,75 @@ +<!DOCTYPE HTML> +<!-- +/* + * jQuery File Upload Plugin postMessage API + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2011, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ +--> +<html lang="en"> +<head> +<meta charset="utf-8"> +<title>jQuery File Upload Plugin postMessage API</title> +<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> +</head> +<body> +<script> +/*jslint unparam: true, regexp: true */ +/*global $, Blob, FormData, location */ +'use strict'; +var origin = /^http:\/\/example.org/, + target = new RegExp('^(http(s)?:)?\\/\\/' + location.host + '\\/'); +$(window).on('message', function (e) { + e = e.originalEvent; + var s = e.data, + xhr = $.ajaxSettings.xhr(), + f; + if (!origin.test(e.origin)) { + throw new Error('Origin "' + e.origin + '" does not match ' + origin); + } + if (!target.test(e.data.url)) { + throw new Error('Target "' + e.data.url + '" does not match ' + target); + } + $(xhr.upload).on('progress', function (ev) { + ev = ev.originalEvent; + e.source.postMessage({ + id: s.id, + type: ev.type, + timeStamp: ev.timeStamp, + lengthComputable: ev.lengthComputable, + loaded: ev.loaded, + total: ev.total + }, e.origin); + }); + s.xhr = function () { + return xhr; + }; + if (!(s.data instanceof Blob)) { + f = new FormData(); + $.each(s.data, function (i, v) { + f.append(v.name, v.value); + }); + s.data = f; + } + $.ajax(s).always(function (result, statusText, jqXHR) { + if (!jqXHR.done) { + jqXHR = result; + result = null; + } + e.source.postMessage({ + id: s.id, + status: jqXHR.status, + statusText: statusText, + result: result, + headers: jqXHR.getAllResponseHeaders() + }, e.origin); + }); +}); +</script> +</body> +</html> diff --git a/vendor/blueimp/jquery-file-upload/cors/result.html b/vendor/blueimp/jquery-file-upload/cors/result.html new file mode 100644 index 000000000..e3d629814 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/cors/result.html @@ -0,0 +1,24 @@ +<!DOCTYPE HTML> +<!-- +/* + * jQuery Iframe Transport Plugin Redirect Page + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ +--> +<html lang="en"> +<head> +<meta charset="utf-8"> +<title>jQuery Iframe Transport Plugin Redirect Page</title> +</head> +<body> +<script> +document.body.innerText=document.body.textContent=decodeURIComponent(window.location.search.slice(1)); +</script> +</body> +</html> diff --git a/vendor/blueimp/jquery-file-upload/css/jquery-ui-demo-ie8.css b/vendor/blueimp/jquery-file-upload/css/jquery-ui-demo-ie8.css new file mode 100644 index 000000000..e0e8ea9b0 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/css/jquery-ui-demo-ie8.css @@ -0,0 +1,21 @@ +@charset "UTF-8"; +/* + * jQuery File Upload Demo CSS Fixes for IE<9 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +.navigation { + list-style: none; + padding: 0; + margin: 1em 0; +} +.navigation li { + display: inline; + margin-right: 10px; +} diff --git a/vendor/blueimp/jquery-file-upload/css/jquery-ui-demo.css b/vendor/blueimp/jquery-file-upload/css/jquery-ui-demo.css new file mode 100644 index 000000000..d7d524df5 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/css/jquery-ui-demo.css @@ -0,0 +1,67 @@ +@charset "UTF-8"; +/* + * jQuery File Upload Demo CSS + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +body { + max-width: 750px; + margin: 0 auto; + padding: 1em; + font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif; + font-size: 1em; + line-height: 1.4em; + background: #222; + color: #fff; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; +} +a { + color: orange; + text-decoration: none; +} +img { + border: 0; + vertical-align: middle; +} +h1 { + line-height: 1em; +} +blockquote { + padding: 0 0 0 15px; + margin: 0 0 20px; + border-left: 5px solid #eee; +} +table { + width: 100%; + margin: 10px 0; +} + +.fileupload-progress { + margin: 10px 0; +} +.fileupload-progress .progress-extended { + margin-top: 5px; +} +.error { + color: red; +} + +@media (min-width: 481px) { + .navigation { + list-style: none; + padding: 0; + } + .navigation li { + display: inline-block; + } + .navigation li:not(:first-child):before { + content: "| "; + } +} diff --git a/vendor/blueimp/jquery-file-upload/css/jquery.fileupload-noscript.css b/vendor/blueimp/jquery-file-upload/css/jquery.fileupload-noscript.css new file mode 100644 index 000000000..2409bfb0a --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/css/jquery.fileupload-noscript.css @@ -0,0 +1,22 @@ +@charset "UTF-8"; +/* + * jQuery File Upload Plugin NoScript CSS + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +.fileinput-button input { + position: static; + opacity: 1; + filter: none; + font-size: inherit !important; + direction: inherit; +} +.fileinput-button span { + display: none; +} diff --git a/vendor/blueimp/jquery-file-upload/css/jquery.fileupload-ui-noscript.css b/vendor/blueimp/jquery-file-upload/css/jquery.fileupload-ui-noscript.css new file mode 100644 index 000000000..30651acf0 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/css/jquery.fileupload-ui-noscript.css @@ -0,0 +1,17 @@ +@charset "UTF-8"; +/* + * jQuery File Upload UI Plugin NoScript CSS + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2012, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +.fileinput-button i, +.fileupload-buttonbar .delete, +.fileupload-buttonbar .toggle { + display: none; +} diff --git a/vendor/blueimp/jquery-file-upload/css/jquery.fileupload-ui.css b/vendor/blueimp/jquery-file-upload/css/jquery.fileupload-ui.css new file mode 100644 index 000000000..9e36c42c5 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/css/jquery.fileupload-ui.css @@ -0,0 +1,57 @@ +@charset "UTF-8"; +/* + * jQuery File Upload UI Plugin CSS + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +.fileupload-buttonbar .btn, +.fileupload-buttonbar .toggle { + margin-bottom: 5px; +} +.progress-animated .progress-bar, +.progress-animated .bar { + background: url("../img/progressbar.gif") !important; + filter: none; +} +.fileupload-process { + float: right; + display: none; +} +.fileupload-processing .fileupload-process, +.files .processing .preview { + display: block; + width: 32px; + height: 32px; + background: url("../img/loading.gif") center no-repeat; + background-size: contain; +} +.files audio, +.files video { + max-width: 300px; +} + +@media (max-width: 767px) { + .fileupload-buttonbar .toggle, + .files .toggle, + .files .btn span { + display: none; + } + .files .name { + width: 80px; + word-wrap: break-word; + } + .files audio, + .files video { + max-width: 80px; + } + .files img, + .files canvas { + max-width: 100%; + } +} diff --git a/vendor/blueimp/jquery-file-upload/css/jquery.fileupload.css b/vendor/blueimp/jquery-file-upload/css/jquery.fileupload.css new file mode 100644 index 000000000..8ae3b09d4 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/css/jquery.fileupload.css @@ -0,0 +1,37 @@ +@charset "UTF-8"; +/* + * jQuery File Upload Plugin CSS + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +.fileinput-button { + position: relative; + overflow: hidden; + display: inline-block; +} +.fileinput-button input { + position: absolute; + top: 0; + right: 0; + margin: 0; + opacity: 0; + -ms-filter: 'alpha(opacity=0)'; + font-size: 200px !important; + direction: ltr; + cursor: pointer; +} + +/* Fixes for IE < 8 */ +@media screen\9 { + .fileinput-button input { + filter: alpha(opacity=0); + font-size: 100%; + height: 100%; + } +} diff --git a/vendor/blueimp/jquery-file-upload/css/style.css b/vendor/blueimp/jquery-file-upload/css/style.css new file mode 100644 index 000000000..3aee25689 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/css/style.css @@ -0,0 +1,15 @@ +@charset "UTF-8"; +/* + * jQuery File Upload Plugin CSS Example + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +body { + padding-top: 60px; +} diff --git a/vendor/blueimp/jquery-file-upload/img/loading.gif b/vendor/blueimp/jquery-file-upload/img/loading.gif Binary files differnew file mode 100644 index 000000000..90f28cbdb --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/img/loading.gif diff --git a/vendor/blueimp/jquery-file-upload/img/progressbar.gif b/vendor/blueimp/jquery-file-upload/img/progressbar.gif Binary files differnew file mode 100644 index 000000000..fbcce6bc9 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/img/progressbar.gif diff --git a/vendor/blueimp/jquery-file-upload/index.html b/vendor/blueimp/jquery-file-upload/index.html new file mode 100644 index 000000000..c8c66ad8b --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/index.html @@ -0,0 +1,255 @@ +<!DOCTYPE HTML> +<!-- +/* + * jQuery File Upload Plugin Demo + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ +--> +<html lang="en"> +<head> +<!-- Force latest IE rendering engine or ChromeFrame if installed --> +<!--[if IE]> +<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> +<![endif]--> +<meta charset="utf-8"> +<title>jQuery File Upload Demo</title> +<meta name="description" content="File Upload widget with multiple file selection, drag&drop support, progress bars, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads and client-side image resizing. Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads."> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<!-- Bootstrap styles --> +<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> +<!-- Generic page styles --> +<link rel="stylesheet" href="css/style.css"> +<!-- blueimp Gallery styles --> +<link rel="stylesheet" href="https://blueimp.github.io/Gallery/css/blueimp-gallery.min.css"> +<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars --> +<link rel="stylesheet" href="css/jquery.fileupload.css"> +<link rel="stylesheet" href="css/jquery.fileupload-ui.css"> +<!-- CSS adjustments for browsers with JavaScript disabled --> +<noscript><link rel="stylesheet" href="css/jquery.fileupload-noscript.css"></noscript> +<noscript><link rel="stylesheet" href="css/jquery.fileupload-ui-noscript.css"></noscript> +</head> +<body> +<div class="navbar navbar-default navbar-fixed-top"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-fixed-top .navbar-collapse"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="https://github.com/blueimp/jQuery-File-Upload">jQuery File Upload</a> + </div> + <div class="navbar-collapse collapse"> + <ul class="nav navbar-nav"> + <li><a href="https://github.com/blueimp/jQuery-File-Upload/tags">Download</a></li> + <li><a href="https://github.com/blueimp/jQuery-File-Upload">Source Code</a></li> + <li><a href="https://github.com/blueimp/jQuery-File-Upload/wiki">Documentation</a></li> + <li><a href="https://blueimp.net">© Sebastian Tschan</a></li> + </ul> + </div> + </div> +</div> +<div class="container"> + <h1>jQuery File Upload Demo</h1> + <h2 class="lead">Basic Plus UI version</h2> + <ul class="nav nav-tabs"> + <li><a href="basic.html">Basic</a></li> + <li><a href="basic-plus.html">Basic Plus</a></li> + <li class="active"><a href="index.html">Basic Plus UI</a></li> + <li><a href="angularjs.html">AngularJS</a></li> + <li><a href="jquery-ui.html">jQuery UI</a></li> + </ul> + <br> + <blockquote> + <p>File Upload widget with multiple file selection, drag&drop support, progress bars, validation and preview images, audio and video for jQuery.<br> + Supports cross-domain, chunked and resumable file uploads and client-side image resizing.<br> + Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.</p> + </blockquote> + <br> + <!-- The file upload form used as target for the file upload widget --> + <form id="fileupload" action="https://jquery-file-upload.appspot.com/" method="POST" enctype="multipart/form-data"> + <!-- Redirect browsers with JavaScript disabled to the origin page --> + <noscript><input type="hidden" name="redirect" value="https://blueimp.github.io/jQuery-File-Upload/"></noscript> + <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload --> + <div class="row fileupload-buttonbar"> + <div class="col-lg-7"> + <!-- The fileinput-button span is used to style the file input field as button --> + <span class="btn btn-success fileinput-button"> + <i class="glyphicon glyphicon-plus"></i> + <span>Add files...</span> + <input type="file" name="files[]" multiple> + </span> + <button type="submit" class="btn btn-primary start"> + <i class="glyphicon glyphicon-upload"></i> + <span>Start upload</span> + </button> + <button type="reset" class="btn btn-warning cancel"> + <i class="glyphicon glyphicon-ban-circle"></i> + <span>Cancel upload</span> + </button> + <button type="button" class="btn btn-danger delete"> + <i class="glyphicon glyphicon-trash"></i> + <span>Delete</span> + </button> + <input type="checkbox" class="toggle"> + <!-- The global file processing state --> + <span class="fileupload-process"></span> + </div> + <!-- The global progress state --> + <div class="col-lg-5 fileupload-progress fade"> + <!-- The global progress bar --> + <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100"> + <div class="progress-bar progress-bar-success" style="width:0%;"></div> + </div> + <!-- The extended global progress state --> + <div class="progress-extended"> </div> + </div> + </div> + <!-- The table listing the files available for upload/download --> + <table role="presentation" class="table table-striped"><tbody class="files"></tbody></table> + </form> + <br> + <div class="panel panel-default"> + <div class="panel-heading"> + <h3 class="panel-title">Demo Notes</h3> + </div> + <div class="panel-body"> + <ul> + <li>The maximum file size for uploads in this demo is <strong>999 KB</strong> (default file size is unlimited).</li> + <li>Only image files (<strong>JPG, GIF, PNG</strong>) are allowed in this demo (by default there is no file type restriction).</li> + <li>Uploaded files will be deleted automatically after <strong>5 minutes or less</strong> (demo files are stored in memory).</li> + <li>You can <strong>drag & drop</strong> files from your desktop on this webpage (see <a href="https://github.com/blueimp/jQuery-File-Upload/wiki/Browser-support">Browser support</a>).</li> + <li>Please refer to the <a href="https://github.com/blueimp/jQuery-File-Upload">project website</a> and <a href="https://github.com/blueimp/jQuery-File-Upload/wiki">documentation</a> for more information.</li> + <li>Built with the <a href="http://getbootstrap.com/">Bootstrap</a> CSS framework and Icons from <a href="http://glyphicons.com/">Glyphicons</a>.</li> + </ul> + </div> + </div> +</div> +<!-- The blueimp Gallery widget --> +<div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls" data-filter=":even"> + <div class="slides"></div> + <h3 class="title"></h3> + <a class="prev">‹</a> + <a class="next">›</a> + <a class="close">×</a> + <a class="play-pause"></a> + <ol class="indicator"></ol> +</div> +<!-- The template to display files available for upload --> +<script id="template-upload" type="text/x-tmpl"> +{% for (var i=0, file; file=o.files[i]; i++) { %} + <tr class="template-upload fade"> + <td> + <span class="preview"></span> + </td> + <td> + <p class="name">{%=file.name%}</p> + <strong class="error text-danger"></strong> + </td> + <td> + <p class="size">Processing...</p> + <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-success" style="width:0%;"></div></div> + </td> + <td> + {% if (!i && !o.options.autoUpload) { %} + <button class="btn btn-primary start" disabled> + <i class="glyphicon glyphicon-upload"></i> + <span>Start</span> + </button> + {% } %} + {% if (!i) { %} + <button class="btn btn-warning cancel"> + <i class="glyphicon glyphicon-ban-circle"></i> + <span>Cancel</span> + </button> + {% } %} + </td> + </tr> +{% } %} +</script> +<!-- The template to display files available for download --> +<script id="template-download" type="text/x-tmpl"> +{% for (var i=0, file; file=o.files[i]; i++) { %} + <tr class="template-download fade"> + <td> + <span class="preview"> + {% if (file.thumbnailUrl) { %} + <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a> + {% } %} + </span> + </td> + <td> + <p class="name"> + {% if (file.url) { %} + <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a> + {% } else { %} + <span>{%=file.name%}</span> + {% } %} + </p> + {% if (file.error) { %} + <div><span class="label label-danger">Error</span> {%=file.error%}</div> + {% } %} + </td> + <td> + <span class="size">{%=o.formatFileSize(file.size)%}</span> + </td> + <td> + {% if (file.deleteUrl) { %} + <button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}> + <i class="glyphicon glyphicon-trash"></i> + <span>Delete</span> + </button> + <input type="checkbox" name="delete" value="1" class="toggle"> + {% } else { %} + <button class="btn btn-warning cancel"> + <i class="glyphicon glyphicon-ban-circle"></i> + <span>Cancel</span> + </button> + {% } %} + </td> + </tr> +{% } %} +</script> +<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> +<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included --> +<script src="js/vendor/jquery.ui.widget.js"></script> +<!-- The Templates plugin is included to render the upload/download listings --> +<script src="https://blueimp.github.io/JavaScript-Templates/js/tmpl.min.js"></script> +<!-- The Load Image plugin is included for the preview images and image resizing functionality --> +<script src="https://blueimp.github.io/JavaScript-Load-Image/js/load-image.all.min.js"></script> +<!-- The Canvas to Blob plugin is included for image resizing functionality --> +<script src="https://blueimp.github.io/JavaScript-Canvas-to-Blob/js/canvas-to-blob.min.js"></script> +<!-- Bootstrap JS is not required, but included for the responsive demo navigation --> +<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> +<!-- blueimp Gallery script --> +<script src="https://blueimp.github.io/Gallery/js/jquery.blueimp-gallery.min.js"></script> +<!-- The Iframe Transport is required for browsers without support for XHR file uploads --> +<script src="js/jquery.iframe-transport.js"></script> +<!-- The basic File Upload plugin --> +<script src="js/jquery.fileupload.js"></script> +<!-- The File Upload processing plugin --> +<script src="js/jquery.fileupload-process.js"></script> +<!-- The File Upload image preview & resize plugin --> +<script src="js/jquery.fileupload-image.js"></script> +<!-- The File Upload audio preview plugin --> +<script src="js/jquery.fileupload-audio.js"></script> +<!-- The File Upload video preview plugin --> +<script src="js/jquery.fileupload-video.js"></script> +<!-- The File Upload validation plugin --> +<script src="js/jquery.fileupload-validate.js"></script> +<!-- The File Upload user interface plugin --> +<script src="js/jquery.fileupload-ui.js"></script> +<!-- The main application script --> +<script src="js/main.js"></script> +<!-- The XDomainRequest Transport is included for cross-domain file deletion for IE 8 and IE 9 --> +<!--[if (gte IE 8)&(lt IE 10)]> +<script src="js/cors/jquery.xdr-transport.js"></script> +<![endif]--> +</body> +</html> diff --git a/vendor/blueimp/jquery-file-upload/jquery-ui.html b/vendor/blueimp/jquery-file-upload/jquery-ui.html new file mode 100644 index 000000000..842dd4ca7 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/jquery-ui.html @@ -0,0 +1,252 @@ +<!DOCTYPE HTML> +<!-- +/* + * jQuery File Upload Plugin jQuery UI Demo + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ +--> +<html lang="en"> +<head> +<!-- Force latest IE rendering engine or ChromeFrame if installed --> +<!--[if IE]> +<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> +<![endif]--> +<meta charset="utf-8"> +<title>jQuery File Upload Demo - jQuery UI version</title> +<meta name="description" content="File Upload widget with multiple file selection, drag&drop support, progress bars, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads and client-side image resizing. Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads."> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<!-- jQuery UI styles --> +<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/dark-hive/jquery-ui.css" id="theme"> +<!-- Generic page styles --> +<link rel="stylesheet" href="css/style.css"> +<!-- Demo styles --> +<link rel="stylesheet" href="css/jquery-ui-demo.css"> +<!--[if lte IE 8]> +<link rel="stylesheet" href="css/jquery-ui-demo-ie8.css"> +<![endif]--> +<style> +/* Adjust the jQuery UI widget font-size: */ +.ui-widget { + font-size: 0.95em; +} +</style> +<!-- blueimp Gallery styles --> +<link rel="stylesheet" href="https://blueimp.github.io/Gallery/css/blueimp-gallery.min.css"> +<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars --> +<link rel="stylesheet" href="css/jquery.fileupload.css"> +<link rel="stylesheet" href="css/jquery.fileupload-ui.css"> +<!-- CSS adjustments for browsers with JavaScript disabled --> +<noscript><link rel="stylesheet" href="css/jquery.fileupload-noscript.css"></noscript> +<noscript><link rel="stylesheet" href="css/jquery.fileupload-ui-noscript.css"></noscript> +</head> +<body> +<ul class="navigation"> + <li><h3><a href="https://github.com/blueimp/jQuery-File-Upload">jQuery File Upload</a></h3></li> + <li><a href="https://github.com/blueimp/jQuery-File-Upload/tags">Download</a></li> + <li><a href="https://github.com/blueimp/jQuery-File-Upload">Source Code</a></li> + <li><a href="https://github.com/blueimp/jQuery-File-Upload/wiki">Documentation</a></li> + <li><a href="https://blueimp.net">© blueimp.net</a></li> +</ul> +<h1>jQuery File Upload Demo</h1> +<h2>jQuery UI version</h2> +<form> + <label for="theme-switcher">Theme:</label> + <select id="theme-switcher" class="pull-right"> + <option value="black-tie">Black Tie</option> + <option value="blitzer">Blitzer</option> + <option value="cupertino">Cupertino</option> + <option value="dark-hive" selected>Dark Hive</option> + <option value="dot-luv">Dot Luv</option> + <option value="eggplant">Eggplant</option> + <option value="excite-bike">Excite Bike</option> + <option value="flick">Flick</option> + <option value="hot-sneaks">Hot sneaks</option> + <option value="humanity">Humanity</option> + <option value="le-frog">Le Frog</option> + <option value="mint-choc">Mint Choc</option> + <option value="overcast">Overcast</option> + <option value="pepper-grinder">Pepper Grinder</option> + <option value="redmond">Redmond</option> + <option value="smoothness">Smoothness</option> + <option value="south-street">South Street</option> + <option value="start">Start</option> + <option value="sunny">Sunny</option> + <option value="swanky-purse">Swanky Purse</option> + <option value="trontastic">Trontastic</option> + <option value="ui-darkness">UI Darkness</option> + <option value="ui-lightness">UI Lightness</option> + <option value="vader">Vader</option> + </select> +</form> +<ul class="navigation"> + <li><a href="basic.html">Basic</a></li> + <li><a href="basic-plus.html">Basic Plus</a></li> + <li><a href="index.html">Basic Plus UI</a></li> + <li><a href="angularjs.html">AngularJS</a></li> + <li class="active"><a href="jquery-ui.html">jQuery UI</a></li> +</ul> +<blockquote> + <p>File Upload widget with multiple file selection, drag&drop support, progress bars, validation and preview images, audio and video for jQuery UI.<br> + Supports cross-domain, chunked and resumable file uploads and client-side image resizing.<br> + Works with any server-side platform (PHP, Python, Ruby on Rails, Java, Node.js, Go etc.) that supports standard HTML form file uploads.</p> +</blockquote> +<!-- The file upload form used as target for the file upload widget --> +<form id="fileupload" action="https://jquery-file-upload.appspot.com/" method="POST" enctype="multipart/form-data"> + <!-- Redirect browsers with JavaScript disabled to the origin page --> + <noscript><input type="hidden" name="redirect" value="https://blueimp.github.io/jQuery-File-Upload/"></noscript> + <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload --> + <div class="fileupload-buttonbar"> + <div class="fileupload-buttons"> + <!-- The fileinput-button span is used to style the file input field as button --> + <span class="fileinput-button"> + <span>Add files...</span> + <input type="file" name="files[]" multiple> + </span> + <button type="submit" class="start">Start upload</button> + <button type="reset" class="cancel">Cancel upload</button> + <button type="button" class="delete">Delete</button> + <input type="checkbox" class="toggle"> + <!-- The global file processing state --> + <span class="fileupload-process"></span> + </div> + <!-- The global progress state --> + <div class="fileupload-progress fade" style="display:none"> + <!-- The global progress bar --> + <div class="progress" role="progressbar" aria-valuemin="0" aria-valuemax="100"></div> + <!-- The extended global progress state --> + <div class="progress-extended"> </div> + </div> + </div> + <!-- The table listing the files available for upload/download --> + <table role="presentation"><tbody class="files"></tbody></table> +</form> +<br> +<h3>Demo Notes</h3> +<ul> + <li>The maximum file size for uploads in this demo is <strong>999 KB</strong> (default file size is unlimited).</li> + <li>Only image files (<strong>JPG, GIF, PNG</strong>) are allowed in this demo (by default there is no file type restriction).</li> + <li>Uploaded files will be deleted automatically after <strong>5 minutes or less</strong> (demo files are stored in memory).</li> + <li>You can <strong>drag & drop</strong> files from your desktop on this webpage (see <a href="https://github.com/blueimp/jQuery-File-Upload/wiki/Browser-support">Browser support</a>).</li> + <li>Please refer to the <a href="https://github.com/blueimp/jQuery-File-Upload">project website</a> and <a href="https://github.com/blueimp/jQuery-File-Upload/wiki">documentation</a> for more information.</li> + <li>Built with <a href="https://jqueryui.com">jQuery UI</a>.</li> +</ul> +<!-- The blueimp Gallery widget --> +<div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls" data-filter=":even"> + <div class="slides"></div> + <h3 class="title"></h3> + <a class="prev">‹</a> + <a class="next">›</a> + <a class="close">×</a> + <a class="play-pause"></a> + <ol class="indicator"></ol> +</div> +<!-- The template to display files available for upload --> +<script id="template-upload" type="text/x-tmpl"> +{% for (var i=0, file; file=o.files[i]; i++) { %} + <tr class="template-upload fade"> + <td> + <span class="preview"></span> + </td> + <td> + <p class="name">{%=file.name%}</p> + <strong class="error"></strong> + </td> + <td> + <p class="size">Processing...</p> + <div class="progress"></div> + </td> + <td> + {% if (!i && !o.options.autoUpload) { %} + <button class="start" disabled>Start</button> + {% } %} + {% if (!i) { %} + <button class="cancel">Cancel</button> + {% } %} + </td> + </tr> +{% } %} +</script> +<!-- The template to display files available for download --> +<script id="template-download" type="text/x-tmpl"> +{% for (var i=0, file; file=o.files[i]; i++) { %} + <tr class="template-download fade"> + <td> + <span class="preview"> + {% if (file.thumbnailUrl) { %} + <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a> + {% } %} + </span> + </td> + <td> + <p class="name"> + <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a> + </p> + {% if (file.error) { %} + <div><span class="error">Error</span> {%=file.error%}</div> + {% } %} + </td> + <td> + <span class="size">{%=o.formatFileSize(file.size)%}</span> + </td> + <td> + <button class="delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>Delete</button> + <input type="checkbox" name="delete" value="1" class="toggle"> + </td> + </tr> +{% } %} +</script> +<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> +<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> +<!-- The Templates plugin is included to render the upload/download listings --> +<script src="https://blueimp.github.io/JavaScript-Templates/js/tmpl.min.js"></script> +<!-- The Load Image plugin is included for the preview images and image resizing functionality --> +<script src="https://blueimp.github.io/JavaScript-Load-Image/js/load-image.all.min.js"></script> +<!-- The Canvas to Blob plugin is included for image resizing functionality --> +<script src="https://blueimp.github.io/JavaScript-Canvas-to-Blob/js/canvas-to-blob.min.js"></script> +<!-- blueimp Gallery script --> +<script src="https://blueimp.github.io/Gallery/js/jquery.blueimp-gallery.min.js"></script> +<!-- The Iframe Transport is required for browsers without support for XHR file uploads --> +<script src="js/jquery.iframe-transport.js"></script> +<!-- The basic File Upload plugin --> +<script src="js/jquery.fileupload.js"></script> +<!-- The File Upload processing plugin --> +<script src="js/jquery.fileupload-process.js"></script> +<!-- The File Upload image preview & resize plugin --> +<script src="js/jquery.fileupload-image.js"></script> +<!-- The File Upload audio preview plugin --> +<script src="js/jquery.fileupload-audio.js"></script> +<!-- The File Upload video preview plugin --> +<script src="js/jquery.fileupload-video.js"></script> +<!-- The File Upload validation plugin --> +<script src="js/jquery.fileupload-validate.js"></script> +<!-- The File Upload user interface plugin --> +<script src="js/jquery.fileupload-ui.js"></script> +<!-- The File Upload jQuery UI plugin --> +<script src="js/jquery.fileupload-jquery-ui.js"></script> +<!-- The main application script --> +<script src="js/main.js"></script> +<script> +// Initialize the jQuery UI theme switcher: +$('#theme-switcher').change(function () { + var theme = $('#theme'); + theme.prop( + 'href', + theme.prop('href').replace( + /[\w\-]+\/jquery-ui.css/, + $(this).val() + '/jquery-ui.css' + ) + ); +}); +</script> +<!-- The XDomainRequest Transport is included for cross-domain file deletion for IE 8 and IE 9 --> +<!--[if (gte IE 8)&(lt IE 10)]> +<script src="js/cors/jquery.xdr-transport.js"></script> +<![endif]--> +</body> +</html> diff --git a/vendor/blueimp/jquery-file-upload/js/app.js b/vendor/blueimp/jquery-file-upload/js/app.js new file mode 100644 index 000000000..e6b7bce3e --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/js/app.js @@ -0,0 +1,101 @@ +/* + * jQuery File Upload Plugin Angular JS Example + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +/* jshint nomen:false */ +/* global window, angular */ + +;(function () { + 'use strict'; + + var isOnGitHub = window.location.hostname === 'blueimp.github.io', + url = isOnGitHub ? '//jquery-file-upload.appspot.com/' : 'server/php/'; + + angular.module('demo', [ + 'blueimp.fileupload' + ]) + .config([ + '$httpProvider', 'fileUploadProvider', + function ($httpProvider, fileUploadProvider) { + delete $httpProvider.defaults.headers.common['X-Requested-With']; + fileUploadProvider.defaults.redirect = window.location.href.replace( + /\/[^\/]*$/, + '/cors/result.html?%s' + ); + if (isOnGitHub) { + // Demo settings: + angular.extend(fileUploadProvider.defaults, { + // Enable image resizing, except for Android and Opera, + // which actually support image resizing, but fail to + // send Blob objects via XHR requests: + disableImageResize: /Android(?!.*Chrome)|Opera/ + .test(window.navigator.userAgent), + maxFileSize: 999000, + acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i + }); + } + } + ]) + + .controller('DemoFileUploadController', [ + '$scope', '$http', '$filter', '$window', + function ($scope, $http) { + $scope.options = { + url: url + }; + if (!isOnGitHub) { + $scope.loadingFiles = true; + $http.get(url) + .then( + function (response) { + $scope.loadingFiles = false; + $scope.queue = response.data.files || []; + }, + function () { + $scope.loadingFiles = false; + } + ); + } + } + ]) + + .controller('FileDestroyController', [ + '$scope', '$http', + function ($scope, $http) { + var file = $scope.file, + state; + if (file.url) { + file.$state = function () { + return state; + }; + file.$destroy = function () { + state = 'pending'; + return $http({ + url: file.deleteUrl, + method: file.deleteType + }).then( + function () { + state = 'resolved'; + $scope.clear(file); + }, + function () { + state = 'rejected'; + } + ); + }; + } else if (!file.$cancel && !file._index) { + file.$cancel = function () { + $scope.clear(file); + }; + } + } + ]); + +}()); diff --git a/vendor/blueimp/jquery-file-upload/js/cors/jquery.postmessage-transport.js b/vendor/blueimp/jquery-file-upload/js/cors/jquery.postmessage-transport.js new file mode 100644 index 000000000..2a0c38cb6 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/js/cors/jquery.postmessage-transport.js @@ -0,0 +1,126 @@ +/* + * jQuery postMessage Transport Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2011, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +/* global define, require, window, document */ + +;(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define(['jquery'], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory(require('jquery')); + } else { + // Browser globals: + factory(window.jQuery); + } +}(function ($) { + 'use strict'; + + var counter = 0, + names = [ + 'accepts', + 'cache', + 'contents', + 'contentType', + 'crossDomain', + 'data', + 'dataType', + 'headers', + 'ifModified', + 'mimeType', + 'password', + 'processData', + 'timeout', + 'traditional', + 'type', + 'url', + 'username' + ], + convert = function (p) { + return p; + }; + + $.ajaxSetup({ + converters: { + 'postmessage text': convert, + 'postmessage json': convert, + 'postmessage html': convert + } + }); + + $.ajaxTransport('postmessage', function (options) { + if (options.postMessage && window.postMessage) { + var iframe, + loc = $('<a>').prop('href', options.postMessage)[0], + target = loc.protocol + '//' + loc.host, + xhrUpload = options.xhr().upload; + // IE always includes the port for the host property of a link + // element, but not in the location.host or origin property for the + // default http port 80 and https port 443, so we strip it: + if (/^(http:\/\/.+:80)|(https:\/\/.+:443)$/.test(target)) { + target = target.replace(/:(80|443)$/, ''); + } + return { + send: function (_, completeCallback) { + counter += 1; + var message = { + id: 'postmessage-transport-' + counter + }, + eventName = 'message.' + message.id; + iframe = $( + '<iframe style="display:none;" src="' + + options.postMessage + '" name="' + + message.id + '"></iframe>' + ).bind('load', function () { + $.each(names, function (i, name) { + message[name] = options[name]; + }); + message.dataType = message.dataType.replace('postmessage ', ''); + $(window).bind(eventName, function (e) { + e = e.originalEvent; + var data = e.data, + ev; + if (e.origin === target && data.id === message.id) { + if (data.type === 'progress') { + ev = document.createEvent('Event'); + ev.initEvent(data.type, false, true); + $.extend(ev, data); + xhrUpload.dispatchEvent(ev); + } else { + completeCallback( + data.status, + data.statusText, + {postmessage: data.result}, + data.headers + ); + iframe.remove(); + $(window).unbind(eventName); + } + } + }); + iframe[0].contentWindow.postMessage( + message, + target + ); + }).appendTo(document.body); + }, + abort: function () { + if (iframe) { + iframe.remove(); + } + } + }; + } + }); + +})); diff --git a/vendor/blueimp/jquery-file-upload/js/cors/jquery.xdr-transport.js b/vendor/blueimp/jquery-file-upload/js/cors/jquery.xdr-transport.js new file mode 100644 index 000000000..a4e2699c6 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/js/cors/jquery.xdr-transport.js @@ -0,0 +1,89 @@ +/* + * jQuery XDomainRequest Transport Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2011, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + * + * Based on Julian Aubourg's ajaxHooks xdr.js: + * https://github.com/jaubourg/ajaxHooks/ + */ + +/* global define, require, window, XDomainRequest */ + +;(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define(['jquery'], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory(require('jquery')); + } else { + // Browser globals: + factory(window.jQuery); + } +}(function ($) { + 'use strict'; + if (window.XDomainRequest && !$.support.cors) { + $.ajaxTransport(function (s) { + if (s.crossDomain && s.async) { + if (s.timeout) { + s.xdrTimeout = s.timeout; + delete s.timeout; + } + var xdr; + return { + send: function (headers, completeCallback) { + var addParamChar = /\?/.test(s.url) ? '&' : '?'; + function callback(status, statusText, responses, responseHeaders) { + xdr.onload = xdr.onerror = xdr.ontimeout = $.noop; + xdr = null; + completeCallback(status, statusText, responses, responseHeaders); + } + xdr = new XDomainRequest(); + // XDomainRequest only supports GET and POST: + if (s.type === 'DELETE') { + s.url = s.url + addParamChar + '_method=DELETE'; + s.type = 'POST'; + } else if (s.type === 'PUT') { + s.url = s.url + addParamChar + '_method=PUT'; + s.type = 'POST'; + } else if (s.type === 'PATCH') { + s.url = s.url + addParamChar + '_method=PATCH'; + s.type = 'POST'; + } + xdr.open(s.type, s.url); + xdr.onload = function () { + callback( + 200, + 'OK', + {text: xdr.responseText}, + 'Content-Type: ' + xdr.contentType + ); + }; + xdr.onerror = function () { + callback(404, 'Not Found'); + }; + if (s.xdrTimeout) { + xdr.ontimeout = function () { + callback(0, 'timeout'); + }; + xdr.timeout = s.xdrTimeout; + } + xdr.send((s.hasContent && s.data) || null); + }, + abort: function () { + if (xdr) { + xdr.onerror = $.noop(); + xdr.abort(); + } + } + }; + } + }); + } +})); diff --git a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-angular.js b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-angular.js new file mode 100644 index 000000000..185907d36 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-angular.js @@ -0,0 +1,438 @@ +/* + * jQuery File Upload AngularJS Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +/* jshint nomen:false */ +/* global define, angular, require */ + +;(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'angular', + './jquery.fileupload-image', + './jquery.fileupload-audio', + './jquery.fileupload-video', + './jquery.fileupload-validate' + ], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory( + require('jquery'), + require('angular'), + require('./jquery.fileupload-image'), + require('./jquery.fileupload-audio'), + require('./jquery.fileupload-video'), + require('./jquery.fileupload-validate') + ); + } else { + factory(); + } +}(function () { + 'use strict'; + + angular.module('blueimp.fileupload', []) + + // The fileUpload service provides configuration options + // for the fileUpload directive and default handlers for + // File Upload events: + .provider('fileUpload', function () { + var scopeEvalAsync = function (expression) { + var scope = angular.element(this) + .fileupload('option', 'scope'); + // Schedule a new $digest cycle if not already inside of one + // and evaluate the given expression: + scope.$evalAsync(expression); + }, + addFileMethods = function (scope, data) { + var files = data.files, + file = files[0]; + angular.forEach(files, function (file, index) { + file._index = index; + file.$state = function () { + return data.state(); + }; + file.$processing = function () { + return data.processing(); + }; + file.$progress = function () { + return data.progress(); + }; + file.$response = function () { + return data.response(); + }; + }); + file.$submit = function () { + if (!file.error) { + return data.submit(); + } + }; + file.$cancel = function () { + return data.abort(); + }; + }, + $config; + $config = this.defaults = { + handleResponse: function (e, data) { + var files = data.result && data.result.files; + if (files) { + data.scope.replace(data.files, files); + } else if (data.errorThrown || + data.textStatus === 'error') { + data.files[0].error = data.errorThrown || + data.textStatus; + } + }, + add: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var scope = data.scope, + filesCopy = []; + angular.forEach(data.files, function (file) { + filesCopy.push(file); + }); + scope.$parent.$applyAsync(function () { + addFileMethods(scope, data); + var method = scope.option('prependFiles') ? + 'unshift' : 'push'; + Array.prototype[method].apply(scope.queue, data.files); + }); + data.process(function () { + return scope.process(data); + }).always(function () { + scope.$parent.$applyAsync(function () { + addFileMethods(scope, data); + scope.replace(filesCopy, data.files); + }); + }).then(function () { + if ((scope.option('autoUpload') || + data.autoUpload) && + data.autoUpload !== false) { + data.submit(); + } + }); + }, + done: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var that = this; + data.scope.$apply(function () { + data.handleResponse.call(that, e, data); + }); + }, + fail: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var that = this, + scope = data.scope; + if (data.errorThrown === 'abort') { + scope.clear(data.files); + return; + } + scope.$apply(function () { + data.handleResponse.call(that, e, data); + }); + }, + stop: scopeEvalAsync, + processstart: scopeEvalAsync, + processstop: scopeEvalAsync, + getNumberOfFiles: function () { + var scope = this.scope; + return scope.queue.length - scope.processing(); + }, + dataType: 'json', + autoUpload: false + }; + this.$get = [ + function () { + return { + defaults: $config + }; + } + ]; + }) + + // Format byte numbers to readable presentations: + .provider('formatFileSizeFilter', function () { + var $config = { + // Byte units following the IEC format + // http://en.wikipedia.org/wiki/Kilobyte + units: [ + {size: 1000000000, suffix: ' GB'}, + {size: 1000000, suffix: ' MB'}, + {size: 1000, suffix: ' KB'} + ] + }; + this.defaults = $config; + this.$get = function () { + return function (bytes) { + if (!angular.isNumber(bytes)) { + return ''; + } + var unit = true, + i = 0, + prefix, + suffix; + while (unit) { + unit = $config.units[i]; + prefix = unit.prefix || ''; + suffix = unit.suffix || ''; + if (i === $config.units.length - 1 || bytes >= unit.size) { + return prefix + (bytes / unit.size).toFixed(2) + suffix; + } + i += 1; + } + }; + }; + }) + + // The FileUploadController initializes the fileupload widget and + // provides scope methods to control the File Upload functionality: + .controller('FileUploadController', [ + '$scope', '$element', '$attrs', '$window', 'fileUpload','$q', + function ($scope, $element, $attrs, $window, fileUpload, $q) { + var uploadMethods = { + progress: function () { + return $element.fileupload('progress'); + }, + active: function () { + return $element.fileupload('active'); + }, + option: function (option, data) { + if (arguments.length === 1) { + return $element.fileupload('option', option); + } + $element.fileupload('option', option, data); + }, + add: function (data) { + return $element.fileupload('add', data); + }, + send: function (data) { + return $element.fileupload('send', data); + }, + process: function (data) { + return $element.fileupload('process', data); + }, + processing: function (data) { + return $element.fileupload('processing', data); + } + }; + $scope.disabled = !$window.jQuery.support.fileInput; + $scope.queue = $scope.queue || []; + $scope.clear = function (files) { + var queue = this.queue, + i = queue.length, + file = files, + length = 1; + if (angular.isArray(files)) { + file = files[0]; + length = files.length; + } + while (i) { + i -= 1; + if (queue[i] === file) { + return queue.splice(i, length); + } + } + }; + $scope.replace = function (oldFiles, newFiles) { + var queue = this.queue, + file = oldFiles[0], + i, + j; + for (i = 0; i < queue.length; i += 1) { + if (queue[i] === file) { + for (j = 0; j < newFiles.length; j += 1) { + queue[i + j] = newFiles[j]; + } + return; + } + } + }; + $scope.applyOnQueue = function (method) { + var list = this.queue.slice(0), + i, + file, + promises = []; + for (i = 0; i < list.length; i += 1) { + file = list[i]; + if (file[method]) { + promises.push(file[method]()); + } + } + return $q.all(promises); + }; + $scope.submit = function () { + return this.applyOnQueue('$submit'); + }; + $scope.cancel = function () { + return this.applyOnQueue('$cancel'); + }; + // Add upload methods to the scope: + angular.extend($scope, uploadMethods); + // The fileupload widget will initialize with + // the options provided via "data-"-parameters, + // as well as those given via options object: + $element.fileupload(angular.extend( + {scope: $scope}, + fileUpload.defaults + )).on('fileuploadadd', function (e, data) { + data.scope = $scope; + }).on('fileuploadfail', function (e, data) { + if (data.errorThrown === 'abort') { + return; + } + if (data.dataType && + data.dataType.indexOf('json') === data.dataType.length - 4) { + try { + data.result = angular.fromJson(data.jqXHR.responseText); + } catch (ignore) {} + } + }).on([ + 'fileuploadadd', + 'fileuploadsubmit', + 'fileuploadsend', + 'fileuploaddone', + 'fileuploadfail', + 'fileuploadalways', + 'fileuploadprogress', + 'fileuploadprogressall', + 'fileuploadstart', + 'fileuploadstop', + 'fileuploadchange', + 'fileuploadpaste', + 'fileuploaddrop', + 'fileuploaddragover', + 'fileuploadchunkbeforesend', + 'fileuploadchunksend', + 'fileuploadchunkdone', + 'fileuploadchunkfail', + 'fileuploadchunkalways', + 'fileuploadprocessstart', + 'fileuploadprocess', + 'fileuploadprocessdone', + 'fileuploadprocessfail', + 'fileuploadprocessalways', + 'fileuploadprocessstop' + ].join(' '), function (e, data) { + $scope.$parent.$applyAsync(function () { + if ($scope.$emit(e.type, data).defaultPrevented) { + e.preventDefault(); + } + }); + }).on('remove', function () { + // Remove upload methods from the scope, + // when the widget is removed: + var method; + for (method in uploadMethods) { + if (uploadMethods.hasOwnProperty(method)) { + delete $scope[method]; + } + } + }); + // Observe option changes: + $scope.$watch( + $attrs.fileUpload, + function (newOptions) { + if (newOptions) { + $element.fileupload('option', newOptions); + } + } + ); + } + ]) + + // Provide File Upload progress feedback: + .controller('FileUploadProgressController', [ + '$scope', '$attrs', '$parse', + function ($scope, $attrs, $parse) { + var fn = $parse($attrs.fileUploadProgress), + update = function () { + var progress = fn($scope); + if (!progress || !progress.total) { + return; + } + $scope.num = Math.floor( + progress.loaded / progress.total * 100 + ); + }; + update(); + $scope.$watch( + $attrs.fileUploadProgress + '.loaded', + function (newValue, oldValue) { + if (newValue !== oldValue) { + update(); + } + } + ); + } + ]) + + // Display File Upload previews: + .controller('FileUploadPreviewController', [ + '$scope', '$element', '$attrs', + function ($scope, $element, $attrs) { + $scope.$watch( + $attrs.fileUploadPreview + '.preview', + function (preview) { + $element.empty(); + if (preview) { + $element.append(preview); + } + } + ); + } + ]) + + .directive('fileUpload', function () { + return { + controller: 'FileUploadController', + scope: true + }; + }) + + .directive('fileUploadProgress', function () { + return { + controller: 'FileUploadProgressController', + scope: true + }; + }) + + .directive('fileUploadPreview', function () { + return { + controller: 'FileUploadPreviewController' + }; + }) + + // Enhance the HTML5 download attribute to + // allow drag&drop of files to the desktop: + .directive('download', function () { + return function (scope, elm) { + elm.on('dragstart', function (e) { + try { + e.originalEvent.dataTransfer.setData( + 'DownloadURL', + [ + 'application/octet-stream', + elm.prop('download'), + elm.prop('href') + ].join(':') + ); + } catch (ignore) {} + }); + }; + }); + +})); diff --git a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-audio.js b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-audio.js new file mode 100644 index 000000000..a25377619 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-audio.js @@ -0,0 +1,113 @@ +/* + * jQuery File Upload Audio Preview Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +/* jshint nomen:false */ +/* global define, require, window, document */ + +;(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'load-image', + './jquery.fileupload-process' + ], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory( + require('jquery'), + require('blueimp-load-image/js/load-image'), + require('./jquery.fileupload-process') + ); + } else { + // Browser globals: + factory( + window.jQuery, + window.loadImage + ); + } +}(function ($, loadImage) { + 'use strict'; + + // Prepend to the default processQueue: + $.blueimp.fileupload.prototype.options.processQueue.unshift( + { + action: 'loadAudio', + // Use the action as prefix for the "@" options: + prefix: true, + fileTypes: '@', + maxFileSize: '@', + disabled: '@disableAudioPreview' + }, + { + action: 'setAudio', + name: '@audioPreviewName', + disabled: '@disableAudioPreview' + } + ); + + // The File Upload Audio Preview plugin extends the fileupload widget + // with audio preview functionality: + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + + options: { + // The regular expression for the types of audio files to load, + // matched against the file type: + loadAudioFileTypes: /^audio\/.*$/ + }, + + _audioElement: document.createElement('audio'), + + processActions: { + + // Loads the audio file given via data.files and data.index + // as audio element if the browser supports playing it. + // Accepts the options fileTypes (regular expression) + // and maxFileSize (integer) to limit the files to load: + loadAudio: function (data, options) { + if (options.disabled) { + return data; + } + var file = data.files[data.index], + url, + audio; + if (this._audioElement.canPlayType && + this._audioElement.canPlayType(file.type) && + ($.type(options.maxFileSize) !== 'number' || + file.size <= options.maxFileSize) && + (!options.fileTypes || + options.fileTypes.test(file.type))) { + url = loadImage.createObjectURL(file); + if (url) { + audio = this._audioElement.cloneNode(false); + audio.src = url; + audio.controls = true; + data.audio = audio; + return data; + } + } + return data; + }, + + // Sets the audio element as a property of the file object: + setAudio: function (data, options) { + if (data.audio && !options.disabled) { + data.files[data.index][options.name || 'preview'] = data.audio; + } + return data; + } + + } + + }); + +})); diff --git a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-image.js b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-image.js new file mode 100644 index 000000000..65fc6d7b8 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-image.js @@ -0,0 +1,326 @@ +/* + * jQuery File Upload Image Preview & Resize Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +/* jshint nomen:false */ +/* global define, require, window, Blob */ + +;(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'load-image', + 'load-image-meta', + 'load-image-scale', + 'load-image-exif', + 'canvas-to-blob', + './jquery.fileupload-process' + ], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory( + require('jquery'), + require('blueimp-load-image/js/load-image'), + require('blueimp-load-image/js/load-image-meta'), + require('blueimp-load-image/js/load-image-scale'), + require('blueimp-load-image/js/load-image-exif'), + require('blueimp-canvas-to-blob'), + require('./jquery.fileupload-process') + ); + } else { + // Browser globals: + factory( + window.jQuery, + window.loadImage + ); + } +}(function ($, loadImage) { + 'use strict'; + + // Prepend to the default processQueue: + $.blueimp.fileupload.prototype.options.processQueue.unshift( + { + action: 'loadImageMetaData', + disableImageHead: '@', + disableExif: '@', + disableExifThumbnail: '@', + disableExifSub: '@', + disableExifGps: '@', + disabled: '@disableImageMetaDataLoad' + }, + { + action: 'loadImage', + // Use the action as prefix for the "@" options: + prefix: true, + fileTypes: '@', + maxFileSize: '@', + noRevoke: '@', + disabled: '@disableImageLoad' + }, + { + action: 'resizeImage', + // Use "image" as prefix for the "@" options: + prefix: 'image', + maxWidth: '@', + maxHeight: '@', + minWidth: '@', + minHeight: '@', + crop: '@', + orientation: '@', + forceResize: '@', + disabled: '@disableImageResize' + }, + { + action: 'saveImage', + quality: '@imageQuality', + type: '@imageType', + disabled: '@disableImageResize' + }, + { + action: 'saveImageMetaData', + disabled: '@disableImageMetaDataSave' + }, + { + action: 'resizeImage', + // Use "preview" as prefix for the "@" options: + prefix: 'preview', + maxWidth: '@', + maxHeight: '@', + minWidth: '@', + minHeight: '@', + crop: '@', + orientation: '@', + thumbnail: '@', + canvas: '@', + disabled: '@disableImagePreview' + }, + { + action: 'setImage', + name: '@imagePreviewName', + disabled: '@disableImagePreview' + }, + { + action: 'deleteImageReferences', + disabled: '@disableImageReferencesDeletion' + } + ); + + // The File Upload Resize plugin extends the fileupload widget + // with image resize functionality: + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + + options: { + // The regular expression for the types of images to load: + // matched against the file type: + loadImageFileTypes: /^image\/(gif|jpeg|png|svg\+xml)$/, + // The maximum file size of images to load: + loadImageMaxFileSize: 10000000, // 10MB + // The maximum width of resized images: + imageMaxWidth: 1920, + // The maximum height of resized images: + imageMaxHeight: 1080, + // Defines the image orientation (1-8) or takes the orientation + // value from Exif data if set to true: + imageOrientation: false, + // Define if resized images should be cropped or only scaled: + imageCrop: false, + // Disable the resize image functionality by default: + disableImageResize: true, + // The maximum width of the preview images: + previewMaxWidth: 80, + // The maximum height of the preview images: + previewMaxHeight: 80, + // Defines the preview orientation (1-8) or takes the orientation + // value from Exif data if set to true: + previewOrientation: true, + // Create the preview using the Exif data thumbnail: + previewThumbnail: true, + // Define if preview images should be cropped or only scaled: + previewCrop: false, + // Define if preview images should be resized as canvas elements: + previewCanvas: true + }, + + processActions: { + + // Loads the image given via data.files and data.index + // as img element, if the browser supports the File API. + // Accepts the options fileTypes (regular expression) + // and maxFileSize (integer) to limit the files to load: + loadImage: function (data, options) { + if (options.disabled) { + return data; + } + var that = this, + file = data.files[data.index], + dfd = $.Deferred(); + if (($.type(options.maxFileSize) === 'number' && + file.size > options.maxFileSize) || + (options.fileTypes && + !options.fileTypes.test(file.type)) || + !loadImage( + file, + function (img) { + if (img.src) { + data.img = img; + } + dfd.resolveWith(that, [data]); + }, + options + )) { + return data; + } + return dfd.promise(); + }, + + // Resizes the image given as data.canvas or data.img + // and updates data.canvas or data.img with the resized image. + // Also stores the resized image as preview property. + // Accepts the options maxWidth, maxHeight, minWidth, + // minHeight, canvas and crop: + resizeImage: function (data, options) { + if (options.disabled || !(data.canvas || data.img)) { + return data; + } + options = $.extend({canvas: true}, options); + var that = this, + dfd = $.Deferred(), + img = (options.canvas && data.canvas) || data.img, + resolve = function (newImg) { + if (newImg && (newImg.width !== img.width || + newImg.height !== img.height || + options.forceResize)) { + data[newImg.getContext ? 'canvas' : 'img'] = newImg; + } + data.preview = newImg; + dfd.resolveWith(that, [data]); + }, + thumbnail; + if (data.exif) { + if (options.orientation === true) { + options.orientation = data.exif.get('Orientation'); + } + if (options.thumbnail) { + thumbnail = data.exif.get('Thumbnail'); + if (thumbnail) { + loadImage(thumbnail, resolve, options); + return dfd.promise(); + } + } + // Prevent orienting the same image twice: + if (data.orientation) { + delete options.orientation; + } else { + data.orientation = options.orientation; + } + } + if (img) { + resolve(loadImage.scale(img, options)); + return dfd.promise(); + } + return data; + }, + + // Saves the processed image given as data.canvas + // inplace at data.index of data.files: + saveImage: function (data, options) { + if (!data.canvas || options.disabled) { + return data; + } + var that = this, + file = data.files[data.index], + dfd = $.Deferred(); + if (data.canvas.toBlob) { + data.canvas.toBlob( + function (blob) { + if (!blob.name) { + if (file.type === blob.type) { + blob.name = file.name; + } else if (file.name) { + blob.name = file.name.replace( + /\.\w+$/, + '.' + blob.type.substr(6) + ); + } + } + // Don't restore invalid meta data: + if (file.type !== blob.type) { + delete data.imageHead; + } + // Store the created blob at the position + // of the original file in the files list: + data.files[data.index] = blob; + dfd.resolveWith(that, [data]); + }, + options.type || file.type, + options.quality + ); + } else { + return data; + } + return dfd.promise(); + }, + + loadImageMetaData: function (data, options) { + if (options.disabled) { + return data; + } + var that = this, + dfd = $.Deferred(); + loadImage.parseMetaData(data.files[data.index], function (result) { + $.extend(data, result); + dfd.resolveWith(that, [data]); + }, options); + return dfd.promise(); + }, + + saveImageMetaData: function (data, options) { + if (!(data.imageHead && data.canvas && + data.canvas.toBlob && !options.disabled)) { + return data; + } + var file = data.files[data.index], + blob = new Blob([ + data.imageHead, + // Resized images always have a head size of 20 bytes, + // including the JPEG marker and a minimal JFIF header: + this._blobSlice.call(file, 20) + ], {type: file.type}); + blob.name = file.name; + data.files[data.index] = blob; + return data; + }, + + // Sets the resized version of the image as a property of the + // file object, must be called after "saveImage": + setImage: function (data, options) { + if (data.preview && !options.disabled) { + data.files[data.index][options.name || 'preview'] = data.preview; + } + return data; + }, + + deleteImageReferences: function (data, options) { + if (!options.disabled) { + delete data.img; + delete data.canvas; + delete data.preview; + delete data.imageHead; + } + return data; + } + + } + + }); + +})); diff --git a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-jquery-ui.js b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-jquery-ui.js new file mode 100644 index 000000000..7b136b379 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-jquery-ui.js @@ -0,0 +1,161 @@ +/* + * jQuery File Upload jQuery UI Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +/* jshint nomen:false */ +/* global define, require, window */ + +;(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + './jquery.fileupload-ui' + ], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory( + require('jquery'), + require('./jquery.fileupload-ui') + ); + } else { + // Browser globals: + factory(window.jQuery); + } +}(function ($) { + 'use strict'; + + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + + options: { + processdone: function (e, data) { + data.context.find('.start').button('enable'); + }, + progress: function (e, data) { + if (data.context) { + data.context.find('.progress').progressbar( + 'option', + 'value', + parseInt(data.loaded / data.total * 100, 10) + ); + } + }, + progressall: function (e, data) { + var $this = $(this); + $this.find('.fileupload-progress') + .find('.progress').progressbar( + 'option', + 'value', + parseInt(data.loaded / data.total * 100, 10) + ).end() + .find('.progress-extended').each(function () { + $(this).html( + ($this.data('blueimp-fileupload') || + $this.data('fileupload')) + ._renderExtendedProgress(data) + ); + }); + } + }, + + _renderUpload: function (func, files) { + var node = this._super(func, files), + showIconText = $(window).width() > 480; + node.find('.progress').empty().progressbar(); + node.find('.start').button({ + icons: {primary: 'ui-icon-circle-arrow-e'}, + text: showIconText + }); + node.find('.cancel').button({ + icons: {primary: 'ui-icon-cancel'}, + text: showIconText + }); + if (node.hasClass('fade')) { + node.hide(); + } + return node; + }, + + _renderDownload: function (func, files) { + var node = this._super(func, files), + showIconText = $(window).width() > 480; + node.find('.delete').button({ + icons: {primary: 'ui-icon-trash'}, + text: showIconText + }); + if (node.hasClass('fade')) { + node.hide(); + } + return node; + }, + + _startHandler: function (e) { + $(e.currentTarget).button('disable'); + this._super(e); + }, + + _transition: function (node) { + var deferred = $.Deferred(); + if (node.hasClass('fade')) { + node.fadeToggle( + this.options.transitionDuration, + this.options.transitionEasing, + function () { + deferred.resolveWith(node); + } + ); + } else { + deferred.resolveWith(node); + } + return deferred; + }, + + _create: function () { + this._super(); + this.element + .find('.fileupload-buttonbar') + .find('.fileinput-button').each(function () { + var input = $(this).find('input:file').detach(); + $(this) + .button({icons: {primary: 'ui-icon-plusthick'}}) + .append(input); + }) + .end().find('.start') + .button({icons: {primary: 'ui-icon-circle-arrow-e'}}) + .end().find('.cancel') + .button({icons: {primary: 'ui-icon-cancel'}}) + .end().find('.delete') + .button({icons: {primary: 'ui-icon-trash'}}) + .end().find('.progress').progressbar(); + }, + + _destroy: function () { + this.element + .find('.fileupload-buttonbar') + .find('.fileinput-button').each(function () { + var input = $(this).find('input:file').detach(); + $(this) + .button('destroy') + .append(input); + }) + .end().find('.start') + .button('destroy') + .end().find('.cancel') + .button('destroy') + .end().find('.delete') + .button('destroy') + .end().find('.progress').progressbar('destroy'); + this._super(); + } + + }); + +})); diff --git a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js new file mode 100644 index 000000000..638f0d26b --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js @@ -0,0 +1,178 @@ +/* + * jQuery File Upload Processing Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2012, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +/* jshint nomen:false */ +/* global define, require, window */ + +;(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + './jquery.fileupload' + ], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory( + require('jquery'), + require('./jquery.fileupload') + ); + } else { + // Browser globals: + factory( + window.jQuery + ); + } +}(function ($) { + 'use strict'; + + var originalAdd = $.blueimp.fileupload.prototype.options.add; + + // The File Upload Processing plugin extends the fileupload widget + // with file processing functionality: + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + + options: { + // The list of processing actions: + processQueue: [ + /* + { + action: 'log', + type: 'debug' + } + */ + ], + add: function (e, data) { + var $this = $(this); + data.process(function () { + return $this.fileupload('process', data); + }); + originalAdd.call(this, e, data); + } + }, + + processActions: { + /* + log: function (data, options) { + console[options.type]( + 'Processing "' + data.files[data.index].name + '"' + ); + } + */ + }, + + _processFile: function (data, originalData) { + var that = this, + dfd = $.Deferred().resolveWith(that, [data]), + chain = dfd.promise(); + this._trigger('process', null, data); + $.each(data.processQueue, function (i, settings) { + var func = function (data) { + if (originalData.errorThrown) { + return $.Deferred() + .rejectWith(that, [originalData]).promise(); + } + return that.processActions[settings.action].call( + that, + data, + settings + ); + }; + chain = chain.then(func, settings.always && func); + }); + chain + .done(function () { + that._trigger('processdone', null, data); + that._trigger('processalways', null, data); + }) + .fail(function () { + that._trigger('processfail', null, data); + that._trigger('processalways', null, data); + }); + return chain; + }, + + // Replaces the settings of each processQueue item that + // are strings starting with an "@", using the remaining + // substring as key for the option map, + // e.g. "@autoUpload" is replaced with options.autoUpload: + _transformProcessQueue: function (options) { + var processQueue = []; + $.each(options.processQueue, function () { + var settings = {}, + action = this.action, + prefix = this.prefix === true ? action : this.prefix; + $.each(this, function (key, value) { + if ($.type(value) === 'string' && + value.charAt(0) === '@') { + settings[key] = options[ + value.slice(1) || (prefix ? prefix + + key.charAt(0).toUpperCase() + key.slice(1) : key) + ]; + } else { + settings[key] = value; + } + + }); + processQueue.push(settings); + }); + options.processQueue = processQueue; + }, + + // Returns the number of files currently in the processsing queue: + processing: function () { + return this._processing; + }, + + // Processes the files given as files property of the data parameter, + // returns a Promise object that allows to bind callbacks: + process: function (data) { + var that = this, + options = $.extend({}, this.options, data); + if (options.processQueue && options.processQueue.length) { + this._transformProcessQueue(options); + if (this._processing === 0) { + this._trigger('processstart'); + } + $.each(data.files, function (index) { + var opts = index ? $.extend({}, options) : options, + func = function () { + if (data.errorThrown) { + return $.Deferred() + .rejectWith(that, [data]).promise(); + } + return that._processFile(opts, data); + }; + opts.index = index; + that._processing += 1; + that._processingQueue = that._processingQueue.then(func, func) + .always(function () { + that._processing -= 1; + if (that._processing === 0) { + that._trigger('processstop'); + } + }); + }); + } + return this._processingQueue; + }, + + _create: function () { + this._super(); + this._processing = 0; + this._processingQueue = $.Deferred().resolveWith(this) + .promise(); + } + + }); + +})); diff --git a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-ui.js b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-ui.js new file mode 100644 index 000000000..5058084b4 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-ui.js @@ -0,0 +1,714 @@ +/* + * jQuery File Upload User Interface Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +/* jshint nomen:false */ +/* global define, require, window */ + +;(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'blueimp-tmpl', + './jquery.fileupload-image', + './jquery.fileupload-audio', + './jquery.fileupload-video', + './jquery.fileupload-validate' + ], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory( + require('jquery'), + require('blueimp-tmpl'), + require('./jquery.fileupload-image'), + require('./jquery.fileupload-audio'), + require('./jquery.fileupload-video'), + require('./jquery.fileupload-validate') + ); + } else { + // Browser globals: + factory( + window.jQuery, + window.tmpl + ); + } +}(function ($, tmpl) { + 'use strict'; + + $.blueimp.fileupload.prototype._specialOptions.push( + 'filesContainer', + 'uploadTemplateId', + 'downloadTemplateId' + ); + + // The UI version extends the file upload widget + // and adds complete user interface interaction: + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + + options: { + // By default, files added to the widget are uploaded as soon + // as the user clicks on the start buttons. To enable automatic + // uploads, set the following option to true: + autoUpload: false, + // The ID of the upload template: + uploadTemplateId: 'template-upload', + // The ID of the download template: + downloadTemplateId: 'template-download', + // The container for the list of files. If undefined, it is set to + // an element with class "files" inside of the widget element: + filesContainer: undefined, + // By default, files are appended to the files container. + // Set the following option to true, to prepend files instead: + prependFiles: false, + // The expected data type of the upload response, sets the dataType + // option of the $.ajax upload requests: + dataType: 'json', + + // Error and info messages: + messages: { + unknownError: 'Unknown error' + }, + + // Function returning the current number of files, + // used by the maxNumberOfFiles validation: + getNumberOfFiles: function () { + return this.filesContainer.children() + .not('.processing').length; + }, + + // Callback to retrieve the list of files from the server response: + getFilesFromResponse: function (data) { + if (data.result && $.isArray(data.result.files)) { + return data.result.files; + } + return []; + }, + + // The add callback is invoked as soon as files are added to the fileupload + // widget (via file input selection, drag & drop or add API call). + // See the basic file upload widget for more information: + add: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var $this = $(this), + that = $this.data('blueimp-fileupload') || + $this.data('fileupload'), + options = that.options; + data.context = that._renderUpload(data.files) + .data('data', data) + .addClass('processing'); + options.filesContainer[ + options.prependFiles ? 'prepend' : 'append' + ](data.context); + that._forceReflow(data.context); + that._transition(data.context); + data.process(function () { + return $this.fileupload('process', data); + }).always(function () { + data.context.each(function (index) { + $(this).find('.size').text( + that._formatFileSize(data.files[index].size) + ); + }).removeClass('processing'); + that._renderPreviews(data); + }).done(function () { + data.context.find('.start').prop('disabled', false); + if ((that._trigger('added', e, data) !== false) && + (options.autoUpload || data.autoUpload) && + data.autoUpload !== false) { + data.submit(); + } + }).fail(function () { + if (data.files.error) { + data.context.each(function (index) { + var error = data.files[index].error; + if (error) { + $(this).find('.error').text(error); + } + }); + } + }); + }, + // Callback for the start of each file upload request: + send: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var that = $(this).data('blueimp-fileupload') || + $(this).data('fileupload'); + if (data.context && data.dataType && + data.dataType.substr(0, 6) === 'iframe') { + // Iframe Transport does not support progress events. + // In lack of an indeterminate progress bar, we set + // the progress to 100%, showing the full animated bar: + data.context + .find('.progress').addClass( + !$.support.transition && 'progress-animated' + ) + .attr('aria-valuenow', 100) + .children().first().css( + 'width', + '100%' + ); + } + return that._trigger('sent', e, data); + }, + // Callback for successful uploads: + done: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var that = $(this).data('blueimp-fileupload') || + $(this).data('fileupload'), + getFilesFromResponse = data.getFilesFromResponse || + that.options.getFilesFromResponse, + files = getFilesFromResponse(data), + template, + deferred; + if (data.context) { + data.context.each(function (index) { + var file = files[index] || + {error: 'Empty file upload result'}; + deferred = that._addFinishedDeferreds(); + that._transition($(this)).done( + function () { + var node = $(this); + template = that._renderDownload([file]) + .replaceAll(node); + that._forceReflow(template); + that._transition(template).done( + function () { + data.context = $(this); + that._trigger('completed', e, data); + that._trigger('finished', e, data); + deferred.resolve(); + } + ); + } + ); + }); + } else { + template = that._renderDownload(files)[ + that.options.prependFiles ? 'prependTo' : 'appendTo' + ](that.options.filesContainer); + that._forceReflow(template); + deferred = that._addFinishedDeferreds(); + that._transition(template).done( + function () { + data.context = $(this); + that._trigger('completed', e, data); + that._trigger('finished', e, data); + deferred.resolve(); + } + ); + } + }, + // Callback for failed (abort or error) uploads: + fail: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var that = $(this).data('blueimp-fileupload') || + $(this).data('fileupload'), + template, + deferred; + if (data.context) { + data.context.each(function (index) { + if (data.errorThrown !== 'abort') { + var file = data.files[index]; + file.error = file.error || data.errorThrown || + data.i18n('unknownError'); + deferred = that._addFinishedDeferreds(); + that._transition($(this)).done( + function () { + var node = $(this); + template = that._renderDownload([file]) + .replaceAll(node); + that._forceReflow(template); + that._transition(template).done( + function () { + data.context = $(this); + that._trigger('failed', e, data); + that._trigger('finished', e, data); + deferred.resolve(); + } + ); + } + ); + } else { + deferred = that._addFinishedDeferreds(); + that._transition($(this)).done( + function () { + $(this).remove(); + that._trigger('failed', e, data); + that._trigger('finished', e, data); + deferred.resolve(); + } + ); + } + }); + } else if (data.errorThrown !== 'abort') { + data.context = that._renderUpload(data.files)[ + that.options.prependFiles ? 'prependTo' : 'appendTo' + ](that.options.filesContainer) + .data('data', data); + that._forceReflow(data.context); + deferred = that._addFinishedDeferreds(); + that._transition(data.context).done( + function () { + data.context = $(this); + that._trigger('failed', e, data); + that._trigger('finished', e, data); + deferred.resolve(); + } + ); + } else { + that._trigger('failed', e, data); + that._trigger('finished', e, data); + that._addFinishedDeferreds().resolve(); + } + }, + // Callback for upload progress events: + progress: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var progress = Math.floor(data.loaded / data.total * 100); + if (data.context) { + data.context.each(function () { + $(this).find('.progress') + .attr('aria-valuenow', progress) + .children().first().css( + 'width', + progress + '%' + ); + }); + } + }, + // Callback for global upload progress events: + progressall: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var $this = $(this), + progress = Math.floor(data.loaded / data.total * 100), + globalProgressNode = $this.find('.fileupload-progress'), + extendedProgressNode = globalProgressNode + .find('.progress-extended'); + if (extendedProgressNode.length) { + extendedProgressNode.html( + ($this.data('blueimp-fileupload') || $this.data('fileupload')) + ._renderExtendedProgress(data) + ); + } + globalProgressNode + .find('.progress') + .attr('aria-valuenow', progress) + .children().first().css( + 'width', + progress + '%' + ); + }, + // Callback for uploads start, equivalent to the global ajaxStart event: + start: function (e) { + if (e.isDefaultPrevented()) { + return false; + } + var that = $(this).data('blueimp-fileupload') || + $(this).data('fileupload'); + that._resetFinishedDeferreds(); + that._transition($(this).find('.fileupload-progress')).done( + function () { + that._trigger('started', e); + } + ); + }, + // Callback for uploads stop, equivalent to the global ajaxStop event: + stop: function (e) { + if (e.isDefaultPrevented()) { + return false; + } + var that = $(this).data('blueimp-fileupload') || + $(this).data('fileupload'), + deferred = that._addFinishedDeferreds(); + $.when.apply($, that._getFinishedDeferreds()) + .done(function () { + that._trigger('stopped', e); + }); + that._transition($(this).find('.fileupload-progress')).done( + function () { + $(this).find('.progress') + .attr('aria-valuenow', '0') + .children().first().css('width', '0%'); + $(this).find('.progress-extended').html(' '); + deferred.resolve(); + } + ); + }, + processstart: function (e) { + if (e.isDefaultPrevented()) { + return false; + } + $(this).addClass('fileupload-processing'); + }, + processstop: function (e) { + if (e.isDefaultPrevented()) { + return false; + } + $(this).removeClass('fileupload-processing'); + }, + // Callback for file deletion: + destroy: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + var that = $(this).data('blueimp-fileupload') || + $(this).data('fileupload'), + removeNode = function () { + that._transition(data.context).done( + function () { + $(this).remove(); + that._trigger('destroyed', e, data); + } + ); + }; + if (data.url) { + data.dataType = data.dataType || that.options.dataType; + $.ajax(data).done(removeNode).fail(function () { + that._trigger('destroyfailed', e, data); + }); + } else { + removeNode(); + } + } + }, + + _resetFinishedDeferreds: function () { + this._finishedUploads = []; + }, + + _addFinishedDeferreds: function (deferred) { + if (!deferred) { + deferred = $.Deferred(); + } + this._finishedUploads.push(deferred); + return deferred; + }, + + _getFinishedDeferreds: function () { + return this._finishedUploads; + }, + + // Link handler, that allows to download files + // by drag & drop of the links to the desktop: + _enableDragToDesktop: function () { + var link = $(this), + url = link.prop('href'), + name = link.prop('download'), + type = 'application/octet-stream'; + link.bind('dragstart', function (e) { + try { + e.originalEvent.dataTransfer.setData( + 'DownloadURL', + [type, name, url].join(':') + ); + } catch (ignore) {} + }); + }, + + _formatFileSize: function (bytes) { + if (typeof bytes !== 'number') { + return ''; + } + if (bytes >= 1000000000) { + return (bytes / 1000000000).toFixed(2) + ' GB'; + } + if (bytes >= 1000000) { + return (bytes / 1000000).toFixed(2) + ' MB'; + } + return (bytes / 1000).toFixed(2) + ' KB'; + }, + + _formatBitrate: function (bits) { + if (typeof bits !== 'number') { + return ''; + } + if (bits >= 1000000000) { + return (bits / 1000000000).toFixed(2) + ' Gbit/s'; + } + if (bits >= 1000000) { + return (bits / 1000000).toFixed(2) + ' Mbit/s'; + } + if (bits >= 1000) { + return (bits / 1000).toFixed(2) + ' kbit/s'; + } + return bits.toFixed(2) + ' bit/s'; + }, + + _formatTime: function (seconds) { + var date = new Date(seconds * 1000), + days = Math.floor(seconds / 86400); + days = days ? days + 'd ' : ''; + return days + + ('0' + date.getUTCHours()).slice(-2) + ':' + + ('0' + date.getUTCMinutes()).slice(-2) + ':' + + ('0' + date.getUTCSeconds()).slice(-2); + }, + + _formatPercentage: function (floatValue) { + return (floatValue * 100).toFixed(2) + ' %'; + }, + + _renderExtendedProgress: function (data) { + return this._formatBitrate(data.bitrate) + ' | ' + + this._formatTime( + (data.total - data.loaded) * 8 / data.bitrate + ) + ' | ' + + this._formatPercentage( + data.loaded / data.total + ) + ' | ' + + this._formatFileSize(data.loaded) + ' / ' + + this._formatFileSize(data.total); + }, + + _renderTemplate: function (func, files) { + if (!func) { + return $(); + } + var result = func({ + files: files, + formatFileSize: this._formatFileSize, + options: this.options + }); + if (result instanceof $) { + return result; + } + return $(this.options.templatesContainer).html(result).children(); + }, + + _renderPreviews: function (data) { + data.context.find('.preview').each(function (index, elm) { + $(elm).append(data.files[index].preview); + }); + }, + + _renderUpload: function (files) { + return this._renderTemplate( + this.options.uploadTemplate, + files + ); + }, + + _renderDownload: function (files) { + return this._renderTemplate( + this.options.downloadTemplate, + files + ).find('a[download]').each(this._enableDragToDesktop).end(); + }, + + _startHandler: function (e) { + e.preventDefault(); + var button = $(e.currentTarget), + template = button.closest('.template-upload'), + data = template.data('data'); + button.prop('disabled', true); + if (data && data.submit) { + data.submit(); + } + }, + + _cancelHandler: function (e) { + e.preventDefault(); + var template = $(e.currentTarget) + .closest('.template-upload,.template-download'), + data = template.data('data') || {}; + data.context = data.context || template; + if (data.abort) { + data.abort(); + } else { + data.errorThrown = 'abort'; + this._trigger('fail', e, data); + } + }, + + _deleteHandler: function (e) { + e.preventDefault(); + var button = $(e.currentTarget); + this._trigger('destroy', e, $.extend({ + context: button.closest('.template-download'), + type: 'DELETE' + }, button.data())); + }, + + _forceReflow: function (node) { + return $.support.transition && node.length && + node[0].offsetWidth; + }, + + _transition: function (node) { + var dfd = $.Deferred(); + if ($.support.transition && node.hasClass('fade') && node.is(':visible')) { + node.bind( + $.support.transition.end, + function (e) { + // Make sure we don't respond to other transitions events + // in the container element, e.g. from button elements: + if (e.target === node[0]) { + node.unbind($.support.transition.end); + dfd.resolveWith(node); + } + } + ).toggleClass('in'); + } else { + node.toggleClass('in'); + dfd.resolveWith(node); + } + return dfd; + }, + + _initButtonBarEventHandlers: function () { + var fileUploadButtonBar = this.element.find('.fileupload-buttonbar'), + filesList = this.options.filesContainer; + this._on(fileUploadButtonBar.find('.start'), { + click: function (e) { + e.preventDefault(); + filesList.find('.start').click(); + } + }); + this._on(fileUploadButtonBar.find('.cancel'), { + click: function (e) { + e.preventDefault(); + filesList.find('.cancel').click(); + } + }); + this._on(fileUploadButtonBar.find('.delete'), { + click: function (e) { + e.preventDefault(); + filesList.find('.toggle:checked') + .closest('.template-download') + .find('.delete').click(); + fileUploadButtonBar.find('.toggle') + .prop('checked', false); + } + }); + this._on(fileUploadButtonBar.find('.toggle'), { + change: function (e) { + filesList.find('.toggle').prop( + 'checked', + $(e.currentTarget).is(':checked') + ); + } + }); + }, + + _destroyButtonBarEventHandlers: function () { + this._off( + this.element.find('.fileupload-buttonbar') + .find('.start, .cancel, .delete'), + 'click' + ); + this._off( + this.element.find('.fileupload-buttonbar .toggle'), + 'change.' + ); + }, + + _initEventHandlers: function () { + this._super(); + this._on(this.options.filesContainer, { + 'click .start': this._startHandler, + 'click .cancel': this._cancelHandler, + 'click .delete': this._deleteHandler + }); + this._initButtonBarEventHandlers(); + }, + + _destroyEventHandlers: function () { + this._destroyButtonBarEventHandlers(); + this._off(this.options.filesContainer, 'click'); + this._super(); + }, + + _enableFileInputButton: function () { + this.element.find('.fileinput-button input') + .prop('disabled', false) + .parent().removeClass('disabled'); + }, + + _disableFileInputButton: function () { + this.element.find('.fileinput-button input') + .prop('disabled', true) + .parent().addClass('disabled'); + }, + + _initTemplates: function () { + var options = this.options; + options.templatesContainer = this.document[0].createElement( + options.filesContainer.prop('nodeName') + ); + if (tmpl) { + if (options.uploadTemplateId) { + options.uploadTemplate = tmpl(options.uploadTemplateId); + } + if (options.downloadTemplateId) { + options.downloadTemplate = tmpl(options.downloadTemplateId); + } + } + }, + + _initFilesContainer: function () { + var options = this.options; + if (options.filesContainer === undefined) { + options.filesContainer = this.element.find('.files'); + } else if (!(options.filesContainer instanceof $)) { + options.filesContainer = $(options.filesContainer); + } + }, + + _initSpecialOptions: function () { + this._super(); + this._initFilesContainer(); + this._initTemplates(); + }, + + _create: function () { + this._super(); + this._resetFinishedDeferreds(); + if (!$.support.fileInput) { + this._disableFileInputButton(); + } + }, + + enable: function () { + var wasDisabled = false; + if (this.options.disabled) { + wasDisabled = true; + } + this._super(); + if (wasDisabled) { + this.element.find('input, button').prop('disabled', false); + this._enableFileInputButton(); + } + }, + + disable: function () { + if (!this.options.disabled) { + this.element.find('input, button').prop('disabled', true); + this._disableFileInputButton(); + } + this._super(); + } + + }); + +})); diff --git a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-validate.js b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-validate.js new file mode 100644 index 000000000..eebeb3733 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-validate.js @@ -0,0 +1,125 @@ +/* + * jQuery File Upload Validation Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +/* global define, require, window */ + +;(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + './jquery.fileupload-process' + ], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory( + require('jquery'), + require('./jquery.fileupload-process') + ); + } else { + // Browser globals: + factory( + window.jQuery + ); + } +}(function ($) { + 'use strict'; + + // Append to the default processQueue: + $.blueimp.fileupload.prototype.options.processQueue.push( + { + action: 'validate', + // Always trigger this action, + // even if the previous action was rejected: + always: true, + // Options taken from the global options map: + acceptFileTypes: '@', + maxFileSize: '@', + minFileSize: '@', + maxNumberOfFiles: '@', + disabled: '@disableValidation' + } + ); + + // The File Upload Validation plugin extends the fileupload widget + // with file validation functionality: + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + + options: { + /* + // The regular expression for allowed file types, matches + // against either file type or file name: + acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, + // The maximum allowed file size in bytes: + maxFileSize: 10000000, // 10 MB + // The minimum allowed file size in bytes: + minFileSize: undefined, // No minimal file size + // The limit of files to be uploaded: + maxNumberOfFiles: 10, + */ + + // Function returning the current number of files, + // has to be overriden for maxNumberOfFiles validation: + getNumberOfFiles: $.noop, + + // Error and info messages: + messages: { + maxNumberOfFiles: 'Maximum number of files exceeded', + acceptFileTypes: 'File type not allowed', + maxFileSize: 'File is too large', + minFileSize: 'File is too small' + } + }, + + processActions: { + + validate: function (data, options) { + if (options.disabled) { + return data; + } + var dfd = $.Deferred(), + settings = this.options, + file = data.files[data.index], + fileSize; + if (options.minFileSize || options.maxFileSize) { + fileSize = file.size; + } + if ($.type(options.maxNumberOfFiles) === 'number' && + (settings.getNumberOfFiles() || 0) + data.files.length > + options.maxNumberOfFiles) { + file.error = settings.i18n('maxNumberOfFiles'); + } else if (options.acceptFileTypes && + !(options.acceptFileTypes.test(file.type) || + options.acceptFileTypes.test(file.name))) { + file.error = settings.i18n('acceptFileTypes'); + } else if (fileSize > options.maxFileSize) { + file.error = settings.i18n('maxFileSize'); + } else if ($.type(fileSize) === 'number' && + fileSize < options.minFileSize) { + file.error = settings.i18n('minFileSize'); + } else { + delete file.error; + } + if (file.error || data.files.error) { + data.files.error = true; + dfd.rejectWith(this, [data]); + } else { + dfd.resolveWith(this, [data]); + } + return dfd.promise(); + } + + } + + }); + +})); diff --git a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-video.js b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-video.js new file mode 100644 index 000000000..aedcec2ba --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-video.js @@ -0,0 +1,113 @@ +/* + * jQuery File Upload Video Preview Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2013, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +/* jshint nomen:false */ +/* global define, require, window, document */ + +;(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'load-image', + './jquery.fileupload-process' + ], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory( + require('jquery'), + require('blueimp-load-image/js/load-image'), + require('./jquery.fileupload-process') + ); + } else { + // Browser globals: + factory( + window.jQuery, + window.loadImage + ); + } +}(function ($, loadImage) { + 'use strict'; + + // Prepend to the default processQueue: + $.blueimp.fileupload.prototype.options.processQueue.unshift( + { + action: 'loadVideo', + // Use the action as prefix for the "@" options: + prefix: true, + fileTypes: '@', + maxFileSize: '@', + disabled: '@disableVideoPreview' + }, + { + action: 'setVideo', + name: '@videoPreviewName', + disabled: '@disableVideoPreview' + } + ); + + // The File Upload Video Preview plugin extends the fileupload widget + // with video preview functionality: + $.widget('blueimp.fileupload', $.blueimp.fileupload, { + + options: { + // The regular expression for the types of video files to load, + // matched against the file type: + loadVideoFileTypes: /^video\/.*$/ + }, + + _videoElement: document.createElement('video'), + + processActions: { + + // Loads the video file given via data.files and data.index + // as video element if the browser supports playing it. + // Accepts the options fileTypes (regular expression) + // and maxFileSize (integer) to limit the files to load: + loadVideo: function (data, options) { + if (options.disabled) { + return data; + } + var file = data.files[data.index], + url, + video; + if (this._videoElement.canPlayType && + this._videoElement.canPlayType(file.type) && + ($.type(options.maxFileSize) !== 'number' || + file.size <= options.maxFileSize) && + (!options.fileTypes || + options.fileTypes.test(file.type))) { + url = loadImage.createObjectURL(file); + if (url) { + video = this._videoElement.cloneNode(false); + video.src = url; + video.controls = true; + data.video = video; + return data; + } + } + return data; + }, + + // Sets the video element as a property of the file object: + setVideo: function (data, options) { + if (data.video && !options.disabled) { + data.files[data.index][options.name || 'preview'] = data.video; + } + return data; + } + + } + + }); + +})); diff --git a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload.js b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload.js new file mode 100644 index 000000000..700f9013c --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload.js @@ -0,0 +1,1502 @@ +/* + * jQuery File Upload Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +/* jshint nomen:false */ +/* global define, require, window, document, location, Blob, FormData */ + +;(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define([ + 'jquery', + 'jquery-ui/ui/widget' + ], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory( + require('jquery'), + require('./vendor/jquery.ui.widget') + ); + } else { + // Browser globals: + factory(window.jQuery); + } +}(function ($) { + 'use strict'; + + // Detect file input support, based on + // http://viljamis.com/blog/2012/file-upload-support-on-mobile/ + $.support.fileInput = !(new RegExp( + // Handle devices which give false positives for the feature detection: + '(Android (1\\.[0156]|2\\.[01]))' + + '|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)' + + '|(w(eb)?OSBrowser)|(webOS)' + + '|(Kindle/(1\\.0|2\\.[05]|3\\.0))' + ).test(window.navigator.userAgent) || + // Feature detection for all other devices: + $('<input type="file"/>').prop('disabled')); + + // The FileReader API is not actually used, but works as feature detection, + // as some Safari versions (5?) support XHR file uploads via the FormData API, + // but not non-multipart XHR file uploads. + // window.XMLHttpRequestUpload is not available on IE10, so we check for + // window.ProgressEvent instead to detect XHR2 file upload capability: + $.support.xhrFileUpload = !!(window.ProgressEvent && window.FileReader); + $.support.xhrFormDataFileUpload = !!window.FormData; + + // Detect support for Blob slicing (required for chunked uploads): + $.support.blobSlice = window.Blob && (Blob.prototype.slice || + Blob.prototype.webkitSlice || Blob.prototype.mozSlice); + + // Helper function to create drag handlers for dragover/dragenter/dragleave: + function getDragHandler(type) { + var isDragOver = type === 'dragover'; + return function (e) { + e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer; + var dataTransfer = e.dataTransfer; + if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 && + this._trigger( + type, + $.Event(type, {delegatedEvent: e}) + ) !== false) { + e.preventDefault(); + if (isDragOver) { + dataTransfer.dropEffect = 'copy'; + } + } + }; + } + + // The fileupload widget listens for change events on file input fields defined + // via fileInput setting and paste or drop events of the given dropZone. + // In addition to the default jQuery Widget methods, the fileupload widget + // exposes the "add" and "send" methods, to add or directly send files using + // the fileupload API. + // By default, files added via file input selection, paste, drag & drop or + // "add" method are uploaded immediately, but it is possible to override + // the "add" callback option to queue file uploads. + $.widget('blueimp.fileupload', { + + options: { + // The drop target element(s), by the default the complete document. + // Set to null to disable drag & drop support: + dropZone: $(document), + // The paste target element(s), by the default undefined. + // Set to a DOM node or jQuery object to enable file pasting: + pasteZone: undefined, + // The file input field(s), that are listened to for change events. + // If undefined, it is set to the file input fields inside + // of the widget element on plugin initialization. + // Set to null to disable the change listener. + fileInput: undefined, + // By default, the file input field is replaced with a clone after + // each input field change event. This is required for iframe transport + // queues and allows change events to be fired for the same file + // selection, but can be disabled by setting the following option to false: + replaceFileInput: true, + // The parameter name for the file form data (the request argument name). + // If undefined or empty, the name property of the file input field is + // used, or "files[]" if the file input name property is also empty, + // can be a string or an array of strings: + paramName: undefined, + // By default, each file of a selection is uploaded using an individual + // request for XHR type uploads. Set to false to upload file + // selections in one request each: + singleFileUploads: true, + // To limit the number of files uploaded with one XHR request, + // set the following option to an integer greater than 0: + limitMultiFileUploads: undefined, + // The following option limits the number of files uploaded with one + // XHR request to keep the request size under or equal to the defined + // limit in bytes: + limitMultiFileUploadSize: undefined, + // Multipart file uploads add a number of bytes to each uploaded file, + // therefore the following option adds an overhead for each file used + // in the limitMultiFileUploadSize configuration: + limitMultiFileUploadSizeOverhead: 512, + // Set the following option to true to issue all file upload requests + // in a sequential order: + sequentialUploads: false, + // To limit the number of concurrent uploads, + // set the following option to an integer greater than 0: + limitConcurrentUploads: undefined, + // Set the following option to true to force iframe transport uploads: + forceIframeTransport: false, + // Set the following option to the location of a redirect url on the + // origin server, for cross-domain iframe transport uploads: + redirect: undefined, + // The parameter name for the redirect url, sent as part of the form + // data and set to 'redirect' if this option is empty: + redirectParamName: undefined, + // Set the following option to the location of a postMessage window, + // to enable postMessage transport uploads: + postMessage: undefined, + // By default, XHR file uploads are sent as multipart/form-data. + // The iframe transport is always using multipart/form-data. + // Set to false to enable non-multipart XHR uploads: + multipart: true, + // To upload large files in smaller chunks, set the following option + // to a preferred maximum chunk size. If set to 0, null or undefined, + // or the browser does not support the required Blob API, files will + // be uploaded as a whole. + maxChunkSize: undefined, + // When a non-multipart upload or a chunked multipart upload has been + // aborted, this option can be used to resume the upload by setting + // it to the size of the already uploaded bytes. This option is most + // useful when modifying the options object inside of the "add" or + // "send" callbacks, as the options are cloned for each file upload. + uploadedBytes: undefined, + // By default, failed (abort or error) file uploads are removed from the + // global progress calculation. Set the following option to false to + // prevent recalculating the global progress data: + recalculateProgress: true, + // Interval in milliseconds to calculate and trigger progress events: + progressInterval: 100, + // Interval in milliseconds to calculate progress bitrate: + bitrateInterval: 500, + // By default, uploads are started automatically when adding files: + autoUpload: true, + + // Error and info messages: + messages: { + uploadedBytes: 'Uploaded bytes exceed file size' + }, + + // Translation function, gets the message key to be translated + // and an object with context specific data as arguments: + i18n: function (message, context) { + message = this.messages[message] || message.toString(); + if (context) { + $.each(context, function (key, value) { + message = message.replace('{' + key + '}', value); + }); + } + return message; + }, + + // Additional form data to be sent along with the file uploads can be set + // using this option, which accepts an array of objects with name and + // value properties, a function returning such an array, a FormData + // object (for XHR file uploads), or a simple object. + // The form of the first fileInput is given as parameter to the function: + formData: function (form) { + return form.serializeArray(); + }, + + // The add callback is invoked as soon as files are added to the fileupload + // widget (via file input selection, drag & drop, paste or add API call). + // If the singleFileUploads option is enabled, this callback will be + // called once for each file in the selection for XHR file uploads, else + // once for each file selection. + // + // The upload starts when the submit method is invoked on the data parameter. + // The data object contains a files property holding the added files + // and allows you to override plugin options as well as define ajax settings. + // + // Listeners for this callback can also be bound the following way: + // .bind('fileuploadadd', func); + // + // data.submit() returns a Promise object and allows to attach additional + // handlers using jQuery's Deferred callbacks: + // data.submit().done(func).fail(func).always(func); + add: function (e, data) { + if (e.isDefaultPrevented()) { + return false; + } + if (data.autoUpload || (data.autoUpload !== false && + $(this).fileupload('option', 'autoUpload'))) { + data.process().done(function () { + data.submit(); + }); + } + }, + + // Other callbacks: + + // Callback for the submit event of each file upload: + // submit: function (e, data) {}, // .bind('fileuploadsubmit', func); + + // Callback for the start of each file upload request: + // send: function (e, data) {}, // .bind('fileuploadsend', func); + + // Callback for successful uploads: + // done: function (e, data) {}, // .bind('fileuploaddone', func); + + // Callback for failed (abort or error) uploads: + // fail: function (e, data) {}, // .bind('fileuploadfail', func); + + // Callback for completed (success, abort or error) requests: + // always: function (e, data) {}, // .bind('fileuploadalways', func); + + // Callback for upload progress events: + // progress: function (e, data) {}, // .bind('fileuploadprogress', func); + + // Callback for global upload progress events: + // progressall: function (e, data) {}, // .bind('fileuploadprogressall', func); + + // Callback for uploads start, equivalent to the global ajaxStart event: + // start: function (e) {}, // .bind('fileuploadstart', func); + + // Callback for uploads stop, equivalent to the global ajaxStop event: + // stop: function (e) {}, // .bind('fileuploadstop', func); + + // Callback for change events of the fileInput(s): + // change: function (e, data) {}, // .bind('fileuploadchange', func); + + // Callback for paste events to the pasteZone(s): + // paste: function (e, data) {}, // .bind('fileuploadpaste', func); + + // Callback for drop events of the dropZone(s): + // drop: function (e, data) {}, // .bind('fileuploaddrop', func); + + // Callback for dragover events of the dropZone(s): + // dragover: function (e) {}, // .bind('fileuploaddragover', func); + + // Callback before the start of each chunk upload request (before form data initialization): + // chunkbeforesend: function (e, data) {}, // .bind('fileuploadchunkbeforesend', func); + + // Callback for the start of each chunk upload request: + // chunksend: function (e, data) {}, // .bind('fileuploadchunksend', func); + + // Callback for successful chunk uploads: + // chunkdone: function (e, data) {}, // .bind('fileuploadchunkdone', func); + + // Callback for failed (abort or error) chunk uploads: + // chunkfail: function (e, data) {}, // .bind('fileuploadchunkfail', func); + + // Callback for completed (success, abort or error) chunk upload requests: + // chunkalways: function (e, data) {}, // .bind('fileuploadchunkalways', func); + + // The plugin options are used as settings object for the ajax calls. + // The following are jQuery ajax settings required for the file uploads: + processData: false, + contentType: false, + cache: false, + timeout: 0 + }, + + // A list of options that require reinitializing event listeners and/or + // special initialization code: + _specialOptions: [ + 'fileInput', + 'dropZone', + 'pasteZone', + 'multipart', + 'forceIframeTransport' + ], + + _blobSlice: $.support.blobSlice && function () { + var slice = this.slice || this.webkitSlice || this.mozSlice; + return slice.apply(this, arguments); + }, + + _BitrateTimer: function () { + this.timestamp = ((Date.now) ? Date.now() : (new Date()).getTime()); + this.loaded = 0; + this.bitrate = 0; + this.getBitrate = function (now, loaded, interval) { + var timeDiff = now - this.timestamp; + if (!this.bitrate || !interval || timeDiff > interval) { + this.bitrate = (loaded - this.loaded) * (1000 / timeDiff) * 8; + this.loaded = loaded; + this.timestamp = now; + } + return this.bitrate; + }; + }, + + _isXHRUpload: function (options) { + return !options.forceIframeTransport && + ((!options.multipart && $.support.xhrFileUpload) || + $.support.xhrFormDataFileUpload); + }, + + _getFormData: function (options) { + var formData; + if ($.type(options.formData) === 'function') { + return options.formData(options.form); + } + if ($.isArray(options.formData)) { + return options.formData; + } + if ($.type(options.formData) === 'object') { + formData = []; + $.each(options.formData, function (name, value) { + formData.push({name: name, value: value}); + }); + return formData; + } + return []; + }, + + _getTotal: function (files) { + var total = 0; + $.each(files, function (index, file) { + total += file.size || 1; + }); + return total; + }, + + _initProgressObject: function (obj) { + var progress = { + loaded: 0, + total: 0, + bitrate: 0 + }; + if (obj._progress) { + $.extend(obj._progress, progress); + } else { + obj._progress = progress; + } + }, + + _initResponseObject: function (obj) { + var prop; + if (obj._response) { + for (prop in obj._response) { + if (obj._response.hasOwnProperty(prop)) { + delete obj._response[prop]; + } + } + } else { + obj._response = {}; + } + }, + + _onProgress: function (e, data) { + if (e.lengthComputable) { + var now = ((Date.now) ? Date.now() : (new Date()).getTime()), + loaded; + if (data._time && data.progressInterval && + (now - data._time < data.progressInterval) && + e.loaded !== e.total) { + return; + } + data._time = now; + loaded = Math.floor( + e.loaded / e.total * (data.chunkSize || data._progress.total) + ) + (data.uploadedBytes || 0); + // Add the difference from the previously loaded state + // to the global loaded counter: + this._progress.loaded += (loaded - data._progress.loaded); + this._progress.bitrate = this._bitrateTimer.getBitrate( + now, + this._progress.loaded, + data.bitrateInterval + ); + data._progress.loaded = data.loaded = loaded; + data._progress.bitrate = data.bitrate = data._bitrateTimer.getBitrate( + now, + loaded, + data.bitrateInterval + ); + // Trigger a custom progress event with a total data property set + // to the file size(s) of the current upload and a loaded data + // property calculated accordingly: + this._trigger( + 'progress', + $.Event('progress', {delegatedEvent: e}), + data + ); + // Trigger a global progress event for all current file uploads, + // including ajax calls queued for sequential file uploads: + this._trigger( + 'progressall', + $.Event('progressall', {delegatedEvent: e}), + this._progress + ); + } + }, + + _initProgressListener: function (options) { + var that = this, + xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr(); + // Accesss to the native XHR object is required to add event listeners + // for the upload progress event: + if (xhr.upload) { + $(xhr.upload).bind('progress', function (e) { + var oe = e.originalEvent; + // Make sure the progress event properties get copied over: + e.lengthComputable = oe.lengthComputable; + e.loaded = oe.loaded; + e.total = oe.total; + that._onProgress(e, options); + }); + options.xhr = function () { + return xhr; + }; + } + }, + + _deinitProgressListener: function (options) { + var xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr(); + if (xhr.upload) { + $(xhr.upload).unbind('progress'); + } + }, + + _isInstanceOf: function (type, obj) { + // Cross-frame instanceof check + return Object.prototype.toString.call(obj) === '[object ' + type + ']'; + }, + + _initXHRData: function (options) { + var that = this, + formData, + file = options.files[0], + // Ignore non-multipart setting if not supported: + multipart = options.multipart || !$.support.xhrFileUpload, + paramName = $.type(options.paramName) === 'array' ? + options.paramName[0] : options.paramName; + options.headers = $.extend({}, options.headers); + if (options.contentRange) { + options.headers['Content-Range'] = options.contentRange; + } + if (!multipart || options.blob || !this._isInstanceOf('File', file)) { + options.headers['Content-Disposition'] = 'attachment; filename="' + + encodeURI(file.uploadName || file.name) + '"'; + } + if (!multipart) { + options.contentType = file.type || 'application/octet-stream'; + options.data = options.blob || file; + } else if ($.support.xhrFormDataFileUpload) { + if (options.postMessage) { + // window.postMessage does not allow sending FormData + // objects, so we just add the File/Blob objects to + // the formData array and let the postMessage window + // create the FormData object out of this array: + formData = this._getFormData(options); + if (options.blob) { + formData.push({ + name: paramName, + value: options.blob + }); + } else { + $.each(options.files, function (index, file) { + formData.push({ + name: ($.type(options.paramName) === 'array' && + options.paramName[index]) || paramName, + value: file + }); + }); + } + } else { + if (that._isInstanceOf('FormData', options.formData)) { + formData = options.formData; + } else { + formData = new FormData(); + $.each(this._getFormData(options), function (index, field) { + formData.append(field.name, field.value); + }); + } + if (options.blob) { + formData.append( + paramName, + options.blob, + file.uploadName || file.name + ); + } else { + $.each(options.files, function (index, file) { + // This check allows the tests to run with + // dummy objects: + if (that._isInstanceOf('File', file) || + that._isInstanceOf('Blob', file)) { + formData.append( + ($.type(options.paramName) === 'array' && + options.paramName[index]) || paramName, + file, + file.uploadName || file.name + ); + } + }); + } + } + options.data = formData; + } + // Blob reference is not needed anymore, free memory: + options.blob = null; + }, + + _initIframeSettings: function (options) { + var targetHost = $('<a></a>').prop('href', options.url).prop('host'); + // Setting the dataType to iframe enables the iframe transport: + options.dataType = 'iframe ' + (options.dataType || ''); + // The iframe transport accepts a serialized array as form data: + options.formData = this._getFormData(options); + // Add redirect url to form data on cross-domain uploads: + if (options.redirect && targetHost && targetHost !== location.host) { + options.formData.push({ + name: options.redirectParamName || 'redirect', + value: options.redirect + }); + } + }, + + _initDataSettings: function (options) { + if (this._isXHRUpload(options)) { + if (!this._chunkedUpload(options, true)) { + if (!options.data) { + this._initXHRData(options); + } + this._initProgressListener(options); + } + if (options.postMessage) { + // Setting the dataType to postmessage enables the + // postMessage transport: + options.dataType = 'postmessage ' + (options.dataType || ''); + } + } else { + this._initIframeSettings(options); + } + }, + + _getParamName: function (options) { + var fileInput = $(options.fileInput), + paramName = options.paramName; + if (!paramName) { + paramName = []; + fileInput.each(function () { + var input = $(this), + name = input.prop('name') || 'files[]', + i = (input.prop('files') || [1]).length; + while (i) { + paramName.push(name); + i -= 1; + } + }); + if (!paramName.length) { + paramName = [fileInput.prop('name') || 'files[]']; + } + } else if (!$.isArray(paramName)) { + paramName = [paramName]; + } + return paramName; + }, + + _initFormSettings: function (options) { + // Retrieve missing options from the input field and the + // associated form, if available: + if (!options.form || !options.form.length) { + options.form = $(options.fileInput.prop('form')); + // If the given file input doesn't have an associated form, + // use the default widget file input's form: + if (!options.form.length) { + options.form = $(this.options.fileInput.prop('form')); + } + } + options.paramName = this._getParamName(options); + if (!options.url) { + options.url = options.form.prop('action') || location.href; + } + // The HTTP request method must be "POST" or "PUT": + options.type = (options.type || + ($.type(options.form.prop('method')) === 'string' && + options.form.prop('method')) || '' + ).toUpperCase(); + if (options.type !== 'POST' && options.type !== 'PUT' && + options.type !== 'PATCH') { + options.type = 'POST'; + } + if (!options.formAcceptCharset) { + options.formAcceptCharset = options.form.attr('accept-charset'); + } + }, + + _getAJAXSettings: function (data) { + var options = $.extend({}, this.options, data); + this._initFormSettings(options); + this._initDataSettings(options); + return options; + }, + + // jQuery 1.6 doesn't provide .state(), + // while jQuery 1.8+ removed .isRejected() and .isResolved(): + _getDeferredState: function (deferred) { + if (deferred.state) { + return deferred.state(); + } + if (deferred.isResolved()) { + return 'resolved'; + } + if (deferred.isRejected()) { + return 'rejected'; + } + return 'pending'; + }, + + // Maps jqXHR callbacks to the equivalent + // methods of the given Promise object: + _enhancePromise: function (promise) { + promise.success = promise.done; + promise.error = promise.fail; + promise.complete = promise.always; + return promise; + }, + + // Creates and returns a Promise object enhanced with + // the jqXHR methods abort, success, error and complete: + _getXHRPromise: function (resolveOrReject, context, args) { + var dfd = $.Deferred(), + promise = dfd.promise(); + context = context || this.options.context || promise; + if (resolveOrReject === true) { + dfd.resolveWith(context, args); + } else if (resolveOrReject === false) { + dfd.rejectWith(context, args); + } + promise.abort = dfd.promise; + return this._enhancePromise(promise); + }, + + // Adds convenience methods to the data callback argument: + _addConvenienceMethods: function (e, data) { + var that = this, + getPromise = function (args) { + return $.Deferred().resolveWith(that, args).promise(); + }; + data.process = function (resolveFunc, rejectFunc) { + if (resolveFunc || rejectFunc) { + data._processQueue = this._processQueue = + (this._processQueue || getPromise([this])).then( + function () { + if (data.errorThrown) { + return $.Deferred() + .rejectWith(that, [data]).promise(); + } + return getPromise(arguments); + } + ).then(resolveFunc, rejectFunc); + } + return this._processQueue || getPromise([this]); + }; + data.submit = function () { + if (this.state() !== 'pending') { + data.jqXHR = this.jqXHR = + (that._trigger( + 'submit', + $.Event('submit', {delegatedEvent: e}), + this + ) !== false) && that._onSend(e, this); + } + return this.jqXHR || that._getXHRPromise(); + }; + data.abort = function () { + if (this.jqXHR) { + return this.jqXHR.abort(); + } + this.errorThrown = 'abort'; + that._trigger('fail', null, this); + return that._getXHRPromise(false); + }; + data.state = function () { + if (this.jqXHR) { + return that._getDeferredState(this.jqXHR); + } + if (this._processQueue) { + return that._getDeferredState(this._processQueue); + } + }; + data.processing = function () { + return !this.jqXHR && this._processQueue && that + ._getDeferredState(this._processQueue) === 'pending'; + }; + data.progress = function () { + return this._progress; + }; + data.response = function () { + return this._response; + }; + }, + + // Parses the Range header from the server response + // and returns the uploaded bytes: + _getUploadedBytes: function (jqXHR) { + var range = jqXHR.getResponseHeader('Range'), + parts = range && range.split('-'), + upperBytesPos = parts && parts.length > 1 && + parseInt(parts[1], 10); + return upperBytesPos && upperBytesPos + 1; + }, + + // Uploads a file in multiple, sequential requests + // by splitting the file up in multiple blob chunks. + // If the second parameter is true, only tests if the file + // should be uploaded in chunks, but does not invoke any + // upload requests: + _chunkedUpload: function (options, testOnly) { + options.uploadedBytes = options.uploadedBytes || 0; + var that = this, + file = options.files[0], + fs = file.size, + ub = options.uploadedBytes, + mcs = options.maxChunkSize || fs, + slice = this._blobSlice, + dfd = $.Deferred(), + promise = dfd.promise(), + jqXHR, + upload; + if (!(this._isXHRUpload(options) && slice && (ub || ($.type(mcs) === 'function' ? mcs(options) : mcs) < fs)) || + options.data) { + return false; + } + if (testOnly) { + return true; + } + if (ub >= fs) { + file.error = options.i18n('uploadedBytes'); + return this._getXHRPromise( + false, + options.context, + [null, 'error', file.error] + ); + } + // The chunk upload method: + upload = function () { + // Clone the options object for each chunk upload: + var o = $.extend({}, options), + currentLoaded = o._progress.loaded; + o.blob = slice.call( + file, + ub, + ub + ($.type(mcs) === 'function' ? mcs(o) : mcs), + file.type + ); + // Store the current chunk size, as the blob itself + // will be dereferenced after data processing: + o.chunkSize = o.blob.size; + // Expose the chunk bytes position range: + o.contentRange = 'bytes ' + ub + '-' + + (ub + o.chunkSize - 1) + '/' + fs; + // Trigger chunkbeforesend to allow form data to be updated for this chunk + that._trigger('chunkbeforesend', null, o); + // Process the upload data (the blob and potential form data): + that._initXHRData(o); + // Add progress listeners for this chunk upload: + that._initProgressListener(o); + jqXHR = ((that._trigger('chunksend', null, o) !== false && $.ajax(o)) || + that._getXHRPromise(false, o.context)) + .done(function (result, textStatus, jqXHR) { + ub = that._getUploadedBytes(jqXHR) || + (ub + o.chunkSize); + // Create a progress event if no final progress event + // with loaded equaling total has been triggered + // for this chunk: + if (currentLoaded + o.chunkSize - o._progress.loaded) { + that._onProgress($.Event('progress', { + lengthComputable: true, + loaded: ub - o.uploadedBytes, + total: ub - o.uploadedBytes + }), o); + } + options.uploadedBytes = o.uploadedBytes = ub; + o.result = result; + o.textStatus = textStatus; + o.jqXHR = jqXHR; + that._trigger('chunkdone', null, o); + that._trigger('chunkalways', null, o); + if (ub < fs) { + // File upload not yet complete, + // continue with the next chunk: + upload(); + } else { + dfd.resolveWith( + o.context, + [result, textStatus, jqXHR] + ); + } + }) + .fail(function (jqXHR, textStatus, errorThrown) { + o.jqXHR = jqXHR; + o.textStatus = textStatus; + o.errorThrown = errorThrown; + that._trigger('chunkfail', null, o); + that._trigger('chunkalways', null, o); + dfd.rejectWith( + o.context, + [jqXHR, textStatus, errorThrown] + ); + }) + .always(function () { + that._deinitProgressListener(o); + }); + }; + this._enhancePromise(promise); + promise.abort = function () { + return jqXHR.abort(); + }; + upload(); + return promise; + }, + + _beforeSend: function (e, data) { + if (this._active === 0) { + // the start callback is triggered when an upload starts + // and no other uploads are currently running, + // equivalent to the global ajaxStart event: + this._trigger('start'); + // Set timer for global bitrate progress calculation: + this._bitrateTimer = new this._BitrateTimer(); + // Reset the global progress values: + this._progress.loaded = this._progress.total = 0; + this._progress.bitrate = 0; + } + // Make sure the container objects for the .response() and + // .progress() methods on the data object are available + // and reset to their initial state: + this._initResponseObject(data); + this._initProgressObject(data); + data._progress.loaded = data.loaded = data.uploadedBytes || 0; + data._progress.total = data.total = this._getTotal(data.files) || 1; + data._progress.bitrate = data.bitrate = 0; + this._active += 1; + // Initialize the global progress values: + this._progress.loaded += data.loaded; + this._progress.total += data.total; + }, + + _onDone: function (result, textStatus, jqXHR, options) { + var total = options._progress.total, + response = options._response; + if (options._progress.loaded < total) { + // Create a progress event if no final progress event + // with loaded equaling total has been triggered: + this._onProgress($.Event('progress', { + lengthComputable: true, + loaded: total, + total: total + }), options); + } + response.result = options.result = result; + response.textStatus = options.textStatus = textStatus; + response.jqXHR = options.jqXHR = jqXHR; + this._trigger('done', null, options); + }, + + _onFail: function (jqXHR, textStatus, errorThrown, options) { + var response = options._response; + if (options.recalculateProgress) { + // Remove the failed (error or abort) file upload from + // the global progress calculation: + this._progress.loaded -= options._progress.loaded; + this._progress.total -= options._progress.total; + } + response.jqXHR = options.jqXHR = jqXHR; + response.textStatus = options.textStatus = textStatus; + response.errorThrown = options.errorThrown = errorThrown; + this._trigger('fail', null, options); + }, + + _onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) { + // jqXHRorResult, textStatus and jqXHRorError are added to the + // options object via done and fail callbacks + this._trigger('always', null, options); + }, + + _onSend: function (e, data) { + if (!data.submit) { + this._addConvenienceMethods(e, data); + } + var that = this, + jqXHR, + aborted, + slot, + pipe, + options = that._getAJAXSettings(data), + send = function () { + that._sending += 1; + // Set timer for bitrate progress calculation: + options._bitrateTimer = new that._BitrateTimer(); + jqXHR = jqXHR || ( + ((aborted || that._trigger( + 'send', + $.Event('send', {delegatedEvent: e}), + options + ) === false) && + that._getXHRPromise(false, options.context, aborted)) || + that._chunkedUpload(options) || $.ajax(options) + ).done(function (result, textStatus, jqXHR) { + that._onDone(result, textStatus, jqXHR, options); + }).fail(function (jqXHR, textStatus, errorThrown) { + that._onFail(jqXHR, textStatus, errorThrown, options); + }).always(function (jqXHRorResult, textStatus, jqXHRorError) { + that._deinitProgressListener(options); + that._onAlways( + jqXHRorResult, + textStatus, + jqXHRorError, + options + ); + that._sending -= 1; + that._active -= 1; + if (options.limitConcurrentUploads && + options.limitConcurrentUploads > that._sending) { + // Start the next queued upload, + // that has not been aborted: + var nextSlot = that._slots.shift(); + while (nextSlot) { + if (that._getDeferredState(nextSlot) === 'pending') { + nextSlot.resolve(); + break; + } + nextSlot = that._slots.shift(); + } + } + if (that._active === 0) { + // The stop callback is triggered when all uploads have + // been completed, equivalent to the global ajaxStop event: + that._trigger('stop'); + } + }); + return jqXHR; + }; + this._beforeSend(e, options); + if (this.options.sequentialUploads || + (this.options.limitConcurrentUploads && + this.options.limitConcurrentUploads <= this._sending)) { + if (this.options.limitConcurrentUploads > 1) { + slot = $.Deferred(); + this._slots.push(slot); + pipe = slot.then(send); + } else { + this._sequence = this._sequence.then(send, send); + pipe = this._sequence; + } + // Return the piped Promise object, enhanced with an abort method, + // which is delegated to the jqXHR object of the current upload, + // and jqXHR callbacks mapped to the equivalent Promise methods: + pipe.abort = function () { + aborted = [undefined, 'abort', 'abort']; + if (!jqXHR) { + if (slot) { + slot.rejectWith(options.context, aborted); + } + return send(); + } + return jqXHR.abort(); + }; + return this._enhancePromise(pipe); + } + return send(); + }, + + _onAdd: function (e, data) { + var that = this, + result = true, + options = $.extend({}, this.options, data), + files = data.files, + filesLength = files.length, + limit = options.limitMultiFileUploads, + limitSize = options.limitMultiFileUploadSize, + overhead = options.limitMultiFileUploadSizeOverhead, + batchSize = 0, + paramName = this._getParamName(options), + paramNameSet, + paramNameSlice, + fileSet, + i, + j = 0; + if (!filesLength) { + return false; + } + if (limitSize && files[0].size === undefined) { + limitSize = undefined; + } + if (!(options.singleFileUploads || limit || limitSize) || + !this._isXHRUpload(options)) { + fileSet = [files]; + paramNameSet = [paramName]; + } else if (!(options.singleFileUploads || limitSize) && limit) { + fileSet = []; + paramNameSet = []; + for (i = 0; i < filesLength; i += limit) { + fileSet.push(files.slice(i, i + limit)); + paramNameSlice = paramName.slice(i, i + limit); + if (!paramNameSlice.length) { + paramNameSlice = paramName; + } + paramNameSet.push(paramNameSlice); + } + } else if (!options.singleFileUploads && limitSize) { + fileSet = []; + paramNameSet = []; + for (i = 0; i < filesLength; i = i + 1) { + batchSize += files[i].size + overhead; + if (i + 1 === filesLength || + ((batchSize + files[i + 1].size + overhead) > limitSize) || + (limit && i + 1 - j >= limit)) { + fileSet.push(files.slice(j, i + 1)); + paramNameSlice = paramName.slice(j, i + 1); + if (!paramNameSlice.length) { + paramNameSlice = paramName; + } + paramNameSet.push(paramNameSlice); + j = i + 1; + batchSize = 0; + } + } + } else { + paramNameSet = paramName; + } + data.originalFiles = files; + $.each(fileSet || files, function (index, element) { + var newData = $.extend({}, data); + newData.files = fileSet ? element : [element]; + newData.paramName = paramNameSet[index]; + that._initResponseObject(newData); + that._initProgressObject(newData); + that._addConvenienceMethods(e, newData); + result = that._trigger( + 'add', + $.Event('add', {delegatedEvent: e}), + newData + ); + return result; + }); + return result; + }, + + _replaceFileInput: function (data) { + var input = data.fileInput, + inputClone = input.clone(true), + restoreFocus = input.is(document.activeElement); + // Add a reference for the new cloned file input to the data argument: + data.fileInputClone = inputClone; + $('<form></form>').append(inputClone)[0].reset(); + // Detaching allows to insert the fileInput on another form + // without loosing the file input value: + input.after(inputClone).detach(); + // If the fileInput had focus before it was detached, + // restore focus to the inputClone. + if (restoreFocus) { + inputClone.focus(); + } + // Avoid memory leaks with the detached file input: + $.cleanData(input.unbind('remove')); + // Replace the original file input element in the fileInput + // elements set with the clone, which has been copied including + // event handlers: + this.options.fileInput = this.options.fileInput.map(function (i, el) { + if (el === input[0]) { + return inputClone[0]; + } + return el; + }); + // If the widget has been initialized on the file input itself, + // override this.element with the file input clone: + if (input[0] === this.element[0]) { + this.element = inputClone; + } + }, + + _handleFileTreeEntry: function (entry, path) { + var that = this, + dfd = $.Deferred(), + entries = [], + dirReader, + errorHandler = function (e) { + if (e && !e.entry) { + e.entry = entry; + } + // Since $.when returns immediately if one + // Deferred is rejected, we use resolve instead. + // This allows valid files and invalid items + // to be returned together in one set: + dfd.resolve([e]); + }, + successHandler = function (entries) { + that._handleFileTreeEntries( + entries, + path + entry.name + '/' + ).done(function (files) { + dfd.resolve(files); + }).fail(errorHandler); + }, + readEntries = function () { + dirReader.readEntries(function (results) { + if (!results.length) { + successHandler(entries); + } else { + entries = entries.concat(results); + readEntries(); + } + }, errorHandler); + }; + path = path || ''; + if (entry.isFile) { + if (entry._file) { + // Workaround for Chrome bug #149735 + entry._file.relativePath = path; + dfd.resolve(entry._file); + } else { + entry.file(function (file) { + file.relativePath = path; + dfd.resolve(file); + }, errorHandler); + } + } else if (entry.isDirectory) { + dirReader = entry.createReader(); + readEntries(); + } else { + // Return an empty list for file system items + // other than files or directories: + dfd.resolve([]); + } + return dfd.promise(); + }, + + _handleFileTreeEntries: function (entries, path) { + var that = this; + return $.when.apply( + $, + $.map(entries, function (entry) { + return that._handleFileTreeEntry(entry, path); + }) + ).then(function () { + return Array.prototype.concat.apply( + [], + arguments + ); + }); + }, + + _getDroppedFiles: function (dataTransfer) { + dataTransfer = dataTransfer || {}; + var items = dataTransfer.items; + if (items && items.length && (items[0].webkitGetAsEntry || + items[0].getAsEntry)) { + return this._handleFileTreeEntries( + $.map(items, function (item) { + var entry; + if (item.webkitGetAsEntry) { + entry = item.webkitGetAsEntry(); + if (entry) { + // Workaround for Chrome bug #149735: + entry._file = item.getAsFile(); + } + return entry; + } + return item.getAsEntry(); + }) + ); + } + return $.Deferred().resolve( + $.makeArray(dataTransfer.files) + ).promise(); + }, + + _getSingleFileInputFiles: function (fileInput) { + fileInput = $(fileInput); + var entries = fileInput.prop('webkitEntries') || + fileInput.prop('entries'), + files, + value; + if (entries && entries.length) { + return this._handleFileTreeEntries(entries); + } + files = $.makeArray(fileInput.prop('files')); + if (!files.length) { + value = fileInput.prop('value'); + if (!value) { + return $.Deferred().resolve([]).promise(); + } + // If the files property is not available, the browser does not + // support the File API and we add a pseudo File object with + // the input value as name with path information removed: + files = [{name: value.replace(/^.*\\/, '')}]; + } else if (files[0].name === undefined && files[0].fileName) { + // File normalization for Safari 4 and Firefox 3: + $.each(files, function (index, file) { + file.name = file.fileName; + file.size = file.fileSize; + }); + } + return $.Deferred().resolve(files).promise(); + }, + + _getFileInputFiles: function (fileInput) { + if (!(fileInput instanceof $) || fileInput.length === 1) { + return this._getSingleFileInputFiles(fileInput); + } + return $.when.apply( + $, + $.map(fileInput, this._getSingleFileInputFiles) + ).then(function () { + return Array.prototype.concat.apply( + [], + arguments + ); + }); + }, + + _onChange: function (e) { + var that = this, + data = { + fileInput: $(e.target), + form: $(e.target.form) + }; + this._getFileInputFiles(data.fileInput).always(function (files) { + data.files = files; + if (that.options.replaceFileInput) { + that._replaceFileInput(data); + } + if (that._trigger( + 'change', + $.Event('change', {delegatedEvent: e}), + data + ) !== false) { + that._onAdd(e, data); + } + }); + }, + + _onPaste: function (e) { + var items = e.originalEvent && e.originalEvent.clipboardData && + e.originalEvent.clipboardData.items, + data = {files: []}; + if (items && items.length) { + $.each(items, function (index, item) { + var file = item.getAsFile && item.getAsFile(); + if (file) { + data.files.push(file); + } + }); + if (this._trigger( + 'paste', + $.Event('paste', {delegatedEvent: e}), + data + ) !== false) { + this._onAdd(e, data); + } + } + }, + + _onDrop: function (e) { + e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer; + var that = this, + dataTransfer = e.dataTransfer, + data = {}; + if (dataTransfer && dataTransfer.files && dataTransfer.files.length) { + e.preventDefault(); + this._getDroppedFiles(dataTransfer).always(function (files) { + data.files = files; + if (that._trigger( + 'drop', + $.Event('drop', {delegatedEvent: e}), + data + ) !== false) { + that._onAdd(e, data); + } + }); + } + }, + + _onDragOver: getDragHandler('dragover'), + + _onDragEnter: getDragHandler('dragenter'), + + _onDragLeave: getDragHandler('dragleave'), + + _initEventHandlers: function () { + if (this._isXHRUpload(this.options)) { + this._on(this.options.dropZone, { + dragover: this._onDragOver, + drop: this._onDrop, + // event.preventDefault() on dragenter is required for IE10+: + dragenter: this._onDragEnter, + // dragleave is not required, but added for completeness: + dragleave: this._onDragLeave + }); + this._on(this.options.pasteZone, { + paste: this._onPaste + }); + } + if ($.support.fileInput) { + this._on(this.options.fileInput, { + change: this._onChange + }); + } + }, + + _destroyEventHandlers: function () { + this._off(this.options.dropZone, 'dragenter dragleave dragover drop'); + this._off(this.options.pasteZone, 'paste'); + this._off(this.options.fileInput, 'change'); + }, + + _destroy: function () { + this._destroyEventHandlers(); + }, + + _setOption: function (key, value) { + var reinit = $.inArray(key, this._specialOptions) !== -1; + if (reinit) { + this._destroyEventHandlers(); + } + this._super(key, value); + if (reinit) { + this._initSpecialOptions(); + this._initEventHandlers(); + } + }, + + _initSpecialOptions: function () { + var options = this.options; + if (options.fileInput === undefined) { + options.fileInput = this.element.is('input[type="file"]') ? + this.element : this.element.find('input[type="file"]'); + } else if (!(options.fileInput instanceof $)) { + options.fileInput = $(options.fileInput); + } + if (!(options.dropZone instanceof $)) { + options.dropZone = $(options.dropZone); + } + if (!(options.pasteZone instanceof $)) { + options.pasteZone = $(options.pasteZone); + } + }, + + _getRegExp: function (str) { + var parts = str.split('/'), + modifiers = parts.pop(); + parts.shift(); + return new RegExp(parts.join('/'), modifiers); + }, + + _isRegExpOption: function (key, value) { + return key !== 'url' && $.type(value) === 'string' && + /^\/.*\/[igm]{0,3}$/.test(value); + }, + + _initDataAttributes: function () { + var that = this, + options = this.options, + data = this.element.data(); + // Initialize options set via HTML5 data-attributes: + $.each( + this.element[0].attributes, + function (index, attr) { + var key = attr.name.toLowerCase(), + value; + if (/^data-/.test(key)) { + // Convert hyphen-ated key to camelCase: + key = key.slice(5).replace(/-[a-z]/g, function (str) { + return str.charAt(1).toUpperCase(); + }); + value = data[key]; + if (that._isRegExpOption(key, value)) { + value = that._getRegExp(value); + } + options[key] = value; + } + } + ); + }, + + _create: function () { + this._initDataAttributes(); + this._initSpecialOptions(); + this._slots = []; + this._sequence = this._getXHRPromise(true); + this._sending = this._active = 0; + this._initProgressObject(this); + this._initEventHandlers(); + }, + + // This method is exposed to the widget API and allows to query + // the number of active uploads: + active: function () { + return this._active; + }, + + // This method is exposed to the widget API and allows to query + // the widget upload progress. + // It returns an object with loaded, total and bitrate properties + // for the running uploads: + progress: function () { + return this._progress; + }, + + // This method is exposed to the widget API and allows adding files + // using the fileupload API. The data parameter accepts an object which + // must have a files property and can contain additional options: + // .fileupload('add', {files: filesList}); + add: function (data) { + var that = this; + if (!data || this.options.disabled) { + return; + } + if (data.fileInput && !data.files) { + this._getFileInputFiles(data.fileInput).always(function (files) { + data.files = files; + that._onAdd(null, data); + }); + } else { + data.files = $.makeArray(data.files); + this._onAdd(null, data); + } + }, + + // This method is exposed to the widget API and allows sending files + // using the fileupload API. The data parameter accepts an object which + // must have a files or fileInput property and can contain additional options: + // .fileupload('send', {files: filesList}); + // The method returns a Promise object for the file upload call. + send: function (data) { + if (data && !this.options.disabled) { + if (data.fileInput && !data.files) { + var that = this, + dfd = $.Deferred(), + promise = dfd.promise(), + jqXHR, + aborted; + promise.abort = function () { + aborted = true; + if (jqXHR) { + return jqXHR.abort(); + } + dfd.reject(null, 'abort', 'abort'); + return promise; + }; + this._getFileInputFiles(data.fileInput).always( + function (files) { + if (aborted) { + return; + } + if (!files.length) { + dfd.reject(); + return; + } + data.files = files; + jqXHR = that._onSend(null, data); + jqXHR.then( + function (result, textStatus, jqXHR) { + dfd.resolve(result, textStatus, jqXHR); + }, + function (jqXHR, textStatus, errorThrown) { + dfd.reject(jqXHR, textStatus, errorThrown); + } + ); + } + ); + return this._enhancePromise(promise); + } + data.files = $.makeArray(data.files); + if (data.files.length) { + return this._onSend(null, data); + } + } + return this._getXHRPromise(false, data && data.context); + } + + }); + +})); diff --git a/vendor/blueimp/jquery-file-upload/js/jquery.iframe-transport.js b/vendor/blueimp/jquery-file-upload/js/jquery.iframe-transport.js new file mode 100644 index 000000000..8d25c4641 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/js/jquery.iframe-transport.js @@ -0,0 +1,224 @@ +/* + * jQuery Iframe Transport Plugin + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2011, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +/* global define, require, window, document, JSON */ + +;(function (factory) { + 'use strict'; + if (typeof define === 'function' && define.amd) { + // Register as an anonymous AMD module: + define(['jquery'], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS: + factory(require('jquery')); + } else { + // Browser globals: + factory(window.jQuery); + } +}(function ($) { + 'use strict'; + + // Helper variable to create unique names for the transport iframes: + var counter = 0, + jsonAPI = $, + jsonParse = 'parseJSON'; + + if ('JSON' in window && 'parse' in JSON) { + jsonAPI = JSON; + jsonParse = 'parse'; + } + + // The iframe transport accepts four additional options: + // options.fileInput: a jQuery collection of file input fields + // options.paramName: the parameter name for the file form data, + // overrides the name property of the file input field(s), + // can be a string or an array of strings. + // options.formData: an array of objects with name and value properties, + // equivalent to the return data of .serializeArray(), e.g.: + // [{name: 'a', value: 1}, {name: 'b', value: 2}] + // options.initialIframeSrc: the URL of the initial iframe src, + // by default set to "javascript:false;" + $.ajaxTransport('iframe', function (options) { + if (options.async) { + // javascript:false as initial iframe src + // prevents warning popups on HTTPS in IE6: + /*jshint scripturl: true */ + var initialIframeSrc = options.initialIframeSrc || 'javascript:false;', + /*jshint scripturl: false */ + form, + iframe, + addParamChar; + return { + send: function (_, completeCallback) { + form = $('<form style="display:none;"></form>'); + form.attr('accept-charset', options.formAcceptCharset); + addParamChar = /\?/.test(options.url) ? '&' : '?'; + // XDomainRequest only supports GET and POST: + if (options.type === 'DELETE') { + options.url = options.url + addParamChar + '_method=DELETE'; + options.type = 'POST'; + } else if (options.type === 'PUT') { + options.url = options.url + addParamChar + '_method=PUT'; + options.type = 'POST'; + } else if (options.type === 'PATCH') { + options.url = options.url + addParamChar + '_method=PATCH'; + options.type = 'POST'; + } + // IE versions below IE8 cannot set the name property of + // elements that have already been added to the DOM, + // so we set the name along with the iframe HTML markup: + counter += 1; + iframe = $( + '<iframe src="' + initialIframeSrc + + '" name="iframe-transport-' + counter + '"></iframe>' + ).bind('load', function () { + var fileInputClones, + paramNames = $.isArray(options.paramName) ? + options.paramName : [options.paramName]; + iframe + .unbind('load') + .bind('load', function () { + var response; + // Wrap in a try/catch block to catch exceptions thrown + // when trying to access cross-domain iframe contents: + try { + response = iframe.contents(); + // Google Chrome and Firefox do not throw an + // exception when calling iframe.contents() on + // cross-domain requests, so we unify the response: + if (!response.length || !response[0].firstChild) { + throw new Error(); + } + } catch (e) { + response = undefined; + } + // The complete callback returns the + // iframe content document as response object: + completeCallback( + 200, + 'success', + {'iframe': response} + ); + // Fix for IE endless progress bar activity bug + // (happens on form submits to iframe targets): + $('<iframe src="' + initialIframeSrc + '"></iframe>') + .appendTo(form); + window.setTimeout(function () { + // Removing the form in a setTimeout call + // allows Chrome's developer tools to display + // the response result + form.remove(); + }, 0); + }); + form + .prop('target', iframe.prop('name')) + .prop('action', options.url) + .prop('method', options.type); + if (options.formData) { + $.each(options.formData, function (index, field) { + $('<input type="hidden"/>') + .prop('name', field.name) + .val(field.value) + .appendTo(form); + }); + } + if (options.fileInput && options.fileInput.length && + options.type === 'POST') { + fileInputClones = options.fileInput.clone(); + // Insert a clone for each file input field: + options.fileInput.after(function (index) { + return fileInputClones[index]; + }); + if (options.paramName) { + options.fileInput.each(function (index) { + $(this).prop( + 'name', + paramNames[index] || options.paramName + ); + }); + } + // Appending the file input fields to the hidden form + // removes them from their original location: + form + .append(options.fileInput) + .prop('enctype', 'multipart/form-data') + // enctype must be set as encoding for IE: + .prop('encoding', 'multipart/form-data'); + // Remove the HTML5 form attribute from the input(s): + options.fileInput.removeAttr('form'); + } + form.submit(); + // Insert the file input fields at their original location + // by replacing the clones with the originals: + if (fileInputClones && fileInputClones.length) { + options.fileInput.each(function (index, input) { + var clone = $(fileInputClones[index]); + // Restore the original name and form properties: + $(input) + .prop('name', clone.prop('name')) + .attr('form', clone.attr('form')); + clone.replaceWith(input); + }); + } + }); + form.append(iframe).appendTo(document.body); + }, + abort: function () { + if (iframe) { + // javascript:false as iframe src aborts the request + // and prevents warning popups on HTTPS in IE6. + // concat is used to avoid the "Script URL" JSLint error: + iframe + .unbind('load') + .prop('src', initialIframeSrc); + } + if (form) { + form.remove(); + } + } + }; + } + }); + + // The iframe transport returns the iframe content document as response. + // The following adds converters from iframe to text, json, html, xml + // and script. + // Please note that the Content-Type for JSON responses has to be text/plain + // or text/html, if the browser doesn't include application/json in the + // Accept header, else IE will show a download dialog. + // The Content-Type for XML responses on the other hand has to be always + // application/xml or text/xml, so IE properly parses the XML response. + // See also + // https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation + $.ajaxSetup({ + converters: { + 'iframe text': function (iframe) { + return iframe && $(iframe[0].body).text(); + }, + 'iframe json': function (iframe) { + return iframe && jsonAPI[jsonParse]($(iframe[0].body).text()); + }, + 'iframe html': function (iframe) { + return iframe && $(iframe[0].body).html(); + }, + 'iframe xml': function (iframe) { + var xmlDoc = iframe && iframe[0]; + return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc : + $.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) || + $(xmlDoc.body).html()); + }, + 'iframe script': function (iframe) { + return iframe && $.globalEval($(iframe[0].body).text()); + } + } + }); + +})); diff --git a/vendor/blueimp/jquery-file-upload/js/main.js b/vendor/blueimp/jquery-file-upload/js/main.js new file mode 100644 index 000000000..0403682e7 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/js/main.js @@ -0,0 +1,75 @@ +/* + * jQuery File Upload Plugin JS Example + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +/* global $, window */ + +$(function () { + 'use strict'; + + // Initialize the jQuery File Upload widget: + $('#fileupload').fileupload({ + // Uncomment the following to send cross-domain cookies: + //xhrFields: {withCredentials: true}, + url: 'server/php/' + }); + + // Enable iframe cross-domain access via redirect option: + $('#fileupload').fileupload( + 'option', + 'redirect', + window.location.href.replace( + /\/[^\/]*$/, + '/cors/result.html?%s' + ) + ); + + if (window.location.hostname === 'blueimp.github.io') { + // Demo settings: + $('#fileupload').fileupload('option', { + url: '//jquery-file-upload.appspot.com/', + // Enable image resizing, except for Android and Opera, + // which actually support image resizing, but fail to + // send Blob objects via XHR requests: + disableImageResize: /Android(?!.*Chrome)|Opera/ + .test(window.navigator.userAgent), + maxFileSize: 999000, + acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i + }); + // Upload server status check for browsers with CORS support: + if ($.support.cors) { + $.ajax({ + url: '//jquery-file-upload.appspot.com/', + type: 'HEAD' + }).fail(function () { + $('<div class="alert alert-danger"/>') + .text('Upload server currently unavailable - ' + + new Date()) + .appendTo('#fileupload'); + }); + } + } else { + // Load existing files: + $('#fileupload').addClass('fileupload-processing'); + $.ajax({ + // Uncomment the following to send cross-domain cookies: + //xhrFields: {withCredentials: true}, + url: $('#fileupload').fileupload('option', 'url'), + dataType: 'json', + context: $('#fileupload')[0] + }).always(function () { + $(this).removeClass('fileupload-processing'); + }).done(function (result) { + $(this).fileupload('option', 'done') + .call(this, $.Event('done'), {result: result}); + }); + } + +}); diff --git a/vendor/blueimp/jquery-file-upload/js/vendor/jquery.ui.widget.js b/vendor/blueimp/jquery-file-upload/js/vendor/jquery.ui.widget.js new file mode 100644 index 000000000..914b8ffb8 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/js/vendor/jquery.ui.widget.js @@ -0,0 +1,752 @@ +/*! jQuery UI - v1.12.1+CommonJS - 2018-02-10 + * http://jqueryui.com + * Includes: widget.js + * Copyright jQuery Foundation and other contributors; Licensed MIT */ + +(function( factory ) { + if ( typeof define === "function" && define.amd ) { + + // AMD. Register as an anonymous module. + define([ "jquery" ], factory ); + } else if ( typeof exports === "object" ) { + + // Node/CommonJS + factory( require( "jquery" ) ); + } else { + + // Browser globals + factory( jQuery ); + } +}(function( $ ) { + + $.ui = $.ui || {}; + + var version = $.ui.version = "1.12.1"; + + + /*! + * jQuery UI Widget 1.12.1 + * http://jqueryui.com + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + */ + + //>>label: Widget + //>>group: Core + //>>description: Provides a factory for creating stateful widgets with a common API. + //>>docs: http://api.jqueryui.com/jQuery.widget/ + //>>demos: http://jqueryui.com/widget/ + + + + var widgetUuid = 0; + var widgetSlice = Array.prototype.slice; + + $.cleanData = ( function( orig ) { + return function( elems ) { + var events, elem, i; + for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) { + try { + + // Only trigger remove when necessary to save time + events = $._data( elem, "events" ); + if ( events && events.remove ) { + $( elem ).triggerHandler( "remove" ); + } + + // Http://bugs.jquery.com/ticket/8235 + } catch ( e ) {} + } + orig( elems ); + }; + } )( $.cleanData ); + + $.widget = function( name, base, prototype ) { + var existingConstructor, constructor, basePrototype; + + // ProxiedPrototype allows the provided prototype to remain unmodified + // so that it can be used as a mixin for multiple widgets (#8876) + var proxiedPrototype = {}; + + var namespace = name.split( "." )[ 0 ]; + name = name.split( "." )[ 1 ]; + var fullName = namespace + "-" + name; + + if ( !prototype ) { + prototype = base; + base = $.Widget; + } + + if ( $.isArray( prototype ) ) { + prototype = $.extend.apply( null, [ {} ].concat( prototype ) ); + } + + // Create selector for plugin + $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { + return !!$.data( elem, fullName ); + }; + + $[ namespace ] = $[ namespace ] || {}; + existingConstructor = $[ namespace ][ name ]; + constructor = $[ namespace ][ name ] = function( options, element ) { + + // Allow instantiation without "new" keyword + if ( !this._createWidget ) { + return new constructor( options, element ); + } + + // Allow instantiation without initializing for simple inheritance + // must use "new" keyword (the code above always passes args) + if ( arguments.length ) { + this._createWidget( options, element ); + } + }; + + // Extend with the existing constructor to carry over any static properties + $.extend( constructor, existingConstructor, { + version: prototype.version, + + // Copy the object used to create the prototype in case we need to + // redefine the widget later + _proto: $.extend( {}, prototype ), + + // Track widgets that inherit from this widget in case this widget is + // redefined after a widget inherits from it + _childConstructors: [] + } ); + + basePrototype = new base(); + + // We need to make the options hash a property directly on the new instance + // otherwise we'll modify the options hash on the prototype that we're + // inheriting from + basePrototype.options = $.widget.extend( {}, basePrototype.options ); + $.each( prototype, function( prop, value ) { + if ( !$.isFunction( value ) ) { + proxiedPrototype[ prop ] = value; + return; + } + proxiedPrototype[ prop ] = ( function() { + function _super() { + return base.prototype[ prop ].apply( this, arguments ); + } + + function _superApply( args ) { + return base.prototype[ prop ].apply( this, args ); + } + + return function() { + var __super = this._super; + var __superApply = this._superApply; + var returnValue; + + this._super = _super; + this._superApply = _superApply; + + returnValue = value.apply( this, arguments ); + + this._super = __super; + this._superApply = __superApply; + + return returnValue; + }; + } )(); + } ); + constructor.prototype = $.widget.extend( basePrototype, { + + // TODO: remove support for widgetEventPrefix + // always use the name + a colon as the prefix, e.g., draggable:start + // don't prefix for widgets that aren't DOM-based + widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name + }, proxiedPrototype, { + constructor: constructor, + namespace: namespace, + widgetName: name, + widgetFullName: fullName + } ); + + // If this widget is being redefined then we need to find all widgets that + // are inheriting from it and redefine all of them so that they inherit from + // the new version of this widget. We're essentially trying to replace one + // level in the prototype chain. + if ( existingConstructor ) { + $.each( existingConstructor._childConstructors, function( i, child ) { + var childPrototype = child.prototype; + + // Redefine the child widget using the same prototype that was + // originally used, but inherit from the new version of the base + $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, + child._proto ); + } ); + + // Remove the list of existing child constructors from the old constructor + // so the old child constructors can be garbage collected + delete existingConstructor._childConstructors; + } else { + base._childConstructors.push( constructor ); + } + + $.widget.bridge( name, constructor ); + + return constructor; + }; + + $.widget.extend = function( target ) { + var input = widgetSlice.call( arguments, 1 ); + var inputIndex = 0; + var inputLength = input.length; + var key; + var value; + + for ( ; inputIndex < inputLength; inputIndex++ ) { + for ( key in input[ inputIndex ] ) { + value = input[ inputIndex ][ key ]; + if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { + + // Clone objects + if ( $.isPlainObject( value ) ) { + target[ key ] = $.isPlainObject( target[ key ] ) ? + $.widget.extend( {}, target[ key ], value ) : + + // Don't extend strings, arrays, etc. with objects + $.widget.extend( {}, value ); + + // Copy everything else by reference + } else { + target[ key ] = value; + } + } + } + } + return target; + }; + + $.widget.bridge = function( name, object ) { + var fullName = object.prototype.widgetFullName || name; + $.fn[ name ] = function( options ) { + var isMethodCall = typeof options === "string"; + var args = widgetSlice.call( arguments, 1 ); + var returnValue = this; + + if ( isMethodCall ) { + + // If this is an empty collection, we need to have the instance method + // return undefined instead of the jQuery instance + if ( !this.length && options === "instance" ) { + returnValue = undefined; + } else { + this.each( function() { + var methodValue; + var instance = $.data( this, fullName ); + + if ( options === "instance" ) { + returnValue = instance; + return false; + } + + if ( !instance ) { + return $.error( "cannot call methods on " + name + + " prior to initialization; " + + "attempted to call method '" + options + "'" ); + } + + if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) { + return $.error( "no such method '" + options + "' for " + name + + " widget instance" ); + } + + methodValue = instance[ options ].apply( instance, args ); + + if ( methodValue !== instance && methodValue !== undefined ) { + returnValue = methodValue && methodValue.jquery ? + returnValue.pushStack( methodValue.get() ) : + methodValue; + return false; + } + } ); + } + } else { + + // Allow multiple hashes to be passed on init + if ( args.length ) { + options = $.widget.extend.apply( null, [ options ].concat( args ) ); + } + + this.each( function() { + var instance = $.data( this, fullName ); + if ( instance ) { + instance.option( options || {} ); + if ( instance._init ) { + instance._init(); + } + } else { + $.data( this, fullName, new object( options, this ) ); + } + } ); + } + + return returnValue; + }; + }; + + $.Widget = function( /* options, element */ ) {}; + $.Widget._childConstructors = []; + + $.Widget.prototype = { + widgetName: "widget", + widgetEventPrefix: "", + defaultElement: "<div>", + + options: { + classes: {}, + disabled: false, + + // Callbacks + create: null + }, + + _createWidget: function( options, element ) { + element = $( element || this.defaultElement || this )[ 0 ]; + this.element = $( element ); + this.uuid = widgetUuid++; + this.eventNamespace = "." + this.widgetName + this.uuid; + + this.bindings = $(); + this.hoverable = $(); + this.focusable = $(); + this.classesElementLookup = {}; + + if ( element !== this ) { + $.data( element, this.widgetFullName, this ); + this._on( true, this.element, { + remove: function( event ) { + if ( event.target === element ) { + this.destroy(); + } + } + } ); + this.document = $( element.style ? + + // Element within the document + element.ownerDocument : + + // Element is window or document + element.document || element ); + this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow ); + } + + this.options = $.widget.extend( {}, + this.options, + this._getCreateOptions(), + options ); + + this._create(); + + if ( this.options.disabled ) { + this._setOptionDisabled( this.options.disabled ); + } + + this._trigger( "create", null, this._getCreateEventData() ); + this._init(); + }, + + _getCreateOptions: function() { + return {}; + }, + + _getCreateEventData: $.noop, + + _create: $.noop, + + _init: $.noop, + + destroy: function() { + var that = this; + + this._destroy(); + $.each( this.classesElementLookup, function( key, value ) { + that._removeClass( value, key ); + } ); + + // We can probably remove the unbind calls in 2.0 + // all event bindings should go through this._on() + this.element + .off( this.eventNamespace ) + .removeData( this.widgetFullName ); + this.widget() + .off( this.eventNamespace ) + .removeAttr( "aria-disabled" ); + + // Clean up events and states + this.bindings.off( this.eventNamespace ); + }, + + _destroy: $.noop, + + widget: function() { + return this.element; + }, + + option: function( key, value ) { + var options = key; + var parts; + var curOption; + var i; + + if ( arguments.length === 0 ) { + + // Don't return a reference to the internal hash + return $.widget.extend( {}, this.options ); + } + + if ( typeof key === "string" ) { + + // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } + options = {}; + parts = key.split( "." ); + key = parts.shift(); + if ( parts.length ) { + curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); + for ( i = 0; i < parts.length - 1; i++ ) { + curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; + curOption = curOption[ parts[ i ] ]; + } + key = parts.pop(); + if ( arguments.length === 1 ) { + return curOption[ key ] === undefined ? null : curOption[ key ]; + } + curOption[ key ] = value; + } else { + if ( arguments.length === 1 ) { + return this.options[ key ] === undefined ? null : this.options[ key ]; + } + options[ key ] = value; + } + } + + this._setOptions( options ); + + return this; + }, + + _setOptions: function( options ) { + var key; + + for ( key in options ) { + this._setOption( key, options[ key ] ); + } + + return this; + }, + + _setOption: function( key, value ) { + if ( key === "classes" ) { + this._setOptionClasses( value ); + } + + this.options[ key ] = value; + + if ( key === "disabled" ) { + this._setOptionDisabled( value ); + } + + return this; + }, + + _setOptionClasses: function( value ) { + var classKey, elements, currentElements; + + for ( classKey in value ) { + currentElements = this.classesElementLookup[ classKey ]; + if ( value[ classKey ] === this.options.classes[ classKey ] || + !currentElements || + !currentElements.length ) { + continue; + } + + // We are doing this to create a new jQuery object because the _removeClass() call + // on the next line is going to destroy the reference to the current elements being + // tracked. We need to save a copy of this collection so that we can add the new classes + // below. + elements = $( currentElements.get() ); + this._removeClass( currentElements, classKey ); + + // We don't use _addClass() here, because that uses this.options.classes + // for generating the string of classes. We want to use the value passed in from + // _setOption(), this is the new value of the classes option which was passed to + // _setOption(). We pass this value directly to _classes(). + elements.addClass( this._classes( { + element: elements, + keys: classKey, + classes: value, + add: true + } ) ); + } + }, + + _setOptionDisabled: function( value ) { + this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value ); + + // If the widget is becoming disabled, then nothing is interactive + if ( value ) { + this._removeClass( this.hoverable, null, "ui-state-hover" ); + this._removeClass( this.focusable, null, "ui-state-focus" ); + } + }, + + enable: function() { + return this._setOptions( { disabled: false } ); + }, + + disable: function() { + return this._setOptions( { disabled: true } ); + }, + + _classes: function( options ) { + var full = []; + var that = this; + + options = $.extend( { + element: this.element, + classes: this.options.classes || {} + }, options ); + + function processClassString( classes, checkOption ) { + var current, i; + for ( i = 0; i < classes.length; i++ ) { + current = that.classesElementLookup[ classes[ i ] ] || $(); + if ( options.add ) { + current = $( $.unique( current.get().concat( options.element.get() ) ) ); + } else { + current = $( current.not( options.element ).get() ); + } + that.classesElementLookup[ classes[ i ] ] = current; + full.push( classes[ i ] ); + if ( checkOption && options.classes[ classes[ i ] ] ) { + full.push( options.classes[ classes[ i ] ] ); + } + } + } + + this._on( options.element, { + "remove": "_untrackClassesElement" + } ); + + if ( options.keys ) { + processClassString( options.keys.match( /\S+/g ) || [], true ); + } + if ( options.extra ) { + processClassString( options.extra.match( /\S+/g ) || [] ); + } + + return full.join( " " ); + }, + + _untrackClassesElement: function( event ) { + var that = this; + $.each( that.classesElementLookup, function( key, value ) { + if ( $.inArray( event.target, value ) !== -1 ) { + that.classesElementLookup[ key ] = $( value.not( event.target ).get() ); + } + } ); + }, + + _removeClass: function( element, keys, extra ) { + return this._toggleClass( element, keys, extra, false ); + }, + + _addClass: function( element, keys, extra ) { + return this._toggleClass( element, keys, extra, true ); + }, + + _toggleClass: function( element, keys, extra, add ) { + add = ( typeof add === "boolean" ) ? add : extra; + var shift = ( typeof element === "string" || element === null ), + options = { + extra: shift ? keys : extra, + keys: shift ? element : keys, + element: shift ? this.element : element, + add: add + }; + options.element.toggleClass( this._classes( options ), add ); + return this; + }, + + _on: function( suppressDisabledCheck, element, handlers ) { + var delegateElement; + var instance = this; + + // No suppressDisabledCheck flag, shuffle arguments + if ( typeof suppressDisabledCheck !== "boolean" ) { + handlers = element; + element = suppressDisabledCheck; + suppressDisabledCheck = false; + } + + // No element argument, shuffle and use this.element + if ( !handlers ) { + handlers = element; + element = this.element; + delegateElement = this.widget(); + } else { + element = delegateElement = $( element ); + this.bindings = this.bindings.add( element ); + } + + $.each( handlers, function( event, handler ) { + function handlerProxy() { + + // Allow widgets to customize the disabled handling + // - disabled as an array instead of boolean + // - disabled class as method for disabling individual parts + if ( !suppressDisabledCheck && + ( instance.options.disabled === true || + $( this ).hasClass( "ui-state-disabled" ) ) ) { + return; + } + return ( typeof handler === "string" ? instance[ handler ] : handler ) + .apply( instance, arguments ); + } + + // Copy the guid so direct unbinding works + if ( typeof handler !== "string" ) { + handlerProxy.guid = handler.guid = + handler.guid || handlerProxy.guid || $.guid++; + } + + var match = event.match( /^([\w:-]*)\s*(.*)$/ ); + var eventName = match[ 1 ] + instance.eventNamespace; + var selector = match[ 2 ]; + + if ( selector ) { + delegateElement.on( eventName, selector, handlerProxy ); + } else { + element.on( eventName, handlerProxy ); + } + } ); + }, + + _off: function( element, eventName ) { + eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) + + this.eventNamespace; + element.off( eventName ).off( eventName ); + + // Clear the stack to avoid memory leaks (#10056) + this.bindings = $( this.bindings.not( element ).get() ); + this.focusable = $( this.focusable.not( element ).get() ); + this.hoverable = $( this.hoverable.not( element ).get() ); + }, + + _delay: function( handler, delay ) { + function handlerProxy() { + return ( typeof handler === "string" ? instance[ handler ] : handler ) + .apply( instance, arguments ); + } + var instance = this; + return setTimeout( handlerProxy, delay || 0 ); + }, + + _hoverable: function( element ) { + this.hoverable = this.hoverable.add( element ); + this._on( element, { + mouseenter: function( event ) { + this._addClass( $( event.currentTarget ), null, "ui-state-hover" ); + }, + mouseleave: function( event ) { + this._removeClass( $( event.currentTarget ), null, "ui-state-hover" ); + } + } ); + }, + + _focusable: function( element ) { + this.focusable = this.focusable.add( element ); + this._on( element, { + focusin: function( event ) { + this._addClass( $( event.currentTarget ), null, "ui-state-focus" ); + }, + focusout: function( event ) { + this._removeClass( $( event.currentTarget ), null, "ui-state-focus" ); + } + } ); + }, + + _trigger: function( type, event, data ) { + var prop, orig; + var callback = this.options[ type ]; + + data = data || {}; + event = $.Event( event ); + event.type = ( type === this.widgetEventPrefix ? + type : + this.widgetEventPrefix + type ).toLowerCase(); + + // The original event may come from any element + // so we need to reset the target on the new event + event.target = this.element[ 0 ]; + + // Copy original event properties over to the new event + orig = event.originalEvent; + if ( orig ) { + for ( prop in orig ) { + if ( !( prop in event ) ) { + event[ prop ] = orig[ prop ]; + } + } + } + + this.element.trigger( event, data ); + return !( $.isFunction( callback ) && + callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false || + event.isDefaultPrevented() ); + } + }; + + $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { + $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { + if ( typeof options === "string" ) { + options = { effect: options }; + } + + var hasOptions; + var effectName = !options ? + method : + options === true || typeof options === "number" ? + defaultEffect : + options.effect || defaultEffect; + + options = options || {}; + if ( typeof options === "number" ) { + options = { duration: options }; + } + + hasOptions = !$.isEmptyObject( options ); + options.complete = callback; + + if ( options.delay ) { + element.delay( options.delay ); + } + + if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { + element[ method ]( options ); + } else if ( effectName !== method && element[ effectName ] ) { + element[ effectName ]( options.duration, options.easing, callback ); + } else { + element.queue( function( next ) { + $( this )[ method ](); + if ( callback ) { + callback.call( element[ 0 ] ); + } + next(); + } ); + } + }; + } ); + + var widget = $.widget; + + + + +})); diff --git a/vendor/blueimp/jquery-file-upload/package.json b/vendor/blueimp/jquery-file-upload/package.json new file mode 100644 index 000000000..4b33a0362 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/package.json @@ -0,0 +1,55 @@ +{ + "name": "blueimp-file-upload", + "version": "9.25.1", + "title": "jQuery File Upload", + "description": "File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.", + "keywords": [ + "jquery", + "file", + "upload", + "widget", + "multiple", + "selection", + "drag", + "drop", + "progress", + "preview", + "cross-domain", + "cross-site", + "chunk", + "resume", + "gae", + "go", + "python", + "php", + "bootstrap" + ], + "homepage": "https://github.com/blueimp/jQuery-File-Upload", + "author": { + "name": "Sebastian Tschan", + "url": "https://blueimp.net" + }, + "repository": { + "type": "git", + "url": "git://github.com/blueimp/jQuery-File-Upload.git" + }, + "license": "MIT", + "optionalDependencies": { + "blueimp-canvas-to-blob": "3.5.0", + "blueimp-load-image": "2.12.2", + "blueimp-tmpl": "3.6.0" + }, + "devDependencies": { + "bower-json": "0.8.1", + "jshint": "2.9.3" + }, + "scripts": { + "bower-version-update": "./bower-version-update.js", + "lint": "jshint *.js js/*.js js/cors/*.js", + "test": "npm run lint", + "preversion": "npm test", + "version": "npm run bower-version-update && git add bower.json", + "postversion": "git push --tags origin master && npm publish" + }, + "main": "js/jquery.fileupload.js" +} diff --git a/vendor/blueimp/jquery-file-upload/server/gae-go/app.yaml b/vendor/blueimp/jquery-file-upload/server/gae-go/app.yaml new file mode 100644 index 000000000..b5ac1a2e1 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/server/gae-go/app.yaml @@ -0,0 +1,10 @@ +runtime: go +api_version: go1 + +handlers: +- url: /(favicon\.ico|robots\.txt) + static_files: static/\1 + upload: static/(.*) + expiration: '1d' +- url: /.* + script: _go_app diff --git a/vendor/blueimp/jquery-file-upload/server/gae-go/main.go b/vendor/blueimp/jquery-file-upload/server/gae-go/main.go new file mode 100644 index 000000000..a92d128c0 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/server/gae-go/main.go @@ -0,0 +1,361 @@ +/* + * jQuery File Upload Plugin GAE Go Example + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2011, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +package app + +import ( + "bufio" + "bytes" + "encoding/json" + "fmt" + "github.com/disintegration/gift" + "golang.org/x/net/context" + "google.golang.org/appengine" + "google.golang.org/appengine/memcache" + "hash/crc32" + "image" + "image/gif" + "image/jpeg" + "image/png" + "io" + "log" + "mime/multipart" + "net/http" + "net/url" + "path/filepath" + "regexp" + "strings" +) + +const ( + WEBSITE = "https://blueimp.github.io/jQuery-File-Upload/" + MIN_FILE_SIZE = 1 // bytes + // Max file size is memcache limit (1MB) minus key size minus overhead: + MAX_FILE_SIZE = 999000 // bytes + IMAGE_TYPES = "image/(gif|p?jpeg|(x-)?png)" + ACCEPT_FILE_TYPES = IMAGE_TYPES + THUMB_MAX_WIDTH = 80 + THUMB_MAX_HEIGHT = 80 + EXPIRATION_TIME = 300 // seconds + // If empty, only allow redirects to the referer protocol+host. + // Set to a regexp string for custom pattern matching: + REDIRECT_ALLOW_TARGET = "" +) + +var ( + imageTypes = regexp.MustCompile(IMAGE_TYPES) + acceptFileTypes = regexp.MustCompile(ACCEPT_FILE_TYPES) + thumbSuffix = "." + fmt.Sprint(THUMB_MAX_WIDTH) + "x" + + fmt.Sprint(THUMB_MAX_HEIGHT) +) + +func escape(s string) string { + return strings.Replace(url.QueryEscape(s), "+", "%20", -1) +} + +func extractKey(r *http.Request) string { + // Use RequestURI instead of r.URL.Path, as we need the encoded form: + path := strings.Split(r.RequestURI, "?")[0] + // Also adjust double encoded slashes: + return strings.Replace(path[1:], "%252F", "%2F", -1) +} + +func check(err error) { + if err != nil { + panic(err) + } +} + +type FileInfo struct { + Key string `json:"-"` + ThumbnailKey string `json:"-"` + Url string `json:"url,omitempty"` + ThumbnailUrl string `json:"thumbnailUrl,omitempty"` + Name string `json:"name"` + Type string `json:"type"` + Size int64 `json:"size"` + Error string `json:"error,omitempty"` + DeleteUrl string `json:"deleteUrl,omitempty"` + DeleteType string `json:"deleteType,omitempty"` +} + +func (fi *FileInfo) ValidateType() (valid bool) { + if acceptFileTypes.MatchString(fi.Type) { + return true + } + fi.Error = "Filetype not allowed" + return false +} + +func (fi *FileInfo) ValidateSize() (valid bool) { + if fi.Size < MIN_FILE_SIZE { + fi.Error = "File is too small" + } else if fi.Size > MAX_FILE_SIZE { + fi.Error = "File is too big" + } else { + return true + } + return false +} + +func (fi *FileInfo) CreateUrls(r *http.Request, c context.Context) { + u := &url.URL{ + Scheme: r.URL.Scheme, + Host: appengine.DefaultVersionHostname(c), + Path: "/", + } + uString := u.String() + fi.Url = uString + fi.Key + fi.DeleteUrl = fi.Url + fi.DeleteType = "DELETE" + if fi.ThumbnailKey != "" { + fi.ThumbnailUrl = uString + fi.ThumbnailKey + } +} + +func (fi *FileInfo) SetKey(checksum uint32) { + fi.Key = escape(string(fi.Type)) + "/" + + escape(fmt.Sprint(checksum)) + "/" + + escape(string(fi.Name)) +} + +func (fi *FileInfo) createThumb(buffer *bytes.Buffer, c context.Context) { + if imageTypes.MatchString(fi.Type) { + src, _, err := image.Decode(bytes.NewReader(buffer.Bytes())) + check(err) + filter := gift.New(gift.ResizeToFit( + THUMB_MAX_WIDTH, + THUMB_MAX_HEIGHT, + gift.LanczosResampling, + )) + dst := image.NewNRGBA(filter.Bounds(src.Bounds())) + filter.Draw(dst, src) + buffer.Reset() + bWriter := bufio.NewWriter(buffer) + switch fi.Type { + case "image/jpeg", "image/pjpeg": + err = jpeg.Encode(bWriter, dst, nil) + case "image/gif": + err = gif.Encode(bWriter, dst, nil) + default: + err = png.Encode(bWriter, dst) + } + check(err) + bWriter.Flush() + thumbnailKey := fi.Key + thumbSuffix + filepath.Ext(fi.Name) + item := &memcache.Item{ + Key: thumbnailKey, + Value: buffer.Bytes(), + } + err = memcache.Set(c, item) + check(err) + fi.ThumbnailKey = thumbnailKey + } +} + +func handleUpload(r *http.Request, p *multipart.Part) (fi *FileInfo) { + fi = &FileInfo{ + Name: p.FileName(), + Type: p.Header.Get("Content-Type"), + } + if !fi.ValidateType() { + return + } + defer func() { + if rec := recover(); rec != nil { + log.Println(rec) + fi.Error = rec.(error).Error() + } + }() + var buffer bytes.Buffer + hash := crc32.NewIEEE() + mw := io.MultiWriter(&buffer, hash) + lr := &io.LimitedReader{R: p, N: MAX_FILE_SIZE + 1} + _, err := io.Copy(mw, lr) + check(err) + fi.Size = MAX_FILE_SIZE + 1 - lr.N + if !fi.ValidateSize() { + return + } + fi.SetKey(hash.Sum32()) + item := &memcache.Item{ + Key: fi.Key, + Value: buffer.Bytes(), + } + context := appengine.NewContext(r) + err = memcache.Set(context, item) + check(err) + fi.createThumb(&buffer, context) + fi.CreateUrls(r, context) + return +} + +func getFormValue(p *multipart.Part) string { + var b bytes.Buffer + io.CopyN(&b, p, int64(1<<20)) // Copy max: 1 MiB + return b.String() +} + +func handleUploads(r *http.Request) (fileInfos []*FileInfo) { + fileInfos = make([]*FileInfo, 0) + mr, err := r.MultipartReader() + check(err) + r.Form, err = url.ParseQuery(r.URL.RawQuery) + check(err) + part, err := mr.NextPart() + for err == nil { + if name := part.FormName(); name != "" { + if part.FileName() != "" { + fileInfos = append(fileInfos, handleUpload(r, part)) + } else { + r.Form[name] = append(r.Form[name], getFormValue(part)) + } + } + part, err = mr.NextPart() + } + return +} + +func validateRedirect(r *http.Request, redirect string) bool { + if redirect != "" { + var redirectAllowTarget *regexp.Regexp + if REDIRECT_ALLOW_TARGET != "" { + redirectAllowTarget = regexp.MustCompile(REDIRECT_ALLOW_TARGET) + } else { + referer := r.Referer() + if referer == "" { + return false + } + refererUrl, err := url.Parse(referer) + if err != nil { + return false + } + redirectAllowTarget = regexp.MustCompile("^" + regexp.QuoteMeta( + refererUrl.Scheme+"://"+refererUrl.Host+"/", + )) + } + return redirectAllowTarget.MatchString(redirect) + } + return false +} + +func get(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/" { + http.Redirect(w, r, WEBSITE, http.StatusFound) + return + } + // Use RequestURI instead of r.URL.Path, as we need the encoded form: + key := extractKey(r) + parts := strings.Split(key, "/") + if len(parts) == 3 { + context := appengine.NewContext(r) + item, err := memcache.Get(context, key) + if err == nil { + w.Header().Add("X-Content-Type-Options", "nosniff") + contentType, _ := url.QueryUnescape(parts[0]) + if !imageTypes.MatchString(contentType) { + contentType = "application/octet-stream" + } + w.Header().Add("Content-Type", contentType) + w.Header().Add( + "Cache-Control", + fmt.Sprintf("public,max-age=%d", EXPIRATION_TIME), + ) + w.Write(item.Value) + return + } + } + http.Error(w, "404 Not Found", http.StatusNotFound) +} + +func post(w http.ResponseWriter, r *http.Request) { + result := make(map[string][]*FileInfo, 1) + result["files"] = handleUploads(r) + b, err := json.Marshal(result) + check(err) + if redirect := r.FormValue("redirect"); validateRedirect(r, redirect) { + if strings.Contains(redirect, "%s") { + redirect = fmt.Sprintf( + redirect, + escape(string(b)), + ) + } + http.Redirect(w, r, redirect, http.StatusFound) + return + } + w.Header().Set("Cache-Control", "no-cache") + jsonType := "application/json" + if strings.Index(r.Header.Get("Accept"), jsonType) != -1 { + w.Header().Set("Content-Type", jsonType) + } + fmt.Fprintln(w, string(b)) +} + +func delete(w http.ResponseWriter, r *http.Request) { + key := extractKey(r) + parts := strings.Split(key, "/") + if len(parts) == 3 { + result := make(map[string]bool, 1) + context := appengine.NewContext(r) + err := memcache.Delete(context, key) + if err == nil { + result[key] = true + contentType, _ := url.QueryUnescape(parts[0]) + if imageTypes.MatchString(contentType) { + thumbnailKey := key + thumbSuffix + filepath.Ext(parts[2]) + err := memcache.Delete(context, thumbnailKey) + if err == nil { + result[thumbnailKey] = true + } + } + } + w.Header().Set("Content-Type", "application/json") + b, err := json.Marshal(result) + check(err) + fmt.Fprintln(w, string(b)) + } else { + http.Error(w, "405 Method not allowed", http.StatusMethodNotAllowed) + } +} + +func handle(w http.ResponseWriter, r *http.Request) { + params, err := url.ParseQuery(r.URL.RawQuery) + check(err) + w.Header().Add("Access-Control-Allow-Origin", "*") + w.Header().Add( + "Access-Control-Allow-Methods", + "OPTIONS, HEAD, GET, POST, DELETE", + ) + w.Header().Add( + "Access-Control-Allow-Headers", + "Content-Type, Content-Range, Content-Disposition", + ) + switch r.Method { + case "OPTIONS", "HEAD": + return + case "GET": + get(w, r) + case "POST": + if len(params["_method"]) > 0 && params["_method"][0] == "DELETE" { + delete(w, r) + } else { + post(w, r) + } + case "DELETE": + delete(w, r) + default: + http.Error(w, "501 Not Implemented", http.StatusNotImplemented) + } +} + +func init() { + http.HandleFunc("/", handle) +} diff --git a/vendor/blueimp/jquery-file-upload/server/gae-go/static/robots.txt b/vendor/blueimp/jquery-file-upload/server/gae-go/static/robots.txt new file mode 100644 index 000000000..eb0536286 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/server/gae-go/static/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: diff --git a/vendor/blueimp/jquery-file-upload/server/gae-python/app.yaml b/vendor/blueimp/jquery-file-upload/server/gae-python/app.yaml new file mode 100644 index 000000000..0c49462fa --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/server/gae-python/app.yaml @@ -0,0 +1,15 @@ +runtime: python27 +api_version: 1 +threadsafe: true + +libraries: +- name: PIL + version: latest + +handlers: +- url: /(favicon\.ico|robots\.txt) + static_files: static/\1 + upload: static/(.*) + expiration: '1d' +- url: /.* + script: main.app diff --git a/vendor/blueimp/jquery-file-upload/server/gae-python/main.py b/vendor/blueimp/jquery-file-upload/server/gae-python/main.py new file mode 100644 index 000000000..1955ac00a --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/server/gae-python/main.py @@ -0,0 +1,204 @@ +# -*- coding: utf-8 -*- +# +# jQuery File Upload Plugin GAE Python Example +# https://github.com/blueimp/jQuery-File-Upload +# +# Copyright 2011, Sebastian Tschan +# https://blueimp.net +# +# Licensed under the MIT license: +# https://opensource.org/licenses/MIT +# + +from google.appengine.api import memcache, images +import json +import os +import re +import urllib +import webapp2 + +DEBUG=os.environ.get('SERVER_SOFTWARE', '').startswith('Dev') +WEBSITE = 'https://blueimp.github.io/jQuery-File-Upload/' +MIN_FILE_SIZE = 1 # bytes +# Max file size is memcache limit (1MB) minus key size minus overhead: +MAX_FILE_SIZE = 999000 # bytes +IMAGE_TYPES = re.compile('image/(gif|p?jpeg|(x-)?png)') +ACCEPT_FILE_TYPES = IMAGE_TYPES +THUMB_MAX_WIDTH = 80 +THUMB_MAX_HEIGHT = 80 +THUMB_SUFFIX = '.'+str(THUMB_MAX_WIDTH)+'x'+str(THUMB_MAX_HEIGHT)+'.png' +EXPIRATION_TIME = 300 # seconds +# If set to None, only allow redirects to the referer protocol+host. +# Set to a regexp for custom pattern matching against the redirect value: +REDIRECT_ALLOW_TARGET = None + +class CORSHandler(webapp2.RequestHandler): + def cors(self): + headers = self.response.headers + headers['Access-Control-Allow-Origin'] = '*' + headers['Access-Control-Allow-Methods'] =\ + 'OPTIONS, HEAD, GET, POST, DELETE' + headers['Access-Control-Allow-Headers'] =\ + 'Content-Type, Content-Range, Content-Disposition' + + def initialize(self, request, response): + super(CORSHandler, self).initialize(request, response) + self.cors() + + def json_stringify(self, obj): + return json.dumps(obj, separators=(',', ':')) + + def options(self, *args, **kwargs): + pass + +class UploadHandler(CORSHandler): + def validate(self, file): + if file['size'] < MIN_FILE_SIZE: + file['error'] = 'File is too small' + elif file['size'] > MAX_FILE_SIZE: + file['error'] = 'File is too big' + elif not ACCEPT_FILE_TYPES.match(file['type']): + file['error'] = 'Filetype not allowed' + else: + return True + return False + + def validate_redirect(self, redirect): + if redirect: + if REDIRECT_ALLOW_TARGET: + return REDIRECT_ALLOW_TARGET.match(redirect) + referer = self.request.headers['referer'] + if referer: + from urlparse import urlparse + parts = urlparse(referer) + redirect_allow_target = '^' + re.escape( + parts.scheme + '://' + parts.netloc + '/' + ) + return re.match(redirect_allow_target, redirect) + return False + + def get_file_size(self, file): + file.seek(0, 2) # Seek to the end of the file + size = file.tell() # Get the position of EOF + file.seek(0) # Reset the file position to the beginning + return size + + def write_blob(self, data, info): + key = urllib.quote(info['type'].encode('utf-8'), '') +\ + '/' + str(hash(data)) +\ + '/' + urllib.quote(info['name'].encode('utf-8'), '') + try: + memcache.set(key, data, time=EXPIRATION_TIME) + except: #Failed to add to memcache + return (None, None) + thumbnail_key = None + if IMAGE_TYPES.match(info['type']): + try: + img = images.Image(image_data=data) + img.resize( + width=THUMB_MAX_WIDTH, + height=THUMB_MAX_HEIGHT + ) + thumbnail_data = img.execute_transforms() + thumbnail_key = key + THUMB_SUFFIX + memcache.set( + thumbnail_key, + thumbnail_data, + time=EXPIRATION_TIME + ) + except: #Failed to resize Image or add to memcache + thumbnail_key = None + return (key, thumbnail_key) + + def handle_upload(self): + results = [] + for name, fieldStorage in self.request.POST.items(): + if type(fieldStorage) is unicode: + continue + result = {} + result['name'] = urllib.unquote(fieldStorage.filename) + result['type'] = fieldStorage.type + result['size'] = self.get_file_size(fieldStorage.file) + if self.validate(result): + key, thumbnail_key = self.write_blob( + fieldStorage.value, + result + ) + if key is not None: + result['url'] = self.request.host_url + '/' + key + result['deleteUrl'] = result['url'] + result['deleteType'] = 'DELETE' + if thumbnail_key is not None: + result['thumbnailUrl'] = self.request.host_url +\ + '/' + thumbnail_key + else: + result['error'] = 'Failed to store uploaded file.' + results.append(result) + return results + + def head(self): + pass + + def get(self): + self.redirect(WEBSITE) + + def post(self): + if (self.request.get('_method') == 'DELETE'): + return self.delete() + result = {'files': self.handle_upload()} + s = self.json_stringify(result) + redirect = self.request.get('redirect') + if self.validate_redirect(redirect): + return self.redirect(str( + redirect.replace('%s', urllib.quote(s, ''), 1) + )) + if 'application/json' in self.request.headers.get('Accept'): + self.response.headers['Content-Type'] = 'application/json' + self.response.write(s) + +class FileHandler(CORSHandler): + def normalize(self, str): + return urllib.quote(urllib.unquote(str), '') + + def get(self, content_type, data_hash, file_name): + content_type = self.normalize(content_type) + file_name = self.normalize(file_name) + key = content_type + '/' + data_hash + '/' + file_name + data = memcache.get(key) + if data is None: + return self.error(404) + # Prevent browsers from MIME-sniffing the content-type: + self.response.headers['X-Content-Type-Options'] = 'nosniff' + content_type = urllib.unquote(content_type) + if not IMAGE_TYPES.match(content_type): + # Force a download dialog for non-image types: + content_type = 'application/octet-stream' + elif file_name.endswith(THUMB_SUFFIX): + content_type = 'image/png' + self.response.headers['Content-Type'] = content_type + # Cache for the expiration time: + self.response.headers['Cache-Control'] = 'public,max-age=%d' \ + % EXPIRATION_TIME + self.response.write(data) + + def delete(self, content_type, data_hash, file_name): + content_type = self.normalize(content_type) + file_name = self.normalize(file_name) + key = content_type + '/' + data_hash + '/' + file_name + result = {key: memcache.delete(key)} + content_type = urllib.unquote(content_type) + if IMAGE_TYPES.match(content_type): + thumbnail_key = key + THUMB_SUFFIX + result[thumbnail_key] = memcache.delete(thumbnail_key) + if 'application/json' in self.request.headers.get('Accept'): + self.response.headers['Content-Type'] = 'application/json' + s = self.json_stringify(result) + self.response.write(s) + +app = webapp2.WSGIApplication( + [ + ('/', UploadHandler), + ('/(.+)/([^/]+)/([^/]+)', FileHandler) + ], + debug=DEBUG +) diff --git a/vendor/blueimp/jquery-file-upload/server/gae-python/static/robots.txt b/vendor/blueimp/jquery-file-upload/server/gae-python/static/robots.txt new file mode 100644 index 000000000..eb0536286 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/server/gae-python/static/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: diff --git a/vendor/blueimp/jquery-file-upload/server/php/Dockerfile b/vendor/blueimp/jquery-file-upload/server/php/Dockerfile new file mode 100644 index 000000000..8633fee74 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/server/php/Dockerfile @@ -0,0 +1,38 @@ +FROM php:7-apache + +# Enable the Apache Headers module: +RUN ln -s /etc/apache2/mods-available/headers.load \ + /etc/apache2/mods-enabled/headers.load + +# Enable the Apache Rewrite module: +RUN ln -s /etc/apache2/mods-available/rewrite.load \ + /etc/apache2/mods-enabled/rewrite.load + +# Install GD, Imagick and ImageMagick as image conversion options: +RUN DEBIAN_FRONTEND=noninteractive \ + apt-get update && apt-get install -y --no-install-recommends \ + libpng-dev \ + libjpeg-dev \ + libmagickwand-dev \ + imagemagick \ + && pecl install \ + imagick \ + && docker-php-ext-enable \ + imagick \ + && docker-php-ext-configure \ + gd --with-jpeg-dir=/usr/include/ \ + && docker-php-ext-install \ + gd \ + # Uninstall obsolete packages: + && apt-get autoremove -y \ + libpng-dev \ + libjpeg-dev \ + libmagickwand-dev \ + # Remove obsolete files: + && apt-get clean \ + && rm -rf \ + /tmp/* \ + /usr/share/doc/* \ + /var/cache/* \ + /var/lib/apt/lists/* \ + /var/tmp/* diff --git a/vendor/blueimp/jquery-file-upload/server/php/UploadHandler.php b/vendor/blueimp/jquery-file-upload/server/php/UploadHandler.php new file mode 100755 index 000000000..e44004395 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/server/php/UploadHandler.php @@ -0,0 +1,1449 @@ +<?php +/* + * jQuery File Upload Plugin PHP Class + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +class UploadHandler +{ + + protected $options; + + // PHP File Upload error message codes: + // http://php.net/manual/en/features.file-upload.errors.php + protected $error_messages = array( + 1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini', + 2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form', + 3 => 'The uploaded file was only partially uploaded', + 4 => 'No file was uploaded', + 6 => 'Missing a temporary folder', + 7 => 'Failed to write file to disk', + 8 => 'A PHP extension stopped the file upload', + 'post_max_size' => 'The uploaded file exceeds the post_max_size directive in php.ini', + 'max_file_size' => 'File is too big', + 'min_file_size' => 'File is too small', + 'accept_file_types' => 'Filetype not allowed', + 'max_number_of_files' => 'Maximum number of files exceeded', + 'max_width' => 'Image exceeds maximum width', + 'min_width' => 'Image requires a minimum width', + 'max_height' => 'Image exceeds maximum height', + 'min_height' => 'Image requires a minimum height', + 'abort' => 'File upload aborted', + 'image_resize' => 'Failed to resize image' + ); + + protected const IMAGETYPE_GIF = 1; + protected const IMAGETYPE_JPEG = 2; + protected const IMAGETYPE_PNG = 3; + + protected $image_objects = array(); + + public function __construct($options = null, $initialize = true, $error_messages = null) { + $this->response = array(); + $this->options = array( + 'script_url' => $this->get_full_url().'/'.$this->basename($this->get_server_var('SCRIPT_NAME')), + 'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/files/', + 'upload_url' => $this->get_full_url().'/files/', + 'input_stream' => 'php://input', + 'user_dirs' => false, + 'mkdir_mode' => 0755, + 'param_name' => 'files', + // Set the following option to 'POST', if your server does not support + // DELETE requests. This is a parameter sent to the client: + 'delete_type' => 'DELETE', + 'access_control_allow_origin' => '*', + 'access_control_allow_credentials' => false, + 'access_control_allow_methods' => array( + 'OPTIONS', + 'HEAD', + 'GET', + 'POST', + 'PUT', + 'PATCH', + 'DELETE' + ), + 'access_control_allow_headers' => array( + 'Content-Type', + 'Content-Range', + 'Content-Disposition' + ), + // By default, allow redirects to the referer protocol+host: + 'redirect_allow_target' => '/^'.preg_quote( + parse_url($this->get_server_var('HTTP_REFERER'), PHP_URL_SCHEME) + .'://' + .parse_url($this->get_server_var('HTTP_REFERER'), PHP_URL_HOST) + .'/', // Trailing slash to not match subdomains by mistake + '/' // preg_quote delimiter param + ).'/', + // Enable to provide file downloads via GET requests to the PHP script: + // 1. Set to 1 to download files via readfile method through PHP + // 2. Set to 2 to send a X-Sendfile header for lighttpd/Apache + // 3. Set to 3 to send a X-Accel-Redirect header for nginx + // If set to 2 or 3, adjust the upload_url option to the base path of + // the redirect parameter, e.g. '/files/'. + 'download_via_php' => false, + // Read files in chunks to avoid memory limits when download_via_php + // is enabled, set to 0 to disable chunked reading of files: + 'readfile_chunk_size' => 10 * 1024 * 1024, // 10 MiB + // Defines which files can be displayed inline when downloaded: + 'inline_file_types' => '/\.(gif|jpe?g|png)$/i', + // Defines which files (based on their names) are accepted for upload. + // By default, only allows file uploads with image file extensions. + // Only change this setting after making sure that any allowed file + // types cannot be executed by the webserver in the files directory, + // e.g. PHP scripts, nor executed by the browser when downloaded, + // e.g. HTML files with embedded JavaScript code. + // Please also read the SECURITY.md document in this repository. + 'accept_file_types' => '/\.(gif|jpe?g|png)$/i', + // Replaces dots in filenames with the given string. + // Can be disabled by setting it to false or an empty string. + // Note that this is a security feature for servers that support + // multiple file extensions, e.g. the Apache AddHandler Directive: + // https://httpd.apache.org/docs/current/mod/mod_mime.html#addhandler + // Before disabling it, make sure that files uploaded with multiple + // extensions cannot be executed by the webserver, e.g. + // "example.php.png" with embedded PHP code, nor executed by the + // browser when downloaded, e.g. "example.html.gif" with embedded + // JavaScript code. + 'replace_dots_in_filenames' => '-', + // The php.ini settings upload_max_filesize and post_max_size + // take precedence over the following max_file_size setting: + 'max_file_size' => null, + 'min_file_size' => 1, + // The maximum number of files for the upload directory: + 'max_number_of_files' => null, + // Reads first file bytes to identify and correct file extensions: + 'correct_image_extensions' => false, + // Image resolution restrictions: + 'max_width' => null, + 'max_height' => null, + 'min_width' => 1, + 'min_height' => 1, + // Set the following option to false to enable resumable uploads: + 'discard_aborted_uploads' => true, + // Set to 0 to use the GD library to scale and orient images, + // set to 1 to use imagick (if installed, falls back to GD), + // set to 2 to use the ImageMagick convert binary directly: + 'image_library' => 1, + // Uncomment the following to define an array of resource limits + // for imagick: + /* + 'imagick_resource_limits' => array( + imagick::RESOURCETYPE_MAP => 32, + imagick::RESOURCETYPE_MEMORY => 32 + ), + */ + // Command or path for to the ImageMagick convert binary: + 'convert_bin' => 'convert', + // Uncomment the following to add parameters in front of each + // ImageMagick convert call (the limit constraints seem only + // to have an effect if put in front): + /* + 'convert_params' => '-limit memory 32MiB -limit map 32MiB', + */ + // Command or path for to the ImageMagick identify binary: + 'identify_bin' => 'identify', + 'image_versions' => array( + // The empty image version key defines options for the original image. + // Keep in mind: these image manipulations are inherited by all other image versions from this point onwards. + // Also note that the property 'no_cache' is not inherited, since it's not a manipulation. + '' => array( + // Automatically rotate images based on EXIF meta data: + 'auto_orient' => true + ), + // You can add arrays to generate different versions. + // The name of the key is the name of the version (example: 'medium'). + // the array contains the options to apply. + /* + 'medium' => array( + 'max_width' => 800, + 'max_height' => 600 + ), + */ + 'thumbnail' => array( + // Uncomment the following to use a defined directory for the thumbnails + // instead of a subdirectory based on the version identifier. + // Make sure that this directory doesn't allow execution of files if you + // don't pose any restrictions on the type of uploaded files, e.g. by + // copying the .htaccess file from the files directory for Apache: + //'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/thumb/', + //'upload_url' => $this->get_full_url().'/thumb/', + // Uncomment the following to force the max + // dimensions and e.g. create square thumbnails: + // 'auto_orient' => true, + // 'crop' => true, + // 'jpeg_quality' => 70, + // 'no_cache' => true, (there's a caching option, but this remembers thumbnail sizes from a previous action!) + // 'strip' => true, (this strips EXIF tags, such as geolocation) + 'max_width' => 80, // either specify width, or set to 0. Then width is automatically adjusted - keeping aspect ratio to a specified max_height. + 'max_height' => 80 // either specify height, or set to 0. Then height is automatically adjusted - keeping aspect ratio to a specified max_width. + ) + ), + 'print_response' => true + ); + if ($options) { + $this->options = $options + $this->options; + } + if ($error_messages) { + $this->error_messages = $error_messages + $this->error_messages; + } + if ($initialize) { + $this->initialize(); + } + } + + protected function initialize() { + switch ($this->get_server_var('REQUEST_METHOD')) { + case 'OPTIONS': + case 'HEAD': + $this->head(); + break; + case 'GET': + $this->get($this->options['print_response']); + break; + case 'PATCH': + case 'PUT': + case 'POST': + $this->post($this->options['print_response']); + break; + case 'DELETE': + $this->delete($this->options['print_response']); + break; + default: + $this->header('HTTP/1.1 405 Method Not Allowed'); + } + } + + protected function get_full_url() { + $https = !empty($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'], 'on') === 0 || + !empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && + strcasecmp($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') === 0; + return + ($https ? 'https://' : 'http://'). + (!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : ''). + (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME']. + ($https && $_SERVER['SERVER_PORT'] === 443 || + $_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))). + substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/')); + } + + protected function get_user_id() { + @session_start(); + return session_id(); + } + + protected function get_user_path() { + if ($this->options['user_dirs']) { + return $this->get_user_id().'/'; + } + return ''; + } + + protected function get_upload_path($file_name = null, $version = null) { + $file_name = $file_name ? $file_name : ''; + if (empty($version)) { + $version_path = ''; + } else { + $version_dir = @$this->options['image_versions'][$version]['upload_dir']; + if ($version_dir) { + return $version_dir.$this->get_user_path().$file_name; + } + $version_path = $version.'/'; + } + return $this->options['upload_dir'].$this->get_user_path() + .$version_path.$file_name; + } + + protected function get_query_separator($url) { + return strpos($url, '?') === false ? '?' : '&'; + } + + protected function get_download_url($file_name, $version = null, $direct = false) { + if (!$direct && $this->options['download_via_php']) { + $url = $this->options['script_url'] + .$this->get_query_separator($this->options['script_url']) + .$this->get_singular_param_name() + .'='.rawurlencode($file_name); + if ($version) { + $url .= '&version='.rawurlencode($version); + } + return $url.'&download=1'; + } + if (empty($version)) { + $version_path = ''; + } else { + $version_url = @$this->options['image_versions'][$version]['upload_url']; + if ($version_url) { + return $version_url.$this->get_user_path().rawurlencode($file_name); + } + $version_path = rawurlencode($version).'/'; + } + return $this->options['upload_url'].$this->get_user_path() + .$version_path.rawurlencode($file_name); + } + + protected function set_additional_file_properties($file) { + $file->deleteUrl = $this->options['script_url'] + .$this->get_query_separator($this->options['script_url']) + .$this->get_singular_param_name() + .'='.rawurlencode($file->name); + $file->deleteType = $this->options['delete_type']; + if ($file->deleteType !== 'DELETE') { + $file->deleteUrl .= '&_method=DELETE'; + } + if ($this->options['access_control_allow_credentials']) { + $file->deleteWithCredentials = true; + } + } + + // Fix for overflowing signed 32 bit integers, + // works for sizes up to 2^32-1 bytes (4 GiB - 1): + protected function fix_integer_overflow($size) { + if ($size < 0) { + $size += 2.0 * (PHP_INT_MAX + 1); + } + return $size; + } + + protected function get_file_size($file_path, $clear_stat_cache = false) { + if ($clear_stat_cache) { + if (version_compare(PHP_VERSION, '5.3.0') >= 0) { + clearstatcache(true, $file_path); + } else { + clearstatcache(); + } + } + return $this->fix_integer_overflow(filesize($file_path)); + } + + protected function is_valid_file_object($file_name) { + $file_path = $this->get_upload_path($file_name); + if (is_file($file_path) && $file_name[0] !== '.') { + return true; + } + return false; + } + + protected function get_file_object($file_name) { + if ($this->is_valid_file_object($file_name)) { + $file = new \stdClass(); + $file->name = $file_name; + $file->size = $this->get_file_size( + $this->get_upload_path($file_name) + ); + $file->url = $this->get_download_url($file->name); + foreach ($this->options['image_versions'] as $version => $options) { + if (!empty($version)) { + if (is_file($this->get_upload_path($file_name, $version))) { + $file->{$version.'Url'} = $this->get_download_url( + $file->name, + $version + ); + } + } + } + $this->set_additional_file_properties($file); + return $file; + } + return null; + } + + protected function get_file_objects($iteration_method = 'get_file_object') { + $upload_dir = $this->get_upload_path(); + if (!is_dir($upload_dir)) { + return array(); + } + return array_values(array_filter(array_map( + array($this, $iteration_method), + scandir($upload_dir) + ))); + } + + protected function count_file_objects() { + return count($this->get_file_objects('is_valid_file_object')); + } + + protected function get_error_message($error) { + return isset($this->error_messages[$error]) ? + $this->error_messages[$error] : $error; + } + + public function get_config_bytes($val) { + $val = trim($val); + $last = strtolower($val[strlen($val)-1]); + $val = (int)$val; + switch ($last) { + case 'g': + $val *= 1024; + case 'm': + $val *= 1024; + case 'k': + $val *= 1024; + } + return $this->fix_integer_overflow($val); + } + + protected function validate($uploaded_file, $file, $error, $index) { + if ($error) { + $file->error = $this->get_error_message($error); + return false; + } + $content_length = $this->fix_integer_overflow( + (int)$this->get_server_var('CONTENT_LENGTH') + ); + $post_max_size = $this->get_config_bytes(ini_get('post_max_size')); + if ($post_max_size && ($content_length > $post_max_size)) { + $file->error = $this->get_error_message('post_max_size'); + return false; + } + if (!preg_match($this->options['accept_file_types'], $file->name)) { + $file->error = $this->get_error_message('accept_file_types'); + return false; + } + if ($uploaded_file && is_uploaded_file($uploaded_file)) { + $file_size = $this->get_file_size($uploaded_file); + } else { + $file_size = $content_length; + } + if ($this->options['max_file_size'] && ( + $file_size > $this->options['max_file_size'] || + $file->size > $this->options['max_file_size']) + ) { + $file->error = $this->get_error_message('max_file_size'); + return false; + } + if ($this->options['min_file_size'] && + $file_size < $this->options['min_file_size']) { + $file->error = $this->get_error_message('min_file_size'); + return false; + } + if (is_int($this->options['max_number_of_files']) && + ($this->count_file_objects() >= $this->options['max_number_of_files']) && + // Ignore additional chunks of existing files: + !is_file($this->get_upload_path($file->name))) { + $file->error = $this->get_error_message('max_number_of_files'); + return false; + } + $max_width = @$this->options['max_width']; + $max_height = @$this->options['max_height']; + $min_width = @$this->options['min_width']; + $min_height = @$this->options['min_height']; + if (($max_width || $max_height || $min_width || $min_height) + && $this->is_valid_image_file($uploaded_file)) { + list($img_width, $img_height) = $this->get_image_size($uploaded_file); + // If we are auto rotating the image by default, do the checks on + // the correct orientation + if ( + @$this->options['image_versions']['']['auto_orient'] && + function_exists('exif_read_data') && + ($exif = @exif_read_data($uploaded_file)) && + (((int) @$exif['Orientation']) >= 5) + ) { + $tmp = $img_width; + $img_width = $img_height; + $img_height = $tmp; + unset($tmp); + } + } + if (!empty($img_width)) { + if ($max_width && $img_width > $max_width) { + $file->error = $this->get_error_message('max_width'); + return false; + } + if ($max_height && $img_height > $max_height) { + $file->error = $this->get_error_message('max_height'); + return false; + } + if ($min_width && $img_width < $min_width) { + $file->error = $this->get_error_message('min_width'); + return false; + } + if ($min_height && $img_height < $min_height) { + $file->error = $this->get_error_message('min_height'); + return false; + } + } + return true; + } + + protected function upcount_name_callback($matches) { + $index = isset($matches[1]) ? ((int)$matches[1]) + 1 : 1; + $ext = isset($matches[2]) ? $matches[2] : ''; + return ' ('.$index.')'.$ext; + } + + protected function upcount_name($name) { + return preg_replace_callback( + '/(?:(?: \(([\d]+)\))?(\.[^.]+))?$/', + array($this, 'upcount_name_callback'), + $name, + 1 + ); + } + + protected function get_unique_filename($file_path, $name, $size, $type, $error, + $index, $content_range) { + while(is_dir($this->get_upload_path($name))) { + $name = $this->upcount_name($name); + } + // Keep an existing filename if this is part of a chunked upload: + $uploaded_bytes = $this->fix_integer_overflow((int)$content_range[1]); + while (is_file($this->get_upload_path($name))) { + if ($uploaded_bytes === $this->get_file_size( + $this->get_upload_path($name))) { + break; + } + $name = $this->upcount_name($name); + } + return $name; + } + + protected function fix_file_extension($file_path, $name, $size, $type, $error, + $index, $content_range) { + // Add missing file extension for known image types: + if (strpos($name, '.') === false && + preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) { + $name .= '.'.$matches[1]; + } + if ($this->options['correct_image_extensions']) { + switch ($this->imagetype($file_path)) { + case self::IMAGETYPE_JPEG: + $extensions = array('jpg', 'jpeg'); + break; + case self::IMAGETYPE_PNG: + $extensions = array('png'); + break; + case self::IMAGETYPE_GIF: + $extensions = array('gif'); + break; + } + // Adjust incorrect image file extensions: + if (!empty($extensions)) { + $parts = explode('.', $name); + $extIndex = count($parts) - 1; + $ext = strtolower(@$parts[$extIndex]); + if (!in_array($ext, $extensions)) { + $parts[$extIndex] = $extensions[0]; + $name = implode('.', $parts); + } + } + } + return $name; + } + + protected function trim_file_name($file_path, $name, $size, $type, $error, + $index, $content_range) { + // Remove path information and dots around the filename, to prevent uploading + // into different directories or replacing hidden system files. + // Also remove control characters and spaces (\x00..\x20) around the filename: + $name = trim($this->basename(stripslashes($name)), ".\x00..\x20"); + // Replace dots in filenames to avoid security issues with servers + // that interpret multiple file extensions, e.g. "example.php.png": + $replacement = $this->options['replace_dots_in_filenames']; + if (!empty($replacement)) { + $parts = explode('.', $name); + if (count($parts) > 2) { + $ext = array_pop($parts); + $name = implode($replacement, $parts).'.'.$ext; + } + } + // Use a timestamp for empty filenames: + if (!$name) { + $name = str_replace('.', '-', microtime(true)); + } + return $name; + } + + protected function get_file_name($file_path, $name, $size, $type, $error, + $index, $content_range) { + $name = $this->trim_file_name($file_path, $name, $size, $type, $error, + $index, $content_range); + return $this->get_unique_filename( + $file_path, + $this->fix_file_extension($file_path, $name, $size, $type, $error, + $index, $content_range), + $size, + $type, + $error, + $index, + $content_range + ); + } + + protected function get_scaled_image_file_paths($file_name, $version) { + $file_path = $this->get_upload_path($file_name); + if (!empty($version)) { + $version_dir = $this->get_upload_path(null, $version); + if (!is_dir($version_dir)) { + mkdir($version_dir, $this->options['mkdir_mode'], true); + } + $new_file_path = $version_dir.'/'.$file_name; + } else { + $new_file_path = $file_path; + } + return array($file_path, $new_file_path); + } + + protected function gd_get_image_object($file_path, $func, $no_cache = false) { + if (empty($this->image_objects[$file_path]) || $no_cache) { + $this->gd_destroy_image_object($file_path); + $this->image_objects[$file_path] = $func($file_path); + } + return $this->image_objects[$file_path]; + } + + protected function gd_set_image_object($file_path, $image) { + $this->gd_destroy_image_object($file_path); + $this->image_objects[$file_path] = $image; + } + + protected function gd_destroy_image_object($file_path) { + $image = (isset($this->image_objects[$file_path])) ? $this->image_objects[$file_path] : null ; + return $image && imagedestroy($image); + } + + protected function gd_imageflip($image, $mode) { + if (function_exists('imageflip')) { + return imageflip($image, $mode); + } + $new_width = $src_width = imagesx($image); + $new_height = $src_height = imagesy($image); + $new_img = imagecreatetruecolor($new_width, $new_height); + $src_x = 0; + $src_y = 0; + switch ($mode) { + case '1': // flip on the horizontal axis + $src_y = $new_height - 1; + $src_height = -$new_height; + break; + case '2': // flip on the vertical axis + $src_x = $new_width - 1; + $src_width = -$new_width; + break; + case '3': // flip on both axes + $src_y = $new_height - 1; + $src_height = -$new_height; + $src_x = $new_width - 1; + $src_width = -$new_width; + break; + default: + return $image; + } + imagecopyresampled( + $new_img, + $image, + 0, + 0, + $src_x, + $src_y, + $new_width, + $new_height, + $src_width, + $src_height + ); + return $new_img; + } + + protected function gd_orient_image($file_path, $src_img) { + if (!function_exists('exif_read_data')) { + return false; + } + $exif = @exif_read_data($file_path); + if ($exif === false) { + return false; + } + $orientation = (int)@$exif['Orientation']; + if ($orientation < 2 || $orientation > 8) { + return false; + } + switch ($orientation) { + case 2: + $new_img = $this->gd_imageflip( + $src_img, + defined('IMG_FLIP_VERTICAL') ? IMG_FLIP_VERTICAL : 2 + ); + break; + case 3: + $new_img = imagerotate($src_img, 180, 0); + break; + case 4: + $new_img = $this->gd_imageflip( + $src_img, + defined('IMG_FLIP_HORIZONTAL') ? IMG_FLIP_HORIZONTAL : 1 + ); + break; + case 5: + $tmp_img = $this->gd_imageflip( + $src_img, + defined('IMG_FLIP_HORIZONTAL') ? IMG_FLIP_HORIZONTAL : 1 + ); + $new_img = imagerotate($tmp_img, 270, 0); + imagedestroy($tmp_img); + break; + case 6: + $new_img = imagerotate($src_img, 270, 0); + break; + case 7: + $tmp_img = $this->gd_imageflip( + $src_img, + defined('IMG_FLIP_VERTICAL') ? IMG_FLIP_VERTICAL : 2 + ); + $new_img = imagerotate($tmp_img, 270, 0); + imagedestroy($tmp_img); + break; + case 8: + $new_img = imagerotate($src_img, 90, 0); + break; + default: + return false; + } + $this->gd_set_image_object($file_path, $new_img); + return true; + } + + protected function gd_create_scaled_image($file_name, $version, $options) { + if (!function_exists('imagecreatetruecolor')) { + error_log('Function not found: imagecreatetruecolor'); + return false; + } + list($file_path, $new_file_path) = + $this->get_scaled_image_file_paths($file_name, $version); + $type = strtolower(substr(strrchr($file_name, '.'), 1)); + switch ($type) { + case 'jpg': + case 'jpeg': + $src_func = 'imagecreatefromjpeg'; + $write_func = 'imagejpeg'; + $image_quality = isset($options['jpeg_quality']) ? + $options['jpeg_quality'] : 75; + break; + case 'gif': + $src_func = 'imagecreatefromgif'; + $write_func = 'imagegif'; + $image_quality = null; + break; + case 'png': + $src_func = 'imagecreatefrompng'; + $write_func = 'imagepng'; + $image_quality = isset($options['png_quality']) ? + $options['png_quality'] : 9; + break; + default: + return false; + } + $src_img = $this->gd_get_image_object( + $file_path, + $src_func, + !empty($options['no_cache']) + ); + $image_oriented = false; + if (!empty($options['auto_orient']) && $this->gd_orient_image( + $file_path, + $src_img + )) { + $image_oriented = true; + $src_img = $this->gd_get_image_object( + $file_path, + $src_func + ); + } + $max_width = $img_width = imagesx($src_img); + $max_height = $img_height = imagesy($src_img); + if (!empty($options['max_width'])) { + $max_width = $options['max_width']; + } + if (!empty($options['max_height'])) { + $max_height = $options['max_height']; + } + $scale = min( + $max_width / $img_width, + $max_height / $img_height + ); + if ($scale >= 1) { + if ($image_oriented) { + return $write_func($src_img, $new_file_path, $image_quality); + } + if ($file_path !== $new_file_path) { + return copy($file_path, $new_file_path); + } + return true; + } + if (empty($options['crop'])) { + $new_width = $img_width * $scale; + $new_height = $img_height * $scale; + $dst_x = 0; + $dst_y = 0; + $new_img = imagecreatetruecolor($new_width, $new_height); + } else { + if (($img_width / $img_height) >= ($max_width / $max_height)) { + $new_width = $img_width / ($img_height / $max_height); + $new_height = $max_height; + } else { + $new_width = $max_width; + $new_height = $img_height / ($img_width / $max_width); + } + $dst_x = 0 - ($new_width - $max_width) / 2; + $dst_y = 0 - ($new_height - $max_height) / 2; + $new_img = imagecreatetruecolor($max_width, $max_height); + } + // Handle transparency in GIF and PNG images: + switch ($type) { + case 'gif': + case 'png': + imagecolortransparent($new_img, imagecolorallocate($new_img, 0, 0, 0)); + case 'png': + imagealphablending($new_img, false); + imagesavealpha($new_img, true); + break; + } + $success = imagecopyresampled( + $new_img, + $src_img, + $dst_x, + $dst_y, + 0, + 0, + $new_width, + $new_height, + $img_width, + $img_height + ) && $write_func($new_img, $new_file_path, $image_quality); + $this->gd_set_image_object($file_path, $new_img); + return $success; + } + + protected function imagick_get_image_object($file_path, $no_cache = false) { + if (empty($this->image_objects[$file_path]) || $no_cache) { + $this->imagick_destroy_image_object($file_path); + $image = new \Imagick(); + if (!empty($this->options['imagick_resource_limits'])) { + foreach ($this->options['imagick_resource_limits'] as $type => $limit) { + $image->setResourceLimit($type, $limit); + } + } + $image->readImage($file_path); + $this->image_objects[$file_path] = $image; + } + return $this->image_objects[$file_path]; + } + + protected function imagick_set_image_object($file_path, $image) { + $this->imagick_destroy_image_object($file_path); + $this->image_objects[$file_path] = $image; + } + + protected function imagick_destroy_image_object($file_path) { + $image = (isset($this->image_objects[$file_path])) ? $this->image_objects[$file_path] : null ; + return $image && $image->destroy(); + } + + protected function imagick_orient_image($image) { + $orientation = $image->getImageOrientation(); + $background = new \ImagickPixel('none'); + switch ($orientation) { + case \imagick::ORIENTATION_TOPRIGHT: // 2 + $image->flopImage(); // horizontal flop around y-axis + break; + case \imagick::ORIENTATION_BOTTOMRIGHT: // 3 + $image->rotateImage($background, 180); + break; + case \imagick::ORIENTATION_BOTTOMLEFT: // 4 + $image->flipImage(); // vertical flip around x-axis + break; + case \imagick::ORIENTATION_LEFTTOP: // 5 + $image->flopImage(); // horizontal flop around y-axis + $image->rotateImage($background, 270); + break; + case \imagick::ORIENTATION_RIGHTTOP: // 6 + $image->rotateImage($background, 90); + break; + case \imagick::ORIENTATION_RIGHTBOTTOM: // 7 + $image->flipImage(); // vertical flip around x-axis + $image->rotateImage($background, 270); + break; + case \imagick::ORIENTATION_LEFTBOTTOM: // 8 + $image->rotateImage($background, 270); + break; + default: + return false; + } + $image->setImageOrientation(\imagick::ORIENTATION_TOPLEFT); // 1 + return true; + } + + protected function imagick_create_scaled_image($file_name, $version, $options) { + list($file_path, $new_file_path) = + $this->get_scaled_image_file_paths($file_name, $version); + $image = $this->imagick_get_image_object( + $file_path, + !empty($options['crop']) || !empty($options['no_cache']) + ); + if ($image->getImageFormat() === 'GIF') { + // Handle animated GIFs: + $images = $image->coalesceImages(); + foreach ($images as $frame) { + $image = $frame; + $this->imagick_set_image_object($file_name, $image); + break; + } + } + $image_oriented = false; + if (!empty($options['auto_orient'])) { + $image_oriented = $this->imagick_orient_image($image); + } + + $image_resize = false; + $new_width = $max_width = $img_width = $image->getImageWidth(); + $new_height = $max_height = $img_height = $image->getImageHeight(); + + // use isset(). User might be setting max_width = 0 (auto in regular resizing). Value 0 would be considered empty when you use empty() + if (isset($options['max_width'])) { + $image_resize = true; + $new_width = $max_width = $options['max_width']; + } + if (isset($options['max_height'])) { + $image_resize = true; + $new_height = $max_height = $options['max_height']; + } + + $image_strip = (isset($options['strip']) ? $options['strip'] : false); + + if ( !$image_oriented && ($max_width >= $img_width) && ($max_height >= $img_height) && !$image_strip && empty($options["jpeg_quality"]) ) { + if ($file_path !== $new_file_path) { + return copy($file_path, $new_file_path); + } + return true; + } + $crop = (isset($options['crop']) ? $options['crop'] : false); + + if ($crop) { + $x = 0; + $y = 0; + if (($img_width / $img_height) >= ($max_width / $max_height)) { + $new_width = 0; // Enables proportional scaling based on max_height + $x = ($img_width / ($img_height / $max_height) - $max_width) / 2; + } else { + $new_height = 0; // Enables proportional scaling based on max_width + $y = ($img_height / ($img_width / $max_width) - $max_height) / 2; + } + } + $success = $image->resizeImage( + $new_width, + $new_height, + isset($options['filter']) ? $options['filter'] : \imagick::FILTER_LANCZOS, + isset($options['blur']) ? $options['blur'] : 1, + $new_width && $new_height // fit image into constraints if not to be cropped + ); + if ($success && $crop) { + $success = $image->cropImage( + $max_width, + $max_height, + $x, + $y + ); + if ($success) { + $success = $image->setImagePage($max_width, $max_height, 0, 0); + } + } + $type = strtolower(substr(strrchr($file_name, '.'), 1)); + switch ($type) { + case 'jpg': + case 'jpeg': + if (!empty($options['jpeg_quality'])) { + $image->setImageCompression(\imagick::COMPRESSION_JPEG); + $image->setImageCompressionQuality($options['jpeg_quality']); + } + break; + } + if ( $image_strip ) { + $image->stripImage(); + } + return $success && $image->writeImage($new_file_path); + } + + protected function imagemagick_create_scaled_image($file_name, $version, $options) { + list($file_path, $new_file_path) = + $this->get_scaled_image_file_paths($file_name, $version); + $resize = @$options['max_width'] + .(empty($options['max_height']) ? '' : 'X'.$options['max_height']); + if (!$resize && empty($options['auto_orient'])) { + if ($file_path !== $new_file_path) { + return copy($file_path, $new_file_path); + } + return true; + } + $cmd = $this->options['convert_bin']; + if (!empty($this->options['convert_params'])) { + $cmd .= ' '.$this->options['convert_params']; + } + $cmd .= ' '.escapeshellarg($file_path); + if (!empty($options['auto_orient'])) { + $cmd .= ' -auto-orient'; + } + if ($resize) { + // Handle animated GIFs: + $cmd .= ' -coalesce'; + if (empty($options['crop'])) { + $cmd .= ' -resize '.escapeshellarg($resize.'>'); + } else { + $cmd .= ' -resize '.escapeshellarg($resize.'^'); + $cmd .= ' -gravity center'; + $cmd .= ' -crop '.escapeshellarg($resize.'+0+0'); + } + // Make sure the page dimensions are correct (fixes offsets of animated GIFs): + $cmd .= ' +repage'; + } + if (!empty($options['convert_params'])) { + $cmd .= ' '.$options['convert_params']; + } + $cmd .= ' '.escapeshellarg($new_file_path); + exec($cmd, $output, $error); + if ($error) { + error_log(implode('\n', $output)); + return false; + } + return true; + } + + protected function get_image_size($file_path) { + if ($this->options['image_library']) { + if (extension_loaded('imagick')) { + $image = new \Imagick(); + try { + if (@$image->pingImage($file_path)) { + $dimensions = array($image->getImageWidth(), $image->getImageHeight()); + $image->destroy(); + return $dimensions; + } + return false; + } catch (\Exception $e) { + error_log($e->getMessage()); + } + } + if ($this->options['image_library'] === 2) { + $cmd = $this->options['identify_bin']; + $cmd .= ' -ping '.escapeshellarg($file_path); + exec($cmd, $output, $error); + if (!$error && !empty($output)) { + // image.jpg JPEG 1920x1080 1920x1080+0+0 8-bit sRGB 465KB 0.000u 0:00.000 + $infos = preg_split('/\s+/', substr($output[0], strlen($file_path))); + $dimensions = preg_split('/x/', $infos[2]); + return $dimensions; + } + return false; + } + } + if (!function_exists('getimagesize')) { + error_log('Function not found: getimagesize'); + return false; + } + return @getimagesize($file_path); + } + + protected function create_scaled_image($file_name, $version, $options) { + if ($this->options['image_library'] === 2) { + return $this->imagemagick_create_scaled_image($file_name, $version, $options); + } + if ($this->options['image_library'] && extension_loaded('imagick')) { + return $this->imagick_create_scaled_image($file_name, $version, $options); + } + return $this->gd_create_scaled_image($file_name, $version, $options); + } + + protected function destroy_image_object($file_path) { + if ($this->options['image_library'] && extension_loaded('imagick')) { + return $this->imagick_destroy_image_object($file_path); + } + } + + protected function imagetype($file_path) { + $fp = fopen($file_path, 'r'); + $data = fread($fp, 4); + fclose($fp); + // GIF: 47 49 46 + if (substr($data, 0, 3) === 'GIF') { + return self::IMAGETYPE_GIF; + } + // JPG: FF D8 + if (bin2hex(substr($data, 0, 2)) === 'ffd8') { + return self::IMAGETYPE_JPEG; + } + // PNG: 89 50 4E 47 + if (bin2hex(@$data[0]).substr($data, 1, 4) === '89PNG') { + return self::IMAGETYPE_PNG; + } + return false; + } + + protected function is_valid_image_file($file_path) { + return !!$this->imagetype($file_path); + } + + protected function handle_image_file($file_path, $file) { + $failed_versions = array(); + foreach ($this->options['image_versions'] as $version => $options) { + if ($this->create_scaled_image($file->name, $version, $options)) { + if (!empty($version)) { + $file->{$version.'Url'} = $this->get_download_url( + $file->name, + $version + ); + } else { + $file->size = $this->get_file_size($file_path, true); + } + } else { + $failed_versions[] = $version ? $version : 'original'; + } + } + if (count($failed_versions)) { + $file->error = $this->get_error_message('image_resize') + .' ('.implode($failed_versions, ', ').')'; + } + // Free memory: + $this->destroy_image_object($file_path); + } + + protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, + $index = null, $content_range = null) { + $file = new \stdClass(); + $file->name = $this->get_file_name($uploaded_file, $name, $size, $type, $error, + $index, $content_range); + $file->size = $this->fix_integer_overflow((int)$size); + $file->type = $type; + if ($this->validate($uploaded_file, $file, $error, $index)) { + $this->handle_form_data($file, $index); + $upload_dir = $this->get_upload_path(); + if (!is_dir($upload_dir)) { + mkdir($upload_dir, $this->options['mkdir_mode'], true); + } + $file_path = $this->get_upload_path($file->name); + $append_file = $content_range && is_file($file_path) && + $file->size > $this->get_file_size($file_path); + if ($uploaded_file && is_uploaded_file($uploaded_file)) { + // multipart/formdata uploads (POST method uploads) + if ($append_file) { + file_put_contents( + $file_path, + fopen($uploaded_file, 'r'), + FILE_APPEND + ); + } else { + move_uploaded_file($uploaded_file, $file_path); + } + } else { + // Non-multipart uploads (PUT method support) + file_put_contents( + $file_path, + fopen($this->options['input_stream'], 'r'), + $append_file ? FILE_APPEND : 0 + ); + } + $file_size = $this->get_file_size($file_path, $append_file); + if ($file_size === $file->size) { + $file->url = $this->get_download_url($file->name); + if ($this->is_valid_image_file($file_path)) { + $this->handle_image_file($file_path, $file); + } + } else { + $file->size = $file_size; + if (!$content_range && $this->options['discard_aborted_uploads']) { + unlink($file_path); + $file->error = $this->get_error_message('abort'); + } + } + $this->set_additional_file_properties($file); + } + return $file; + } + + protected function readfile($file_path) { + $file_size = $this->get_file_size($file_path); + $chunk_size = $this->options['readfile_chunk_size']; + if ($chunk_size && $file_size > $chunk_size) { + $handle = fopen($file_path, 'rb'); + while (!feof($handle)) { + echo fread($handle, $chunk_size); + @ob_flush(); + @flush(); + } + fclose($handle); + return $file_size; + } + return readfile($file_path); + } + + protected function body($str) { + echo $str; + } + + protected function header($str) { + header($str); + } + + protected function get_upload_data($id) { + return @$_FILES[$id]; + } + + protected function get_post_param($id) { + return @$_POST[$id]; + } + + protected function get_query_param($id) { + return @$_GET[$id]; + } + + protected function get_server_var($id) { + return @$_SERVER[$id]; + } + + protected function handle_form_data($file, $index) { + // Handle form data, e.g. $_POST['description'][$index] + } + + protected function get_version_param() { + return $this->basename(stripslashes($this->get_query_param('version'))); + } + + protected function get_singular_param_name() { + return substr($this->options['param_name'], 0, -1); + } + + protected function get_file_name_param() { + $name = $this->get_singular_param_name(); + return $this->basename(stripslashes($this->get_query_param($name))); + } + + protected function get_file_names_params() { + $params = $this->get_query_param($this->options['param_name']); + if (!$params) { + return null; + } + foreach ($params as $key => $value) { + $params[$key] = $this->basename(stripslashes($value)); + } + return $params; + } + + protected function get_file_type($file_path) { + switch (strtolower(pathinfo($file_path, PATHINFO_EXTENSION))) { + case 'jpeg': + case 'jpg': + return 'image/jpeg'; + case 'png': + return 'image/png'; + case 'gif': + return 'image/gif'; + default: + return ''; + } + } + + protected function download() { + switch ($this->options['download_via_php']) { + case 1: + $redirect_header = null; + break; + case 2: + $redirect_header = 'X-Sendfile'; + break; + case 3: + $redirect_header = 'X-Accel-Redirect'; + break; + default: + return $this->header('HTTP/1.1 403 Forbidden'); + } + $file_name = $this->get_file_name_param(); + if (!$this->is_valid_file_object($file_name)) { + return $this->header('HTTP/1.1 404 Not Found'); + } + if ($redirect_header) { + return $this->header( + $redirect_header.': '.$this->get_download_url( + $file_name, + $this->get_version_param(), + true + ) + ); + } + $file_path = $this->get_upload_path($file_name, $this->get_version_param()); + // Prevent browsers from MIME-sniffing the content-type: + $this->header('X-Content-Type-Options: nosniff'); + if (!preg_match($this->options['inline_file_types'], $file_name)) { + $this->header('Content-Type: application/octet-stream'); + $this->header('Content-Disposition: attachment; filename="'.$file_name.'"'); + } else { + $this->header('Content-Type: '.$this->get_file_type($file_path)); + $this->header('Content-Disposition: inline; filename="'.$file_name.'"'); + } + $this->header('Content-Length: '.$this->get_file_size($file_path)); + $this->header('Last-Modified: '.gmdate('D, d M Y H:i:s T', filemtime($file_path))); + $this->readfile($file_path); + } + + protected function send_content_type_header() { + $this->header('Vary: Accept'); + if (strpos($this->get_server_var('HTTP_ACCEPT'), 'application/json') !== false) { + $this->header('Content-type: application/json'); + } else { + $this->header('Content-type: text/plain'); + } + } + + protected function send_access_control_headers() { + $this->header('Access-Control-Allow-Origin: '.$this->options['access_control_allow_origin']); + $this->header('Access-Control-Allow-Credentials: ' + .($this->options['access_control_allow_credentials'] ? 'true' : 'false')); + $this->header('Access-Control-Allow-Methods: ' + .implode(', ', $this->options['access_control_allow_methods'])); + $this->header('Access-Control-Allow-Headers: ' + .implode(', ', $this->options['access_control_allow_headers'])); + } + + public function generate_response($content, $print_response = true) { + $this->response = $content; + if ($print_response) { + $json = json_encode($content); + $redirect = stripslashes($this->get_post_param('redirect')); + if ($redirect && preg_match($this->options['redirect_allow_target'], $redirect)) { + $this->header('Location: '.sprintf($redirect, rawurlencode($json))); + return; + } + $this->head(); + if ($this->get_server_var('HTTP_CONTENT_RANGE')) { + $files = isset($content[$this->options['param_name']]) ? + $content[$this->options['param_name']] : null; + if ($files && is_array($files) && is_object($files[0]) && $files[0]->size) { + $this->header('Range: 0-'.( + $this->fix_integer_overflow((int)$files[0]->size) - 1 + )); + } + } + $this->body($json); + } + return $content; + } + + public function get_response () { + return $this->response; + } + + public function head() { + $this->header('Pragma: no-cache'); + $this->header('Cache-Control: no-store, no-cache, must-revalidate'); + $this->header('Content-Disposition: inline; filename="files.json"'); + // Prevent Internet Explorer from MIME-sniffing the content-type: + $this->header('X-Content-Type-Options: nosniff'); + if ($this->options['access_control_allow_origin']) { + $this->send_access_control_headers(); + } + $this->send_content_type_header(); + } + + public function get($print_response = true) { + if ($print_response && $this->get_query_param('download')) { + return $this->download(); + } + $file_name = $this->get_file_name_param(); + if ($file_name) { + $response = array( + $this->get_singular_param_name() => $this->get_file_object($file_name) + ); + } else { + $response = array( + $this->options['param_name'] => $this->get_file_objects() + ); + } + return $this->generate_response($response, $print_response); + } + + public function post($print_response = true) { + if ($this->get_query_param('_method') === 'DELETE') { + return $this->delete($print_response); + } + $upload = $this->get_upload_data($this->options['param_name']); + // Parse the Content-Disposition header, if available: + $content_disposition_header = $this->get_server_var('HTTP_CONTENT_DISPOSITION'); + $file_name = $content_disposition_header ? + rawurldecode(preg_replace( + '/(^[^"]+")|("$)/', + '', + $content_disposition_header + )) : null; + // Parse the Content-Range header, which has the following form: + // Content-Range: bytes 0-524287/2000000 + $content_range_header = $this->get_server_var('HTTP_CONTENT_RANGE'); + $content_range = $content_range_header ? + preg_split('/[^0-9]+/', $content_range_header) : null; + $size = $content_range ? $content_range[3] : null; + $files = array(); + if ($upload) { + if (is_array($upload['tmp_name'])) { + // param_name is an array identifier like "files[]", + // $upload is a multi-dimensional array: + foreach ($upload['tmp_name'] as $index => $value) { + $files[] = $this->handle_file_upload( + $upload['tmp_name'][$index], + $file_name ? $file_name : $upload['name'][$index], + $size ? $size : $upload['size'][$index], + $upload['type'][$index], + $upload['error'][$index], + $index, + $content_range + ); + } + } else { + // param_name is a single object identifier like "file", + // $upload is a one-dimensional array: + $files[] = $this->handle_file_upload( + isset($upload['tmp_name']) ? $upload['tmp_name'] : null, + $file_name ? $file_name : (isset($upload['name']) ? + $upload['name'] : null), + $size ? $size : (isset($upload['size']) ? + $upload['size'] : $this->get_server_var('CONTENT_LENGTH')), + isset($upload['type']) ? + $upload['type'] : $this->get_server_var('CONTENT_TYPE'), + isset($upload['error']) ? $upload['error'] : null, + null, + $content_range + ); + } + } + $response = array($this->options['param_name'] => $files); + return $this->generate_response($response, $print_response); + } + + public function delete($print_response = true) { + $file_names = $this->get_file_names_params(); + if (empty($file_names)) { + $file_names = array($this->get_file_name_param()); + } + $response = array(); + foreach ($file_names as $file_name) { + $file_path = $this->get_upload_path($file_name); + $success = is_file($file_path) && $file_name[0] !== '.' && unlink($file_path); + if ($success) { + foreach ($this->options['image_versions'] as $version => $options) { + if (!empty($version)) { + $file = $this->get_upload_path($file_name, $version); + if (is_file($file)) { + unlink($file); + } + } + } + } + $response[$file_name] = $success; + } + return $this->generate_response($response, $print_response); + } + + protected function basename($filepath, $suffix = null) { + $splited = preg_split('/\//', rtrim ($filepath, '/ ')); + return substr(basename('X'.$splited[count($splited)-1], $suffix), 1); + } +} diff --git a/vendor/blueimp/jquery-file-upload/server/php/docker-compose.yml b/vendor/blueimp/jquery-file-upload/server/php/docker-compose.yml new file mode 100644 index 000000000..74eabf7dc --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/server/php/docker-compose.yml @@ -0,0 +1,9 @@ +version: '2.3' +services: + apache: + build: ./ + network_mode: bridge + ports: + - "80:80" + volumes: + - "../../:/var/www/html" diff --git a/vendor/blueimp/jquery-file-upload/server/php/files/.gitignore b/vendor/blueimp/jquery-file-upload/server/php/files/.gitignore new file mode 100644 index 000000000..e24a60fae --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/server/php/files/.gitignore @@ -0,0 +1,3 @@ +* +!.gitignore +!.htaccess diff --git a/vendor/blueimp/jquery-file-upload/server/php/files/.htaccess b/vendor/blueimp/jquery-file-upload/server/php/files/.htaccess new file mode 100644 index 000000000..6f454afb9 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/server/php/files/.htaccess @@ -0,0 +1,26 @@ +# To enable the Headers module, execute the following command and reload Apache: +# sudo a2enmod headers + +# The following directives prevent the execution of script files +# in the context of the website. +# They also force the content-type application/octet-stream and +# force browsers to display a download dialog for non-image files. +SetHandler default-handler +ForceType application/octet-stream +Header set Content-Disposition attachment + +# The following unsets the forced type and Content-Disposition headers +# for known image files: +<FilesMatch "(?i)\.(gif|jpe?g|png)$"> + ForceType none + Header unset Content-Disposition +</FilesMatch> + +# The following directive prevents browsers from MIME-sniffing the content-type. +# This is an important complement to the ForceType directive above: +Header set X-Content-Type-Options nosniff + +# Uncomment the following lines to prevent unauthorized download of files: +#AuthName "Authorization required" +#AuthType Basic +#require valid-user diff --git a/vendor/blueimp/jquery-file-upload/server/php/index.php b/vendor/blueimp/jquery-file-upload/server/php/index.php new file mode 100644 index 000000000..9c2cfb8eb --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/server/php/index.php @@ -0,0 +1,15 @@ +<?php +/* + * jQuery File Upload Plugin PHP Example + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ +exit; +error_reporting(E_ALL | E_STRICT); +require('UploadHandler.php'); +$upload_handler = new UploadHandler(); diff --git a/vendor/blueimp/jquery-file-upload/test/index.html b/vendor/blueimp/jquery-file-upload/test/index.html new file mode 100644 index 000000000..0b5cf57b7 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/test/index.html @@ -0,0 +1,172 @@ +<!DOCTYPE HTML> +<!-- +/* + * jQuery File Upload Plugin Test + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ +--> +<html lang="en"> +<head> +<!-- Force latest IE rendering engine or ChromeFrame if installed --> +<!--[if IE]> +<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> +<![endif]--> +<meta charset="utf-8"> +<title>jQuery File Upload Plugin Test</title> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-1.23.1.css"> +</head> +<body> +<h1 id="qunit-header">jQuery File Upload Plugin Test</h1> +<h2 id="qunit-banner"></h2> +<div id="qunit-testrunner-toolbar"></div> +<h2 id="qunit-userAgent"></h2> +<ol id="qunit-tests"></ol> +<div id="qunit-fixture"> + <!-- The file upload form used as target for the file upload widget --> + <form id="fileupload" action="../server/php/" method="POST" enctype="multipart/form-data"> + <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload --> + <div class="row fileupload-buttonbar"> + <div class="col-lg-7"> + <!-- The fileinput-button span is used to style the file input field as button --> + <span class="btn btn-success fileinput-button"> + <i class="icon-plus icon-white"></i> + <span>Add files...</span> + <input type="file" name="files[]" multiple> + </span> + <button type="submit" class="btn btn-primary start"> + <i class="icon-upload icon-white"></i> + <span>Start upload</span> + </button> + <button type="reset" class="btn btn-warning cancel"> + <i class="icon-ban-circle icon-white"></i> + <span>Cancel upload</span> + </button> + <button type="button" class="btn btn-danger delete"> + <i class="icon-trash icon-white"></i> + <span>Delete</span> + </button> + <input type="checkbox" class="toggle"> + <!-- The global file processing state --> + <span class="fileupload-process"></span> + </div> + <!-- The global progress state --> + <div class="col-lg-5 fileupload-progress"> + <!-- The global progress bar --> + <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100"> + <div class="progress-bar progress-bar-success" style="width:0%;"></div> + </div> + <!-- The extended global progress state --> + <div class="progress-extended"> </div> + </div> + </div> + <!-- The table listing the files available for upload/download --> + <table role="presentation" class="table table-striped"><tbody class="files"></tbody></table> + </form> +</div> +<!-- The template to display files available for upload --> +<script id="template-upload" type="text/x-tmpl"> +{% for (var i=0, file; file=o.files[i]; i++) { %} + <tr class="template-upload"> + <td> + <span class="preview"></span> + </td> + <td> + <p class="name">{%=file.name%}</p> + <strong class="error text-danger"></strong> + </td> + <td> + <p class="size">Processing...</p> + <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-success" style="width:0%;"></div></div> + </td> + <td> + {% if (!i && !o.options.autoUpload) { %} + <button class="btn btn-primary start" disabled> + <i class="glyphicon glyphicon-upload"></i> + <span>Start</span> + </button> + {% } %} + {% if (!i) { %} + <button class="btn btn-warning cancel"> + <i class="glyphicon glyphicon-ban-circle"></i> + <span>Cancel</span> + </button> + {% } %} + </td> + </tr> +{% } %} +</script> +<!-- The template to display files available for download --> +<script id="template-download" type="text/x-tmpl"> +{% for (var i=0, file; file=o.files[i]; i++) { %} + <tr class="template-download"> + <td> + <span class="preview"> + {% if (file.thumbnailUrl) { %} + <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a> + {% } %} + </span> + </td> + <td> + <p class="name"> + {% if (file.url) { %} + <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a> + {% } else { %} + <span>{%=file.name%}</span> + {% } %} + </p> + {% if (file.error) { %} + <div><span class="label label-danger">Error</span> {%=file.error%}</div> + {% } %} + </td> + <td> + <span class="size">{%=o.formatFileSize(file.size)%}</span> + </td> + <td> + {% if (file.deleteUrl) { %} + <button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}> + <i class="glyphicon glyphicon-trash"></i> + <span>Delete</span> + </button> + <input type="checkbox" name="delete" value="1" class="toggle"> + {% } else { %} + <button class="btn btn-warning cancel"> + <i class="glyphicon glyphicon-ban-circle"></i> + <span>Cancel</span> + </button> + {% } %} + </td> + </tr> +{% } %} +</script> +<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> +<script src="../js/vendor/jquery.ui.widget.js"></script> +<script src="https://blueimp.github.io/JavaScript-Templates/js/tmpl.min.js"></script> +<script src="https://blueimp.github.io/JavaScript-Load-Image/js/load-image.all.min.js"></script> +<script src="https://blueimp.github.io/JavaScript-Canvas-to-Blob/js/canvas-to-blob.min.js"></script> +<script src="../js/jquery.iframe-transport.js"></script> +<script src="../js/jquery.fileupload.js"></script> +<script> +/* global window, $ */ +window.testBasicWidget = $.blueimp.fileupload; +</script> +<script src="../js/jquery.fileupload-process.js"></script> +<script src="../js/jquery.fileupload-image.js"></script> +<script src="../js/jquery.fileupload-audio.js"></script> +<script src="../js/jquery.fileupload-video.js"></script> +<script src="../js/jquery.fileupload-validate.js"></script> +<script src="../js/jquery.fileupload-ui.js"></script> +<script> +/* global window, $ */ +window.testUIWidget = $.blueimp.fileupload; +</script> +<script src="https://code.jquery.com/qunit/qunit-1.23.1.js"></script> +<script src="test.js"></script> +</body> +</html> diff --git a/vendor/blueimp/jquery-file-upload/test/test.js b/vendor/blueimp/jquery-file-upload/test/test.js new file mode 100644 index 000000000..452127567 --- /dev/null +++ b/vendor/blueimp/jquery-file-upload/test/test.js @@ -0,0 +1,1292 @@ +/* + * jQuery File Upload Plugin Test + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * https://opensource.org/licenses/MIT + */ + +/* global $, QUnit, window, document, expect, module, test, asyncTest, start, ok, strictEqual, notStrictEqual */ + +$(function () { + // jshint nomen:false + 'use strict'; + + QUnit.done = function () { + // Delete all uploaded files: + var url = $('#fileupload').prop('action'); + $.getJSON(url, function (result) { + $.each(result.files, function (index, file) { + $.ajax({ + url: url + '?file=' + encodeURIComponent(file.name), + type: 'DELETE' + }); + }); + }); + }; + + var lifecycle = { + setup: function () { + // Set the .fileupload method to the basic widget method: + $.widget('blueimp.fileupload', window.testBasicWidget, {}); + }, + teardown: function () { + // Remove all remaining event listeners: + $(document).unbind(); + } + }, + lifecycleUI = { + setup: function () { + // Set the .fileupload method to the UI widget method: + $.widget('blueimp.fileupload', window.testUIWidget, {}); + }, + teardown: function () { + // Remove all remaining event listeners: + $(document).unbind(); + } + }; + + module('Initialization', lifecycle); + + test('Widget initialization', function () { + var fu = $('#fileupload').fileupload(); + ok(fu.data('blueimp-fileupload') || fu.data('fileupload')); + }); + + test('Data attribute options', function () { + $('#fileupload').attr('data-url', 'http://example.org'); + $('#fileupload').fileupload(); + strictEqual( + $('#fileupload').fileupload('option', 'url'), + 'http://example.org' + ); + }); + + test('File input initialization', function () { + var fu = $('#fileupload').fileupload(); + ok( + fu.fileupload('option', 'fileInput').length, + 'File input field inside of the widget' + ); + ok( + fu.fileupload('option', 'fileInput').length, + 'Widget element as file input field' + ); + }); + + test('Drop zone initialization', function () { + ok($('#fileupload').fileupload() + .fileupload('option', 'dropZone').length); + }); + + test('Paste zone initialization', function () { + ok($('#fileupload').fileupload({pasteZone: document}) + .fileupload('option', 'pasteZone').length); + }); + + test('Event listeners initialization', function () { + expect( + $.support.xhrFormDataFileUpload ? 4 : 1 + ); + var eo = { + originalEvent: { + dataTransfer: {files: [{}], types: ['Files']}, + clipboardData: {items: [{}]} + } + }, + fu = $('#fileupload').fileupload({ + pasteZone: document, + dragover: function () { + ok(true, 'Triggers dragover callback'); + return false; + }, + drop: function () { + ok(true, 'Triggers drop callback'); + return false; + }, + paste: function () { + ok(true, 'Triggers paste callback'); + return false; + }, + change: function () { + ok(true, 'Triggers change callback'); + return false; + } + }), + fileInput = fu.fileupload('option', 'fileInput'), + dropZone = fu.fileupload('option', 'dropZone'), + pasteZone = fu.fileupload('option', 'pasteZone'); + fileInput.trigger($.Event('change', eo)); + dropZone.trigger($.Event('dragover', eo)); + dropZone.trigger($.Event('drop', eo)); + pasteZone.trigger($.Event('paste', eo)); + }); + + module('API', lifecycle); + + test('destroy', function () { + expect(4); + var eo = { + originalEvent: { + dataTransfer: {files: [{}], types: ['Files']}, + clipboardData: {items: [{}]} + } + }, + options = { + pasteZone: document, + dragover: function () { + ok(true, 'Triggers dragover callback'); + return false; + }, + drop: function () { + ok(true, 'Triggers drop callback'); + return false; + }, + paste: function () { + ok(true, 'Triggers paste callback'); + return false; + }, + change: function () { + ok(true, 'Triggers change callback'); + return false; + } + }, + fu = $('#fileupload').fileupload(options), + fileInput = fu.fileupload('option', 'fileInput'), + dropZone = fu.fileupload('option', 'dropZone'), + pasteZone = fu.fileupload('option', 'pasteZone'); + dropZone.bind('dragover', options.dragover); + dropZone.bind('drop', options.drop); + pasteZone.bind('paste', options.paste); + fileInput.bind('change', options.change); + fu.fileupload('destroy'); + fileInput.trigger($.Event('change', eo)); + dropZone.trigger($.Event('dragover', eo)); + dropZone.trigger($.Event('drop', eo)); + pasteZone.trigger($.Event('paste', eo)); + }); + + test('disable/enable', function () { + expect( + $.support.xhrFormDataFileUpload ? 4 : 1 + ); + var eo = { + originalEvent: { + dataTransfer: {files: [{}], types: ['Files']}, + clipboardData: {items: [{}]} + } + }, + fu = $('#fileupload').fileupload({ + pasteZone: document, + dragover: function () { + ok(true, 'Triggers dragover callback'); + return false; + }, + drop: function () { + ok(true, 'Triggers drop callback'); + return false; + }, + paste: function () { + ok(true, 'Triggers paste callback'); + return false; + }, + change: function () { + ok(true, 'Triggers change callback'); + return false; + } + }), + fileInput = fu.fileupload('option', 'fileInput'), + dropZone = fu.fileupload('option', 'dropZone'), + pasteZone = fu.fileupload('option', 'pasteZone'); + fu.fileupload('disable'); + fileInput.trigger($.Event('change', eo)); + dropZone.trigger($.Event('dragover', eo)); + dropZone.trigger($.Event('drop', eo)); + pasteZone.trigger($.Event('paste', eo)); + fu.fileupload('enable'); + fileInput.trigger($.Event('change', eo)); + dropZone.trigger($.Event('dragover', eo)); + dropZone.trigger($.Event('drop', eo)); + pasteZone.trigger($.Event('paste', eo)); + }); + + test('option', function () { + expect( + $.support.xhrFormDataFileUpload ? 10 : 7 + ); + var eo = { + originalEvent: { + dataTransfer: {files: [{}], types: ['Files']}, + clipboardData: {items: [{}]} + } + }, + fu = $('#fileupload').fileupload({ + pasteZone: document, + dragover: function () { + ok(true, 'Triggers dragover callback'); + return false; + }, + drop: function () { + ok(true, 'Triggers drop callback'); + return false; + }, + paste: function () { + ok(true, 'Triggers paste callback'); + return false; + }, + change: function () { + ok(true, 'Triggers change callback'); + return false; + } + }), + fileInput = fu.fileupload('option', 'fileInput'), + dropZone = fu.fileupload('option', 'dropZone'), + pasteZone = fu.fileupload('option', 'pasteZone'); + fu.fileupload('option', 'fileInput', null); + fu.fileupload('option', 'dropZone', null); + fu.fileupload('option', 'pasteZone', null); + fileInput.trigger($.Event('change', eo)); + dropZone.trigger($.Event('dragover', eo)); + dropZone.trigger($.Event('drop', eo)); + pasteZone.trigger($.Event('paste', eo)); + fu.fileupload('option', 'dropZone', 'body'); + strictEqual( + fu.fileupload('option', 'dropZone')[0], + document.body, + 'Allow a query string as parameter for the dropZone option' + ); + fu.fileupload('option', 'dropZone', document); + strictEqual( + fu.fileupload('option', 'dropZone')[0], + document, + 'Allow a document element as parameter for the dropZone option' + ); + fu.fileupload('option', 'pasteZone', 'body'); + strictEqual( + fu.fileupload('option', 'pasteZone')[0], + document.body, + 'Allow a query string as parameter for the pasteZone option' + ); + fu.fileupload('option', 'pasteZone', document); + strictEqual( + fu.fileupload('option', 'pasteZone')[0], + document, + 'Allow a document element as parameter for the pasteZone option' + ); + fu.fileupload('option', 'fileInput', ':file'); + strictEqual( + fu.fileupload('option', 'fileInput')[0], + $(':file')[0], + 'Allow a query string as parameter for the fileInput option' + ); + fu.fileupload('option', 'fileInput', $(':file')[0]); + strictEqual( + fu.fileupload('option', 'fileInput')[0], + $(':file')[0], + 'Allow a document element as parameter for the fileInput option' + ); + fu.fileupload('option', 'fileInput', fileInput); + fu.fileupload('option', 'dropZone', dropZone); + fu.fileupload('option', 'pasteZone', pasteZone); + fileInput.trigger($.Event('change', eo)); + dropZone.trigger($.Event('dragover', eo)); + dropZone.trigger($.Event('drop', eo)); + pasteZone.trigger($.Event('paste', eo)); + }); + + asyncTest('add', function () { + expect(2); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + add: function (e, data) { + strictEqual( + data.files[0].name, + param.files[0].name, + 'Triggers add callback' + ); + } + }).fileupload('add', param).fileupload( + 'option', + 'add', + function (e, data) { + data.submit().complete(function () { + ok(true, 'data.submit() Returns a jqXHR object'); + start(); + }); + } + ).fileupload('add', param); + }); + + asyncTest('send', function () { + expect(3); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + send: function (e, data) { + strictEqual( + data.files[0].name, + 'test', + 'Triggers send callback' + ); + } + }).fileupload('send', param).fail(function () { + ok(true, 'Allows to abort the request'); + }).complete(function () { + ok(true, 'Returns a jqXHR object'); + start(); + }).abort(); + }); + + module('Callbacks', lifecycle); + + asyncTest('add', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + add: function () { + ok(true, 'Triggers add callback'); + start(); + } + }).fileupload('add', param); + }); + + asyncTest('submit', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + submit: function () { + ok(true, 'Triggers submit callback'); + start(); + return false; + } + }).fileupload('add', param); + }); + + asyncTest('send', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + send: function () { + ok(true, 'Triggers send callback'); + start(); + return false; + } + }).fileupload('send', param); + }); + + asyncTest('done', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + done: function () { + ok(true, 'Triggers done callback'); + start(); + } + }).fileupload('send', param); + }); + + asyncTest('fail', function () { + expect(1); + var param = {files: [{name: 'test'}]}, + fu = $('#fileupload').fileupload({ + url: '404', + fail: function () { + ok(true, 'Triggers fail callback'); + start(); + } + }); + (fu.data('blueimp-fileupload') || fu.data('fileupload')) + ._isXHRUpload = function () { + return true; + }; + fu.fileupload('send', param); + }); + + asyncTest('always', function () { + expect(2); + var param = {files: [{name: 'test'}]}, + counter = 0, + fu = $('#fileupload').fileupload({ + always: function () { + ok(true, 'Triggers always callback'); + if (counter === 1) { + start(); + } else { + counter += 1; + } + } + }); + (fu.data('blueimp-fileupload') || fu.data('fileupload')) + ._isXHRUpload = function () { + return true; + }; + fu.fileupload('add', param).fileupload( + 'option', + 'url', + '404' + ).fileupload('add', param); + }); + + asyncTest('progress', function () { + expect(1); + var param = {files: [{name: 'test'}]}, + counter = 0; + $('#fileupload').fileupload({ + forceIframeTransport: true, + progress: function () { + ok(true, 'Triggers progress callback'); + if (counter === 0) { + start(); + } else { + counter += 1; + } + } + }).fileupload('send', param); + }); + + asyncTest('progressall', function () { + expect(1); + var param = {files: [{name: 'test'}]}, + counter = 0; + $('#fileupload').fileupload({ + forceIframeTransport: true, + progressall: function () { + ok(true, 'Triggers progressall callback'); + if (counter === 0) { + start(); + } else { + counter += 1; + } + } + }).fileupload('send', param); + }); + + asyncTest('start', function () { + expect(1); + var param = {files: [{name: '1'}, {name: '2'}]}, + active = 0; + $('#fileupload').fileupload({ + send: function () { + active += 1; + }, + start: function () { + ok(!active, 'Triggers start callback before uploads'); + start(); + } + }).fileupload('send', param); + }); + + asyncTest('stop', function () { + expect(1); + var param = {files: [{name: '1'}, {name: '2'}]}, + active = 0; + $('#fileupload').fileupload({ + send: function () { + active += 1; + }, + always: function () { + active -= 1; + }, + stop: function () { + ok(!active, 'Triggers stop callback after uploads'); + start(); + } + }).fileupload('send', param); + }); + + test('change', function () { + var fu = $('#fileupload').fileupload(), + fuo = fu.data('blueimp-fileupload') || fu.data('fileupload'), + fileInput = fu.fileupload('option', 'fileInput'); + expect(2); + fu.fileupload({ + change: function (e, data) { + ok(true, 'Triggers change callback'); + strictEqual( + data.files.length, + 0, + 'Returns empty files list' + ); + }, + add: $.noop + }); + fuo._onChange({ + data: {fileupload: fuo}, + target: fileInput[0] + }); + }); + + test('paste', function () { + var fu = $('#fileupload').fileupload(), + fuo = fu.data('blueimp-fileupload') || fu.data('fileupload'); + expect(1); + fu.fileupload({ + paste: function () { + ok(true, 'Triggers paste callback'); + }, + add: $.noop + }); + fuo._onPaste({ + data: {fileupload: fuo}, + originalEvent: { + dataTransfer: {files: [{}]}, + clipboardData: {items: [{}]} + }, + preventDefault: $.noop + }); + }); + + test('drop', function () { + var fu = $('#fileupload').fileupload(), + fuo = fu.data('blueimp-fileupload') || fu.data('fileupload'); + expect(1); + fu.fileupload({ + drop: function () { + ok(true, 'Triggers drop callback'); + }, + add: $.noop + }); + fuo._onDrop({ + data: {fileupload: fuo}, + originalEvent: { + dataTransfer: {files: [{}]}, + clipboardData: {items: [{}]} + }, + preventDefault: $.noop + }); + }); + + test('dragover', function () { + var fu = $('#fileupload').fileupload(), + fuo = fu.data('blueimp-fileupload') || fu.data('fileupload'); + expect(1); + fu.fileupload({ + dragover: function () { + ok(true, 'Triggers dragover callback'); + }, + add: $.noop + }); + fuo._onDragOver({ + data: {fileupload: fuo}, + originalEvent: {dataTransfer: {types: ['Files']}}, + preventDefault: $.noop + }); + }); + + module('Options', lifecycle); + + test('paramName', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + paramName: null, + send: function (e, data) { + strictEqual( + data.paramName[0], + data.fileInput.prop('name'), + 'Takes paramName from file input field if not set' + ); + return false; + } + }).fileupload('send', param); + }); + + test('url', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + url: null, + send: function (e, data) { + strictEqual( + data.url, + $(data.fileInput.prop('form')).prop('action'), + 'Takes url from form action if not set' + ); + return false; + } + }).fileupload('send', param); + }); + + test('type', function () { + expect(2); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + type: null, + send: function (e, data) { + strictEqual( + data.type, + 'POST', + 'Request type is "POST" if not set to "PUT"' + ); + return false; + } + }).fileupload('send', param); + $('#fileupload').fileupload({ + type: 'PUT', + send: function (e, data) { + strictEqual( + data.type, + 'PUT', + 'Request type is "PUT" if set to "PUT"' + ); + return false; + } + }).fileupload('send', param); + }); + + test('replaceFileInput', function () { + var fu = $('#fileupload').fileupload(), + fuo = fu.data('blueimp-fileupload') || fu.data('fileupload'), + fileInput = fu.fileupload('option', 'fileInput'), + fileInputElement = fileInput[0]; + expect(2); + fu.fileupload({ + replaceFileInput: false, + change: function () { + strictEqual( + fu.fileupload('option', 'fileInput')[0], + fileInputElement, + 'Keeps file input with replaceFileInput: false' + ); + }, + add: $.noop + }); + fuo._onChange({ + data: {fileupload: fuo}, + target: fileInput[0] + }); + fu.fileupload({ + replaceFileInput: true, + change: function () { + notStrictEqual( + fu.fileupload('option', 'fileInput')[0], + fileInputElement, + 'Replaces file input with replaceFileInput: true' + ); + }, + add: $.noop + }); + fuo._onChange({ + data: {fileupload: fuo}, + target: fileInput[0] + }); + }); + + asyncTest('forceIframeTransport', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + forceIframeTransport: true, + done: function (e, data) { + strictEqual( + data.dataType.substr(0, 6), + 'iframe', + 'Iframe Transport is used' + ); + start(); + } + }).fileupload('send', param); + }); + + test('singleFileUploads', function () { + expect(3); + var fu = $('#fileupload').fileupload(), + param = {files: [{name: '1'}, {name: '2'}]}, + index = 1; + (fu.data('blueimp-fileupload') || fu.data('fileupload')) + ._isXHRUpload = function () { + return true; + }; + $('#fileupload').fileupload({ + singleFileUploads: true, + add: function () { + ok(true, 'Triggers callback number ' + index.toString()); + index += 1; + } + }).fileupload('add', param).fileupload( + 'option', + 'singleFileUploads', + false + ).fileupload('add', param); + }); + + test('limitMultiFileUploads', function () { + expect(3); + var fu = $('#fileupload').fileupload(), + param = {files: [ + {name: '1'}, + {name: '2'}, + {name: '3'}, + {name: '4'}, + {name: '5'} + ]}, + index = 1; + (fu.data('blueimp-fileupload') || fu.data('fileupload')) + ._isXHRUpload = function () { + return true; + }; + $('#fileupload').fileupload({ + singleFileUploads: false, + limitMultiFileUploads: 2, + add: function () { + ok(true, 'Triggers callback number ' + index.toString()); + index += 1; + } + }).fileupload('add', param); + }); + + test('limitMultiFileUploadSize', function () { + expect(7); + var fu = $('#fileupload').fileupload(), + param = {files: [ + {name: '1-1', size: 100000}, + {name: '1-2', size: 40000}, + {name: '2-1', size: 100000}, + {name: '3-1', size: 50000}, + {name: '3-2', size: 40000}, + {name: '4-1', size: 45000} // New request due to limitMultiFileUploads + ]}, + param2 = {files: [ + {name: '5-1'}, + {name: '5-2'}, + {name: '6-1'}, + {name: '6-2'}, + {name: '7-1'} + ]}, + index = 1; + (fu.data('blueimp-fileupload') || fu.data('fileupload')) + ._isXHRUpload = function () { + return true; + }; + $('#fileupload').fileupload({ + singleFileUploads: false, + limitMultiFileUploads: 2, + limitMultiFileUploadSize: 150000, + limitMultiFileUploadSizeOverhead: 5000, + add: function () { + ok(true, 'Triggers callback number ' + index.toString()); + index += 1; + } + }).fileupload('add', param).fileupload('add', param2); + }); + + asyncTest('sequentialUploads', function () { + expect(6); + var param = {files: [ + {name: '1'}, + {name: '2'}, + {name: '3'}, + {name: '4'}, + {name: '5'}, + {name: '6'} + ]}, + addIndex = 0, + sendIndex = 0, + loadIndex = 0, + fu = $('#fileupload').fileupload({ + sequentialUploads: true, + add: function (e, data) { + addIndex += 1; + if (addIndex === 4) { + data.submit().abort(); + } else { + data.submit(); + } + }, + send: function () { + sendIndex += 1; + }, + done: function () { + loadIndex += 1; + strictEqual(sendIndex, loadIndex, 'upload in order'); + }, + fail: function (e, data) { + strictEqual(data.errorThrown, 'abort', 'upload aborted'); + }, + stop: function () { + start(); + } + }); + (fu.data('blueimp-fileupload') || fu.data('fileupload')) + ._isXHRUpload = function () { + return true; + }; + fu.fileupload('add', param); + }); + + asyncTest('limitConcurrentUploads', function () { + expect(12); + var param = {files: [ + {name: '1'}, + {name: '2'}, + {name: '3'}, + {name: '4'}, + {name: '5'}, + {name: '6'}, + {name: '7'}, + {name: '8'}, + {name: '9'}, + {name: '10'}, + {name: '11'}, + {name: '12'} + ]}, + addIndex = 0, + sendIndex = 0, + loadIndex = 0, + fu = $('#fileupload').fileupload({ + limitConcurrentUploads: 3, + add: function (e, data) { + addIndex += 1; + if (addIndex === 4) { + data.submit().abort(); + } else { + data.submit(); + } + }, + send: function () { + sendIndex += 1; + }, + done: function () { + loadIndex += 1; + ok(sendIndex - loadIndex < 3); + }, + fail: function (e, data) { + strictEqual(data.errorThrown, 'abort', 'upload aborted'); + }, + stop: function () { + start(); + } + }); + (fu.data('blueimp-fileupload') || fu.data('fileupload')) + ._isXHRUpload = function () { + return true; + }; + fu.fileupload('add', param); + }); + + if ($.support.xhrFileUpload) { + asyncTest('multipart', function () { + expect(2); + var param = {files: [{ + name: 'test.png', + size: 123, + type: 'image/png' + }]}, + fu = $('#fileupload').fileupload({ + multipart: false, + always: function (e, data) { + strictEqual( + data.contentType, + param.files[0].type, + 'non-multipart upload sets file type as contentType' + ); + strictEqual( + data.headers['Content-Disposition'], + 'attachment; filename="' + param.files[0].name + '"', + 'non-multipart upload sets Content-Disposition header' + ); + start(); + } + }); + fu.fileupload('send', param); + }); + } + + module('UI Initialization', lifecycleUI); + + test('Widget initialization', function () { + var fu = $('#fileupload').fileupload(); + ok(fu.data('blueimp-fileupload') || fu.data('fileupload')); + ok( + $('#fileupload').fileupload('option', 'uploadTemplate').length, + 'Initialized upload template' + ); + ok( + $('#fileupload').fileupload('option', 'downloadTemplate').length, + 'Initialized download template' + ); + }); + + test('Buttonbar event listeners', function () { + var buttonbar = $('#fileupload .fileupload-buttonbar'), + files = [{name: 'test'}]; + expect(4); + $('#fileupload').fileupload({ + send: function () { + ok(true, 'Started file upload via global start button'); + }, + fail: function (e, data) { + ok(true, 'Canceled file upload via global cancel button'); + data.context.remove(); + }, + destroy: function () { + ok(true, 'Delete action called via global delete button'); + } + }); + $('#fileupload').fileupload('add', {files: files}); + buttonbar.find('.cancel').click(); + $('#fileupload').fileupload('add', {files: files}); + buttonbar.find('.start').click(); + buttonbar.find('.cancel').click(); + files[0].deleteUrl = 'http://example.org/banana.jpg'; + ($('#fileupload').data('blueimp-fileupload') || + $('#fileupload').data('fileupload')) + ._renderDownload(files) + .appendTo($('#fileupload .files')).show() + .find('.toggle').click(); + buttonbar.find('.delete').click(); + }); + + module('UI API', lifecycleUI); + + test('destroy', function () { + var buttonbar = $('#fileupload .fileupload-buttonbar'), + files = [{name: 'test'}]; + expect(1); + $('#fileupload').fileupload({ + send: function () { + ok(true, 'This test should not run'); + return false; + } + }) + .fileupload('add', {files: files}) + .fileupload('destroy'); + buttonbar.find('.start').click(function () { + ok(true, 'Clicked global start button'); + return false; + }).click(); + }); + + test('disable/enable', function () { + var buttonbar = $('#fileupload .fileupload-buttonbar'); + $('#fileupload').fileupload(); + $('#fileupload').fileupload('disable'); + strictEqual( + buttonbar.find('input[type=file], button').not(':disabled').length, + 0, + 'Disables the buttonbar buttons' + ); + $('#fileupload').fileupload('enable'); + strictEqual( + buttonbar.find('input[type=file], button').not(':disabled').length, + 4, + 'Enables the buttonbar buttons' + ); + }); + + module('UI Callbacks', lifecycleUI); + + test('destroy', function () { + expect(3); + $('#fileupload').fileupload({ + destroy: function (e, data) { + ok(true, 'Triggers destroy callback'); + strictEqual( + data.url, + 'test', + 'Passes over deletion url parameter' + ); + strictEqual( + data.type, + 'DELETE', + 'Passes over deletion request type parameter' + ); + } + }); + ($('#fileupload').data('blueimp-fileupload') || + $('#fileupload').data('fileupload')) + ._renderDownload([{ + name: 'test', + deleteUrl: 'test', + deleteType: 'DELETE' + }]) + .appendTo($('#fileupload .files')) + .show() + .find('.toggle').click(); + $('#fileupload .fileupload-buttonbar .delete').click(); + }); + + asyncTest('added', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + added: function (e, data) { + start(); + strictEqual( + data.files[0].name, + param.files[0].name, + 'Triggers added callback' + ); + }, + send: function () { + return false; + } + }).fileupload('add', param); + }); + + asyncTest('started', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + started: function () { + start(); + ok('Triggers started callback'); + return false; + }, + sent: function () { + return false; + } + }).fileupload('send', param); + }); + + asyncTest('sent', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + sent: function (e, data) { + start(); + strictEqual( + data.files[0].name, + param.files[0].name, + 'Triggers sent callback' + ); + return false; + } + }).fileupload('send', param); + }); + + asyncTest('completed', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + completed: function () { + start(); + ok('Triggers completed callback'); + return false; + } + }).fileupload('send', param); + }); + + asyncTest('failed', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + failed: function () { + start(); + ok('Triggers failed callback'); + return false; + } + }).fileupload('send', param).abort(); + }); + + asyncTest('stopped', function () { + expect(1); + var param = {files: [{name: 'test'}]}; + $('#fileupload').fileupload({ + stopped: function () { + start(); + ok('Triggers stopped callback'); + return false; + } + }).fileupload('send', param); + }); + + asyncTest('destroyed', function () { + expect(1); + $('#fileupload').fileupload({ + dataType: 'html', + destroyed: function () { + start(); + ok(true, 'Triggers destroyed callback'); + } + }); + ($('#fileupload').data('blueimp-fileupload') || + $('#fileupload').data('fileupload')) + ._renderDownload([{ + name: 'test', + deleteUrl: '.', + deleteType: 'GET' + }]) + .appendTo($('#fileupload .files')) + .show() + .find('.toggle').click(); + $('#fileupload .fileupload-buttonbar .delete').click(); + }); + + module('UI Options', lifecycleUI); + + test('autoUpload', function () { + expect(1); + $('#fileupload') + .fileupload({ + autoUpload: true, + send: function () { + ok(true, 'Started file upload automatically'); + return false; + } + }) + .fileupload('add', {files: [{name: 'test'}]}) + .fileupload('option', 'autoUpload', false) + .fileupload('add', {files: [{name: 'test'}]}); + }); + + test('maxNumberOfFiles', function () { + expect(3); + var addIndex = 0, + sendIndex = 0; + $('#fileupload') + .fileupload({ + autoUpload: true, + maxNumberOfFiles: 3, + singleFileUploads: false, + send: function () { + strictEqual( + sendIndex += 1, + addIndex + ); + }, + progress: $.noop, + progressall: $.noop, + done: $.noop, + stop: $.noop + }) + .fileupload('add', {files: [{name: (addIndex += 1)}]}) + .fileupload('add', {files: [{name: (addIndex += 1)}]}) + .fileupload('add', {files: [{name: (addIndex += 1)}]}) + .fileupload('add', {files: [{name: 'test'}]}); + }); + + test('maxFileSize', function () { + expect(2); + var addIndex = 0, + sendIndex = 0; + $('#fileupload') + .fileupload({ + autoUpload: true, + maxFileSize: 1000, + send: function () { + strictEqual( + sendIndex += 1, + addIndex + ); + return false; + } + }) + .fileupload('add', {files: [{ + name: (addIndex += 1) + }]}) + .fileupload('add', {files: [{ + name: (addIndex += 1), + size: 999 + }]}) + .fileupload('add', {files: [{ + name: 'test', + size: 1001 + }]}) + .fileupload({ + send: function (e, data) { + ok( + !$.blueimp.fileupload.prototype.options + .send.call(this, e, data) + ); + return false; + } + }); + }); + + test('minFileSize', function () { + expect(2); + var addIndex = 0, + sendIndex = 0; + $('#fileupload') + .fileupload({ + autoUpload: true, + minFileSize: 1000, + send: function () { + strictEqual( + sendIndex += 1, + addIndex + ); + return false; + } + }) + .fileupload('add', {files: [{ + name: (addIndex += 1) + }]}) + .fileupload('add', {files: [{ + name: (addIndex += 1), + size: 1001 + }]}) + .fileupload('add', {files: [{ + name: 'test', + size: 999 + }]}) + .fileupload({ + send: function (e, data) { + ok( + !$.blueimp.fileupload.prototype.options + .send.call(this, e, data) + ); + return false; + } + }); + }); + + test('acceptFileTypes', function () { + expect(2); + var addIndex = 0, + sendIndex = 0; + $('#fileupload') + .fileupload({ + autoUpload: true, + acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, + disableImageMetaDataLoad: true, + send: function () { + strictEqual( + sendIndex += 1, + addIndex + ); + return false; + } + }) + .fileupload('add', {files: [{ + name: (addIndex += 1) + '.jpg' + }]}) + .fileupload('add', {files: [{ + name: (addIndex += 1), + type: 'image/jpeg' + }]}) + .fileupload('add', {files: [{ + name: 'test.txt', + type: 'text/plain' + }]}) + .fileupload({ + send: function (e, data) { + ok( + !$.blueimp.fileupload.prototype.options + .send.call(this, e, data) + ); + return false; + } + }); + }); + + test('acceptFileTypes as HTML5 data attribute', function () { + expect(2); + var regExp = /(\.|\/)(gif|jpe?g|png)$/i; + $('#fileupload') + .attr('data-accept-file-types', regExp.toString()) + .fileupload(); + strictEqual( + $.type($('#fileupload').fileupload('option', 'acceptFileTypes')), + $.type(regExp) + ); + strictEqual( + $('#fileupload').fileupload('option', 'acceptFileTypes').toString(), + regExp.toString() + ); + }); + +}); diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE index f27399a04..f0157a6ed 100644 --- a/vendor/composer/LICENSE +++ b/vendor/composer/LICENSE @@ -1,21 +1,56 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: Composer +Upstream-Contact: Jordi Boggiano <j.boggiano@seld.be> +Source: https://github.com/composer/composer -Copyright (c) Nils Adermann, Jordi Boggiano +Files: * +Copyright: 2016, Nils Adermann <naderman@naderman.de> + 2016, Jordi Boggiano <j.boggiano@seld.be> +License: Expat -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: +Files: src/Composer/Util/TlsHelper.php +Copyright: 2016, Nils Adermann <naderman@naderman.de> + 2016, Jordi Boggiano <j.boggiano@seld.be> + 2013, Evan Coury <me@evancoury.com> +License: Expat and BSD-2-Clause -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +License: BSD-2-Clause + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + . + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + . + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +License: Expat + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is furnished + to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 4b8316c37..f3c814e02 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -300,6 +300,7 @@ return array( 'League\\HTMLToMarkdown\\ElementInterface' => $vendorDir . '/league/html-to-markdown/src/ElementInterface.php', 'League\\HTMLToMarkdown\\Environment' => $vendorDir . '/league/html-to-markdown/src/Environment.php', 'League\\HTMLToMarkdown\\HtmlConverter' => $vendorDir . '/league/html-to-markdown/src/HtmlConverter.php', + 'League\\HTMLToMarkdown\\HtmlConverterInterface' => $vendorDir . '/league/html-to-markdown/src/HtmlConverterInterface.php', 'Michelf\\Markdown' => $vendorDir . '/michelf/php-markdown/Michelf/Markdown.php', 'Michelf\\MarkdownExtra' => $vendorDir . '/michelf/php-markdown/Michelf/MarkdownExtra.php', 'Michelf\\MarkdownInterface' => $vendorDir . '/michelf/php-markdown/Michelf/MarkdownInterface.php', @@ -804,6 +805,7 @@ return array( 'Text_LanguageDetect_Exception' => $vendorDir . '/pear/text_languagedetect/Text/LanguageDetect/Exception.php', 'Text_LanguageDetect_ISO639' => $vendorDir . '/pear/text_languagedetect/Text/LanguageDetect/ISO639.php', 'Text_LanguageDetect_Parser' => $vendorDir . '/pear/text_languagedetect/Text/LanguageDetect/Parser.php', + 'UploadHandler' => $vendorDir . '/blueimp/jquery-file-upload/server/php/UploadHandler.php', 'Zotlabs\\Access\\AccessList' => $baseDir . '/Zotlabs/Access/AccessList.php', 'Zotlabs\\Access\\PermissionLimits' => $baseDir . '/Zotlabs/Access/PermissionLimits.php', 'Zotlabs\\Access\\PermissionRoles' => $baseDir . '/Zotlabs/Access/PermissionRoles.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 0202e148c..d55227eb1 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -468,6 +468,7 @@ class ComposerStaticInit7b34d7e50a62201ec5d5e526a5b8b35d 'League\\HTMLToMarkdown\\ElementInterface' => __DIR__ . '/..' . '/league/html-to-markdown/src/ElementInterface.php', 'League\\HTMLToMarkdown\\Environment' => __DIR__ . '/..' . '/league/html-to-markdown/src/Environment.php', 'League\\HTMLToMarkdown\\HtmlConverter' => __DIR__ . '/..' . '/league/html-to-markdown/src/HtmlConverter.php', + 'League\\HTMLToMarkdown\\HtmlConverterInterface' => __DIR__ . '/..' . '/league/html-to-markdown/src/HtmlConverterInterface.php', 'Michelf\\Markdown' => __DIR__ . '/..' . '/michelf/php-markdown/Michelf/Markdown.php', 'Michelf\\MarkdownExtra' => __DIR__ . '/..' . '/michelf/php-markdown/Michelf/MarkdownExtra.php', 'Michelf\\MarkdownInterface' => __DIR__ . '/..' . '/michelf/php-markdown/Michelf/MarkdownInterface.php', @@ -972,6 +973,7 @@ class ComposerStaticInit7b34d7e50a62201ec5d5e526a5b8b35d 'Text_LanguageDetect_Exception' => __DIR__ . '/..' . '/pear/text_languagedetect/Text/LanguageDetect/Exception.php', 'Text_LanguageDetect_ISO639' => __DIR__ . '/..' . '/pear/text_languagedetect/Text/LanguageDetect/ISO639.php', 'Text_LanguageDetect_Parser' => __DIR__ . '/..' . '/pear/text_languagedetect/Text/LanguageDetect/Parser.php', + 'UploadHandler' => __DIR__ . '/..' . '/blueimp/jquery-file-upload/server/php/UploadHandler.php', 'Zotlabs\\Access\\AccessList' => __DIR__ . '/../..' . '/Zotlabs/Access/AccessList.php', 'Zotlabs\\Access\\PermissionLimits' => __DIR__ . '/../..' . '/Zotlabs/Access/PermissionLimits.php', 'Zotlabs\\Access\\PermissionRoles' => __DIR__ . '/../..' . '/Zotlabs/Access/PermissionRoles.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index eac4cebde..af845828e 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1,5 +1,62 @@ [ { + "name": "blueimp/jquery-file-upload", + "version": "v9.25.1", + "version_normalized": "9.25.1.0", + "source": { + "type": "git", + "url": "https://github.com/vkhramtsov/jQuery-File-Upload.git", + "reference": "28891f9b2bc339bcc1ca8d548e5401e8563bf04b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vkhramtsov/jQuery-File-Upload/zipball/28891f9b2bc339bcc1ca8d548e5401e8563bf04b", + "reference": "28891f9b2bc339bcc1ca8d548e5401e8563bf04b", + "shasum": "" + }, + "time": "2018-10-26T07:21:48+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "server/php/UploadHandler.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Sebastian Tschan", + "homepage": "https://blueimp.net" + } + ], + "description": "File Upload widget for jQuery.", + "homepage": "https://github.com/blueimp/jQuery-File-Upload", + "keywords": [ + "bootstrap", + "chunk", + "cross-domain", + "cross-site", + "drag", + "drop", + "file", + "gae", + "go", + "jquery", + "multiple", + "php", + "preview", + "progress", + "python", + "resume", + "selection", + "upload", + "widget" + ] + }, + { "name": "bshaffer/oauth2-server-php", "version": "v1.10.0", "version_normalized": "1.10.0.0", @@ -156,17 +213,17 @@ }, { "name": "league/html-to-markdown", - "version": "4.7.0", - "version_normalized": "4.7.0.0", + "version": "4.8.0", + "version_normalized": "4.8.0.0", "source": { "type": "git", "url": "https://github.com/thephpleague/html-to-markdown.git", - "reference": "76c076483cef89860d32a3fd25312f5a42848a8c" + "reference": "f9a879a068c68ff47b722de63f58bec79e448f9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/html-to-markdown/zipball/76c076483cef89860d32a3fd25312f5a42848a8c", - "reference": "76c076483cef89860d32a3fd25312f5a42848a8c", + "url": "https://api.github.com/repos/thephpleague/html-to-markdown/zipball/f9a879a068c68ff47b722de63f58bec79e448f9d", + "reference": "f9a879a068c68ff47b722de63f58bec79e448f9d", "shasum": "" }, "require": { @@ -179,14 +236,14 @@ "phpunit/phpunit": "4.*", "scrutinizer/ocular": "~1.1" }, - "time": "2018-05-19T23:47:12+00:00", + "time": "2018-09-18T12:18:08+00:00", "bin": [ "bin/html-to-markdown" ], "type": "library", "extra": { "branch-alias": { - "dev-master": "4.8-dev" + "dev-master": "4.9-dev" } }, "installation-source": "dist", @@ -201,16 +258,16 @@ ], "authors": [ { - "name": "Colin O'Dell", - "email": "colinodell@gmail.com", - "homepage": "http://www.colinodell.com", - "role": "Lead Developer" - }, - { "name": "Nick Cernis", "email": "nick@cern.is", "homepage": "http://modernnerd.net", "role": "Original Author" + }, + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com", + "role": "Lead Developer" } ], "description": "An HTML-to-markdown conversion helper for PHP", @@ -533,17 +590,17 @@ }, { "name": "sabre/dav", - "version": "3.2.2", - "version_normalized": "3.2.2.0", + "version": "3.2.3", + "version_normalized": "3.2.3.0", "source": { "type": "git", "url": "https://github.com/sabre-io/dav.git", - "reference": "e987775e619728f12205606c9cc3ee565ffb1516" + "reference": "a9780ce4f35560ecbd0af524ad32d9d2c8954b80" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/dav/zipball/e987775e619728f12205606c9cc3ee565ffb1516", - "reference": "e987775e619728f12205606c9cc3ee565ffb1516", + "url": "https://api.github.com/repos/sabre-io/dav/zipball/a9780ce4f35560ecbd0af524ad32d9d2c8954b80", + "reference": "a9780ce4f35560ecbd0af524ad32d9d2c8954b80", "shasum": "" }, "require": { @@ -574,7 +631,7 @@ "ext-curl": "*", "ext-pdo": "*" }, - "time": "2017-02-15T03:06:08+00:00", + "time": "2018-10-19T09:58:27+00:00", "bin": [ "bin/sabredav", "bin/naturalselection" @@ -1029,23 +1086,23 @@ }, { "name": "smarty/smarty", - "version": "v3.1.32", - "version_normalized": "3.1.32.0", + "version": "v3.1.33", + "version_normalized": "3.1.33.0", "source": { "type": "git", "url": "https://github.com/smarty-php/smarty.git", - "reference": "ac9d4b587e5bf53381e21881820a9830765cb459" + "reference": "dd55b23121e55a3b4f1af90a707a6c4e5969530f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/smarty-php/smarty/zipball/ac9d4b587e5bf53381e21881820a9830765cb459", - "reference": "ac9d4b587e5bf53381e21881820a9830765cb459", + "url": "https://api.github.com/repos/smarty-php/smarty/zipball/dd55b23121e55a3b4f1af90a707a6c4e5969530f", + "reference": "dd55b23121e55a3b4f1af90a707a6c4e5969530f", "shasum": "" }, "require": { "php": ">=5.2" }, - "time": "2018-04-24T14:53:33+00:00", + "time": "2018-09-12T20:54:16+00:00", "type": "library", "extra": { "branch-alias": { diff --git a/vendor/league/html-to-markdown/CHANGELOG.md b/vendor/league/html-to-markdown/CHANGELOG.md index 981ffd594..ab07c94f5 100644 --- a/vendor/league/html-to-markdown/CHANGELOG.md +++ b/vendor/league/html-to-markdown/CHANGELOG.md @@ -4,6 +4,24 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip ## [Unreleased][unreleased] +## [4.8.0] - 2018-09-18 +### Added + - Added support for email auto-linking + - Added a new interface (`HtmlConverterInterface`) for the main `HtmlConverter` class + - Added additional test cases (#14) + +### Changed + - The `italic_style` option now defaults to `'*'` so that in-word emphasis is handled properly (#75) + +### Fixed + - Fixed several issues of `<code>` and `<pre>` tags not converting to blocks or inlines properly (#26, #70, #102, #140, #161, #162) + - Fixed in-word emphasis using underscores as delimiter (#75) + - Fixed character escaping inside of `<div>` elements + - Fixed header edge cases + +### Deprecated + - The `bold_style` and `italic_style` options have been deprecated (#75) + ## [4.7.0] - 2018-05-19 ### Added - Added `setOptions()` function for chainable calling (#149) @@ -217,7 +235,8 @@ not ideally set, so this releases fixes that. Moving forwards this should reduce ### Added - Initial release -[unreleased]: https://github.com/thephpleague/html-to-markdown/compare/4.7.0...master +[unreleased]: https://github.com/thephpleague/html-to-markdown/compare/4.8.0...master +[4.8.0]: https://github.com/thephpleague/html-to-markdown/compare/4.7.0...4.8.0 [4.7.0]: https://github.com/thephpleague/html-to-markdown/compare/4.6.2...4.7.0 [4.6.2]: https://github.com/thephpleague/html-to-markdown/compare/4.6.1...4.6.2 [4.6.1]: https://github.com/thephpleague/html-to-markdown/compare/4.6.0...4.6.1 diff --git a/vendor/league/html-to-markdown/composer.json b/vendor/league/html-to-markdown/composer.json index c79230562..53403916e 100644 --- a/vendor/league/html-to-markdown/composer.json +++ b/vendor/league/html-to-markdown/composer.json @@ -9,7 +9,7 @@ { "name": "Colin O'Dell", "email": "colinodell@gmail.com", - "homepage": "http://www.colinodell.com", + "homepage": "https://www.colinodell.com", "role": "Lead Developer" }, { @@ -42,7 +42,7 @@ "bin": ["bin/html-to-markdown"], "extra": { "branch-alias": { - "dev-master": "4.8-dev" + "dev-master": "4.9-dev" } } } diff --git a/vendor/league/html-to-markdown/src/Configuration.php b/vendor/league/html-to-markdown/src/Configuration.php index 2943383aa..5bc8d5503 100644 --- a/vendor/league/html-to-markdown/src/Configuration.php +++ b/vendor/league/html-to-markdown/src/Configuration.php @@ -12,6 +12,8 @@ class Configuration public function __construct(array $config = array()) { $this->config = $config; + + $this->checkForDeprecatedOptions($config); } /** @@ -19,6 +21,7 @@ class Configuration */ public function merge(array $config = array()) { + $this->checkForDeprecatedOptions($config); $this->config = array_replace_recursive($this->config, $config); } @@ -27,6 +30,7 @@ class Configuration */ public function replace(array $config = array()) { + $this->checkForDeprecatedOptions($config); $this->config = $config; } @@ -36,6 +40,7 @@ class Configuration */ public function setOption($key, $value) { + $this->checkForDeprecatedOptions(array($key => $value)); $this->config[$key] = $value; } @@ -57,4 +62,15 @@ class Configuration return $this->config[$key]; } + + private function checkForDeprecatedOptions(array $config) + { + foreach ($config as $key => $value) { + if ($key === 'bold_style' && $value !== '**') { + @trigger_error('Customizing the bold_style option is deprecated and may be removed in the next major version', E_USER_DEPRECATED); + } elseif ($key === 'italic_style' && $value !== '*') { + @trigger_error('Customizing the italic_style option is deprecated and may be removed in the next major version', E_USER_DEPRECATED); + } + } + } } diff --git a/vendor/league/html-to-markdown/src/Converter/CodeConverter.php b/vendor/league/html-to-markdown/src/Converter/CodeConverter.php index e536362ee..39e6a7bc4 100644 --- a/vendor/league/html-to-markdown/src/Converter/CodeConverter.php +++ b/vendor/league/html-to-markdown/src/Converter/CodeConverter.php @@ -13,7 +13,7 @@ class CodeConverter implements ConverterInterface */ public function convert(ElementInterface $element) { - $language = null; + $language = ''; // Checking for language class on the code block $classes = $element->getAttribute('class'); @@ -24,8 +24,7 @@ class CodeConverter implements ConverterInterface foreach ($classes as $class) { if (strpos($class, 'language-') !== false) { // Found one, save it as the selected language and stop looping over the classes. - // The space after the language avoids gluing the actual code with the language tag - $language = str_replace('language-', '', $class) . ' '; + $language = str_replace('language-', '', $class); break; } } @@ -39,14 +38,13 @@ class CodeConverter implements ConverterInterface $code = preg_replace('/<code\b[^>]*>/', '', $code); $code = str_replace('</code>', '', $code); - // Checking if the code has multiple lines - $lines = preg_split('/\r\n|\r|\n/', $code); - if (count($lines) > 1) { - // Multiple lines detected, adding three backticks and newlines - $markdown .= '```' . $language . "\n" . $code . "\n" . '```' . "\n\n"; + // Checking if it's a code block or span + if ($this->shouldBeBlock($element, $code)) { + // Code block detected, newlines will be added in parent + $markdown .= '```' . $language . "\n" . $code . "\n" . '```'; } else { - // One line of code, wrapping it on one backtick. - $markdown .= '`' . $language . $code . '`'; + // One line of code, wrapping it on one backtick, removing new lines + $markdown .= '`' . preg_replace('/\r\n|\r|\n/', '', $code) . '`'; } return $markdown; @@ -59,4 +57,23 @@ class CodeConverter implements ConverterInterface { return array('code'); } + + /** + * @param ElementInterface $element + * @param string $code + * + * @return bool + */ + private function shouldBeBlock(ElementInterface $element, $code) + { + if ($element->getParent()->getTagName() == 'pre') { + return true; + } + + if (preg_match('/[^\s]` `/', $code)) { + return true; + } + + return false; + } } diff --git a/vendor/league/html-to-markdown/src/Converter/HeaderConverter.php b/vendor/league/html-to-markdown/src/Converter/HeaderConverter.php index d117e7d36..05d4fe81e 100644 --- a/vendor/league/html-to-markdown/src/Converter/HeaderConverter.php +++ b/vendor/league/html-to-markdown/src/Converter/HeaderConverter.php @@ -34,6 +34,10 @@ class HeaderConverter implements ConverterInterface, ConfigurationAwareInterface $level = (int) substr($element->getTagName(), 1, 1); $style = $this->config->getOption('header_style', self::STYLE_SETEXT); + if (strlen($element->getValue()) === 0) { + return ''; + } + if (($level === 1 || $level === 2) && !$element->isDescendantOf('blockquote') && $style === self::STYLE_SETEXT) { return $this->createSetextHeader($level, $element->getValue()); } diff --git a/vendor/league/html-to-markdown/src/Converter/LinkConverter.php b/vendor/league/html-to-markdown/src/Converter/LinkConverter.php index 74b49a778..c82b70e97 100644 --- a/vendor/league/html-to-markdown/src/Converter/LinkConverter.php +++ b/vendor/league/html-to-markdown/src/Converter/LinkConverter.php @@ -21,6 +21,8 @@ class LinkConverter implements ConverterInterface $markdown = '[' . $text . '](' . $href . ' "' . $title . '")'; } elseif ($href === $text && $this->isValidAutolink($href)) { $markdown = '<' . $href . '>'; + } elseif ($href === 'mailto:' . $text && $this->isValidEmail($text)) { + $markdown = '<' . $text . '>'; } else { $markdown = '[' . $text . '](' . $href . ')'; } @@ -49,4 +51,15 @@ class LinkConverter implements ConverterInterface { return preg_match('/^[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*/i', $href) === 1; } + + /** + * @param string $email + * + * @return bool + */ + private function isValidEmail($email) + { + // Email validation is messy business, but this should cover most cases + return filter_var($email, FILTER_VALIDATE_EMAIL); + } } diff --git a/vendor/league/html-to-markdown/src/Converter/PreformattedConverter.php b/vendor/league/html-to-markdown/src/Converter/PreformattedConverter.php index 3b77ba10b..321c898b1 100644 --- a/vendor/league/html-to-markdown/src/Converter/PreformattedConverter.php +++ b/vendor/league/html-to-markdown/src/Converter/PreformattedConverter.php @@ -13,8 +13,6 @@ class PreformattedConverter implements ConverterInterface */ public function convert(ElementInterface $element) { - $markdown = ''; - $pre_content = html_entity_decode($element->getChildrenAsString()); $pre_content = str_replace(array('<pre>', '</pre>'), '', $pre_content); @@ -28,28 +26,22 @@ class PreformattedConverter implements ConverterInterface $firstBacktick = strpos(trim($pre_content), '`'); $lastBacktick = strrpos(trim($pre_content), '`'); if ($firstBacktick === 0 && $lastBacktick === strlen(trim($pre_content)) - 1) { - return $pre_content; + return $pre_content . "\n\n"; } // If the execution reaches this point it means it's just a pre tag, with no code tag nested // Empty lines are a special case if ($pre_content === '') { - return "```\n```\n"; + return "```\n```\n\n"; } // Normalizing new lines - $pre_content = preg_replace('/\r\n|\r|\n/', PHP_EOL, $pre_content); - - // Is it a single line? - if (strpos($pre_content, PHP_EOL) === false) { - // One line of code, wrapping it on one backtick. - return '`' . $pre_content . '`'; - } + $pre_content = preg_replace('/\r\n|\r|\n/', "\n", $pre_content); // Ensure there's a newline at the end - if (strrpos($pre_content, PHP_EOL) !== strlen($pre_content) - 1) { - $pre_content .= PHP_EOL; + if (strrpos($pre_content, "\n") !== strlen($pre_content) - strlen("\n")) { + $pre_content .= "\n"; } // Use three backticks diff --git a/vendor/league/html-to-markdown/src/Converter/TextConverter.php b/vendor/league/html-to-markdown/src/Converter/TextConverter.php index d6d91e16f..fcd466094 100644 --- a/vendor/league/html-to-markdown/src/Converter/TextConverter.php +++ b/vendor/league/html-to-markdown/src/Converter/TextConverter.php @@ -22,7 +22,9 @@ class TextConverter implements ConverterInterface $markdown = preg_replace('~\s+~u', ' ', $markdown); // Escape the following characters: '*', '_', '[', ']' and '\' - $markdown = preg_replace('~([*_\\[\\]\\\\])~u', '\\\\$1', $markdown); + if ($element->getParent() && $element->getParent()->getTagName() !== 'div') { + $markdown = preg_replace('~([*_\\[\\]\\\\])~u', '\\\\$1', $markdown); + } $markdown = preg_replace('~^#~u', '\\\\#', $markdown); diff --git a/vendor/league/html-to-markdown/src/HtmlConverter.php b/vendor/league/html-to-markdown/src/HtmlConverter.php index 155369f56..3381e1e1e 100644 --- a/vendor/league/html-to-markdown/src/HtmlConverter.php +++ b/vendor/league/html-to-markdown/src/HtmlConverter.php @@ -14,7 +14,7 @@ namespace League\HTMLToMarkdown; * * @license http://www.opensource.org/licenses/mit-license.php MIT */ -class HtmlConverter +class HtmlConverter implements HtmlConverterInterface { /** * @var Environment @@ -35,8 +35,8 @@ class HtmlConverter 'header_style' => 'setext', // Set to 'atx' to output H1 and H2 headers as # Header1 and ## Header2 'suppress_errors' => true, // Set to false to show warnings when loading malformed HTML 'strip_tags' => false, // Set to true to strip tags that don't have markdown equivalents. N.B. Strips tags, not their content. Useful to clean MS Word HTML output. - 'bold_style' => '**', // Set to '__' if you prefer the underlined style - 'italic_style' => '_', // Set to '*' if you prefer the asterisk style + 'bold_style' => '**', // DEPRECATED: Set to '__' if you prefer the underlined style + 'italic_style' => '*', // DEPRECATED: Set to '_' if you prefer the underlined style 'remove_nodes' => '', // space-separated list of dom nodes that should be removed. example: 'meta style script' 'hard_break' => false, // Set to true to turn <br> into `\n` instead of ` \n` 'list_item_style' => '-', // Set the default character for each <li> in a <ul>. Can be '-', '*', or '+' diff --git a/vendor/league/html-to-markdown/src/HtmlConverterInterface.php b/vendor/league/html-to-markdown/src/HtmlConverterInterface.php new file mode 100644 index 000000000..7d43cf87e --- /dev/null +++ b/vendor/league/html-to-markdown/src/HtmlConverterInterface.php @@ -0,0 +1,26 @@ +<?php + +namespace League\HTMLToMarkdown; + +/** + * Interface for an HTML-to-Markdown converter. + * + * @author Colin O'Dell <colinodell@gmail.com> + * + * @link https://github.com/thephpleague/html-to-markdown/ Latest version on GitHub. + * + * @license http://www.opensource.org/licenses/mit-license.php MIT + */ +interface HtmlConverterInterface +{ + /** + * Convert the given $html to Markdown + * + * @param string $html + * + * @throws \InvalidArgumentException + * + * @return string The Markdown version of the html + */ + public function convert($html); +} diff --git a/vendor/sabre/dav/CHANGELOG.md b/vendor/sabre/dav/CHANGELOG.md index 0bccc995c..cda2564e1 100644 --- a/vendor/sabre/dav/CHANGELOG.md +++ b/vendor/sabre/dav/CHANGELOG.md @@ -1,6 +1,12 @@ ChangeLog ========= +3.2.3 (2018-10-19) +------------------ + +* #982: Make sure that files that are siblings of directories, are reported + as files (@nickvergessen) + 3.2.2 (2017-02-14) ------------------ diff --git a/vendor/sabre/dav/bin/build.php b/vendor/sabre/dav/bin/build.php index c4ba20941..c4ba20941 100755..100644 --- a/vendor/sabre/dav/bin/build.php +++ b/vendor/sabre/dav/bin/build.php diff --git a/vendor/sabre/dav/bin/googlecode_upload.py b/vendor/sabre/dav/bin/googlecode_upload.py index caafd5ded..caafd5ded 100755..100644 --- a/vendor/sabre/dav/bin/googlecode_upload.py +++ b/vendor/sabre/dav/bin/googlecode_upload.py diff --git a/vendor/sabre/dav/bin/migrateto20.php b/vendor/sabre/dav/bin/migrateto20.php index 77236804f..77236804f 100755..100644 --- a/vendor/sabre/dav/bin/migrateto20.php +++ b/vendor/sabre/dav/bin/migrateto20.php diff --git a/vendor/sabre/dav/bin/migrateto21.php b/vendor/sabre/dav/bin/migrateto21.php index c81ee5cca..c81ee5cca 100755..100644 --- a/vendor/sabre/dav/bin/migrateto21.php +++ b/vendor/sabre/dav/bin/migrateto21.php diff --git a/vendor/sabre/dav/bin/migrateto30.php b/vendor/sabre/dav/bin/migrateto30.php index 9ca77c13c..9ca77c13c 100755..100644 --- a/vendor/sabre/dav/bin/migrateto30.php +++ b/vendor/sabre/dav/bin/migrateto30.php diff --git a/vendor/sabre/dav/bin/migrateto32.php b/vendor/sabre/dav/bin/migrateto32.php index 7567aeb60..7567aeb60 100755..100644 --- a/vendor/sabre/dav/bin/migrateto32.php +++ b/vendor/sabre/dav/bin/migrateto32.php diff --git a/vendor/sabre/dav/bin/sabredav.php b/vendor/sabre/dav/bin/sabredav.php index 950075d1a..950075d1a 100755..100644 --- a/vendor/sabre/dav/bin/sabredav.php +++ b/vendor/sabre/dav/bin/sabredav.php diff --git a/vendor/sabre/dav/lib/CardDAV/Xml/Filter/AddressData.php b/vendor/sabre/dav/lib/CardDAV/Xml/Filter/AddressData.php index a130cd61d..5b7b2ee17 100644 --- a/vendor/sabre/dav/lib/CardDAV/Xml/Filter/AddressData.php +++ b/vendor/sabre/dav/lib/CardDAV/Xml/Filter/AddressData.php @@ -52,12 +52,15 @@ class AddressData implements XmlDeserializable { ]; $elems = (array)$reader->parseInnerTree(); + $elems = array_filter($elems, function($element) { + return $element['name'] === '{urn:ietf:params:xml:ns:carddav}prop' && + isset($element['attributes']['name']); + }); $result['addressDataProperties'] = array_map(function($element) { return $element['attributes']['name']; }, $elems); return $result; - } } diff --git a/vendor/sabre/dav/lib/DAV/Server.php b/vendor/sabre/dav/lib/DAV/Server.php index 6805ec0b0..f7fcf3057 100644 --- a/vendor/sabre/dav/lib/DAV/Server.php +++ b/vendor/sabre/dav/lib/DAV/Server.php @@ -893,15 +893,16 @@ class Server extends EventEmitter implements LoggerAwareInterface { $newDepth--; } + $propertyNames = $propFind->getRequestedProperties(); + $propFindType = !empty($propertyNames) ? PropFind::NORMAL : PropFind::ALLPROPS; + foreach ($this->tree->getChildren($path) as $childNode) { - $subPropFind = clone $propFind; - $subPropFind->setDepth($newDepth); if ($path !== '') { $subPath = $path . '/' . $childNode->getName(); } else { $subPath = $childNode->getName(); } - $subPropFind->setPath($subPath); + $subPropFind = new PropFind($subPath, $propertyNames, $newDepth, $propFindType); yield [ $subPropFind, diff --git a/vendor/sabre/dav/lib/DAV/Tree.php b/vendor/sabre/dav/lib/DAV/Tree.php index 5d2792503..7c04f0915 100644 --- a/vendor/sabre/dav/lib/DAV/Tree.php +++ b/vendor/sabre/dav/lib/DAV/Tree.php @@ -298,7 +298,9 @@ class Tree { */ protected function copyNode(INode $source, ICollection $destinationParent, $destinationName = null) { - if (!$destinationName) $destinationName = $source->getName(); + if ((string)$destinationName === '') { + $destinationName = $source->getName(); + } if ($source instanceof IFile) { diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractBasicTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractBasicTest.php index 455403aff..917f5ec3f 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractBasicTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractBasicTest.php @@ -60,7 +60,7 @@ class AbstractBasicTest extends \PHPUnit_Framework_TestCase { $backend->setRealm('writing unittests on a saturday night'); $backend->challenge($request, $response); - $this->assertEquals( + $this->assertContains( 'Basic realm="writing unittests on a saturday night"', $response->getHeader('WWW-Authenticate') ); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php index e719e38d5..c70d17a22 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php @@ -24,6 +24,22 @@ class TreeTest extends \PHPUnit_Framework_TestCase { } + function testCopyFile() { + + $tree = new TreeMock(); + $tree->copy('hi/file', 'hi/newfile'); + + $this->assertArrayHasKey('newfile', $tree->getNodeForPath('hi')->newFiles); + } + + function testCopyFile0() { + + $tree = new TreeMock(); + $tree->copy('hi/file', 'hi/0'); + + $this->assertArrayHasKey('0', $tree->getNodeForPath('hi')->newFiles); + } + function testMove() { $tree = new TreeMock(); diff --git a/vendor/smarty/smarty/NEW_FEATURES.txt b/vendor/smarty/smarty/NEW_FEATURES.txt index 7632b07ea..b3289dfc1 100644 --- a/vendor/smarty/smarty/NEW_FEATURES.txt +++ b/vendor/smarty/smarty/NEW_FEATURES.txt @@ -2,7 +2,14 @@ This file contains a brief description of new features which have been added to Smarty 3.1 -Smarty 3.1.32 New tags for inheritance parent and child +Smarty 3.1.33-dev + Variable capture name in Smarty special variable + ================================================ + {$smarty.capture.$foo} can now be used to access the content of a named + capture block + +Smarty 3.1.32 + New tags for inheritance parent and child ========================================= {parent} == {$smarty.block.parent} {child} == {$smarty.block.child} diff --git a/vendor/smarty/smarty/change_log.txt b/vendor/smarty/smarty/change_log.txt index 5765a1718..70762eda5 100644 --- a/vendor/smarty/smarty/change_log.txt +++ b/vendor/smarty/smarty/change_log.txt @@ -1,4 +1,46 @@ -===== 3.1.32 ===== (24.04.2018) +===== 3.1.33 release ===== 12.09.2018 +===== 3.1.33-dev-12 ===== +03.09.2018 + - bugfix {foreach} using new style property access like {$item@property} on + Smarty 2 style named foreach loop could produce errors https://github.com/smarty-php/smarty/issues/484 + +31.08.2018 + - bugfix some custom left and right delimiters like '{^' '^}' did not work + https://github.com/smarty-php/smarty/issues/450 https://github.com/smarty-php/smarty/pull/482 + + - reformating for PSR-2 coding standards https://github.com/smarty-php/smarty/pull/483 + + - bugfix on Windows absolute filepathes did fail if the drive letter was followed by a linux DIRECTORY_SEPARATOR + like C:/ at Smarty > 3.1.33-dev-5 https://github.com/smarty-php/smarty/issues/451 + + - PSR-2 code style fixes for config and template file Lexer/Parser generated with + the Smarty Lexer/Parser generator from https://github.com/smarty-php/smarty-lexer + https://github.com/smarty-php/smarty/pull/483 + +26.08.2018 + - bugfix/enhancement {capture} allow variable as capture block name in Smarty special variable + like $smarty.capture.$foo https://github.com/smarty-php/smarty/issues/478 https://github.com/smarty-php/smarty/pull/481 + +===== 3.1.33-dev-6 ===== +19.08.2018 + - fix PSR-2 coding standards and PHPDoc blocks https://github.com/smarty-php/smarty/pull/452 + https://github.com/smarty-php/smarty/pull/475 + https://github.com/smarty-php/smarty/pull/473 + - bugfix PHP5.2 compatibility https://github.com/smarty-php/smarty/pull/472 + +===== 3.1.33-dev-4 ===== +17.05.2018 + - bugfix strip-block produces different output in Smarty v3.1.32 https://github.com/smarty-php/smarty/issues/436 + - bugfix Smarty::compileAllTemplates ignores `$extension` parameter https://github.com/smarty-php/smarty/issues/437 + https://github.com/smarty-php/smarty/pull/438 + - improvement do not compute total property in {foreach} if not needed https://github.com/smarty-php/smarty/issues/443 + - bugfix plugins may not be loaded when setMergeCompiledIncludes is true https://github.com/smarty-php/smarty/issues/435 + +26.04.2018 + - bugfix regarding Security Vulnerability did not solve the problem under Linux. + Security issue CVE-2018-16831 + +===== 3.1.32 ===== (24.04.2018) 24.04.2018 - bugfix possible Security Vulnerability in Smarty_Security class. diff --git a/vendor/smarty/smarty/composer.json b/vendor/smarty/smarty/composer.json index 5064c8ce3..5007517bc 100644 --- a/vendor/smarty/smarty/composer.json +++ b/vendor/smarty/smarty/composer.json @@ -2,7 +2,9 @@ "name": "smarty/smarty", "type": "library", "description": "Smarty - the compiling PHP template engine", - "keywords": ["templating"], + "keywords": [ + "templating" + ], "homepage": "http://www.smarty.net", "license": "LGPL-3.0", "authors": [ @@ -28,12 +30,13 @@ "php": ">=5.2" }, "autoload": { - "files": ["libs/bootstrap.php"] + "files": [ + "libs/bootstrap.php" + ] }, "extra": { "branch-alias": { "dev-master": "3.1.x-dev" } } - -} +}
\ No newline at end of file diff --git a/vendor/smarty/smarty/demo/index.php b/vendor/smarty/smarty/demo/index.php index b67c217be..3aed37168 100644 --- a/vendor/smarty/smarty/demo/index.php +++ b/vendor/smarty/smarty/demo/index.php @@ -4,27 +4,32 @@ * * @package Example-application */ - require '../libs/Smarty.class.php'; - $smarty = new Smarty; - //$smarty->force_compile = true; $smarty->debugging = true; $smarty->caching = true; $smarty->cache_lifetime = 120; - $smarty->assign("Name", "Fred Irving Johnathan Bradley Peppergill", true); $smarty->assign("FirstName", array("John", "Mary", "James", "Henry")); $smarty->assign("LastName", array("Doe", "Smith", "Johnson", "Case")); -$smarty->assign("Class", array(array("A", "B", "C", "D"), array("E", "F", "G", "H"), array("I", "J", "K", "L"), - array("M", "N", "O", "P"))); - -$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"), - array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234"))); - +$smarty->assign( + "Class", + array( + array("A", "B", "C", "D"), + array("E", "F", "G", "H"), + array("I", "J", "K", "L"), + array("M", "N", "O", "P") + ) +); +$smarty->assign( + "contacts", + array( + array("phone" => "1", "fax" => "2", "cell" => "3"), + array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234") + ) +); $smarty->assign("option_values", array("NY", "NE", "KS", "IA", "OK", "TX")); $smarty->assign("option_output", array("New York", "Nebraska", "Kansas", "Iowa", "Oklahoma", "Texas")); $smarty->assign("option_selected", "NE"); - $smarty->display('index.tpl'); diff --git a/vendor/smarty/smarty/demo/plugins/cacheresource.apc.php b/vendor/smarty/smarty/demo/plugins/cacheresource.apc.php index ed55ec846..7867cc598 100644 --- a/vendor/smarty/smarty/demo/plugins/cacheresource.apc.php +++ b/vendor/smarty/smarty/demo/plugins/cacheresource.apc.php @@ -11,6 +11,11 @@ */ class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore { + /** + * Smarty_CacheResource_Apc constructor. + * + * @throws \Exception + */ public function __construct() { // test if APC is present @@ -22,7 +27,7 @@ class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore /** * Read values for a set of keys from cache * - * @param array $keys list of keys to fetch + * @param array $keys list of keys to fetch * * @return array list of values with the given keys used as indexes * @return boolean true on success, false on failure @@ -34,15 +39,14 @@ class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore foreach ($res as $k => $v) { $_res[ $k ] = $v; } - return $_res; } /** * Save values for a set of keys to cache * - * @param array $keys list of values to save - * @param int $expire expiration time + * @param array $keys list of values to save + * @param int $expire expiration time * * @return boolean true on success, false on failure */ @@ -51,14 +55,13 @@ class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore foreach ($keys as $k => $v) { apc_store($k, $v, $expire); } - return true; } /** * Remove values from cache * - * @param array $keys list of keys to delete + * @param array $keys list of keys to delete * * @return boolean true on success, false on failure */ @@ -67,7 +70,6 @@ class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore foreach ($keys as $k) { apc_delete($k); } - return true; } diff --git a/vendor/smarty/smarty/demo/plugins/cacheresource.memcache.php b/vendor/smarty/smarty/demo/plugins/cacheresource.memcache.php index 945beb349..9c8855c31 100644 --- a/vendor/smarty/smarty/demo/plugins/cacheresource.memcache.php +++ b/vendor/smarty/smarty/demo/plugins/cacheresource.memcache.php @@ -19,6 +19,9 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore */ protected $memcache = null; + /** + * Smarty_CacheResource_Memcache constructor. + */ public function __construct() { if (class_exists('Memcached')) { @@ -32,7 +35,7 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore /** * Read values for a set of keys from cache * - * @param array $keys list of keys to fetch + * @param array $keys list of keys to fetch * * @return array list of values with the given keys used as indexes * @return boolean true on success, false on failure @@ -50,15 +53,14 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore foreach ($res as $k => $v) { $_res[ $lookup[ $k ] ] = $v; } - return $_res; } /** * Save values for a set of keys to cache * - * @param array $keys list of values to save - * @param int $expire expiration time + * @param array $keys list of values to save + * @param int $expire expiration time * * @return boolean true on success, false on failure */ @@ -68,14 +70,13 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore $k = sha1($k); $this->memcache->set($k, $v, 0, $expire); } - return true; } /** * Remove values from cache * - * @param array $keys list of keys to delete + * @param array $keys list of keys to delete * * @return boolean true on success, false on failure */ @@ -85,7 +86,6 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore $k = sha1($k); $this->memcache->delete($k); } - return true; } @@ -96,6 +96,6 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore */ protected function purge() { - $this->memcache->flush(); + return $this->memcache->flush(); } } diff --git a/vendor/smarty/smarty/demo/plugins/cacheresource.mysql.php b/vendor/smarty/smarty/demo/plugins/cacheresource.mysql.php index 027b93766..c5037eb13 100644 --- a/vendor/smarty/smarty/demo/plugins/cacheresource.mysql.php +++ b/vendor/smarty/smarty/demo/plugins/cacheresource.mysql.php @@ -24,38 +24,55 @@ */ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom { - // PDO instance + /** + * @var \PDO + */ protected $db; + /** + * @var \PDOStatement + */ protected $fetch; + /** + * @var \PDOStatement + */ protected $fetchTimestamp; + /** + * @var \PDOStatement + */ protected $save; + /** + * Smarty_CacheResource_Mysql constructor. + * + * @throws \SmartyException + */ public function __construct() { try { $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty"); - } - catch (PDOException $e) { + } catch (PDOException $e) { throw new SmartyException('Mysql Resource failed: ' . $e->getMessage()); } $this->fetch = $this->db->prepare('SELECT modified, content FROM output_cache WHERE id = :id'); $this->fetchTimestamp = $this->db->prepare('SELECT modified FROM output_cache WHERE id = :id'); - $this->save = $this->db->prepare('REPLACE INTO output_cache (id, name, cache_id, compile_id, content) - VALUES (:id, :name, :cache_id, :compile_id, :content)'); + $this->save = $this->db->prepare( + 'REPLACE INTO output_cache (id, name, cache_id, compile_id, content) + VALUES (:id, :name, :cache_id, :compile_id, :content)' + ); } /** * fetch cached content and its modification time from data source * - * @param string $id unique cache content identifier - * @param string $name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param string $content cached content - * @param integer $mtime cache modification timestamp (epoch) + * @param string $id unique cache content identifier + * @param string $name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param string $content cached content + * @param integer $mtime cache modification timestamp (epoch) * * @return void */ @@ -76,12 +93,13 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom /** * Fetch cached content's modification timestamp from data source * - * @note implementing this method is optional. Only implement it if modification times can be accessed faster than loading the complete cached content. + * @note implementing this method is optional. Only implement it if modification times can be accessed faster than + * loading the complete cached content. * - * @param string $id unique cache content identifier - * @param string $name template name - * @param string $cache_id cache id - * @param string $compile_id compile id + * @param string $id unique cache content identifier + * @param string $name template name + * @param string $cache_id cache id + * @param string $compile_id compile id * * @return integer|boolean timestamp (epoch) the template was modified, or false if not found */ @@ -90,37 +108,40 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom $this->fetchTimestamp->execute(array('id' => $id)); $mtime = strtotime($this->fetchTimestamp->fetchColumn()); $this->fetchTimestamp->closeCursor(); - return $mtime; } /** * Save content to cache * - * @param string $id unique cache content identifier - * @param string $name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param integer|null $exp_time seconds till expiration time in seconds or null - * @param string $content content to cache + * @param string $id unique cache content identifier + * @param string $name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param integer|null $exp_time seconds till expiration time in seconds or null + * @param string $content content to cache * * @return boolean success */ protected function save($id, $name, $cache_id, $compile_id, $exp_time, $content) { - $this->save->execute(array('id' => $id, 'name' => $name, 'cache_id' => $cache_id, 'compile_id' => $compile_id, - 'content' => $content,)); - + $this->save->execute( + array('id' => $id, + 'name' => $name, + 'cache_id' => $cache_id, + 'compile_id' => $compile_id, + 'content' => $content,) + ); return !!$this->save->rowCount(); } /** * Delete content from cache * - * @param string $name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param integer|null $exp_time seconds till expiration or null + * @param string $name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param integer|null $exp_time seconds till expiration or null * * @return integer number of deleted caches */ @@ -130,8 +151,7 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom if ($name === null && $cache_id === null && $compile_id === null && $exp_time === null) { // returning the number of deleted caches would require a second query to count them $query = $this->db->query('TRUNCATE TABLE output_cache'); - - return - 1; + return -1; } // build the filter $where = array(); @@ -149,12 +169,15 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom } // equal test cache_id and match sub-groups if ($cache_id !== null) { - $where[] = '(cache_id = ' . $this->db->quote($cache_id) . ' OR cache_id LIKE ' . - $this->db->quote($cache_id . '|%') . ')'; + $where[] = + '(cache_id = ' . + $this->db->quote($cache_id) . + ' OR cache_id LIKE ' . + $this->db->quote($cache_id . '|%') . + ')'; } // run delete query $query = $this->db->query('DELETE FROM output_cache WHERE ' . join(' AND ', $where)); - return $query->rowCount(); } } diff --git a/vendor/smarty/smarty/demo/plugins/cacheresource.pdo.php b/vendor/smarty/smarty/demo/plugins/cacheresource.pdo.php index 24a94c1a0..a80cd698e 100644 --- a/vendor/smarty/smarty/demo/plugins/cacheresource.pdo.php +++ b/vendor/smarty/smarty/demo/plugins/cacheresource.pdo.php @@ -29,28 +29,27 @@ */ class Smarty_CacheResource_Pdo extends Smarty_CacheResource_Custom { - - protected $fetchStatements = Array('default' => 'SELECT %2$s + /** + * @var string[] + */ + protected $fetchStatements = array('default' => 'SELECT %2$s FROM %1$s WHERE 1 AND id = :id AND cache_id IS NULL AND compile_id IS NULL', - 'withCacheId' => 'SELECT %2$s FROM %1$s WHERE 1 AND id = :id AND cache_id = :cache_id AND compile_id IS NULL', - 'withCompileId' => 'SELECT %2$s FROM %1$s WHERE 1 AND id = :id AND compile_id = :compile_id AND cache_id IS NULL', - 'withCacheIdAndCompileId' => 'SELECT %2$s FROM %1$s WHERE 1 @@ -58,6 +57,9 @@ class Smarty_CacheResource_Pdo extends Smarty_CacheResource_Custom AND cache_id = :cache_id AND compile_id = :compile_id'); + /** + * @var string + */ protected $insertStatement = 'INSERT INTO %s SET id = :id, @@ -76,113 +78,130 @@ class Smarty_CacheResource_Pdo extends Smarty_CacheResource_Custom expire = DATE_ADD(CURRENT_TIMESTAMP, INTERVAL :expire SECOND), content = :content'; + /** + * @var string + */ protected $deleteStatement = 'DELETE FROM %1$s WHERE %2$s'; + /** + * @var string + */ protected $truncateStatement = 'TRUNCATE TABLE %s'; + /** + * @var string + */ protected $fetchColumns = 'modified, content'; + /** + * @var string + */ protected $fetchTimestampColumns = 'modified'; - protected $pdo, $table, $database; + /** + * @var \PDO + */ + protected $pdo; + + /** + * @var + */ + protected $table; - /* - * Constructor - * - * @param PDO $pdo PDO : active connection - * @param string $table : table (or view) name - * @param string $database : optional - if table is located in another db + /** + * @var null + */ + protected $database; + + /** + * Constructor + * + * @param PDO $pdo PDO : active connection + * @param string $table : table (or view) name + * @param string $database : optional - if table is located in another db + * + * @throws \SmartyException */ public function __construct(PDO $pdo, $table, $database = null) { - if (is_null($table)) { throw new SmartyException("Table name for caching can't be null"); } - $this->pdo = $pdo; $this->table = $table; $this->database = $database; - $this->fillStatementsWithTableName(); } - /* - * Fills the table name into the statements. - * - * @return Current Instance - * @access protected + /** + * Fills the table name into the statements. + * + * @return $this Current Instance + * @access protected */ protected function fillStatementsWithTableName() { - - foreach ($this->fetchStatements AS &$statement) { + foreach ($this->fetchStatements as &$statement) { $statement = sprintf($statement, $this->getTableName(), '%s'); } - $this->insertStatement = sprintf($this->insertStatement, $this->getTableName()); $this->deleteStatement = sprintf($this->deleteStatement, $this->getTableName(), '%s'); $this->truncateStatement = sprintf($this->truncateStatement, $this->getTableName()); - return $this; } - /* - * Gets the fetch statement, depending on what you specify - * - * @param string $columns : the column(s) name(s) you want to retrieve from the database - * @param string $id unique cache content identifier - * @param string|null $cache_id cache id - * @param string|null $compile_id compile id - * @access protected + /** + * Gets the fetch statement, depending on what you specify + * + * @param string $columns : the column(s) name(s) you want to retrieve from the database + * @param string $id unique cache content identifier + * @param string|null $cache_id cache id + * @param string|null $compile_id compile id + * + * @access protected + * @return \PDOStatement */ protected function getFetchStatement($columns, $id, $cache_id = null, $compile_id = null) { - + $args = array(); if (!is_null($cache_id) && !is_null($compile_id)) { - $query = $this->fetchStatements[ 'withCacheIdAndCompileId' ] AND - $args = Array('id' => $id, 'cache_id' => $cache_id, 'compile_id' => $compile_id); + $query = $this->fetchStatements[ 'withCacheIdAndCompileId' ] and + $args = array('id' => $id, 'cache_id' => $cache_id, 'compile_id' => $compile_id); } elseif (is_null($cache_id) && !is_null($compile_id)) { - $query = $this->fetchStatements[ 'withCompileId' ] AND - $args = Array('id' => $id, 'compile_id' => $compile_id); + $query = $this->fetchStatements[ 'withCompileId' ] and + $args = array('id' => $id, 'compile_id' => $compile_id); } elseif (!is_null($cache_id) && is_null($compile_id)) { - $query = $this->fetchStatements[ 'withCacheId' ] AND $args = Array('id' => $id, 'cache_id' => $cache_id); + $query = $this->fetchStatements[ 'withCacheId' ] and $args = array('id' => $id, 'cache_id' => $cache_id); } else { - $query = $this->fetchStatements[ 'default' ] AND $args = Array('id' => $id); + $query = $this->fetchStatements[ 'default' ] and $args = array('id' => $id); } - $query = sprintf($query, $columns); - $stmt = $this->pdo->prepare($query); - - foreach ($args AS $key => $value) { + foreach ($args as $key => $value) { $stmt->bindValue($key, $value); } - return $stmt; } /** * fetch cached content and its modification time from data source * - * @param string $id unique cache content identifier - * @param string $name template name - * @param string|null $cache_id cache id - * @param string|null $compile_id compile id - * @param string $content cached content - * @param integer $mtime cache modification timestamp (epoch) + * @param string $id unique cache content identifier + * @param string $name template name + * @param string|null $cache_id cache id + * @param string|null $compile_id compile id + * @param string $content cached content + * @param integer $mtime cache modification timestamp (epoch) * * @return void * @access protected */ protected function fetch($id, $name, $cache_id = null, $compile_id = null, &$content, &$mtime) { - $stmt = $this->getFetchStatement($this->fetchColumns, $id, $cache_id, $compile_id); $stmt->execute(); $row = $stmt->fetch(); $stmt->closeCursor(); - if ($row) { $content = $this->outputContent($row[ 'content' ]); $mtime = strtotime($row[ 'modified' ]); @@ -197,10 +216,10 @@ class Smarty_CacheResource_Pdo extends Smarty_CacheResource_Custom * {@internal implementing this method is optional. * Only implement it if modification times can be accessed faster than loading the complete cached content.}} * - * @param string $id unique cache content identifier - * @param string $name template name - * @param string|null $cache_id cache id - * @param string|null $compile_id compile id + * @param string $id unique cache content identifier + * @param string $name template name + * @param string|null $cache_id cache id + * @param string|null $compile_id compile id * * @return integer|boolean timestamp (epoch) the template was modified, or false if not found * @access protected @@ -212,7 +231,6 @@ class Smarty_CacheResource_Pdo extends Smarty_CacheResource_Custom // $stmt -> closeCursor(); // return $mtime; // } - /** * Save content to cache * @@ -228,38 +246,37 @@ class Smarty_CacheResource_Pdo extends Smarty_CacheResource_Custom */ protected function save($id, $name, $cache_id = null, $compile_id = null, $exp_time, $content) { - $stmt = $this->pdo->prepare($this->insertStatement); - $stmt->bindValue('id', $id); $stmt->bindValue('name', $name); $stmt->bindValue('cache_id', $cache_id, (is_null($cache_id)) ? PDO::PARAM_NULL : PDO::PARAM_STR); $stmt->bindValue('compile_id', $compile_id, (is_null($compile_id)) ? PDO::PARAM_NULL : PDO::PARAM_STR); - $stmt->bindValue('expire', (int) $exp_time, PDO::PARAM_INT); + $stmt->bindValue('expire', (int)$exp_time, PDO::PARAM_INT); $stmt->bindValue('content', $this->inputContent($content)); $stmt->execute(); - return !!$stmt->rowCount(); } - /* - * Encodes the content before saving to database - * - * @param string $content - * @return string $content - * @access protected + /** + * Encodes the content before saving to database + * + * @param string $content + * + * @return string $content + * @access protected */ protected function inputContent($content) { return $content; } - /* - * Decodes the content before saving to database - * - * @param string $content - * @return string $content - * @access protected + /** + * Decodes the content before saving to database + * + * @param string $content + * + * @return string $content + * @access protected */ protected function outputContent($content) { @@ -272,43 +289,46 @@ class Smarty_CacheResource_Pdo extends Smarty_CacheResource_Custom * @param string|null $name template name * @param string|null $cache_id cache id * @param string|null $compile_id compile id - * @param integer|null|-1 $exp_time seconds till expiration or null + * @param integer|null|-1 $exp_time seconds till expiration or null * * @return integer number of deleted caches - * @access protected + * @access protected */ protected function delete($name = null, $cache_id = null, $compile_id = null, $exp_time = null) { - - // delete the whole cache + // delete the whole cache if ($name === null && $cache_id === null && $compile_id === null && $exp_time === null) { - // returning the number of deleted caches would require a second query to count them + // returning the number of deleted caches would require a second query to count them $this->pdo->query($this->truncateStatement); - return - 1; + return -1; } - // build the filter + // build the filter $where = array(); - // equal test name + // equal test name if ($name !== null) { $where[] = 'name = ' . $this->pdo->quote($name); } - // equal test cache_id and match sub-groups + // equal test cache_id and match sub-groups if ($cache_id !== null) { - $where[] = '(cache_id = ' . $this->pdo->quote($cache_id) . ' OR cache_id LIKE ' . - $this->pdo->quote($cache_id . '|%') . ')'; + $where[] = + '(cache_id = ' . + $this->pdo->quote($cache_id) . + ' OR cache_id LIKE ' . + $this->pdo->quote($cache_id . '|%') . + ')'; } - // equal test compile_id + // equal test compile_id if ($compile_id !== null) { $where[] = 'compile_id = ' . $this->pdo->quote($compile_id); } - // for clearing expired caches + // for clearing expired caches if ($exp_time === Smarty::CLEAR_EXPIRED) { $where[] = 'expire < CURRENT_TIMESTAMP'; } // range test expiration time elseif ($exp_time !== null) { $where[] = 'modified < DATE_SUB(NOW(), INTERVAL ' . intval($exp_time) . ' SECOND)'; } - // run delete query + // run delete query $query = $this->pdo->query(sprintf($this->deleteStatement, join(' AND ', $where))); return $query->rowCount(); } @@ -324,4 +344,3 @@ class Smarty_CacheResource_Pdo extends Smarty_CacheResource_Custom return (is_null($this->database)) ? "`{$this->table}`" : "`{$this->database}`.`{$this->table}`"; } } -
\ No newline at end of file diff --git a/vendor/smarty/smarty/demo/plugins/cacheresource.pdo_gzip.php b/vendor/smarty/smarty/demo/plugins/cacheresource.pdo_gzip.php index 8a9e0a5dd..5560b9e39 100644 --- a/vendor/smarty/smarty/demo/plugins/cacheresource.pdo_gzip.php +++ b/vendor/smarty/smarty/demo/plugins/cacheresource.pdo_gzip.php @@ -1,4 +1,5 @@ <?php +require_once 'cacheresource.pdo.php'; /** * PDO Cache Handler with GZIP support @@ -11,33 +12,31 @@ * @require Smarty_CacheResource_Pdo class * @author Beno!t POLASZEK - 2014 */ -require_once 'cacheresource.pdo.php'; - class Smarty_CacheResource_Pdo_Gzip extends Smarty_CacheResource_Pdo { - - /* - * Encodes the content before saving to database - * - * @param string $content - * @return string $content - * @access protected + /** + * Encodes the content before saving to database + * + * @param string $content + * + * @return string $content + * @access protected */ protected function inputContent($content) { return gzdeflate($content); } - /* - * Decodes the content before saving to database - * - * @param string $content - * @return string $content - * @access protected + /** + * Decodes the content before saving to database + * + * @param string $content + * + * @return string $content + * @access protected */ protected function outputContent($content) { return gzinflate($content); } -} -
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/demo/plugins/resource.extendsall.php b/vendor/smarty/smarty/demo/plugins/resource.extendsall.php index a5ee432dd..a547d41db 100644 --- a/vendor/smarty/smarty/demo/plugins/resource.extendsall.php +++ b/vendor/smarty/smarty/demo/plugins/resource.extendsall.php @@ -13,8 +13,8 @@ class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends /** * populate Source Object with meta data from Resource * - * @param Smarty_Template_Source $source source object - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Template_Source $source source object + * @param Smarty_Internal_Template $_template template object * * @return void */ @@ -32,15 +32,13 @@ class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends $sources[ $s->uid ] = $s; $uid .= $s->filepath; $timestamp = $s->timestamp > $timestamp ? $s->timestamp : $timestamp; - } - catch (SmartyException $e) { + } catch (SmartyException $e) { } } if (!$sources) { $source->exists = false; return; } - $sources = array_reverse($sources, true); reset($sources); $s = current($sources); @@ -51,15 +49,14 @@ class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends $source->timestamp = $timestamp; } - /* + /** * Disable timestamp checks for extendsall resource. * The individual source components will be checked. * - * @return bool + * @return bool false */ public function checkTimestamps() { return false; } - } diff --git a/vendor/smarty/smarty/demo/plugins/resource.mysql.php b/vendor/smarty/smarty/demo/plugins/resource.mysql.php index 619707e78..95a3c2baf 100644 --- a/vendor/smarty/smarty/demo/plugins/resource.mysql.php +++ b/vendor/smarty/smarty/demo/plugins/resource.mysql.php @@ -12,28 +12,46 @@ * PRIMARY KEY (`name`) * ) ENGINE=InnoDB DEFAULT CHARSET=utf8;</pre> * Demo data: - * <pre>INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello world"}{$x}');</pre> + * <pre>INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello + * world"}{$x}');</pre> + * * * @package Resource-examples * @author Rodney Rehm */ class Smarty_Resource_Mysql extends Smarty_Resource_Custom { - // PDO instance + /** + * PDO instance + * + * @var \PDO + */ protected $db; - // prepared fetch() statement + /** + * prepared fetch() statement + * + * @var \PDOStatement + */ protected $fetch; - // prepared fetchTimestamp() statement + /** + * prepared fetchTimestamp() statement + * + * @var \PDOStatement + */ protected $mtime; + /** + * Smarty_Resource_Mysql constructor. + * + * @throws \SmartyException + */ public function __construct() { try { $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty"); - } - catch (PDOException $e) { + } catch (PDOException $e) { throw new SmartyException('Mysql Resource failed: ' . $e->getMessage()); } $this->fetch = $this->db->prepare('SELECT modified, source FROM templates WHERE name = :name'); @@ -43,9 +61,9 @@ class Smarty_Resource_Mysql extends Smarty_Resource_Custom /** * Fetch a template and its modification time from database * - * @param string $name template name - * @param string $source template source - * @param integer $mtime template modification timestamp (epoch) + * @param string $name template name + * @param string $source template source + * @param integer $mtime template modification timestamp (epoch) * * @return void */ @@ -66,9 +84,10 @@ class Smarty_Resource_Mysql extends Smarty_Resource_Custom /** * Fetch a template's modification time from database * - * @note implementing this method is optional. Only implement it if modification times can be accessed faster than loading the comple template source. + * @note implementing this method is optional. Only implement it if modification times can be accessed faster than + * loading the comple template source. * - * @param string $name template name + * @param string $name template name * * @return integer timestamp (epoch) the template was modified */ @@ -77,7 +96,6 @@ class Smarty_Resource_Mysql extends Smarty_Resource_Custom $this->mtime->execute(array('name' => $name)); $mtime = $this->mtime->fetchColumn(); $this->mtime->closeCursor(); - return strtotime($mtime); } } diff --git a/vendor/smarty/smarty/demo/plugins/resource.mysqls.php b/vendor/smarty/smarty/demo/plugins/resource.mysqls.php index d85aecf31..148a8dd61 100644 --- a/vendor/smarty/smarty/demo/plugins/resource.mysqls.php +++ b/vendor/smarty/smarty/demo/plugins/resource.mysqls.php @@ -14,25 +14,39 @@ * PRIMARY KEY (`name`) * ) ENGINE=InnoDB DEFAULT CHARSET=utf8;</pre> * Demo data: - * <pre>INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello world"}{$x}');</pre> + * <pre>INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello + * world"}{$x}');</pre> + * * * @package Resource-examples * @author Rodney Rehm */ class Smarty_Resource_Mysqls extends Smarty_Resource_Custom { - // PDO instance + /** + * PDO instance + * + * @var \PDO + */ protected $db; - // prepared fetch() statement + /** + * prepared fetch() statement + * + * @var \PDOStatement + */ protected $fetch; + /** + * Smarty_Resource_Mysqls constructor. + * + * @throws \SmartyException + */ public function __construct() { try { $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty"); - } - catch (PDOException $e) { + } catch (PDOException $e) { throw new SmartyException('Mysql Resource failed: ' . $e->getMessage()); } $this->fetch = $this->db->prepare('SELECT modified, source FROM templates WHERE name = :name'); @@ -41,9 +55,9 @@ class Smarty_Resource_Mysqls extends Smarty_Resource_Custom /** * Fetch a template and its modification time from database * - * @param string $name template name - * @param string $source template source - * @param integer $mtime template modification timestamp (epoch) + * @param string $name template name + * @param string $source template source + * @param integer $mtime template modification timestamp (epoch) * * @return void */ diff --git a/vendor/smarty/smarty/libs/Autoloader.php b/vendor/smarty/smarty/libs/Autoloader.php index 3a0da8faf..e4dc450f0 100644 --- a/vendor/smarty/smarty/libs/Autoloader.php +++ b/vendor/smarty/smarty/libs/Autoloader.php @@ -2,14 +2,14 @@ /** * Smarty Autoloader * - * @package Smarty + * @package Smarty */ /** * Smarty Autoloader * - * @package Smarty - * @author Uwe Tews + * @package Smarty + * @author Uwe Tews * Usage: * require_once '...path/Autoloader.php'; * Smarty_Autoloader::register(); @@ -20,7 +20,7 @@ */ class Smarty_Autoloader { - /** + /** * Filepath to Smarty root * * @var string @@ -54,8 +54,8 @@ class Smarty_Autoloader if (!defined('SMARTY_SPL_AUTOLOAD')) { define('SMARTY_SPL_AUTOLOAD', 0); } - if (SMARTY_SPL_AUTOLOAD && - set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false + if (SMARTY_SPL_AUTOLOAD + && set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false ) { $registeredAutoLoadFunctions = spl_autoload_functions(); if (!isset($registeredAutoLoadFunctions[ 'spl_autoload' ])) { diff --git a/vendor/smarty/smarty/libs/Smarty.class.php b/vendor/smarty/smarty/libs/Smarty.class.php index 597fbbf0c..a8969926b 100644 --- a/vendor/smarty/smarty/libs/Smarty.class.php +++ b/vendor/smarty/smarty/libs/Smarty.class.php @@ -27,7 +27,7 @@ * @author Uwe Tews <uwe dot tews at gmail dot com> * @author Rodney Rehm * @package Smarty - * @version 3.1.32 + * @version 3.1.33 */ /** * set SMARTY_DIR to absolute path to Smarty library files. @@ -112,7 +112,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.32'; + const SMARTY_VERSION = '3.1.33'; /** * define variable scopes */ @@ -166,133 +166,157 @@ class Smarty extends Smarty_Internal_TemplateBase const PLUGIN_COMPILER = 'compiler'; const PLUGIN_MODIFIER = 'modifier'; const PLUGIN_MODIFIERCOMPILER = 'modifiercompiler'; + /** * assigned global tpl vars */ public static $global_tpl_vars = array(); + /** * Flag denoting if Multibyte String functions are available */ public static $_MBSTRING = SMARTY_MBSTRING; + /** * The character set to adhere to (e.g. "UTF-8") */ public static $_CHARSET = SMARTY_RESOURCE_CHAR_SET; + /** * The date format to be used internally * (accepts date() and strftime()) */ public static $_DATE_FORMAT = SMARTY_RESOURCE_DATE_FORMAT; + /** * Flag denoting if PCRE should run in UTF-8 mode */ public static $_UTF8_MODIFIER = 'u'; + /** * Flag denoting if operating system is windows */ public static $_IS_WINDOWS = false; + /** * auto literal on delimiters with whitespace * * @var boolean */ public $auto_literal = true; + /** * display error on not assigned variables * * @var boolean */ public $error_unassigned = false; + /** * look up relative file path in include_path * * @var boolean */ public $use_include_path = false; + /** * flag if template_dir is normalized * * @var bool */ public $_templateDirNormalized = false; + /** * joined template directory string used in cache keys * * @var string */ public $_joined_template_dir = null; + /** * flag if config_dir is normalized * * @var bool */ public $_configDirNormalized = false; + /** * joined config directory string used in cache keys * * @var string */ public $_joined_config_dir = null; + /** * default template handler * * @var callable */ public $default_template_handler_func = null; + /** * default config handler * * @var callable */ public $default_config_handler_func = null; + /** * default plugin handler * * @var callable */ public $default_plugin_handler_func = null; + /** * flag if template_dir is normalized * * @var bool */ public $_compileDirNormalized = false; + /** * flag if plugins_dir is normalized * * @var bool */ public $_pluginsDirNormalized = false; + /** * flag if template_dir is normalized * * @var bool */ public $_cacheDirNormalized = false; + /** * force template compiling? * * @var boolean */ public $force_compile = false; - /** + + /** * use sub dirs for compiled/cached files? * * @var boolean */ public $use_sub_dirs = false; + /** * allow ambiguous resources (that are made unique by the resource handler) * * @var boolean */ public $allow_ambiguous_resources = false; + /** * merge compiled includes * * @var boolean */ public $merge_compiled_includes = false; + /* * flag for behaviour when extends: resource and {extends} tag are used simultaneous * if false disable execution of {extends} in templates called by extends resource. @@ -301,30 +325,35 @@ class Smarty extends Smarty_Internal_TemplateBase * @var boolean */ public $extends_recursion = true; + /** * force cache file creation * * @var boolean */ public $force_cache = false; + /** * template left-delimiter * * @var string */ public $left_delimiter = "{"; + /** * template right-delimiter * * @var string */ public $right_delimiter = "}"; + /** * array of strings which shall be treated as literal by compiler * * @var array string */ public $literals = array(); + /** * class name * This should be instance of Smarty_Security. @@ -333,24 +362,28 @@ class Smarty extends Smarty_Internal_TemplateBase * @see Smarty_Security */ public $security_class = 'Smarty_Security'; + /** * implementation of security class * * @var Smarty_Security */ public $security_policy = null; + /** * controls handling of PHP-blocks * * @var integer */ public $php_handling = self::PHP_PASSTHRU; + /** * controls if the php template file resource is allowed * * @var bool */ public $allow_php_templates = false; + /** * debug mode * Setting this to true enables the debug-console. @@ -358,6 +391,7 @@ class Smarty extends Smarty_Internal_TemplateBase * @var boolean */ public $debugging = false; + /** * This determines if debugging is enable-able from the browser. * <ul> @@ -368,6 +402,7 @@ class Smarty extends Smarty_Internal_TemplateBase * @var string */ public $debugging_ctrl = 'NONE'; + /** * Name of debugging URL-param. * Only used when $debugging_ctrl is set to 'URL'. @@ -376,54 +411,63 @@ class Smarty extends Smarty_Internal_TemplateBase * @var string */ public $smarty_debug_id = 'SMARTY_DEBUG'; + /** * Path of debug template. * * @var string */ public $debug_tpl = null; + /** * When set, smarty uses this value as error_reporting-level. * * @var int */ public $error_reporting = null; + /** * Controls whether variables with the same name overwrite each other. * * @var boolean */ public $config_overwrite = true; + /** * Controls whether config values of on/true/yes and off/false/no get converted to boolean. * * @var boolean */ public $config_booleanize = true; + /** * Controls whether hidden config sections/vars are read from the file. * * @var boolean */ public $config_read_hidden = false; + /** * locking concurrent compiles * * @var boolean */ public $compile_locking = true; + /** * Controls whether cache resources should use locking mechanism * * @var boolean */ public $cache_locking = false; + /** * seconds to wait for acquiring a lock before ignoring the write lock * * @var float */ public $locking_timeout = 10; + /** * resource type used if none given * Must be an valid key of $registered_resources. @@ -431,6 +475,7 @@ class Smarty extends Smarty_Internal_TemplateBase * @var string */ public $default_resource_type = 'file'; + /** * caching type * Must be an element of $cache_resource_types. @@ -438,160 +483,189 @@ class Smarty extends Smarty_Internal_TemplateBase * @var string */ public $caching_type = 'file'; + /** * config type * * @var string */ public $default_config_type = 'file'; + /** * check If-Modified-Since headers * * @var boolean */ public $cache_modified_check = false; + /** * registered plugins * * @var array */ public $registered_plugins = array(); + /** * registered objects * * @var array */ public $registered_objects = array(); + /** * registered classes * * @var array */ public $registered_classes = array(); + /** * registered filters * * @var array */ public $registered_filters = array(); + /** * registered resources * * @var array */ public $registered_resources = array(); + /** * registered cache resources * * @var array */ public $registered_cache_resources = array(); + /** * autoload filter * * @var array */ public $autoload_filters = array(); + /** * default modifier * * @var array */ public $default_modifiers = array(); + /** * autoescape variable output * * @var boolean */ public $escape_html = false; + /** * start time for execution time calculation * * @var int */ public $start_time = 0; + /** * required by the compiler for BC * * @var string */ public $_current_file = null; + /** * internal flag to enable parser debugging * * @var bool */ public $_parserdebug = false; + /** * This object type (Smarty = 1, template = 2, data = 4) * * @var int */ public $_objType = 1; + /** * Debug object * * @var Smarty_Internal_Debug */ public $_debug = null; + /** * template directory * * @var array */ protected $template_dir = array('./templates/'); + /** * flags for normalized template directory entries * * @var array */ protected $_processedTemplateDir = array(); + /** * config directory * * @var array */ protected $config_dir = array('./configs/'); + /** * flags for normalized template directory entries * * @var array */ protected $_processedConfigDir = array(); + /** * compile directory * * @var string */ protected $compile_dir = './templates_c/'; + /** * plugins directory * * @var array */ protected $plugins_dir = array(); + /** * cache directory * * @var string */ protected $cache_dir = './cache/'; + /** * removed properties * * @var string[] */ - protected $obsoleteProperties = array('resource_caching', 'template_resource_caching', 'direct_access_security', - '_dir_perms', '_file_perms', 'plugin_search_order', - 'inheritance_merge_compiled_includes', 'resource_cache_mode',); + protected $obsoleteProperties = array( + 'resource_caching', 'template_resource_caching', 'direct_access_security', + '_dir_perms', '_file_perms', 'plugin_search_order', + 'inheritance_merge_compiled_includes', 'resource_cache_mode', + ); + /** * List of private properties which will call getter/setter on a direct access * * @var string[] */ - protected $accessMap = array('template_dir' => 'TemplateDir', 'config_dir' => 'ConfigDir', - 'plugins_dir' => 'PluginsDir', 'compile_dir' => 'CompileDir', - 'cache_dir' => 'CacheDir',); + protected $accessMap = array( + 'template_dir' => 'TemplateDir', 'config_dir' => 'ConfigDir', + 'plugins_dir' => 'PluginsDir', 'compile_dir' => 'CompileDir', + 'cache_dir' => 'CacheDir', + ); /** * Initialize new Smarty object @@ -618,7 +692,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * Enable error handler to mute expected messages * - * @return boolean + * @return boolean * @deprecated */ public static function muteExpectedErrors() @@ -639,7 +713,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * Check if a template resource exists * - * @param string $resource_name template name + * @param string $resource_name template name * * @return bool status * @throws \SmartyException @@ -654,10 +728,10 @@ class Smarty extends Smarty_Internal_TemplateBase /** * Loads security class and enables security * - * @param string|Smarty_Security $security_class if a string is used, it must be class-name + * @param string|Smarty_Security $security_class if a string is used, it must be class-name * * @return Smarty current Smarty instance for chaining - * @throws SmartyException when an invalid class name is provided + * @throws \SmartyException */ public function enableSecurity($security_class = null) { @@ -679,9 +753,9 @@ class Smarty extends Smarty_Internal_TemplateBase /** * Add template directory(s) * - * @param string|array $template_dir directory(s) of template sources - * @param string $key of the array element to assign the template dir to - * @param bool $isConfig true for config_dir + * @param string|array $template_dir directory(s) of template sources + * @param string $key of the array element to assign the template dir to + * @param bool $isConfig true for config_dir * * @return Smarty current Smarty instance for chaining */ @@ -747,8 +821,8 @@ class Smarty extends Smarty_Internal_TemplateBase /** * Set template directory * - * @param string|array $template_dir directory(s) of template sources - * @param bool $isConfig true for config_dir + * @param string|array $template_dir directory(s) of template sources + * @param bool $isConfig true for config_dir * * @return \Smarty current Smarty instance for chaining */ @@ -835,7 +909,7 @@ class Smarty extends Smarty_Internal_TemplateBase $this->plugins_dir = (array)$this->plugins_dir; } foreach ($this->plugins_dir as $k => $v) { - $this->plugins_dir[ $k ] = $this->_realpath(rtrim($v, "/\\") . DIRECTORY_SEPARATOR, true); + $this->plugins_dir[ $k ] = $this->_realpath(rtrim($v, '/\\') . DIRECTORY_SEPARATOR, true); } $this->_cache[ 'plugin_files' ] = array(); $this->_pluginsDirNormalized = true; @@ -846,7 +920,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * Set plugins directory * - * @param string|array $plugins_dir directory(s) of plugins + * @param string|array $plugins_dir directory(s) of plugins * * @return Smarty current Smarty instance for chaining */ @@ -901,7 +975,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * Set cache directory * - * @param string $cache_dir directory to store cached templates in + * @param string $cache_dir directory to store cached templates in * * @return Smarty current Smarty instance for chaining */ @@ -915,11 +989,11 @@ class Smarty extends Smarty_Internal_TemplateBase /** * creates a template object * - * @param string $template the resource handle of the template file - * @param mixed $cache_id cache id to be used with this template - * @param mixed $compile_id compile id to be used with this template - * @param object $parent next higher level of Smarty variables - * @param boolean $do_clone flag is Smarty object shall be cloned + * @param string $template the resource handle of the template file + * @param mixed $cache_id cache id to be used with this template + * @param mixed $compile_id compile id to be used with this template + * @param object $parent next higher level of Smarty variables + * @param boolean $do_clone flag is Smarty object shall be cloned * * @return \Smarty_Internal_Template template object * @throws \SmartyException @@ -946,7 +1020,7 @@ class Smarty extends Smarty_Internal_TemplateBase Smarty_Internal_Template::$isCacheTplObj[ $_templateId ]; $tpl->inheritance = null; $tpl->tpl_vars = $tpl->config_vars = array(); - } else if (!$do_clone && isset(Smarty_Internal_Template::$tplObjCache[ $_templateId ])) { + } elseif (!$do_clone && isset(Smarty_Internal_Template::$tplObjCache[ $_templateId ])) { $tpl = clone Smarty_Internal_Template::$tplObjCache[ $_templateId ]; $tpl->inheritance = null; $tpl->tpl_vars = $tpl->config_vars = array(); @@ -981,11 +1055,11 @@ class Smarty extends Smarty_Internal_TemplateBase * class name format: Smarty_PluginType_PluginName * plugin filename format: plugintype.pluginname.php * - * @param string $plugin_name class plugin name to load - * @param bool $check check if already loaded + * @param string $plugin_name class plugin name to load + * @param bool $check check if already loaded * - * @throws SmartyException * @return string |boolean filepath of loaded file or false + * @throws \SmartyException */ public function loadPlugin($plugin_name, $check = true) { @@ -1004,12 +1078,13 @@ class Smarty extends Smarty_Internal_TemplateBase * @return string * @throws \SmartyException */ - public function _getTemplateId($template_name, - $cache_id = null, - $compile_id = null, - $caching = null, - Smarty_Internal_Template $template = null) - { + public function _getTemplateId( + $template_name, + $cache_id = null, + $compile_id = null, + $caching = null, + Smarty_Internal_Template $template = null + ) { $template_name = (strpos($template_name, ':') === false) ? "{$this->default_resource_type}:{$template_name}" : $template_name; $cache_id = $cache_id === null ? $this->cache_id : $cache_id; @@ -1033,33 +1108,22 @@ class Smarty extends Smarty_Internal_TemplateBase * - remove /./ and /../ * - make it absolute if required * - * @param string $path file path - * @param bool $realpath if true - convert to absolute - * false - convert to relative - * null - keep as it is but remove /./ /../ + * @param string $path file path + * @param bool $realpath if true - convert to absolute + * false - convert to relative + * null - keep as it is but + * remove /./ /../ * * @return string */ public function _realpath($path, $realpath = null) { - static $nds = null; - static $sepDotsep = null; - static $sepDot = null; - static $sepSep =null; - if (!isset($nds)) { - $nds = array('/' => '\\', '\\' => '/'); - $sepDotsep = DIRECTORY_SEPARATOR . '.' . DIRECTORY_SEPARATOR; - $sepDot = DIRECTORY_SEPARATOR . '.'; - $sepSep = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR; - } - // normalize DIRECTORY_SEPARATOR - $path = str_replace(array($nds[DIRECTORY_SEPARATOR], $sepDotsep), DIRECTORY_SEPARATOR, $path); - if (strpos($path,$sepDot) === false && (($realpath === false && $path[0] === '.') || $realpath === null) && $path[0] !== '\\') { - return $path; - } - preg_match('%^(?<root>(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(.*))$%u', - $path, - $parts); + $nds = array('/' => '\\', '\\' => '/'); + preg_match( + '%^(?<root>(?:[[:alpha:]]:[\\\\/]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?<path>(.*))$%u', + $path, + $parts + ); $path = $parts[ 'path' ]; if ($parts[ 'root' ] === '\\') { $parts[ 'root' ] = substr(getcwd(), 0, 2) . $parts[ 'root' ]; @@ -1068,24 +1132,18 @@ class Smarty extends Smarty_Internal_TemplateBase $path = getcwd() . DIRECTORY_SEPARATOR . $path; } } - // remove noop 'DIRECTORY_SEPARATOR DIRECTORY_SEPARATOR' and 'DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR' patterns - $path = str_replace(array($sepDotsep,$sepSep), DIRECTORY_SEPARATOR, $path); - // resolve '..DIRECTORY_SEPARATOR' pattern, smallest first - if (strpos($path, '..' . DIRECTORY_SEPARATOR) !== false && - preg_match_all('#[\\\\/]([.][.][\\\\/])+#u', $path, $match) - ) { - $counts = array(); - foreach ($match[ 0 ] as $m) { - $counts[] = (int)((strlen($m) - 1) / 3); - } - sort($counts); - foreach ($counts as $count) { - $path = preg_replace('#([\\\\/]+[^\\\\/]+){' . $count . - '}[\\\\/]+([.][.][\\\\/]+){' . $count . '}#u', - DIRECTORY_SEPARATOR, - $path); - } - } + // normalize DIRECTORY_SEPARATOR + $path = str_replace($nds[ DIRECTORY_SEPARATOR ], DIRECTORY_SEPARATOR, $path); + $parts[ 'root' ] = str_replace($nds[ DIRECTORY_SEPARATOR ], DIRECTORY_SEPARATOR, $parts[ 'root' ]); + do { + $path = preg_replace( + array('#[\\\\/]{2}#', '#[\\\\/][.][\\\\/]#', '#[\\\\/]([^\\\\/.]+)[\\\\/][.][.][\\\\/]#'), + DIRECTORY_SEPARATOR, + $path, + -1, + $count + ); + } while ($count > 0); return $realpath !== false ? $parts[ 'root' ] . $path : str_ireplace(getcwd(), '.', $parts[ 'root' ] . $path); } @@ -1279,19 +1337,18 @@ class Smarty extends Smarty_Internal_TemplateBase * Calls the appropriate getter function. * Issues an E_USER_NOTICE if no valid getter is found. * - * @param string $name property name + * @param string $name property name * * @return mixed - * @throws \SmartyException */ public function __get($name) { if (isset($this->accessMap[ $name ])) { $method = 'get' . $this->accessMap[ $name ]; return $this->{$method}(); - } else if (isset($this->_cache[ $name ])) { + } elseif (isset($this->_cache[ $name ])) { return $this->_cache[ $name ]; - } else if (in_array($name, $this->obsoleteProperties)) { + } elseif (in_array($name, $this->obsoleteProperties)) { return null; } else { trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE); @@ -1307,21 +1364,18 @@ class Smarty extends Smarty_Internal_TemplateBase * @param string $name property name * @param mixed $value parameter passed to setter * - * @throws \SmartyException */ public function __set($name, $value) { if (isset($this->accessMap[ $name ])) { $method = 'set' . $this->accessMap[ $name ]; $this->{$method}($value); - } else if (in_array($name, $this->obsoleteProperties)) { + } elseif (in_array($name, $this->obsoleteProperties)) { return; + } elseif (is_object($value) && method_exists($value, $name)) { + $this->$name = $value; } else { - if (is_object($value) && method_exists($value, $name)) { - $this->$name = $value; - } else { - trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE); - } + trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE); } } @@ -1345,7 +1399,6 @@ class Smarty extends Smarty_Internal_TemplateBase * Normalize template_dir or config_dir * * @param bool $isConfig true for config_dir - * */ private function _normalizeTemplateConfig($isConfig) { diff --git a/vendor/smarty/smarty/libs/SmartyBC.class.php b/vendor/smarty/smarty/libs/SmartyBC.class.php index f2230fc9c..836f98153 100644 --- a/vendor/smarty/smarty/libs/SmartyBC.class.php +++ b/vendor/smarty/smarty/libs/SmartyBC.class.php @@ -28,7 +28,7 @@ /** * @ignore */ -require_once(dirname(__FILE__) . '/Smarty.class.php'); +require_once dirname(__FILE__) . '/Smarty.class.php'; /** * Smarty Backward Compatibility Wrapper Class @@ -53,7 +53,6 @@ class SmartyBC extends Smarty /** * Initialize new SmartyBC object - * */ public function __construct() { @@ -127,12 +126,16 @@ class SmartyBC extends Smarty * @param boolean $smarty_args smarty argument format, else traditional * @param array $block_methods list of methods that are block format * - * @throws SmartyException + * @throws SmartyException * @internal param array $block_functs list of methods that are block format */ - public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true, - $block_methods = array()) - { + public function register_object( + $object, + $object_impl, + $allowed = array(), + $smarty_args = true, + $block_methods = array() + ) { settype($allowed, 'array'); settype($smarty_args, 'boolean'); $this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods); @@ -326,10 +329,10 @@ class SmartyBC extends Smarty /** * clear cached content for the given template and cache id * - * @param string $tpl_file name of template file - * @param string $cache_id name of cache_id - * @param string $compile_id name of compile_id - * @param string $exp_time expiration time + * @param string $tpl_file name of template file + * @param string $cache_id name of cache_id + * @param string $compile_id name of compile_id + * @param string $exp_time expiration time * * @return boolean */ @@ -341,7 +344,7 @@ class SmartyBC extends Smarty /** * clear the entire contents of cache (all templates) * - * @param string $exp_time expire time + * @param string $exp_time expire time * * @return boolean */ @@ -353,9 +356,9 @@ class SmartyBC extends Smarty /** * test to see if valid cache exists for this template * - * @param string $tpl_file name of template file - * @param string $cache_id - * @param string $compile_id + * @param string $tpl_file name of template file + * @param string $cache_id + * @param string $compile_id * * @return bool * @throws \Exception @@ -379,9 +382,9 @@ class SmartyBC extends Smarty * or all compiled template files if one is not specified. * This function is for advanced use only, not normally needed. * - * @param string $tpl_file - * @param string $compile_id - * @param string $exp_time + * @param string $tpl_file + * @param string $compile_id + * @param string $exp_time * * @return boolean results of {@link smarty_core_rm_auto()} */ @@ -393,7 +396,7 @@ class SmartyBC extends Smarty /** * Checks whether requested template exists. * - * @param string $tpl_file + * @param string $tpl_file * * @return bool * @throws \SmartyException @@ -406,7 +409,7 @@ class SmartyBC extends Smarty /** * Returns an array containing template variables * - * @param string $name + * @param string $name * * @return array */ @@ -418,7 +421,7 @@ class SmartyBC extends Smarty /** * Returns an array containing config variables * - * @param string $name + * @param string $name * * @return array */ @@ -442,7 +445,7 @@ class SmartyBC extends Smarty /** * return a reference to a registered object * - * @param string $name + * @param string $name * * @return object */ diff --git a/vendor/smarty/smarty/libs/bootstrap.php b/vendor/smarty/smarty/libs/bootstrap.php index dad72fcb1..2c830468e 100644 --- a/vendor/smarty/smarty/libs/bootstrap.php +++ b/vendor/smarty/smarty/libs/bootstrap.php @@ -1,5 +1,5 @@ <?php -/* +/** * This file is part of the Smarty package. * * (c) Sebastian Bergmann <sebastian@phpunit.de> @@ -7,11 +7,10 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ - -/* +/** * Load and register Smarty Autoloader */ if (!class_exists('Smarty_Autoloader')) { - require dirname(__FILE__) . '/Autoloader.php'; + include dirname(__FILE__) . '/Autoloader.php'; } Smarty_Autoloader::register(true); diff --git a/vendor/smarty/smarty/libs/debug.tpl b/vendor/smarty/smarty/libs/debug.tpl index 5526cbca8..edc7bef98 100644 --- a/vendor/smarty/smarty/libs/debug.tpl +++ b/vendor/smarty/smarty/libs/debug.tpl @@ -113,10 +113,10 @@ <div> {foreach $template_data as $template} <font color=brown>{$template.name}</font> - <br> <span class="exectime"> + <br /> <span class="exectime"> (compile {$template['compile_time']|string_format:"%.5f"}) (render {$template['render_time']|string_format:"%.5f"}) (cache {$template['cache_time']|string_format:"%.5f"}) </span> - <br> + <br /> {/foreach} </div> {/if} @@ -127,7 +127,7 @@ {foreach $assigned_vars as $vars} <tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}"> <td><h3><font color=blue>${$vars@key}</font></h3> - {if isset($vars['nocache'])}<b>Nocache</b></br>{/if} + {if isset($vars['nocache'])}<b>Nocache</b><br />{/if} {if isset($vars['scope'])}<b>Origin:</b> {$vars['scope']|debug_print_var nofilter}{/if} </td> <td><h3>Value</h3>{$vars['value']|debug_print_var:10:80 nofilter}</td> diff --git a/vendor/smarty/smarty/libs/plugins/block.textformat.php b/vendor/smarty/smarty/libs/plugins/block.textformat.php index 310a420ee..5e494637e 100644 --- a/vendor/smarty/smarty/libs/plugins/block.textformat.php +++ b/vendor/smarty/smarty/libs/plugins/block.textformat.php @@ -20,7 +20,6 @@ * - indent_char - string (" ") * - wrap_boundary - boolean (true) * - * * @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat} * (Smarty online manual) * @@ -39,10 +38,15 @@ function smarty_block_textformat($params, $content, Smarty_Internal_Template $te return; } if (Smarty::$_MBSTRING) { - $template->_checkPlugins(array(array('function' => 'smarty_modifier_mb_wordwrap', - 'file' => SMARTY_PLUGINS_DIR . 'modifier.mb_wordwrap.php'))); + $template->_checkPlugins( + array( + array( + 'function' => 'smarty_modifier_mb_wordwrap', + 'file' => SMARTY_PLUGINS_DIR . 'modifier.mb_wordwrap.php' + ) + ) + ); } - $style = null; $indent = 0; $indent_first = 0; @@ -51,47 +55,48 @@ function smarty_block_textformat($params, $content, Smarty_Internal_Template $te $wrap_char = "\n"; $wrap_cut = false; $assign = null; - foreach ($params as $_key => $_val) { switch ($_key) { case 'style': case 'indent_char': case 'wrap_char': case 'assign': - $$_key = (string) $_val; + $$_key = (string)$_val; break; - case 'indent': case 'indent_first': case 'wrap': - $$_key = (int) $_val; + $$_key = (int)$_val; break; - case 'wrap_cut': - $$_key = (bool) $_val; + $$_key = (bool)$_val; break; - default: trigger_error("textformat: unknown attribute '{$_key}'"); } } - if ($style === 'email') { $wrap = 72; } // split into paragraphs $_paragraphs = preg_split('![\r\n]{2}!', $content); - foreach ($_paragraphs as &$_paragraph) { if (!$_paragraph) { continue; } // convert mult. spaces & special chars to single space $_paragraph = - preg_replace(array('!\s+!' . Smarty::$_UTF8_MODIFIER, - '!(^\s+)|(\s+$)!' . Smarty::$_UTF8_MODIFIER), - array(' ', - ''), $_paragraph); + preg_replace( + array( + '!\s+!' . Smarty::$_UTF8_MODIFIER, + '!(^\s+)|(\s+$)!' . Smarty::$_UTF8_MODIFIER + ), + array( + ' ', + '' + ), + $_paragraph + ); // indent first line if ($indent_first > 0) { $_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph; @@ -108,7 +113,6 @@ function smarty_block_textformat($params, $content, Smarty_Internal_Template $te } } $_output = implode($wrap_char . $wrap_char, $_paragraphs); - if ($assign) { $template->assign($assign, $_output); } else { diff --git a/vendor/smarty/smarty/libs/plugins/function.counter.php b/vendor/smarty/smarty/libs/plugins/function.counter.php index 9610362d9..a4129e77c 100644 --- a/vendor/smarty/smarty/libs/plugins/function.counter.php +++ b/vendor/smarty/smarty/libs/plugins/function.counter.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsFunction */ - /** * Smarty {counter} function plugin * Type: function @@ -24,50 +23,40 @@ function smarty_function_counter($params, $template) { static $counters = array(); - $name = (isset($params[ 'name' ])) ? $params[ 'name' ] : 'default'; if (!isset($counters[ $name ])) { $counters[ $name ] = array('start' => 1, 'skip' => 1, 'direction' => 'up', 'count' => 1); } $counter =& $counters[ $name ]; - if (isset($params[ 'start' ])) { - $counter[ 'start' ] = $counter[ 'count' ] = (int) $params[ 'start' ]; + $counter[ 'start' ] = $counter[ 'count' ] = (int)$params[ 'start' ]; } - if (!empty($params[ 'assign' ])) { $counter[ 'assign' ] = $params[ 'assign' ]; } - if (isset($counter[ 'assign' ])) { $template->assign($counter[ 'assign' ], $counter[ 'count' ]); } - if (isset($params[ 'print' ])) { - $print = (bool) $params[ 'print' ]; + $print = (bool)$params[ 'print' ]; } else { $print = empty($counter[ 'assign' ]); } - if ($print) { $retval = $counter[ 'count' ]; } else { $retval = null; } - if (isset($params[ 'skip' ])) { $counter[ 'skip' ] = $params[ 'skip' ]; } - if (isset($params[ 'direction' ])) { $counter[ 'direction' ] = $params[ 'direction' ]; } - if ($counter[ 'direction' ] === 'down') { $counter[ 'count' ] -= $counter[ 'skip' ]; } else { $counter[ 'count' ] += $counter[ 'skip' ]; } - return $retval; } diff --git a/vendor/smarty/smarty/libs/plugins/function.cycle.php b/vendor/smarty/smarty/libs/plugins/function.cycle.php index b871524fc..07ffcc5e2 100644 --- a/vendor/smarty/smarty/libs/plugins/function.cycle.php +++ b/vendor/smarty/smarty/libs/plugins/function.cycle.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsFunction */ - /** * Smarty {cycle} function plugin * Type: function @@ -29,34 +28,29 @@ * {cycle name=row values="one,two,three" reset=true} * {cycle name=row} * - * - * @link http://www.smarty.net/manual/en/language.function.cycle.php {cycle} + * @link http://www.smarty.net/manual/en/language.function.cycle.php {cycle} * (Smarty online manual) - * @author Monte Ohrt <monte at ohrt dot com> - * @author credit to Mark Priatel <mpriatel@rogers.com> - * @author credit to Gerard <gerard@interfold.com> - * @author credit to Jason Sweat <jsweat_php@yahoo.com> - * @version 1.3 + * @author Monte Ohrt <monte at ohrt dot com> + * @author credit to Mark Priatel <mpriatel@rogers.com> + * @author credit to Gerard <gerard@interfold.com> + * @author credit to Jason Sweat <jsweat_php@yahoo.com> + * @version 1.3 * * @param array $params parameters * @param Smarty_Internal_Template $template template object * * @return string|null */ - function smarty_function_cycle($params, $template) { static $cycle_vars; - $name = (empty($params[ 'name' ])) ? 'default' : $params[ 'name' ]; - $print = (isset($params[ 'print' ])) ? (bool) $params[ 'print' ] : true; - $advance = (isset($params[ 'advance' ])) ? (bool) $params[ 'advance' ] : true; - $reset = (isset($params[ 'reset' ])) ? (bool) $params[ 'reset' ] : false; - + $print = (isset($params[ 'print' ])) ? (bool)$params[ 'print' ] : true; + $advance = (isset($params[ 'advance' ])) ? (bool)$params[ 'advance' ] : true; + $reset = (isset($params[ 'reset' ])) ? (bool)$params[ 'reset' ] : false; if (!isset($params[ 'values' ])) { if (!isset($cycle_vars[ $name ][ 'values' ])) { trigger_error('cycle: missing \'values\' parameter'); - return; } } else { @@ -65,41 +59,34 @@ function smarty_function_cycle($params, $template) } $cycle_vars[ $name ][ 'values' ] = $params[ 'values' ]; } - if (isset($params[ 'delimiter' ])) { $cycle_vars[ $name ][ 'delimiter' ] = $params[ 'delimiter' ]; } elseif (!isset($cycle_vars[ $name ][ 'delimiter' ])) { $cycle_vars[ $name ][ 'delimiter' ] = ','; } - if (is_array($cycle_vars[ $name ][ 'values' ])) { $cycle_array = $cycle_vars[ $name ][ 'values' ]; } else { $cycle_array = explode($cycle_vars[ $name ][ 'delimiter' ], $cycle_vars[ $name ][ 'values' ]); } - if (!isset($cycle_vars[ $name ][ 'index' ]) || $reset) { $cycle_vars[ $name ][ 'index' ] = 0; } - if (isset($params[ 'assign' ])) { $print = false; $template->assign($params[ 'assign' ], $cycle_array[ $cycle_vars[ $name ][ 'index' ] ]); } - if ($print) { $retval = $cycle_array[ $cycle_vars[ $name ][ 'index' ] ]; } else { $retval = null; } - if ($advance) { if ($cycle_vars[ $name ][ 'index' ] >= count($cycle_array) - 1) { $cycle_vars[ $name ][ 'index' ] = 0; } else { - $cycle_vars[ $name ][ 'index' ] ++; + $cycle_vars[ $name ][ 'index' ]++; } } - return $retval; } diff --git a/vendor/smarty/smarty/libs/plugins/function.fetch.php b/vendor/smarty/smarty/libs/plugins/function.fetch.php index 9539e1fcc..768761b23 100644 --- a/vendor/smarty/smarty/libs/plugins/function.fetch.php +++ b/vendor/smarty/smarty/libs/plugins/function.fetch.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsFunction */ - /** * Smarty {fetch} plugin * Type: function @@ -26,20 +25,16 @@ function smarty_function_fetch($params, $template) { if (empty($params[ 'file' ])) { trigger_error('[plugin] fetch parameter \'file\' cannot be empty', E_USER_NOTICE); - return; } - // strip file protocol if (stripos($params[ 'file' ], 'file://') === 0) { $params[ 'file' ] = substr($params[ 'file' ], 7); } - $protocol = strpos($params[ 'file' ], '://'); if ($protocol !== false) { $protocol = strtolower(substr($params[ 'file' ], 0, $protocol)); } - if (isset($template->smarty->security_policy)) { if ($protocol) { // remote resource (or php stream, …) @@ -53,7 +48,6 @@ function smarty_function_fetch($params, $template) } } } - $content = ''; if ($protocol === 'http') { // http fetch @@ -104,7 +98,6 @@ function smarty_function_fetch($params, $template) if (!empty($param_value)) { if (!preg_match('![\w\d-]+: .+!', $param_value)) { trigger_error("[plugin] invalid header format '{$param_value}'", E_USER_NOTICE); - return; } else { $extra_headers[] = $param_value; @@ -118,10 +111,9 @@ function smarty_function_fetch($params, $template) break; case 'proxy_port': if (!preg_match('!\D!', $param_value)) { - $proxy_port = (int) $param_value; + $proxy_port = (int)$param_value; } else { trigger_error("[plugin] invalid value for attribute '{$param_key }'", E_USER_NOTICE); - return; } break; @@ -137,16 +129,14 @@ function smarty_function_fetch($params, $template) break; case 'timeout': if (!preg_match('!\D!', $param_value)) { - $timeout = (int) $param_value; + $timeout = (int)$param_value; } else { trigger_error("[plugin] invalid value for attribute '{$param_key}'", E_USER_NOTICE); - return; } break; default: trigger_error("[plugin] unrecognized attribute '{$param_key}'", E_USER_NOTICE); - return; } } @@ -156,10 +146,8 @@ function smarty_function_fetch($params, $template) } else { $fp = fsockopen($server_name, $port, $errno, $errstr, $timeout); } - if (!$fp) { trigger_error("[plugin] unable to fetch: $errstr ($errno)", E_USER_NOTICE); - return; } else { if ($_is_proxy) { @@ -187,23 +175,19 @@ function smarty_function_fetch($params, $template) if (!empty($user) && !empty($pass)) { fputs($fp, 'Authorization: BASIC ' . base64_encode("$user:$pass") . "\r\n"); } - fputs($fp, "\r\n"); while (!feof($fp)) { $content .= fgets($fp, 4096); } fclose($fp); $csplit = preg_split("!\r\n\r\n!", $content, 2); - $content = $csplit[ 1 ]; - if (!empty($params[ 'assign_headers' ])) { $template->assign($params[ 'assign_headers' ], preg_split("!\r\n!", $csplit[ 0 ])); } } } else { trigger_error("[plugin fetch] unable to parse URL, check syntax", E_USER_NOTICE); - return; } } else { @@ -212,7 +196,6 @@ function smarty_function_fetch($params, $template) throw new SmartyException("{fetch} cannot read resource '" . $params[ 'file' ] . "'"); } } - if (!empty($params[ 'assign' ])) { $template->assign($params[ 'assign' ], $content); } else { diff --git a/vendor/smarty/smarty/libs/plugins/function.html_checkboxes.php b/vendor/smarty/smarty/libs/plugins/function.html_checkboxes.php index d654caba6..302358edd 100644 --- a/vendor/smarty/smarty/libs/plugins/function.html_checkboxes.php +++ b/vendor/smarty/smarty/libs/plugins/function.html_checkboxes.php @@ -29,25 +29,29 @@ * - assign (optional) - assign the output as an array to this variable * - escape (optional) - escape the content (not value), defaults to true * - * - * @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes} + * @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes} * (Smarty online manual) - * @author Christopher Kvarme <christopher.kvarme@flashjab.com> - * @author credits to Monte Ohrt <monte at ohrt dot com> - * @version 1.0 + * @author Christopher Kvarme <christopher.kvarme@flashjab.com> + * @author credits to Monte Ohrt <monte at ohrt dot com> + * @version 1.0 * * @param array $params parameters * @param Smarty_Internal_Template $template template object * * @return string - * @uses smarty_function_escape_special_chars() + * @uses smarty_function_escape_special_chars() * @throws \SmartyException */ function smarty_function_html_checkboxes($params, Smarty_Internal_Template $template) { - $template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars', - 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))); - + $template->_checkPlugins( + array( + array( + 'function' => 'smarty_function_escape_special_chars', + 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php' + ) + ) + ); $name = 'checkbox'; $values = null; $options = null; @@ -57,31 +61,25 @@ function smarty_function_html_checkboxes($params, Smarty_Internal_Template $temp $labels = true; $label_ids = false; $output = null; - $extra = ''; - foreach ($params as $_key => $_val) { switch ($_key) { case 'name': case 'separator': - $$_key = (string) $_val; + $$_key = (string)$_val; break; - case 'escape': case 'labels': case 'label_ids': - $$_key = (bool) $_val; + $$_key = (bool)$_val; break; - case 'options': - $$_key = (array) $_val; + $$_key = (array)$_val; break; - case 'values': case 'output': - $$_key = array_values((array) $_val); + $$_key = array_values((array)$_val); break; - case 'checked': case 'selected': if (is_array($_val)) { @@ -89,57 +87,61 @@ function smarty_function_html_checkboxes($params, Smarty_Internal_Template $temp foreach ($_val as $_sel) { if (is_object($_sel)) { if (method_exists($_sel, '__toString')) { - $_sel = smarty_function_escape_special_chars((string) $_sel->__toString()); + $_sel = smarty_function_escape_special_chars((string)$_sel->__toString()); } else { - trigger_error('html_checkboxes: selected attribute contains an object of class \'' . - get_class($_sel) . '\' without __toString() method', E_USER_NOTICE); + trigger_error( + 'html_checkboxes: selected attribute contains an object of class \'' . + get_class($_sel) . '\' without __toString() method', + E_USER_NOTICE + ); continue; } } else { - $_sel = smarty_function_escape_special_chars((string) $_sel); + $_sel = smarty_function_escape_special_chars((string)$_sel); } $selected[ $_sel ] = true; } } elseif (is_object($_val)) { if (method_exists($_val, '__toString')) { - $selected = smarty_function_escape_special_chars((string) $_val->__toString()); + $selected = smarty_function_escape_special_chars((string)$_val->__toString()); } else { - trigger_error('html_checkboxes: selected attribute is an object of class \'' . get_class($_val) . - '\' without __toString() method', E_USER_NOTICE); + trigger_error( + 'html_checkboxes: selected attribute is an object of class \'' . get_class($_val) . + '\' without __toString() method', + E_USER_NOTICE + ); } } else { - $selected = smarty_function_escape_special_chars((string) $_val); + $selected = smarty_function_escape_special_chars((string)$_val); } break; - case 'checkboxes': - trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', - E_USER_WARNING); - $options = (array) $_val; + trigger_error( + 'html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', + E_USER_WARNING + ); + $options = (array)$_val; break; - case 'assign': break; - case 'strict': break; - case 'disabled': case 'readonly': if (!empty($params[ 'strict' ])) { if (!is_scalar($_val)) { - trigger_error("html_options: {$_key} attribute must be a scalar, only boolean true or string '{$_key}' will actually add the attribute", - E_USER_NOTICE); + trigger_error( + "html_options: {$_key} attribute must be a scalar, only boolean true or string '{$_key}' will actually add the attribute", + E_USER_NOTICE + ); } - if ($_val === true || $_val === $_key) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; } - break; } // omit break; to fall through! - + // no break default: if (!is_array($_val)) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; @@ -149,34 +151,49 @@ function smarty_function_html_checkboxes($params, Smarty_Internal_Template $temp break; } } - if (!isset($options) && !isset($values)) { return ''; } /* raise error here? */ - $_html_result = array(); - if (isset($options)) { foreach ($options as $_key => $_val) { $_html_result[] = - smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, - $label_ids, $escape); + smarty_function_html_checkboxes_output( + $name, + $_key, + $_val, + $selected, + $extra, + $separator, + $labels, + $label_ids, + $escape + ); } } else { foreach ($values as $_i => $_key) { $_val = isset($output[ $_i ]) ? $output[ $_i ] : ''; $_html_result[] = - smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, - $label_ids, $escape); + smarty_function_html_checkboxes_output( + $name, + $_key, + $_val, + $selected, + $extra, + $separator, + $labels, + $label_ids, + $escape + ); } } - if (!empty($params[ 'assign' ])) { $template->assign($params[ 'assign' ], $_html_result); } else { return implode("\n", $_html_result); } } + /** * @param $name * @param $value @@ -190,59 +207,69 @@ function smarty_function_html_checkboxes($params, Smarty_Internal_Template $temp * * @return string */ -function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, - $label_ids, $escape = true) -{ +function smarty_function_html_checkboxes_output( + $name, + $value, + $output, + $selected, + $extra, + $separator, + $labels, + $label_ids, + $escape = true +) { $_output = ''; - if (is_object($value)) { if (method_exists($value, '__toString')) { - $value = (string) $value->__toString(); + $value = (string)$value->__toString(); } else { - trigger_error('html_options: value is an object of class \'' . get_class($value) . - '\' without __toString() method', E_USER_NOTICE); - + trigger_error( + 'html_options: value is an object of class \'' . get_class($value) . + '\' without __toString() method', + E_USER_NOTICE + ); return ''; } } else { - $value = (string) $value; + $value = (string)$value; } - if (is_object($output)) { if (method_exists($output, '__toString')) { - $output = (string) $output->__toString(); + $output = (string)$output->__toString(); } else { - trigger_error('html_options: output is an object of class \'' . get_class($output) . - '\' without __toString() method', E_USER_NOTICE); - + trigger_error( + 'html_options: output is an object of class \'' . get_class($output) . + '\' without __toString() method', + E_USER_NOTICE + ); return ''; } } else { - $output = (string) $output; + $output = (string)$output; } - if ($labels) { if ($label_ids) { - $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_', - $name . '_' . $value)); + $_id = smarty_function_escape_special_chars( + preg_replace( + '![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, + '_', + $name . '_' . $value + ) + ); $_output .= '<label for="' . $_id . '">'; } else { $_output .= '<label>'; } } - $name = smarty_function_escape_special_chars($name); $value = smarty_function_escape_special_chars($value); if ($escape) { $output = smarty_function_escape_special_chars($output); } - $_output .= '<input type="checkbox" name="' . $name . '[]" value="' . $value . '"'; - if ($labels && $label_ids) { $_output .= ' id="' . $_id . '"'; } - if (is_array($selected)) { if (isset($selected[ $value ])) { $_output .= ' checked="checked"'; @@ -250,13 +277,10 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte } elseif ($value === $selected) { $_output .= ' checked="checked"'; } - $_output .= $extra . ' />' . $output; if ($labels) { $_output .= '</label>'; } - $_output .= $separator; - return $_output; } diff --git a/vendor/smarty/smarty/libs/plugins/function.html_image.php b/vendor/smarty/smarty/libs/plugins/function.html_image.php index 4fda72eef..ad468e4f1 100644 --- a/vendor/smarty/smarty/libs/plugins/function.html_image.php +++ b/vendor/smarty/smarty/libs/plugins/function.html_image.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsFunction */ - /** * Smarty {html_image} function plugin * Type: function @@ -22,7 +21,6 @@ * - basedir - (optional) - base directory for absolute paths, default is environment variable DOCUMENT_ROOT * - path_prefix - prefix for path output (optional, default empty) * - * * @link http://www.smarty.net/manual/en/language.function.html.image.php {html_image} * (Smarty online manual) * @author Monte Ohrt <monte at ohrt dot com> @@ -38,9 +36,14 @@ */ function smarty_function_html_image($params, Smarty_Internal_Template $template) { - $template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars', - 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))); - + $template->_checkPlugins( + array( + array( + 'function' => 'smarty_function_escape_special_chars', + 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php' + ) + ) + ); $alt = ''; $file = ''; $height = ''; @@ -60,53 +63,50 @@ function smarty_function_html_image($params, Smarty_Internal_Template $template) case 'basedir': $$_key = $_val; break; - case 'alt': if (!is_array($_val)) { $$_key = smarty_function_escape_special_chars($_val); } else { - throw new SmartyException ("html_image: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); + throw new SmartyException( + "html_image: extra attribute '{$_key}' cannot be an array", + E_USER_NOTICE + ); } break; - case 'link': case 'href': $prefix = '<a href="' . $_val . '">'; $suffix = '</a>'; break; - default: if (!is_array($_val)) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; } else { - throw new SmartyException ("html_image: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); + throw new SmartyException( + "html_image: extra attribute '{$_key}' cannot be an array", + E_USER_NOTICE + ); } break; } } - if (empty($file)) { trigger_error('html_image: missing \'file\' parameter', E_USER_NOTICE); - return; } - if ($file[ 0 ] === '/') { $_image_path = $basedir . $file; } else { $_image_path = $file; } - // strip file protocol if (stripos($params[ 'file' ], 'file://') === 0) { $params[ 'file' ] = substr($params[ 'file' ], 7); } - $protocol = strpos($params[ 'file' ], '://'); if ($protocol !== false) { $protocol = strtolower(substr($params[ 'file' ], 0, $protocol)); } - if (isset($template->smarty->security_policy)) { if ($protocol) { // remote resource (or php stream, …) @@ -120,25 +120,20 @@ function smarty_function_html_image($params, Smarty_Internal_Template $template) } } } - if (!isset($params[ 'width' ]) || !isset($params[ 'height' ])) { // FIXME: (rodneyrehm) getimagesize() loads the complete file off a remote resource, use custom [jpg,png,gif]header reader! if (!$_image_data = @getimagesize($_image_path)) { if (!file_exists($_image_path)) { trigger_error("html_image: unable to find '{$_image_path}'", E_USER_NOTICE); - return; } elseif (!is_readable($_image_path)) { trigger_error("html_image: unable to read '{$_image_path}'", E_USER_NOTICE); - return; } else { trigger_error("html_image: '{$_image_path}' is not a valid image file", E_USER_NOTICE); - return; } } - if (!isset($params[ 'width' ])) { $width = $_image_data[ 0 ]; } @@ -146,7 +141,6 @@ function smarty_function_html_image($params, Smarty_Internal_Template $template) $height = $_image_data[ 1 ]; } } - if (isset($params[ 'dpi' ])) { if (strstr($_SERVER[ 'HTTP_USER_AGENT' ], 'Mac')) { // FIXME: (rodneyrehm) wrong dpi assumption @@ -159,7 +153,6 @@ function smarty_function_html_image($params, Smarty_Internal_Template $template) $width = round($width * $_resize); $height = round($height * $_resize); } - return $prefix . '<img src="' . $path_prefix . $file . '" alt="' . $alt . '" width="' . $width . '" height="' . $height . '"' . $extra . ' />' . $suffix; } diff --git a/vendor/smarty/smarty/libs/plugins/function.html_options.php b/vendor/smarty/smarty/libs/plugins/function.html_options.php index b8b986493..6907e8ee1 100644 --- a/vendor/smarty/smarty/libs/plugins/function.html_options.php +++ b/vendor/smarty/smarty/libs/plugins/function.html_options.php @@ -21,25 +21,29 @@ * - id (optional) - string default not set * - class (optional) - string default not set * - * - * @link http://www.smarty.net/manual/en/language.function.html.options.php {html_image} + * @link http://www.smarty.net/manual/en/language.function.html.options.php {html_image} * (Smarty online manual) - * @author Monte Ohrt <monte at ohrt dot com> - * @author Ralf Strehle (minor optimization) <ralf dot strehle at yahoo dot de> + * @author Monte Ohrt <monte at ohrt dot com> + * @author Ralf Strehle (minor optimization) <ralf dot strehle at yahoo dot de> * * @param array $params parameters * * @param \Smarty_Internal_Template $template * * @return string - * @uses smarty_function_escape_special_chars() + * @uses smarty_function_escape_special_chars() * @throws \SmartyException */ function smarty_function_html_options($params, Smarty_Internal_Template $template) { - $template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars', - 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))); - + $template->_checkPlugins( + array( + array( + 'function' => 'smarty_function_escape_special_chars', + 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php' + ) + ) + ); $name = null; $values = null; $options = null; @@ -47,74 +51,73 @@ function smarty_function_html_options($params, Smarty_Internal_Template $templat $output = null; $id = null; $class = null; - $extra = ''; - foreach ($params as $_key => $_val) { switch ($_key) { case 'name': case 'class': case 'id': - $$_key = (string) $_val; + $$_key = (string)$_val; break; - case 'options': - $options = (array) $_val; + $options = (array)$_val; break; - case 'values': case 'output': - $$_key = array_values((array) $_val); + $$_key = array_values((array)$_val); break; - case 'selected': if (is_array($_val)) { $selected = array(); foreach ($_val as $_sel) { if (is_object($_sel)) { if (method_exists($_sel, '__toString')) { - $_sel = smarty_function_escape_special_chars((string) $_sel->__toString()); + $_sel = smarty_function_escape_special_chars((string)$_sel->__toString()); } else { - trigger_error('html_options: selected attribute contains an object of class \'' . - get_class($_sel) . '\' without __toString() method', E_USER_NOTICE); + trigger_error( + 'html_options: selected attribute contains an object of class \'' . + get_class($_sel) . '\' without __toString() method', + E_USER_NOTICE + ); continue; } } else { - $_sel = smarty_function_escape_special_chars((string) $_sel); + $_sel = smarty_function_escape_special_chars((string)$_sel); } $selected[ $_sel ] = true; } } elseif (is_object($_val)) { if (method_exists($_val, '__toString')) { - $selected = smarty_function_escape_special_chars((string) $_val->__toString()); + $selected = smarty_function_escape_special_chars((string)$_val->__toString()); } else { - trigger_error('html_options: selected attribute is an object of class \'' . get_class($_val) . - '\' without __toString() method', E_USER_NOTICE); + trigger_error( + 'html_options: selected attribute is an object of class \'' . get_class($_val) . + '\' without __toString() method', + E_USER_NOTICE + ); } } else { - $selected = smarty_function_escape_special_chars((string) $_val); + $selected = smarty_function_escape_special_chars((string)$_val); } break; - case 'strict': break; - case 'disabled': case 'readonly': if (!empty($params[ 'strict' ])) { if (!is_scalar($_val)) { - trigger_error("html_options: {$_key} attribute must be a scalar, only boolean true or string '{$_key}' will actually add the attribute", - E_USER_NOTICE); + trigger_error( + "html_options: {$_key} attribute must be a scalar, only boolean true or string '{$_key}' will actually add the attribute", + E_USER_NOTICE + ); } - if ($_val === true || $_val === $_key) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; } - break; } // omit break; to fall through! - + // no break default: if (!is_array($_val)) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; @@ -124,16 +127,12 @@ function smarty_function_html_options($params, Smarty_Internal_Template $templat break; } } - if (!isset($options) && !isset($values)) { /* raise error here? */ - return ''; } - $_html_result = ''; $_idx = 0; - if (isset($options)) { foreach ($options as $_key => $_val) { $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected, $id, $class, $_idx); @@ -144,7 +143,6 @@ function smarty_function_html_options($params, Smarty_Internal_Template $templat $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected, $id, $class, $_idx); } } - if (!empty($name)) { $_html_class = !empty($class) ? ' class="' . $class . '"' : ''; $_html_id = !empty($id) ? ' id="' . $id . '"' : ''; @@ -152,9 +150,9 @@ function smarty_function_html_options($params, Smarty_Internal_Template $templat '<select name="' . $name . '"' . $_html_class . $_html_id . $extra . '>' . "\n" . $_html_result . '</select>' . "\n"; } - return $_html_result; } + /** * @param $key * @param $value @@ -181,28 +179,36 @@ function smarty_function_html_options_optoutput($key, $value, $selected, $id, $c $_html_id = !empty($id) ? ' id="' . $id . '-' . $idx . '"' : ''; if (is_object($value)) { if (method_exists($value, '__toString')) { - $value = smarty_function_escape_special_chars((string) $value->__toString()); + $value = smarty_function_escape_special_chars((string)$value->__toString()); } else { - trigger_error('html_options: value is an object of class \'' . get_class($value) . - '\' without __toString() method', E_USER_NOTICE); - + trigger_error( + 'html_options: value is an object of class \'' . get_class($value) . + '\' without __toString() method', + E_USER_NOTICE + ); return ''; } } else { - $value = smarty_function_escape_special_chars((string) $value); + $value = smarty_function_escape_special_chars((string)$value); } $_html_result .= $_html_class . $_html_id . '>' . $value . '</option>' . "\n"; - $idx ++; + $idx++; } else { $_idx = 0; $_html_result = - smarty_function_html_options_optgroup($key, $value, $selected, !empty($id) ? ($id . '-' . $idx) : null, - $class, $_idx); - $idx ++; + smarty_function_html_options_optgroup( + $key, + $value, + $selected, + !empty($id) ? ($id . '-' . $idx) : null, + $class, + $_idx + ); + $idx++; } - return $_html_result; } + /** * @param $key * @param $values @@ -220,6 +226,5 @@ function smarty_function_html_options_optgroup($key, $values, $selected, $id, $c $optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, $idx); } $optgroup_html .= "</optgroup>\n"; - return $optgroup_html; } diff --git a/vendor/smarty/smarty/libs/plugins/function.html_radios.php b/vendor/smarty/smarty/libs/plugins/function.html_radios.php index 37feec63e..5e834587c 100644 --- a/vendor/smarty/smarty/libs/plugins/function.html_radios.php +++ b/vendor/smarty/smarty/libs/plugins/function.html_radios.php @@ -29,7 +29,6 @@ * {html_radios values=$ids name='box' separator='<br>' output=$names} * {html_radios values=$ids checked=$checked separator='<br>' output=$names} * - * * @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios} * (Smarty online manual) * @author Christopher Kvarme <christopher.kvarme@flashjab.com> @@ -45,9 +44,14 @@ */ function smarty_function_html_radios($params, Smarty_Internal_Template $template) { - $template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars', - 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))); - + $template->_checkPlugins( + array( + array( + 'function' => 'smarty_function_escape_special_chars', + 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php' + ) + ) + ); $name = 'radio'; $values = null; $options = null; @@ -58,73 +62,69 @@ function smarty_function_html_radios($params, Smarty_Internal_Template $template $label_ids = false; $output = null; $extra = ''; - foreach ($params as $_key => $_val) { switch ($_key) { case 'name': case 'separator': - $$_key = (string) $_val; + $$_key = (string)$_val; break; - case 'checked': case 'selected': if (is_array($_val)) { trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING); } elseif (is_object($_val)) { if (method_exists($_val, '__toString')) { - $selected = smarty_function_escape_special_chars((string) $_val->__toString()); + $selected = smarty_function_escape_special_chars((string)$_val->__toString()); } else { - trigger_error('html_radios: selected attribute is an object of class \'' . get_class($_val) . - '\' without __toString() method', E_USER_NOTICE); + trigger_error( + 'html_radios: selected attribute is an object of class \'' . get_class($_val) . + '\' without __toString() method', + E_USER_NOTICE + ); } } else { - $selected = (string) $_val; + $selected = (string)$_val; } break; - case 'escape': case 'labels': case 'label_ids': - $$_key = (bool) $_val; + $$_key = (bool)$_val; break; - case 'options': - $$_key = (array) $_val; + $$_key = (array)$_val; break; - case 'values': case 'output': - $$_key = array_values((array) $_val); + $$_key = array_values((array)$_val); break; - case 'radios': - trigger_error('html_radios: the use of the "radios" attribute is deprecated, use "options" instead', - E_USER_WARNING); - $options = (array) $_val; + trigger_error( + 'html_radios: the use of the "radios" attribute is deprecated, use "options" instead', + E_USER_WARNING + ); + $options = (array)$_val; break; - case 'assign': break; - case 'strict': break; - case 'disabled': case 'readonly': if (!empty($params[ 'strict' ])) { if (!is_scalar($_val)) { - trigger_error("html_options: {$_key} attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", - E_USER_NOTICE); + trigger_error( + "html_options: {$_key} attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", + E_USER_NOTICE + ); } - if ($_val === true || $_val === $_key) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; } - break; } // omit break; to fall through! - + // no break default: if (!is_array($_val)) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; @@ -134,36 +134,50 @@ function smarty_function_html_radios($params, Smarty_Internal_Template $template break; } } - if (!isset($options) && !isset($values)) { /* raise error here? */ - return ''; } - $_html_result = array(); - if (isset($options)) { foreach ($options as $_key => $_val) { $_html_result[] = - smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, - $label_ids, $escape); + smarty_function_html_radios_output( + $name, + $_key, + $_val, + $selected, + $extra, + $separator, + $labels, + $label_ids, + $escape + ); } } else { foreach ($values as $_i => $_key) { $_val = isset($output[ $_i ]) ? $output[ $_i ] : ''; $_html_result[] = - smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, - $label_ids, $escape); + smarty_function_html_radios_output( + $name, + $_key, + $_val, + $selected, + $extra, + $separator, + $labels, + $label_ids, + $escape + ); } } - if (!empty($params[ 'assign' ])) { $template->assign($params[ 'assign' ], $_html_result); } else { return implode("\n", $_html_result); } } + /** * @param $name * @param $value @@ -177,69 +191,76 @@ function smarty_function_html_radios($params, Smarty_Internal_Template $template * * @return string */ -function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, - $escape) -{ +function smarty_function_html_radios_output( + $name, + $value, + $output, + $selected, + $extra, + $separator, + $labels, + $label_ids, + $escape +) { $_output = ''; - if (is_object($value)) { if (method_exists($value, '__toString')) { - $value = (string) $value->__toString(); + $value = (string)$value->__toString(); } else { - trigger_error('html_options: value is an object of class \'' . get_class($value) . - '\' without __toString() method', E_USER_NOTICE); - + trigger_error( + 'html_options: value is an object of class \'' . get_class($value) . + '\' without __toString() method', + E_USER_NOTICE + ); return ''; } } else { - $value = (string) $value; + $value = (string)$value; } - if (is_object($output)) { if (method_exists($output, '__toString')) { - $output = (string) $output->__toString(); + $output = (string)$output->__toString(); } else { - trigger_error('html_options: output is an object of class \'' . get_class($output) . - '\' without __toString() method', E_USER_NOTICE); - + trigger_error( + 'html_options: output is an object of class \'' . get_class($output) . + '\' without __toString() method', + E_USER_NOTICE + ); return ''; } } else { - $output = (string) $output; + $output = (string)$output; } - if ($labels) { if ($label_ids) { - $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_', - $name . '_' . $value)); + $_id = smarty_function_escape_special_chars( + preg_replace( + '![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, + '_', + $name . '_' . $value + ) + ); $_output .= '<label for="' . $_id . '">'; } else { $_output .= '<label>'; } } - $name = smarty_function_escape_special_chars($name); $value = smarty_function_escape_special_chars($value); if ($escape) { $output = smarty_function_escape_special_chars($output); } - $_output .= '<input type="radio" name="' . $name . '" value="' . $value . '"'; - if ($labels && $label_ids) { $_output .= ' id="' . $_id . '"'; } - if ($value === $selected) { $_output .= ' checked="checked"'; } - $_output .= $extra . ' />' . $output; if ($labels) { $_output .= '</label>'; } - $_output .= $separator; - return $_output; } diff --git a/vendor/smarty/smarty/libs/plugins/function.html_select_date.php b/vendor/smarty/smarty/libs/plugins/function.html_select_date.php index 1d63800e1..86403e3dc 100644 --- a/vendor/smarty/smarty/libs/plugins/function.html_select_date.php +++ b/vendor/smarty/smarty/libs/plugins/function.html_select_date.php @@ -28,13 +28,12 @@ * - 2.0 complete rewrite for performance, * added attributes month_names, *_id * - * - * @link http://www.smarty.net/manual/en/language.function.html.select.date.php {html_select_date} + * @link http://www.smarty.net/manual/en/language.function.html.select.date.php {html_select_date} * (Smarty online manual) - * @version 2.0 - * @author Andrei Zmievski - * @author Monte Ohrt <monte at ohrt dot com> - * @author Rodney Rehm + * @version 2.0 + * @author Andrei Zmievski + * @author Monte Ohrt <monte at ohrt dot com> + * @author Rodney Rehm * * @param array $params parameters * @@ -45,19 +44,24 @@ */ function smarty_function_html_select_date($params, Smarty_Internal_Template $template) { - $template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars', - 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))); + $template->_checkPlugins( + array( + array( + 'function' => 'smarty_function_escape_special_chars', + 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php' + ) + ) + ); // generate timestamps used for month names only static $_month_timestamps = null; static $_current_year = null; if ($_month_timestamps === null) { $_current_year = date('Y'); $_month_timestamps = array(); - for ($i = 1; $i <= 12; $i ++) { + for ($i = 1; $i <= 12; $i++) { $_month_timestamps[ $i ] = mktime(0, 0, 0, $i, 1, 2000); } } - /* Default values. */ $prefix = 'Date_'; $start_year = null; @@ -106,17 +110,21 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem $day_id = null; $month_id = null; $year_id = null; - foreach ($params as $_key => $_value) { switch ($_key) { case 'time': if (!is_array($_value) && $_value !== null) { - $template->_checkPlugins(array(array('function' => 'smarty_make_timestamp', - 'file' => SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'))); + $template->_checkPlugins( + array( + array( + 'function' => 'smarty_make_timestamp', + 'file' => SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php' + ) + ) + ); $time = smarty_make_timestamp($_value); } break; - case 'month_names': if (is_array($_value) && count($_value) === 12) { $$_key = $_value; @@ -124,7 +132,6 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem trigger_error('html_select_date: month_names must be an array of 12 strings', E_USER_NOTICE); } break; - case 'prefix': case 'field_array': case 'start_year': @@ -151,17 +158,15 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem case 'month_id': case 'day_id': case 'year_id': - $$_key = (string) $_value; + $$_key = (string)$_value; break; - case 'display_days': case 'display_months': case 'display_years': case 'year_as_text': case 'reverse_years': - $$_key = (bool) $_value; + $$_key = (bool)$_value; break; - default: if (!is_array($_value)) { $extra_attrs .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_value) . '"'; @@ -171,15 +176,16 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem break; } } - // Note: date() is faster than strftime() // Note: explode(date()) is faster than date() date() date() if (isset($params[ 'time' ]) && is_array($params[ 'time' ])) { if (isset($params[ 'time' ][ $prefix . 'Year' ])) { // $_REQUEST[$field_array] given - foreach (array('Y' => 'Year', - 'm' => 'Month', - 'd' => 'Day') as $_elementKey => $_elementName) { + foreach (array( + 'Y' => 'Year', + 'm' => 'Month', + 'd' => 'Day' + ) as $_elementKey => $_elementName) { $_variableName = '_' . strtolower($_elementName); $$_variableName = isset($params[ 'time' ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $prefix . $_elementName ] : @@ -187,9 +193,11 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem } } elseif (isset($params[ 'time' ][ $field_array ][ $prefix . 'Year' ])) { // $_REQUEST given - foreach (array('Y' => 'Year', - 'm' => 'Month', - 'd' => 'Day') as $_elementKey => $_elementName) { + foreach (array( + 'Y' => 'Year', + 'm' => 'Month', + 'd' => 'Day' + ) as $_elementKey => $_elementName) { $_variableName = '_' . strtolower($_elementName); $$_variableName = isset($params[ 'time' ][ $field_array ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $field_array ][ $prefix . $_elementName ] : date($_elementKey); @@ -207,31 +215,30 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem } else { list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d', $time)); } - // make syntax "+N" or "-N" work with $start_year and $end_year // Note preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match) is slower than trim+substr - foreach (array('start', - 'end') as $key) { + foreach (array( + 'start', + 'end' + ) as $key) { $key .= '_year'; $t = $$key; if ($t === null) { - $$key = (int) $_current_year; + $$key = (int)$_current_year; } elseif ($t[ 0 ] === '+') { - $$key = (int) ($_current_year + (int) trim(substr($t, 1))); + $$key = (int)($_current_year + (int)trim(substr($t, 1))); } elseif ($t[ 0 ] === '-') { - $$key = (int) ($_current_year - (int) trim(substr($t, 1))); + $$key = (int)($_current_year - (int)trim(substr($t, 1))); } else { - $$key = (int) $$key; + $$key = (int)$$key; } } - // flip for ascending or descending if (($start_year > $end_year && !$reverse_years) || ($start_year < $end_year && $reverse_years)) { $t = $end_year; $end_year = $start_year; $start_year = $t; } - // generate year <select> or <input> if ($display_years) { $_extra = ''; @@ -242,7 +249,6 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem if ($year_extra) { $_extra .= ' ' . $year_extra; } - if ($year_as_text) { $_html_years = '<input type="text" name="' . $_name . '" value="' . $_year . '" size="4" maxlength="4"' . $_extra . @@ -250,31 +256,29 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem } else { $_html_years = '<select name="' . $_name . '"'; if ($year_id !== null || $all_id !== null) { - $_html_years .= ' id="' . smarty_function_escape_special_chars($year_id !== null ? - ($year_id ? $year_id : $_name) : - ($all_id ? ($all_id . $_name) : - $_name)) . '"'; + $_html_years .= ' id="' . smarty_function_escape_special_chars( + $year_id !== null ? + ($year_id ? $year_id : $_name) : + ($all_id ? ($all_id . $_name) : + $_name) + ) . '"'; } if ($year_size) { $_html_years .= ' size="' . $year_size . '"'; } $_html_years .= $_extra . $extra_attrs . '>' . $option_separator; - if (isset($year_empty) || isset($all_empty)) { $_html_years .= '<option value="">' . (isset($year_empty) ? $year_empty : $all_empty) . '</option>' . $option_separator; } - - $op = $start_year > $end_year ? - 1 : 1; + $op = $start_year > $end_year ? -1 : 1; for ($i = $start_year; $op > 0 ? $i <= $end_year : $i >= $end_year; $i += $op) { $_html_years .= '<option value="' . $i . '"' . ($_year == $i ? ' selected="selected"' : '') . '>' . $i . '</option>' . $option_separator; } - $_html_years .= '</select>'; } } - // generate month <select> or <input> if ($display_months) { $_extra = ''; @@ -285,25 +289,24 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem if ($month_extra) { $_extra .= ' ' . $month_extra; } - $_html_months = '<select name="' . $_name . '"'; if ($month_id !== null || $all_id !== null) { - $_html_months .= ' id="' . smarty_function_escape_special_chars($month_id !== null ? - ($month_id ? $month_id : $_name) : - ($all_id ? ($all_id . $_name) : - $_name)) . '"'; + $_html_months .= ' id="' . smarty_function_escape_special_chars( + $month_id !== null ? + ($month_id ? $month_id : $_name) : + ($all_id ? ($all_id . $_name) : + $_name) + ) . '"'; } if ($month_size) { $_html_months .= ' size="' . $month_size . '"'; } $_html_months .= $_extra . $extra_attrs . '>' . $option_separator; - if (isset($month_empty) || isset($all_empty)) { $_html_months .= '<option value="">' . (isset($month_empty) ? $month_empty : $all_empty) . '</option>' . $option_separator; } - - for ($i = 1; $i <= 12; $i ++) { + for ($i = 1; $i <= 12; $i++) { $_val = sprintf('%02d', $i); $_text = isset($month_names) ? smarty_function_escape_special_chars($month_names[ $i ]) : ($month_format === '%m' ? $_val : strftime($month_format, $_month_timestamps[ $i ])); @@ -311,10 +314,8 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem $_html_months .= '<option value="' . $_value . '"' . ($_val == $_month ? ' selected="selected"' : '') . '>' . $_text . '</option>' . $option_separator; } - $_html_months .= '</select>'; } - // generate day <select> or <input> if ($display_days) { $_extra = ''; @@ -325,37 +326,34 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem if ($day_extra) { $_extra .= ' ' . $day_extra; } - $_html_days = '<select name="' . $_name . '"'; if ($day_id !== null || $all_id !== null) { $_html_days .= ' id="' . - smarty_function_escape_special_chars($day_id !== null ? ($day_id ? $day_id : $_name) : - ($all_id ? ($all_id . $_name) : $_name)) . '"'; + smarty_function_escape_special_chars( + $day_id !== null ? ($day_id ? $day_id : $_name) : + ($all_id ? ($all_id . $_name) : $_name) + ) . '"'; } if ($day_size) { $_html_days .= ' size="' . $day_size . '"'; } $_html_days .= $_extra . $extra_attrs . '>' . $option_separator; - if (isset($day_empty) || isset($all_empty)) { $_html_days .= '<option value="">' . (isset($day_empty) ? $day_empty : $all_empty) . '</option>' . $option_separator; } - - for ($i = 1; $i <= 31; $i ++) { + for ($i = 1; $i <= 31; $i++) { $_val = sprintf('%02d', $i); $_text = $day_format === '%02d' ? $_val : sprintf($day_format, $i); $_value = $day_value_format === '%02d' ? $_val : sprintf($day_value_format, $i); $_html_days .= '<option value="' . $_value . '"' . ($_val == $_day ? ' selected="selected"' : '') . '>' . $_text . '</option>' . $option_separator; } - $_html_days .= '</select>'; } - // order the fields for output $_html = ''; - for ($i = 0; $i <= 2; $i ++) { + for ($i = 0; $i <= 2; $i++) { switch ($field_order[ $i ]) { case 'Y': case 'y': @@ -366,7 +364,6 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem $_html .= $_html_years; } break; - case 'm': case 'M': if (isset($_html_months)) { @@ -376,7 +373,6 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem $_html .= $_html_months; } break; - case 'd': case 'D': if (isset($_html_days)) { @@ -388,6 +384,5 @@ function smarty_function_html_select_date($params, Smarty_Internal_Template $tem break; } } - return $_html; } diff --git a/vendor/smarty/smarty/libs/plugins/function.html_select_time.php b/vendor/smarty/smarty/libs/plugins/function.html_select_time.php index f7c3816e3..cb047bc0a 100644 --- a/vendor/smarty/smarty/libs/plugins/function.html_select_time.php +++ b/vendor/smarty/smarty/libs/plugins/function.html_select_time.php @@ -11,130 +11,124 @@ * Name: html_select_time * Purpose: Prints the dropdowns for time selection * - * @link http://www.smarty.net/manual/en/language.function.html.select.time.php {html_select_time} + * @link http://www.smarty.net/manual/en/language.function.html.select.time.php {html_select_time} * (Smarty online manual) - * @author Roberto Berto <roberto@berto.net> - * @author Monte Ohrt <monte AT ohrt DOT com> + * @author Roberto Berto <roberto@berto.net> + * @author Monte Ohrt <monte AT ohrt DOT com> * * @param array $params parameters * * @param \Smarty_Internal_Template $template * * @return string - * @uses smarty_make_timestamp() + * @uses smarty_make_timestamp() * @throws \SmartyException */ function smarty_function_html_select_time($params, Smarty_Internal_Template $template) { - $template->_checkPlugins(array(array('function' => 'smarty_function_escape_special_chars', - 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'))); + $template->_checkPlugins( + array( + array( + 'function' => 'smarty_function_escape_special_chars', + 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php' + ) + ) + ); $prefix = 'Time_'; $field_array = null; $field_separator = "\n"; $option_separator = "\n"; $time = null; - $display_hours = true; $display_minutes = true; $display_seconds = true; $display_meridian = true; - $hour_format = '%02d'; $hour_value_format = '%02d'; $minute_format = '%02d'; $minute_value_format = '%02d'; $second_format = '%02d'; $second_value_format = '%02d'; - $hour_size = null; $minute_size = null; $second_size = null; $meridian_size = null; - $all_empty = null; $hour_empty = null; $minute_empty = null; $second_empty = null; $meridian_empty = null; - $all_id = null; $hour_id = null; $minute_id = null; $second_id = null; $meridian_id = null; - $use_24_hours = true; $minute_interval = 1; $second_interval = 1; - $extra_attrs = ''; $all_extra = null; $hour_extra = null; $minute_extra = null; $second_extra = null; $meridian_extra = null; - foreach ($params as $_key => $_value) { switch ($_key) { case 'time': if (!is_array($_value) && $_value !== null) { - $template->_checkPlugins(array(array('function' => 'smarty_make_timestamp', - 'file' => SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'))); + $template->_checkPlugins( + array( + array( + 'function' => 'smarty_make_timestamp', + 'file' => SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php' + ) + ) + ); $time = smarty_make_timestamp($_value); } break; - case 'prefix': case 'field_array': - case 'field_separator': case 'option_separator': - case 'all_extra': case 'hour_extra': case 'minute_extra': case 'second_extra': case 'meridian_extra': - case 'all_empty': case 'hour_empty': case 'minute_empty': case 'second_empty': case 'meridian_empty': - case 'all_id': case 'hour_id': case 'minute_id': case 'second_id': case 'meridian_id': - case 'hour_format': case 'hour_value_format': case 'minute_format': case 'minute_value_format': case 'second_format': case 'second_value_format': - $$_key = (string) $_value; + $$_key = (string)$_value; break; - case 'display_hours': case 'display_minutes': case 'display_seconds': case 'display_meridian': case 'use_24_hours': - $$_key = (bool) $_value; + $$_key = (bool)$_value; break; - case 'minute_interval': case 'second_interval': - case 'hour_size': case 'minute_size': case 'second_size': case 'meridian_size': - $$_key = (int) $_value; + $$_key = (int)$_value; break; - default: if (!is_array($_value)) { $extra_attrs .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_value) . '"'; @@ -144,13 +138,14 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem break; } } - if (isset($params[ 'time' ]) && is_array($params[ 'time' ])) { if (isset($params[ 'time' ][ $prefix . 'Hour' ])) { // $_REQUEST[$field_array] given - foreach (array('H' => 'Hour', - 'i' => 'Minute', - 's' => 'Second') as $_elementKey => $_elementName) { + foreach (array( + 'H' => 'Hour', + 'i' => 'Minute', + 's' => 'Second' + ) as $_elementKey => $_elementName) { $_variableName = '_' . strtolower($_elementName); $$_variableName = isset($params[ 'time' ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $prefix . $_elementName ] : @@ -163,9 +158,11 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time)); } elseif (isset($params[ 'time' ][ $field_array ][ $prefix . 'Hour' ])) { // $_REQUEST given - foreach (array('H' => 'Hour', - 'i' => 'Minute', - 's' => 'Second') as $_elementKey => $_elementName) { + foreach (array( + 'H' => 'Hour', + 'i' => 'Minute', + 's' => 'Second' + ) as $_elementKey => $_elementName) { $_variableName = '_' . strtolower($_elementName); $$_variableName = isset($params[ 'time' ][ $field_array ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $field_array ][ $prefix . $_elementName ] : date($_elementKey); @@ -187,7 +184,6 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem } else { list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time)); } - // generate hour <select> if ($display_hours) { $_html_hours = ''; @@ -199,42 +195,37 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem if ($hour_extra) { $_extra .= ' ' . $hour_extra; } - $_html_hours = '<select name="' . $_name . '"'; if ($hour_id !== null || $all_id !== null) { $_html_hours .= ' id="' . - smarty_function_escape_special_chars($hour_id !== null ? ($hour_id ? $hour_id : $_name) : - ($all_id ? ($all_id . $_name) : $_name)) . '"'; + smarty_function_escape_special_chars( + $hour_id !== null ? ($hour_id ? $hour_id : $_name) : + ($all_id ? ($all_id . $_name) : $_name) + ) . '"'; } if ($hour_size) { $_html_hours .= ' size="' . $hour_size . '"'; } $_html_hours .= $_extra . $extra_attrs . '>' . $option_separator; - if (isset($hour_empty) || isset($all_empty)) { $_html_hours .= '<option value="">' . (isset($hour_empty) ? $hour_empty : $all_empty) . '</option>' . $option_separator; } - $start = $use_24_hours ? 0 : 1; $end = $use_24_hours ? 23 : 12; - for ($i = $start; $i <= $end; $i ++) { + for ($i = $start; $i <= $end; $i++) { $_val = sprintf('%02d', $i); $_text = $hour_format === '%02d' ? $_val : sprintf($hour_format, $i); $_value = $hour_value_format === '%02d' ? $_val : sprintf($hour_value_format, $i); - if (!$use_24_hours) { $_hour12 = $_hour == 0 ? 12 : ($_hour <= 12 ? $_hour : $_hour - 12); } - $selected = $_hour !== null ? ($use_24_hours ? $_hour == $_val : $_hour12 == $_val) : null; $_html_hours .= '<option value="' . $_value . '"' . ($selected ? ' selected="selected"' : '') . '>' . $_text . '</option>' . $option_separator; } - $_html_hours .= '</select>'; } - // generate minute <select> if ($display_minutes) { $_html_minutes = ''; @@ -246,24 +237,23 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem if ($minute_extra) { $_extra .= ' ' . $minute_extra; } - $_html_minutes = '<select name="' . $_name . '"'; if ($minute_id !== null || $all_id !== null) { - $_html_minutes .= ' id="' . smarty_function_escape_special_chars($minute_id !== null ? - ($minute_id ? $minute_id : $_name) : - ($all_id ? ($all_id . $_name) : - $_name)) . '"'; + $_html_minutes .= ' id="' . smarty_function_escape_special_chars( + $minute_id !== null ? + ($minute_id ? $minute_id : $_name) : + ($all_id ? ($all_id . $_name) : + $_name) + ) . '"'; } if ($minute_size) { $_html_minutes .= ' size="' . $minute_size . '"'; } $_html_minutes .= $_extra . $extra_attrs . '>' . $option_separator; - if (isset($minute_empty) || isset($all_empty)) { $_html_minutes .= '<option value="">' . (isset($minute_empty) ? $minute_empty : $all_empty) . '</option>' . $option_separator; } - $selected = $_minute !== null ? ($_minute - $_minute % $minute_interval) : null; for ($i = 0; $i <= 59; $i += $minute_interval) { $_val = sprintf('%02d', $i); @@ -272,10 +262,8 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem $_html_minutes .= '<option value="' . $_value . '"' . ($selected === $i ? ' selected="selected"' : '') . '>' . $_text . '</option>' . $option_separator; } - $_html_minutes .= '</select>'; } - // generate second <select> if ($display_seconds) { $_html_seconds = ''; @@ -287,24 +275,23 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem if ($second_extra) { $_extra .= ' ' . $second_extra; } - $_html_seconds = '<select name="' . $_name . '"'; if ($second_id !== null || $all_id !== null) { - $_html_seconds .= ' id="' . smarty_function_escape_special_chars($second_id !== null ? - ($second_id ? $second_id : $_name) : - ($all_id ? ($all_id . $_name) : - $_name)) . '"'; + $_html_seconds .= ' id="' . smarty_function_escape_special_chars( + $second_id !== null ? + ($second_id ? $second_id : $_name) : + ($all_id ? ($all_id . $_name) : + $_name) + ) . '"'; } if ($second_size) { $_html_seconds .= ' size="' . $second_size . '"'; } $_html_seconds .= $_extra . $extra_attrs . '>' . $option_separator; - if (isset($second_empty) || isset($all_empty)) { $_html_seconds .= '<option value="">' . (isset($second_empty) ? $second_empty : $all_empty) . '</option>' . $option_separator; } - $selected = $_second !== null ? ($_second - $_second % $second_interval) : null; for ($i = 0; $i <= 59; $i += $second_interval) { $_val = sprintf('%02d', $i); @@ -313,10 +300,8 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem $_html_seconds .= '<option value="' . $_value . '"' . ($selected === $i ? ' selected="selected"' : '') . '>' . $_text . '</option>' . $option_separator; } - $_html_seconds .= '</select>'; } - // generate meridian <select> if ($display_meridian && !$use_24_hours) { $_html_meridian = ''; @@ -328,36 +313,36 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem if ($meridian_extra) { $_extra .= ' ' . $meridian_extra; } - $_html_meridian = '<select name="' . $_name . '"'; if ($meridian_id !== null || $all_id !== null) { - $_html_meridian .= ' id="' . smarty_function_escape_special_chars($meridian_id !== null ? - ($meridian_id ? $meridian_id : - $_name) : - ($all_id ? ($all_id . $_name) : - $_name)) . '"'; + $_html_meridian .= ' id="' . smarty_function_escape_special_chars( + $meridian_id !== null ? + ($meridian_id ? $meridian_id : + $_name) : + ($all_id ? ($all_id . $_name) : + $_name) + ) . '"'; } if ($meridian_size) { $_html_meridian .= ' size="' . $meridian_size . '"'; } $_html_meridian .= $_extra . $extra_attrs . '>' . $option_separator; - if (isset($meridian_empty) || isset($all_empty)) { $_html_meridian .= '<option value="">' . (isset($meridian_empty) ? $meridian_empty : $all_empty) . '</option>' . $option_separator; } - $_html_meridian .= '<option value="am"' . ($_hour > 0 && $_hour < 12 ? ' selected="selected"' : '') . '>AM</option>' . $option_separator . '<option value="pm"' . ($_hour < 12 ? '' : ' selected="selected"') . '>PM</option>' . $option_separator . '</select>'; } - $_html = ''; - foreach (array('_html_hours', - '_html_minutes', - '_html_seconds', - '_html_meridian') as $k) { + foreach (array( + '_html_hours', + '_html_minutes', + '_html_seconds', + '_html_meridian' + ) as $k) { if (isset($$k)) { if ($_html) { $_html .= $field_separator; @@ -365,6 +350,5 @@ function smarty_function_html_select_time($params, Smarty_Internal_Template $tem $_html .= $$k; } } - return $_html; } diff --git a/vendor/smarty/smarty/libs/plugins/function.html_table.php b/vendor/smarty/smarty/libs/plugins/function.html_table.php index d9a9fd691..ae61e83dc 100644 --- a/vendor/smarty/smarty/libs/plugins/function.html_table.php +++ b/vendor/smarty/smarty/libs/plugins/function.html_table.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsFunction */ - /** * Smarty {html_table} function plugin * Type: function @@ -35,12 +34,11 @@ * {table loop=$data cols=4 tr_attr='"bgcolor=red"'} * {table loop=$data cols="first,second,third" tr_attr=$colors} * - * - * @author Monte Ohrt <monte at ohrt dot com> - * @author credit to Messju Mohr <messju at lammfellpuschen dot de> - * @author credit to boots <boots dot smarty at yahoo dot com> - * @version 1.1 - * @link http://www.smarty.net/manual/en/language.function.html.table.php {html_table} + * @author Monte Ohrt <monte at ohrt dot com> + * @author credit to Messju Mohr <messju at lammfellpuschen dot de> + * @author credit to boots <boots dot smarty at yahoo dot com> + * @version 1.1 + * @link http://www.smarty.net/manual/en/language.function.html.table.php {html_table} * (Smarty online manual) * * @param array $params parameters @@ -61,19 +59,15 @@ function smarty_function_html_table($params) $inner = 'cols'; $caption = ''; $loop = null; - if (!isset($params[ 'loop' ])) { trigger_error("html_table: missing 'loop' parameter", E_USER_WARNING); - return; } - foreach ($params as $_key => $_value) { switch ($_key) { case 'loop': - $$_key = (array) $_value; + $$_key = (array)$_value; break; - case 'cols': if (is_array($_value) && !empty($_value)) { $cols = $_value; @@ -82,25 +76,22 @@ function smarty_function_html_table($params) $cols = explode(',', $_value); $cols_count = count($cols); } elseif (!empty($_value)) { - $cols_count = (int) $_value; + $cols_count = (int)$_value; } else { $cols_count = $cols; } break; - case 'rows': - $$_key = (int) $_value; + $$_key = (int)$_value; break; - case 'table_attr': case 'trailpad': case 'hdir': case 'vdir': case 'inner': case 'caption': - $$_key = (string) $_value; + $$_key = (string)$_value; break; - case 'tr_attr': case 'td_attr': case 'th_attr': @@ -108,7 +99,6 @@ function smarty_function_html_table($params) break; } } - $loop_count = count($loop); if (empty($params[ 'rows' ])) { /* no rows specified */ @@ -119,37 +109,30 @@ function smarty_function_html_table($params) $cols_count = ceil($loop_count / $rows); } } - $output = "<table $table_attr>\n"; - if (!empty($caption)) { $output .= '<caption>' . $caption . "</caption>\n"; } - if (is_array($cols)) { $cols = ($hdir === 'right') ? $cols : array_reverse($cols); $output .= "<thead><tr>\n"; - - for ($r = 0; $r < $cols_count; $r ++) { + for ($r = 0; $r < $cols_count; $r++) { $output .= '<th' . smarty_function_html_table_cycle('th', $th_attr, $r) . '>'; $output .= $cols[ $r ]; $output .= "</th>\n"; } $output .= "</tr></thead>\n"; } - $output .= "<tbody>\n"; - for ($r = 0; $r < $rows; $r ++) { + for ($r = 0; $r < $rows; $r++) { $output .= "<tr" . smarty_function_html_table_cycle('tr', $tr_attr, $r) . ">\n"; $rx = ($vdir === 'down') ? $r * $cols_count : ($rows - 1 - $r) * $cols_count; - - for ($c = 0; $c < $cols_count; $c ++) { + for ($c = 0; $c < $cols_count; $c++) { $x = ($hdir === 'right') ? $rx + $c : $rx + $cols_count - 1 - $c; if ($inner !== 'cols') { /* shuffle x to loop over rows*/ $x = floor($x / $cols_count) + ($x % $cols_count) * $rows; } - if ($x < $loop_count) { $output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">" . $loop[ $x ] . "</td>\n"; } else { @@ -160,9 +143,9 @@ function smarty_function_html_table($params) } $output .= "</tbody>\n"; $output .= "</table>\n"; - return $output; } + /** * @param $name * @param $var @@ -177,6 +160,5 @@ function smarty_function_html_table_cycle($name, $var, $no) } else { $ret = $var[ $no % count($var) ]; } - return ($ret) ? ' ' . $ret : ''; } diff --git a/vendor/smarty/smarty/libs/plugins/function.mailto.php b/vendor/smarty/smarty/libs/plugins/function.mailto.php index 0d817535a..27351df82 100644 --- a/vendor/smarty/smarty/libs/plugins/function.mailto.php +++ b/vendor/smarty/smarty/libs/plugins/function.mailto.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsFunction */ - /** * Smarty {mailto} function plugin * Type: function @@ -37,12 +36,11 @@ * {mailto address="me@domain.com" cc="you@domain.com,they@domain.com"} * {mailto address="me@domain.com" extra='class="mailto"'} * - * - * @link http://www.smarty.net/manual/en/language.function.mailto.php {mailto} + * @link http://www.smarty.net/manual/en/language.function.mailto.php {mailto} * (Smarty online manual) - * @version 1.2 - * @author Monte Ohrt <monte at ohrt dot com> - * @author credits to Jason Sweat (added cc, bcc and subject functionality) + * @version 1.2 + * @author Monte Ohrt <monte at ohrt dot com> + * @author credits to Jason Sweat (added cc, bcc and subject functionality) * * @param array $params parameters * @@ -53,15 +51,12 @@ function smarty_function_mailto($params) static $_allowed_encoding = array('javascript' => true, 'javascript_charcode' => true, 'hex' => true, 'none' => true); $extra = ''; - if (empty($params[ 'address' ])) { trigger_error("mailto: missing 'address' parameter", E_USER_WARNING); - return; } else { $address = $params[ 'address' ]; } - $text = $address; // netscape and mozilla do not decode %40 (@) in BCC field (bug?) // so, don't encode it. @@ -77,61 +72,52 @@ function smarty_function_mailto($params) $mail_parms[] = $var . '=' . str_replace($search, $replace, rawurlencode($value)); } break; - case 'subject': case 'newsgroups': $mail_parms[] = $var . '=' . rawurlencode($value); break; - case 'extra': case 'text': $$var = $value; - + // no break default: } } - if ($mail_parms) { $address .= '?' . join('&', $mail_parms); } - $encode = (empty($params[ 'encode' ])) ? 'none' : $params[ 'encode' ]; if (!isset($_allowed_encoding[ $encode ])) { - trigger_error("mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex", - E_USER_WARNING); - + trigger_error( + "mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex", + E_USER_WARNING + ); return; } // FIXME: (rodneyrehm) document.write() excues me what? 1998 has passed! if ($encode === 'javascript') { $string = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');'; - $js_encode = ''; - for ($x = 0, $_length = strlen($string); $x < $_length; $x ++) { + for ($x = 0, $_length = strlen($string); $x < $_length; $x++) { $js_encode .= '%' . bin2hex($string[ $x ]); } - return '<script type="text/javascript">eval(unescape(\'' . $js_encode . '\'))</script>'; } elseif ($encode === 'javascript_charcode') { $string = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>'; - - for ($x = 0, $y = strlen($string); $x < $y; $x ++) { + for ($x = 0, $y = strlen($string); $x < $y; $x++) { $ord[] = ord($string[ $x ]); } - $_ret = "<script type=\"text/javascript\" language=\"javascript\">\n" . "{document.write(String.fromCharCode(" . implode(',', $ord) . "))" . "}\n" . "</script>\n"; - return $_ret; } elseif ($encode === 'hex') { preg_match('!^(.*)(\?.*)$!', $address, $match); if (!empty($match[ 2 ])) { trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.", E_USER_WARNING); - return; } $address_encode = ''; - for ($x = 0, $_length = strlen($address); $x < $_length; $x ++) { + for ($x = 0, $_length = strlen($address); $x < $_length; $x++) { if (preg_match('!\w!' . Smarty::$_UTF8_MODIFIER, $address[ $x ])) { $address_encode .= '%' . bin2hex($address[ $x ]); } else { @@ -139,12 +125,10 @@ function smarty_function_mailto($params) } } $text_encode = ''; - for ($x = 0, $_length = strlen($text); $x < $_length; $x ++) { + for ($x = 0, $_length = strlen($text); $x < $_length; $x++) { $text_encode .= '&#x' . bin2hex($text[ $x ]) . ';'; } - $mailto = "mailto:"; - return '<a href="' . $mailto . $address_encode . '" ' . $extra . '>' . $text_encode . '</a>'; } else { // no encoding diff --git a/vendor/smarty/smarty/libs/plugins/function.math.php b/vendor/smarty/smarty/libs/plugins/function.math.php index 396ad085e..7348d9649 100644 --- a/vendor/smarty/smarty/libs/plugins/function.math.php +++ b/vendor/smarty/smarty/libs/plugins/function.math.php @@ -6,16 +6,15 @@ * @package Smarty * @subpackage PluginsFunction */ - /** * Smarty {math} function plugin * Type: function * Name: math * Purpose: handle math computations in template * - * @link http://www.smarty.net/manual/en/language.function.math.php {math} + * @link http://www.smarty.net/manual/en/language.function.math.php {math} * (Smarty online manual) - * @author Monte Ohrt <monte at ohrt dot com> + * @author Monte Ohrt <monte at ohrt dot com> * * @param array $params parameters * @param Smarty_Internal_Template $template template object @@ -25,66 +24,71 @@ function smarty_function_math($params, $template) { static $_allowed_funcs = - array('int' => true, 'abs' => true, 'ceil' => true, 'cos' => true, 'exp' => true, 'floor' => true, - 'log' => true, 'log10' => true, 'max' => true, 'min' => true, 'pi' => true, 'pow' => true, 'rand' => true, - 'round' => true, 'sin' => true, 'sqrt' => true, 'srand' => true, 'tan' => true); + array( + 'int' => true, + 'abs' => true, + 'ceil' => true, + 'cos' => true, + 'exp' => true, + 'floor' => true, + 'log' => true, + 'log10' => true, + 'max' => true, + 'min' => true, + 'pi' => true, + 'pow' => true, + 'rand' => true, + 'round' => true, + 'sin' => true, + 'sqrt' => true, + 'srand' => true, + 'tan' => true + ); // be sure equation parameter is present if (empty($params[ 'equation' ])) { trigger_error("math: missing equation parameter", E_USER_WARNING); - return; } - $equation = $params[ 'equation' ]; - // make sure parenthesis are balanced if (substr_count($equation, '(') !== substr_count($equation, ')')) { trigger_error("math: unbalanced parenthesis", E_USER_WARNING); - return; } - // disallow backticks if (strpos($equation, '`') !== false) { trigger_error("math: backtick character not allowed in equation", E_USER_WARNING); - return; } - // also disallow dollar signs if (strpos($equation, '$') !== false) { trigger_error("math: dollar signs not allowed in equation", E_USER_WARNING); - return; } - foreach ($params as $key => $val) { if ($key !== 'equation' && $key !== 'format' && $key !== 'assign') { // make sure value is not empty if (strlen($val) === 0) { trigger_error("math: parameter '{$key}' is empty", E_USER_WARNING); - return; } if (!is_numeric($val)) { trigger_error("math: parameter '{$key}' is not numeric", E_USER_WARNING); - return; } } } - // match all vars in equation, make sure all are passed preg_match_all('!(?:0x[a-fA-F0-9]+)|([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)!', $equation, $match); - foreach ($match[ 1 ] as $curr_var) { if ($curr_var && !isset($params[ $curr_var ]) && !isset($_allowed_funcs[ $curr_var ])) { - trigger_error("math: function call '{$curr_var}' not allowed, or missing parameter '{$curr_var}'", E_USER_WARNING); - + trigger_error( + "math: function call '{$curr_var}' not allowed, or missing parameter '{$curr_var}'", + E_USER_WARNING + ); return; } } - foreach ($params as $key => $val) { if ($key !== 'equation' && $key !== 'format' && $key !== 'assign') { $equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation); @@ -92,7 +96,6 @@ function smarty_function_math($params, $template) } $smarty_math_result = null; eval("\$smarty_math_result = " . $equation . ";"); - if (empty($params[ 'format' ])) { if (empty($params[ 'assign' ])) { return $smarty_math_result; diff --git a/vendor/smarty/smarty/libs/plugins/modifier.capitalize.php b/vendor/smarty/smarty/libs/plugins/modifier.capitalize.php index e354977b0..c5fc400a6 100644 --- a/vendor/smarty/smarty/libs/plugins/modifier.capitalize.php +++ b/vendor/smarty/smarty/libs/plugins/modifier.capitalize.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsModifier */ - /** * Smarty capitalize modifier plugin * Type: modifier @@ -29,50 +28,75 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals $upper_string = mb_convert_case($string, MB_CASE_TITLE, Smarty::$_CHARSET); } else { // uppercase word breaks - $upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, - 'smarty_mod_cap_mbconvert_cb', $string); + $upper_string = preg_replace_callback( + "!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, + 'smarty_mod_cap_mbconvert_cb', + $string + ); } // check uc_digits case if (!$uc_digits) { - if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches, - PREG_OFFSET_CAPTURE)) { + if (preg_match_all( + "!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, + $string, + $matches, + PREG_OFFSET_CAPTURE + ) + ) { foreach ($matches[ 1 ] as $match) { $upper_string = - substr_replace($upper_string, mb_strtolower($match[ 0 ], Smarty::$_CHARSET), $match[ 1 ], - strlen($match[ 0 ])); + substr_replace( + $upper_string, + mb_strtolower($match[ 0 ], Smarty::$_CHARSET), + $match[ 1 ], + strlen($match[ 0 ]) + ); } } } $upper_string = - preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_mbconvert2_cb', - $upper_string); + preg_replace_callback( + "!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, + 'smarty_mod_cap_mbconvert2_cb', + $upper_string + ); return $upper_string; } - // lowercase first if ($lc_rest) { $string = strtolower($string); } // uppercase (including hyphenated words) $upper_string = - preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst_cb', - $string); + preg_replace_callback( + "!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, + 'smarty_mod_cap_ucfirst_cb', + $string + ); // check uc_digits case if (!$uc_digits) { - if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches, - PREG_OFFSET_CAPTURE)) { + if (preg_match_all( + "!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, + $string, + $matches, + PREG_OFFSET_CAPTURE + ) + ) { foreach ($matches[ 1 ] as $match) { $upper_string = substr_replace($upper_string, strtolower($match[ 0 ]), $match[ 1 ], strlen($match[ 0 ])); } } } - $upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst2_cb', - $upper_string); + $upper_string = preg_replace_callback( + "!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, + 'smarty_mod_cap_ucfirst2_cb', + $upper_string + ); return $upper_string; } -/* +/** * * Bug: create_function() use exhausts memory when used in long loops * Fix: use declared functions for callbacks instead of using create_function() @@ -89,6 +113,7 @@ function smarty_mod_cap_mbconvert_cb($matches) { return stripslashes($matches[ 1 ]) . mb_convert_case(stripslashes($matches[ 2 ]), MB_CASE_UPPER, Smarty::$_CHARSET); } + /** * @param $matches * @@ -98,6 +123,7 @@ function smarty_mod_cap_mbconvert2_cb($matches) { return stripslashes($matches[ 1 ]) . mb_convert_case(stripslashes($matches[ 3 ]), MB_CASE_UPPER, Smarty::$_CHARSET); } + /** * @param $matches * @@ -107,6 +133,7 @@ function smarty_mod_cap_ucfirst_cb($matches) { return stripslashes($matches[ 1 ]) . ucfirst(stripslashes($matches[ 2 ])); } + /** * @param $matches * diff --git a/vendor/smarty/smarty/libs/plugins/modifier.date_format.php b/vendor/smarty/smarty/libs/plugins/modifier.date_format.php index b45b2d4b8..23b69430b 100644 --- a/vendor/smarty/smarty/libs/plugins/modifier.date_format.php +++ b/vendor/smarty/smarty/libs/plugins/modifier.date_format.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsModifier */ - /** * Smarty date_format modifier plugin * Type: modifier @@ -38,7 +37,7 @@ function smarty_modifier_date_format($string, $format = null, $default_date = '' static $is_loaded = false; if (!$is_loaded) { if (!is_callable('smarty_make_timestamp')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'); + include_once SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'; } $is_loaded = true; } @@ -51,20 +50,24 @@ function smarty_modifier_date_format($string, $format = null, $default_date = '' } if ($formatter === 'strftime' || ($formatter === 'auto' && strpos($format, '%') !== false)) { if (Smarty::$_IS_WINDOWS) { - $_win_from = array('%D', - '%h', - '%n', - '%r', - '%R', - '%t', - '%T'); - $_win_to = array('%m/%d/%y', - '%b', - "\n", - '%I:%M:%S %p', - '%H:%M', - "\t", - '%H:%M:%S'); + $_win_from = array( + '%D', + '%h', + '%n', + '%r', + '%R', + '%t', + '%T' + ); + $_win_to = array( + '%m/%d/%y', + '%b', + "\n", + '%I:%M:%S %p', + '%H:%M', + "\t", + '%H:%M:%S' + ); if (strpos($format, '%e') !== false) { $_win_from[] = '%e'; $_win_to[] = sprintf('%\' 2d', date('j', $timestamp)); @@ -75,7 +78,6 @@ function smarty_modifier_date_format($string, $format = null, $default_date = '' } $format = str_replace($_win_from, $_win_to, $format); } - return strftime($format, $timestamp); } else { return date($format, $timestamp); diff --git a/vendor/smarty/smarty/libs/plugins/modifier.debug_print_var.php b/vendor/smarty/smarty/libs/plugins/modifier.debug_print_var.php index 2bd112154..78397d017 100644 --- a/vendor/smarty/smarty/libs/plugins/modifier.debug_print_var.php +++ b/vendor/smarty/smarty/libs/plugins/modifier.debug_print_var.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage Debug */ - /** * Smarty debug_print_var modifier plugin * Type: modifier @@ -26,7 +25,7 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = { $_replace = array("\n" => '\n', "\r" => '\r', "\t" => '\t'); switch (gettype($var)) { - case 'array' : + case 'array': $results = '<b>Array (' . count($var) . ')</b>'; if ($depth === $max) { break; @@ -34,12 +33,11 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = foreach ($var as $curr_key => $curr_val) { $results .= '<br>' . str_repeat(' ', $depth * 2) . '<b>' . strtr($curr_key, $_replace) . '</b> => ' . - smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects); - $depth --; + smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects); + $depth--; } break; - - case 'object' : + case 'object': $object_vars = get_object_vars($var); $results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>'; if (in_array($var, $objects)) { @@ -52,14 +50,13 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = $objects[] = $var; foreach ($object_vars as $curr_key => $curr_val) { $results .= '<br>' . str_repeat(' ', $depth * 2) . '<b> ->' . strtr($curr_key, $_replace) . - '</b> = ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects); - $depth --; + '</b> = ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects); + $depth--; } break; - - case 'boolean' : - case 'NULL' : - case 'resource' : + case 'boolean': + case 'NULL': + case 'resource': if (true === $var) { $results = 'true'; } elseif (false === $var) { @@ -67,17 +64,15 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = } elseif (null === $var) { $results = 'null'; } else { - $results = htmlspecialchars((string) $var); + $results = htmlspecialchars((string)$var); } $results = '<i>' . $results . '</i>'; break; - - case 'integer' : - case 'float' : - $results = htmlspecialchars((string) $var); + case 'integer': + case 'float': + $results = htmlspecialchars((string)$var); break; - - case 'string' : + case 'string': $results = strtr($var, $_replace); if (Smarty::$_MBSTRING) { if (mb_strlen($var, Smarty::$_CHARSET) > $length) { @@ -88,13 +83,11 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = $results = substr($var, 0, $length - 3) . '...'; } } - $results = htmlspecialchars('"' . $results . '"', ENT_QUOTES, Smarty::$_CHARSET); break; - - case 'unknown type' : - default : - $results = strtr((string) $var, $_replace); + case 'unknown type': + default: + $results = strtr((string)$var, $_replace); if (Smarty::$_MBSTRING) { if (mb_strlen($results, Smarty::$_CHARSET) > $length) { $results = mb_substr($results, 0, $length - 3, Smarty::$_CHARSET) . '...'; @@ -104,9 +97,7 @@ function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = $results = substr($results, 0, $length - 3) . '...'; } } - $results = htmlspecialchars($results, ENT_QUOTES, Smarty::$_CHARSET); } - return $results; } diff --git a/vendor/smarty/smarty/libs/plugins/modifier.escape.php b/vendor/smarty/smarty/libs/plugins/modifier.escape.php index 1ae87a7aa..150901c7c 100644 --- a/vendor/smarty/smarty/libs/plugins/modifier.escape.php +++ b/vendor/smarty/smarty/libs/plugins/modifier.escape.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsModifier */ - /** * Smarty escape modifier plugin * Type: modifier @@ -30,11 +29,9 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $ if ($_double_encode === null) { $_double_encode = version_compare(PHP_VERSION, '5.2.3', '>='); } - if (!$char_set) { $char_set = Smarty::$_CHARSET; } - switch ($esc_type) { case 'html': if ($_double_encode) { @@ -48,14 +45,21 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $ // php <5.2.3 - prevent double encoding $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); $string = htmlspecialchars($string, ENT_QUOTES, $char_set); - $string = str_replace(array('%%%SMARTY_START%%%', - '%%%SMARTY_END%%%'), array('&', - ';'), $string); - + $string = str_replace( + array( + '%%%SMARTY_START%%%', + '%%%SMARTY_END%%%' + ), + array( + '&', + ';' + ), + $string + ); return $string; } } - + // no break case 'htmlall': if (Smarty::$_MBSTRING) { // mb_convert_encoding ignores htmlspecialchars() @@ -71,18 +75,23 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $ $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); $string = htmlspecialchars($string, ENT_QUOTES, $char_set); $string = - str_replace(array('%%%SMARTY_START%%%', - '%%%SMARTY_END%%%'), array('&', - ';'), $string); - + str_replace( + array( + '%%%SMARTY_START%%%', + '%%%SMARTY_END%%%' + ), + array( + '&', + ';' + ), + $string + ); return $string; } } - // htmlentities() won't convert everything, so use mb_convert_encoding return mb_convert_encoding($string, 'HTML-ENTITIES', $char_set); } - // no MBString fallback if ($_double_encode) { return htmlentities($string, ENT_QUOTES, $char_set, $double_encode); @@ -92,41 +101,43 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $ } else { $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); $string = htmlentities($string, ENT_QUOTES, $char_set); - $string = str_replace(array('%%%SMARTY_START%%%', - '%%%SMARTY_END%%%'), array('&', - ';'), $string); - + $string = str_replace( + array( + '%%%SMARTY_START%%%', + '%%%SMARTY_END%%%' + ), + array( + '&', + ';' + ), + $string + ); return $string; } } - + // no break case 'url': return rawurlencode($string); - case 'urlpathinfo': return str_replace('%2F', '/', rawurlencode($string)); - case 'quotes': // escape unescaped single quotes return preg_replace("%(?<!\\\\)'%", "\\'", $string); - case 'hex': // escape every byte into hex // Note that the UTF-8 encoded character ä will be represented as %c3%a4 $return = ''; $_length = strlen($string); - for ($x = 0; $x < $_length; $x ++) { + for ($x = 0; $x < $_length; $x++) { $return .= '%' . bin2hex($string[ $x ]); } - return $return; - case 'hexentity': $return = ''; if (Smarty::$_MBSTRING) { if (!$is_loaded_1) { if (!is_callable('smarty_mb_to_unicode')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php'); + include_once SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php'; } $is_loaded_1 = true; } @@ -134,23 +145,20 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $ foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) { $return .= '&#x' . strtoupper(dechex($unicode)) . ';'; } - return $return; } // no MBString fallback $_length = strlen($string); - for ($x = 0; $x < $_length; $x ++) { + for ($x = 0; $x < $_length; $x++) { $return .= '&#x' . bin2hex($string[ $x ]) . ';'; } - return $return; - case 'decentity': $return = ''; if (Smarty::$_MBSTRING) { if (!$is_loaded_1) { if (!is_callable('smarty_mb_to_unicode')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php'); + include_once SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php'; } $is_loaded_1 = true; } @@ -158,50 +166,66 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $ foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) { $return .= '&#' . $unicode . ';'; } - return $return; } // no MBString fallback $_length = strlen($string); - for ($x = 0; $x < $_length; $x ++) { + for ($x = 0; $x < $_length; $x++) { $return .= '&#' . ord($string[ $x ]) . ';'; } - return $return; - case 'javascript': // escape quotes and backslashes, newlines, etc. - return strtr($string, array('\\' => '\\\\', - "'" => "\\'", - '"' => '\\"', - "\r" => '\\r', - "\n" => '\\n', - '</' => '<\/')); - + return strtr( + $string, + array( + '\\' => '\\\\', + "'" => "\\'", + '"' => '\\"', + "\r" => '\\r', + "\n" => '\\n', + '</' => '<\/' + ) + ); case 'mail': if (Smarty::$_MBSTRING) { if (!$is_loaded_2) { if (!is_callable('smarty_mb_str_replace')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php'); + include_once SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php'; } $is_loaded_2 = true; } - return smarty_mb_str_replace(array('@', - '.'), array(' [AT] ', - ' [DOT] '), $string); + return smarty_mb_str_replace( + array( + '@', + '.' + ), + array( + ' [AT] ', + ' [DOT] ' + ), + $string + ); } // no MBString fallback - return str_replace(array('@', - '.'), array(' [AT] ', - ' [DOT] '), $string); - + return str_replace( + array( + '@', + '.' + ), + array( + ' [AT] ', + ' [DOT] ' + ), + $string + ); case 'nonstd': // escape non-standard chars, such as ms document quotes $return = ''; if (Smarty::$_MBSTRING) { if (!$is_loaded_1) { if (!is_callable('smarty_mb_to_unicode')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php'); + include_once SMARTY_PLUGINS_DIR . 'shared.mb_unicode.php'; } $is_loaded_1 = true; } @@ -212,12 +236,10 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $ $return .= chr($unicode); } } - return $return; } - $_length = strlen($string); - for ($_i = 0; $_i < $_length; $_i ++) { + for ($_i = 0; $_i < $_length; $_i++) { $_ord = ord(substr($string, $_i, 1)); // non-standard char, escape it if ($_ord >= 126) { @@ -226,9 +248,7 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $ $return .= substr($string, $_i, 1); } } - return $return; - default: return $string; } diff --git a/vendor/smarty/smarty/libs/plugins/modifier.mb_wordwrap.php b/vendor/smarty/smarty/libs/plugins/modifier.mb_wordwrap.php index 93c6241ec..1cd625b64 100644 --- a/vendor/smarty/smarty/libs/plugins/modifier.mb_wordwrap.php +++ b/vendor/smarty/smarty/libs/plugins/modifier.mb_wordwrap.php @@ -11,13 +11,12 @@ * Name: mb_wordwrap * Purpose: Wrap a string to a given number of characters * - * @link http://php.net/manual/en/function.wordwrap.php for similarity * - * @param string $str the string to wrap - * @param int $width the width of the output - * @param string $break the character used to break the line - * @param boolean $cut ignored parameter, just for the sake of + * @param string $str the string to wrap + * @param int $width the width of the output + * @param string $break the character used to break the line + * @param boolean $cut ignored parameter, just for the sake of * * @return string wrapped string * @author Rodney Rehm @@ -30,30 +29,28 @@ function smarty_modifier_mb_wordwrap($str, $width = 75, $break = "\n", $cut = fa $t = ''; $_previous = false; $_space = false; - foreach ($tokens as $_token) { $token_length = mb_strlen($_token, Smarty::$_CHARSET); $_tokens = array($_token); if ($token_length > $width) { if ($cut) { - $_tokens = preg_split('!(.{' . $width . '})!S' . Smarty::$_UTF8_MODIFIER, - $_token, - -1, - PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE); + $_tokens = preg_split( + '!(.{' . $width . '})!S' . Smarty::$_UTF8_MODIFIER, + $_token, + -1, + PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE + ); } } - foreach ($_tokens as $token) { $_space = !!preg_match('!^\s$!S' . Smarty::$_UTF8_MODIFIER, $token); $token_length = mb_strlen($token, Smarty::$_CHARSET); $length += $token_length; - if ($length > $width) { // remove space before inserted break if ($_previous) { $t = mb_substr($t, 0, -1, Smarty::$_CHARSET); } - if (!$_space) { // add the break before the token if (!empty($t)) { @@ -61,7 +58,7 @@ function smarty_modifier_mb_wordwrap($str, $width = 75, $break = "\n", $cut = fa } $length = $token_length; } - } else if ($token === "\n") { + } elseif ($token === "\n") { // hard break must reset counters $length = 0; } @@ -70,6 +67,5 @@ function smarty_modifier_mb_wordwrap($str, $width = 75, $break = "\n", $cut = fa $t .= $token; } } - return $t; } diff --git a/vendor/smarty/smarty/libs/plugins/modifier.regex_replace.php b/vendor/smarty/smarty/libs/plugins/modifier.regex_replace.php index 479aba875..7eb550695 100644 --- a/vendor/smarty/smarty/libs/plugins/modifier.regex_replace.php +++ b/vendor/smarty/smarty/libs/plugins/modifier.regex_replace.php @@ -5,16 +5,15 @@ * @package Smarty * @subpackage PluginsModifier */ - /** * Smarty regex_replace modifier plugin * Type: modifier * Name: regex_replace * Purpose: regular expression search/replace * - * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php + * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php * regex_replace (Smarty online manual) - * @author Monte Ohrt <monte at ohrt dot com> + * @author Monte Ohrt <monte at ohrt dot com> * * @param string $string input string * @param string|array $search regular expression(s) to search for @@ -23,7 +22,7 @@ * * @return string */ -function smarty_modifier_regex_replace($string, $search, $replace, $limit = - 1) +function smarty_modifier_regex_replace($string, $search, $replace, $limit = -1) { if (is_array($search)) { foreach ($search as $idx => $s) { @@ -32,7 +31,6 @@ function smarty_modifier_regex_replace($string, $search, $replace, $limit = - 1) } else { $search = _smarty_regex_replace_check($search); } - return preg_replace($search, $replace, $string, $limit); } @@ -51,8 +49,7 @@ function _smarty_regex_replace_check($search) } // remove eval-modifier from $search if (preg_match('!([a-zA-Z\s]+)$!s', $search, $match) && (strpos($match[ 1 ], 'e') !== false)) { - $search = substr($search, 0, - strlen($match[ 1 ])) . preg_replace('![e\s]+!', '', $match[ 1 ]); + $search = substr($search, 0, -strlen($match[ 1 ])) . preg_replace('![e\s]+!', '', $match[ 1 ]); } - return $search; } diff --git a/vendor/smarty/smarty/libs/plugins/modifier.replace.php b/vendor/smarty/smarty/libs/plugins/modifier.replace.php index a1b043b64..a98f5a4a6 100644 --- a/vendor/smarty/smarty/libs/plugins/modifier.replace.php +++ b/vendor/smarty/smarty/libs/plugins/modifier.replace.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsModifier */ - /** * Smarty replace modifier plugin * Type: modifier @@ -28,12 +27,11 @@ function smarty_modifier_replace($string, $search, $replace) if (Smarty::$_MBSTRING) { if (!$is_loaded) { if (!is_callable('smarty_mb_str_replace')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php'); + include_once SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php'; } $is_loaded = true; } - return smarty_mb_str_replace($search, $replace, $string); + return smarty_mb_str_replace($search, $replace, $string); } - return str_replace($search, $replace, $string); } diff --git a/vendor/smarty/smarty/libs/plugins/modifier.spacify.php b/vendor/smarty/smarty/libs/plugins/modifier.spacify.php index 1e29fd553..98efd4b30 100644 --- a/vendor/smarty/smarty/libs/plugins/modifier.spacify.php +++ b/vendor/smarty/smarty/libs/plugins/modifier.spacify.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsModifier */ - /** * Smarty spacify modifier plugin * Type: modifier @@ -23,5 +22,5 @@ function smarty_modifier_spacify($string, $spacify_char = ' ') { // well… what about charsets besides latin and UTF-8? - return implode($spacify_char, preg_split('//' . Smarty::$_UTF8_MODIFIER, $string, - 1, PREG_SPLIT_NO_EMPTY)); + return implode($spacify_char, preg_split('//' . Smarty::$_UTF8_MODIFIER, $string, -1, PREG_SPLIT_NO_EMPTY)); } diff --git a/vendor/smarty/smarty/libs/plugins/modifier.truncate.php b/vendor/smarty/smarty/libs/plugins/modifier.truncate.php index bb9df92d7..bb881bf6e 100644 --- a/vendor/smarty/smarty/libs/plugins/modifier.truncate.php +++ b/vendor/smarty/smarty/libs/plugins/modifier.truncate.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsModifier */ - /** * Smarty truncate modifier plugin * Type: modifier @@ -30,25 +29,24 @@ function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_wo if ($length === 0) { return ''; } - if (Smarty::$_MBSTRING) { if (mb_strlen($string, Smarty::$_CHARSET) > $length) { $length -= min($length, mb_strlen($etc, Smarty::$_CHARSET)); if (!$break_words && !$middle) { - $string = preg_replace('/\s+?(\S+)?$/' . Smarty::$_UTF8_MODIFIER, '', - mb_substr($string, 0, $length + 1, Smarty::$_CHARSET)); + $string = preg_replace( + '/\s+?(\S+)?$/' . Smarty::$_UTF8_MODIFIER, + '', + mb_substr($string, 0, $length + 1, Smarty::$_CHARSET) + ); } if (!$middle) { return mb_substr($string, 0, $length, Smarty::$_CHARSET) . $etc; } - return mb_substr($string, 0, $length / 2, Smarty::$_CHARSET) . $etc . - mb_substr($string, - $length / 2, $length, Smarty::$_CHARSET); + mb_substr($string, -$length / 2, $length, Smarty::$_CHARSET); } - return $string; } - // no MBString fallback if (isset($string[ $length ])) { $length -= min($length, strlen($etc)); @@ -58,9 +56,7 @@ function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_wo if (!$middle) { return substr($string, 0, $length) . $etc; } - - return substr($string, 0, $length / 2) . $etc . substr($string, - $length / 2); + return substr($string, 0, $length / 2) . $etc . substr($string, -$length / 2); } - return $string; } diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.cat.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.cat.php index 919b03c39..21d0e6624 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.cat.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.cat.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsModifierCompiler */ - /** * Smarty cat modifier plugin * Type: modifier @@ -15,9 +14,9 @@ * Input: string to catenate * Example: {$var|cat:"foo"} * - * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat + * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat * (Smarty online manual) - * @author Uwe Tews + * @author Uwe Tews * * @param array $params parameters * diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_characters.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_characters.php index 8116aa327..6c44278af 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_characters.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_characters.php @@ -5,14 +5,14 @@ * @package Smarty * @subpackage PluginsModifierCompiler */ - /** * Smarty count_characters modifier plugin * Type: modifier * Name: count_characters * Purpose: count the number of characters in a text * - * @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual) + * @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online + * manual) * @author Uwe Tews * * @param array $params parameters diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_paragraphs.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_paragraphs.php index 1917d290a..e214a56f0 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_paragraphs.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_paragraphs.php @@ -5,16 +5,15 @@ * @package Smarty * @subpackage PluginsModifierCompiler */ - /** * Smarty count_paragraphs modifier plugin * Type: modifier * Name: count_paragraphs * Purpose: count the number of paragraphs in a text * - * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php + * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php * count_paragraphs (Smarty online manual) - * @author Uwe Tews + * @author Uwe Tews * * @param array $params parameters * diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_sentences.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_sentences.php index a782d8e0b..027745635 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_sentences.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_sentences.php @@ -5,16 +5,15 @@ * @package Smarty * @subpackage PluginsModifierCompiler */ - /** * Smarty count_sentences modifier plugin * Type: modifier * Name: count_sentences * Purpose: count the number of sentences in a text * - * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php + * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php * count_sentences (Smarty online manual) - * @author Uwe Tews + * @author Uwe Tews * * @param array $params parameters * diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_words.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_words.php index dc8500c75..6d889da5c 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_words.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.count_words.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsModifierCompiler */ - /** * Smarty count_words modifier plugin * Type: modifier diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.default.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.default.php index 9fe5d4da2..ae886c4b2 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.default.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.default.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsModifierCompiler */ - /** * Smarty default modifier plugin * Type: modifier @@ -25,11 +24,9 @@ function smarty_modifiercompiler_default($params) if (!isset($params[ 1 ])) { $params[ 1 ] = "''"; } - array_shift($params); foreach ($params as $param) { $output = '(($tmp = @' . $output . ')===null||$tmp===\'\' ? ' . $param . ' : $tmp)'; } - return $output; } diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.escape.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.escape.php index 6a6e01637..e0763adce 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.escape.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.escape.php @@ -14,8 +14,8 @@ * @link http://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual) * @author Rodney Rehm * - * @param array $params parameters - * @param Smarty_Internal_TemplateCompilerBase $compiler + * @param array $params parameters + * @param Smarty_Internal_TemplateCompilerBase $compiler * * @return string with compiled code * @throws \SmartyException @@ -24,21 +24,24 @@ function smarty_modifiercompiler_escape($params, Smarty_Internal_TemplateCompile { static $_double_encode = null; static $is_loaded = false; - $compiler->template->_checkPlugins(array(array('function' => 'smarty_literal_compiler_param', - 'file' => SMARTY_PLUGINS_DIR . 'shared.literal_compiler_param.php'))); + $compiler->template->_checkPlugins( + array( + array( + 'function' => 'smarty_literal_compiler_param', + 'file' => SMARTY_PLUGINS_DIR . 'shared.literal_compiler_param.php' + ) + ) + ); if ($_double_encode === null) { $_double_encode = version_compare(PHP_VERSION, '5.2.3', '>='); } - try { $esc_type = smarty_literal_compiler_param($params, 1, 'html'); $char_set = smarty_literal_compiler_param($params, 2, Smarty::$_CHARSET); $double_encode = smarty_literal_compiler_param($params, 3, true); - if (!$char_set) { $char_set = Smarty::$_CHARSET; } - switch ($esc_type) { case 'html': if ($_double_encode) { @@ -49,7 +52,7 @@ function smarty_modifiercompiler_escape($params, Smarty_Internal_TemplateCompile } else { // fall back to modifier.escape.php } - + // no break case 'htmlall': if (Smarty::$_MBSTRING) { if ($_double_encode) { @@ -65,7 +68,6 @@ function smarty_modifiercompiler_escape($params, Smarty_Internal_TemplateCompile // fall back to modifier.escape.php } } - // no MBString fallback if ($_double_encode) { // php >=5.2.3 - go native @@ -77,27 +79,23 @@ function smarty_modifiercompiler_escape($params, Smarty_Internal_TemplateCompile } else { // fall back to modifier.escape.php } - + // no break case 'url': return 'rawurlencode(' . $params[ 0 ] . ')'; - case 'urlpathinfo': return 'str_replace("%2F", "/", rawurlencode(' . $params[ 0 ] . '))'; - case 'quotes': // escape unescaped single quotes return 'preg_replace("%(?<!\\\\\\\\)\'%", "\\\'",' . $params[ 0 ] . ')'; - case 'javascript': // escape quotes and backslashes, newlines, etc. - return 'strtr(' . $params[ 0 ] . + return 'strtr(' . + $params[ 0 ] . ', array("\\\\" => "\\\\\\\\", "\'" => "\\\\\'", "\"" => "\\\\\"", "\\r" => "\\\\r", "\\n" => "\\\n", "</" => "<\/" ))'; } - } - catch (SmartyException $e) { + } catch (SmartyException $e) { // pass through to regular plugin fallback } - // could not optimize |escape call, so fallback to regular plugin if ($compiler->template->caching && ($compiler->tag_nocache | $compiler->nocache)) { $compiler->required_plugins[ 'nocache' ][ 'escape' ][ 'modifier' ][ 'file' ] = @@ -110,6 +108,5 @@ function smarty_modifiercompiler_escape($params, Smarty_Internal_TemplateCompile $compiler->required_plugins[ 'compiled' ][ 'escape' ][ 'modifier' ][ 'function' ] = 'smarty_modifier_escape'; } - return 'smarty_modifier_escape(' . join(', ', $params) . ')'; } diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.from_charset.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.from_charset.php index b5732db42..acce7784b 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.from_charset.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.from_charset.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsModifierCompiler */ - /** * Smarty from_charset modifier plugin * Type: modifier @@ -24,10 +23,8 @@ function smarty_modifiercompiler_from_charset($params) // FIXME: (rodneyrehm) shouldn't this throw an error? return $params[ 0 ]; } - if (!isset($params[ 1 ])) { $params[ 1 ] = '"ISO-8859-1"'; } - return 'mb_convert_encoding(' . $params[ 0 ] . ', "' . addslashes(Smarty::$_CHARSET) . '", ' . $params[ 1 ] . ')'; } diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.indent.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.indent.php index fede8aa74..2088ad6a8 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.indent.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.indent.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsModifierCompiler */ - /** * Smarty indent modifier plugin * Type: modifier @@ -19,7 +18,6 @@ * * @return string with compiled code */ - function smarty_modifiercompiler_indent($params) { if (!isset($params[ 1 ])) { @@ -28,6 +26,5 @@ function smarty_modifiercompiler_indent($params) if (!isset($params[ 2 ])) { $params[ 2 ] = "' '"; } - return 'preg_replace(\'!^!m\',str_repeat(' . $params[ 2 ] . ',' . $params[ 1 ] . '),' . $params[ 0 ] . ')'; } diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.lower.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.lower.php index 8c6c26a89..0d899a002 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.lower.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.lower.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsModifierCompiler */ - /** * Smarty lower modifier plugin * Type: modifier @@ -20,7 +19,6 @@ * * @return string with compiled code */ - function smarty_modifiercompiler_lower($params) { if (Smarty::$_MBSTRING) { diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.noprint.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.noprint.php index 455cfe14b..1275190e0 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.noprint.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.noprint.php @@ -5,14 +5,13 @@ * @package Smarty * @subpackage PluginsModifierCompiler */ - /** * Smarty noprint modifier plugin * Type: modifier * Name: noprint * Purpose: return an empty string * - * @author Uwe Tews + * @author Uwe Tews * @return string with compiled code */ function smarty_modifiercompiler_noprint() diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.string_format.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.string_format.php index 8d3bfa4e2..663094311 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.string_format.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.string_format.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsModifierCompiler */ - /** * Smarty string_format modifier plugin * Type: modifier diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.strip.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.strip.php index 3b7ade5ed..04ea332c5 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.strip.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.strip.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsModifierCompiler */ - /** * Smarty strip modifier plugin * Type: modifier @@ -22,12 +21,10 @@ * * @return string with compiled code */ - function smarty_modifiercompiler_strip($params) { if (!isset($params[ 1 ])) { $params[ 1 ] = "' '"; } - return "preg_replace('!\s+!" . Smarty::$_UTF8_MODIFIER . "', {$params[1]},{$params[0]})"; } diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.strip_tags.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.strip_tags.php index 5ddca7a94..1bca1a28e 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.strip_tags.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.strip_tags.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsModifierCompiler */ - /** * Smarty strip_tags modifier plugin * Type: modifier diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.to_charset.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.to_charset.php index 889005712..d652eab1b 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.to_charset.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.to_charset.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsModifierCompiler */ - /** * Smarty to_charset modifier plugin * Type: modifier @@ -24,10 +23,8 @@ function smarty_modifiercompiler_to_charset($params) // FIXME: (rodneyrehm) shouldn't this throw an error? return $params[ 0 ]; } - if (!isset($params[ 1 ])) { $params[ 1 ] = '"ISO-8859-1"'; } - return 'mb_convert_encoding(' . $params[ 0 ] . ', ' . $params[ 1 ] . ', "' . addslashes(Smarty::$_CHARSET) . '")'; } diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.unescape.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.unescape.php index 5a94e0727..05beb81f5 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.unescape.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.unescape.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsModifierCompiler */ - /** * Smarty unescape modifier plugin * Type: modifier @@ -28,22 +27,17 @@ function smarty_modifiercompiler_unescape($params) } else { $params[ 2 ] = "'{$params[ 2 ]}'"; } - switch (trim($params[ 1 ], '"\'')) { case 'entity': case 'htmlall': if (Smarty::$_MBSTRING) { return 'mb_convert_encoding(' . $params[ 0 ] . ', ' . $params[ 2 ] . ', \'HTML-ENTITIES\')'; } - return 'html_entity_decode(' . $params[ 0 ] . ', ENT_NOQUOTES, ' . $params[ 2 ] . ')'; - case 'html': return 'htmlspecialchars_decode(' . $params[ 0 ] . ', ENT_QUOTES)'; - case 'url': return 'rawurldecode(' . $params[ 0 ] . ')'; - default: return $params[ 0 ]; } diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.upper.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.upper.php index d0d5cc7c3..ea4e95b7a 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.upper.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.upper.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsModifierCompiler */ - /** * Smarty upper modifier plugin * Type: modifier diff --git a/vendor/smarty/smarty/libs/plugins/modifiercompiler.wordwrap.php b/vendor/smarty/smarty/libs/plugins/modifiercompiler.wordwrap.php index 94a0cf602..8565f140e 100644 --- a/vendor/smarty/smarty/libs/plugins/modifiercompiler.wordwrap.php +++ b/vendor/smarty/smarty/libs/plugins/modifiercompiler.wordwrap.php @@ -33,7 +33,7 @@ function smarty_modifiercompiler_wordwrap($params, Smarty_Internal_TemplateCompi } $function = 'wordwrap'; if (Smarty::$_MBSTRING) { - $function = $compiler->getPlugin('mb_wordwrap','modifier'); + $function = $compiler->getPlugin('mb_wordwrap', 'modifier'); } return $function . '(' . $params[ 0 ] . ',' . $params[ 1 ] . ',' . $params[ 2 ] . ',' . $params[ 3 ] . ')'; } diff --git a/vendor/smarty/smarty/libs/plugins/outputfilter.trimwhitespace.php b/vendor/smarty/smarty/libs/plugins/outputfilter.trimwhitespace.php index 70a66d3da..7e4503a1c 100644 --- a/vendor/smarty/smarty/libs/plugins/outputfilter.trimwhitespace.php +++ b/vendor/smarty/smarty/libs/plugins/outputfilter.trimwhitespace.php @@ -5,85 +5,85 @@ * @package Smarty * @subpackage PluginsFilter */ - /** * Smarty trimwhitespace outputfilter plugin * Trim unnecessary whitespace from HTML markup. * - * @author Rodney Rehm + * @author Rodney Rehm * * @param string $source input string * * @return string filtered output - * @todo substr_replace() is not overloaded by mbstring.func_overload - so this function might fail! + * @todo substr_replace() is not overloaded by mbstring.func_overload - so this function might fail! */ function smarty_outputfilter_trimwhitespace($source) { $store = array(); $_store = 0; $_offset = 0; - // Unify Line-Breaks to \n $source = preg_replace('/\015\012|\015|\012/', "\n", $source); - // capture Internet Explorer and KnockoutJS Conditional Comments - if (preg_match_all('#<!--((\[[^\]]+\]>.*?<!\[[^\]]+\])|(\s*/?ko\s+.+))-->#is', $source, $matches, - PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { + if (preg_match_all( + '#<!--((\[[^\]]+\]>.*?<!\[[^\]]+\])|(\s*/?ko\s+.+))-->#is', + $source, + $matches, + PREG_OFFSET_CAPTURE | PREG_SET_ORDER + ) + ) { foreach ($matches as $match) { $store[] = $match[ 0 ][ 0 ]; $_length = strlen($match[ 0 ][ 0 ]); $replace = '@!@SMARTY:' . $_store . ':SMARTY@!@'; $source = substr_replace($source, $replace, $match[ 0 ][ 1 ] - $_offset, $_length); - $_offset += $_length - strlen($replace); - $_store ++; + $_store++; } } - // Strip all HTML-Comments // yes, even the ones in <script> - see http://stackoverflow.com/a/808850/515124 $source = preg_replace('#<!--.*?-->#ms', '', $source); - // capture html elements not to be messed with $_offset = 0; - if (preg_match_all('#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is', - $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { + if (preg_match_all( + '#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is', + $source, + $matches, + PREG_OFFSET_CAPTURE | PREG_SET_ORDER + ) + ) { foreach ($matches as $match) { $store[] = $match[ 0 ][ 0 ]; $_length = strlen($match[ 0 ][ 0 ]); $replace = '@!@SMARTY:' . $_store . ':SMARTY@!@'; $source = substr_replace($source, $replace, $match[ 0 ][ 1 ] - $_offset, $_length); - $_offset += $_length - strlen($replace); - $_store ++; + $_store++; } } - $expressions = array(// replace multiple spaces between tags by a single space // can't remove them entirely, becaue that might break poorly implemented CSS display:inline-block elements - '#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s' => '\1 \2', + '#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s' => '\1 \2', // remove spaces between attributes (but not in attribute values!) '#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5', // note: for some very weird reason trim() seems to remove spaces inside attributes. // maybe a \0 byte or something is interfering? - '#^\s+<#Ss' => '<', '#>\s+$#Ss' => '>',); - + '#^\s+<#Ss' => '<', + '#>\s+$#Ss' => '>', + ); $source = preg_replace(array_keys($expressions), array_values($expressions), $source); // note: for some very weird reason trim() seems to remove spaces inside attributes. // maybe a \0 byte or something is interfering? // $source = trim( $source ); - $_offset = 0; if (preg_match_all('#@!@SMARTY:([0-9]+):SMARTY@!@#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { foreach ($matches as $match) { $_length = strlen($match[ 0 ][ 0 ]); $replace = $store[ $match[ 1 ][ 0 ] ]; $source = substr_replace($source, $replace, $match[ 0 ][ 1 ] + $_offset, $_length); - $_offset += strlen($replace) - $_length; - $_store ++; + $_store++; } } - return $source; } diff --git a/vendor/smarty/smarty/libs/plugins/shared.escape_special_chars.php b/vendor/smarty/smarty/libs/plugins/shared.escape_special_chars.php index 1d4c7284b..6b18d3eec 100644 --- a/vendor/smarty/smarty/libs/plugins/shared.escape_special_chars.php +++ b/vendor/smarty/smarty/libs/plugins/shared.escape_special_chars.php @@ -5,16 +5,15 @@ * @package Smarty * @subpackage PluginsShared */ - /** * escape_special_chars common function * Function: smarty_function_escape_special_chars * Purpose: used by other smarty functions to escape * special chars except for already escaped ones * - * @author Monte Ohrt <monte at ohrt dot com> + * @author Monte Ohrt <monte at ohrt dot com> * - * @param string $string text that should by escaped + * @param string $string text that should by escaped * * @return string */ @@ -29,6 +28,5 @@ function smarty_function_escape_special_chars($string) $string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string); } } - return $string; } diff --git a/vendor/smarty/smarty/libs/plugins/shared.literal_compiler_param.php b/vendor/smarty/smarty/libs/plugins/shared.literal_compiler_param.php index 8a3711d30..65caf03c8 100644 --- a/vendor/smarty/smarty/libs/plugins/shared.literal_compiler_param.php +++ b/vendor/smarty/smarty/libs/plugins/shared.literal_compiler_param.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsShared */ - /** * evaluate compiler parameter * @@ -25,12 +24,12 @@ function smarty_literal_compiler_param($params, $index, $default = null) } // test if param is a literal if (!preg_match('/^([\'"]?)[a-zA-Z0-9-]+(\\1)$/', $params[ $index ])) { - throw new SmartyException('$param[' . $index . - '] is not a literal and is thus not evaluatable at compile time'); + throw new SmartyException( + '$param[' . $index . + '] is not a literal and is thus not evaluatable at compile time' + ); } - $t = null; eval("\$t = " . $params[ $index ] . ";"); - return $t; } diff --git a/vendor/smarty/smarty/libs/plugins/shared.make_timestamp.php b/vendor/smarty/smarty/libs/plugins/shared.make_timestamp.php index eb064607d..9626dc68e 100644 --- a/vendor/smarty/smarty/libs/plugins/shared.make_timestamp.php +++ b/vendor/smarty/smarty/libs/plugins/shared.make_timestamp.php @@ -5,12 +5,11 @@ * @package Smarty * @subpackage PluginsShared */ - /** * Function: smarty_make_timestamp * Purpose: used by other smarty functions to make a timestamp from a string. * - * @author Monte Ohrt <monte at ohrt dot com> + * @author Monte Ohrt <monte at ohrt dot com> * * @param DateTime|int|string $string date object, timestamp or string that can be converted using strtotime() * @@ -21,25 +20,30 @@ function smarty_make_timestamp($string) if (empty($string)) { // use "now": return time(); - } elseif ($string instanceof DateTime || - (interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface) + } elseif ($string instanceof DateTime + || (interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface) ) { - return (int) $string->format('U'); // PHP 5.2 BC + return (int)$string->format('U'); // PHP 5.2 BC } elseif (strlen($string) === 14 && ctype_digit($string)) { // it is mysql timestamp format of YYYYMMDDHHMMSS? - return mktime(substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2), substr($string, 4, 2), - substr($string, 6, 2), substr($string, 0, 4)); + return mktime( + substr($string, 8, 2), + substr($string, 10, 2), + substr($string, 12, 2), + substr($string, 4, 2), + substr($string, 6, 2), + substr($string, 0, 4) + ); } elseif (is_numeric($string)) { // it is a numeric string, we handle it as timestamp - return (int) $string; + return (int)$string; } else { // strtotime should handle it $time = strtotime($string); - if ($time === - 1 || $time === false) { + if ($time === -1 || $time === false) { // strtotime() was not able to parse $string, use "now": return time(); } - return $time; } } diff --git a/vendor/smarty/smarty/libs/plugins/shared.mb_str_replace.php b/vendor/smarty/smarty/libs/plugins/shared.mb_str_replace.php index 300702933..206cf9ea6 100644 --- a/vendor/smarty/smarty/libs/plugins/shared.mb_str_replace.php +++ b/vendor/smarty/smarty/libs/plugins/shared.mb_str_replace.php @@ -9,10 +9,10 @@ if (!function_exists('smarty_mb_str_replace')) { /** * Multibyte string replace * - * @param string|string[] $search the string to be searched - * @param string|string[] $replace the replacement string - * @param string $subject the source string - * @param int &$count number of matches found + * @param string|string[] $search the string to be searched + * @param string|string[] $replace the replacement string + * @param string $subject the source string + * @param int &$count number of matches found * * @return string replaced string * @author Rodney Rehm @@ -28,7 +28,7 @@ if (!function_exists('smarty_mb_str_replace')) { $string = smarty_mb_str_replace($search, $replace, $string, $c); $count += $c; } - } else if (is_array($search)) { + } elseif (is_array($search)) { if (!is_array($replace)) { foreach ($search as &$string) { $subject = smarty_mb_str_replace($string, $replace, $subject, $c); diff --git a/vendor/smarty/smarty/libs/plugins/shared.mb_unicode.php b/vendor/smarty/smarty/libs/plugins/shared.mb_unicode.php index 7450148a4..7d1206506 100644 --- a/vendor/smarty/smarty/libs/plugins/shared.mb_unicode.php +++ b/vendor/smarty/smarty/libs/plugins/shared.mb_unicode.php @@ -5,7 +5,6 @@ * @package Smarty * @subpackage PluginsShared */ - /** * convert characters to their decimal unicode equivalents * @@ -24,7 +23,6 @@ function smarty_mb_to_unicode($string, $encoding = null) } else { $expanded = mb_convert_encoding($string, 'UTF-32BE'); } - return unpack('N*', $expanded); } @@ -45,10 +43,9 @@ function smarty_mb_from_unicode($unicode, $encoding = null) if (!$encoding) { $encoding = mb_internal_encoding(); } - foreach ((array) $unicode as $utf32be) { + foreach ((array)$unicode as $utf32be) { $character = pack('N*', $utf32be); $t .= mb_convert_encoding($character, $encoding, 'UTF-32BE'); } - return $t; } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource.php b/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource.php index 2a4552cb2..91e9f3924 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource.php @@ -25,12 +25,12 @@ abstract class Smarty_CacheResource /** * populate Cached Object with meta data from Resource * - * @param Smarty_Template_Cached $cached cached object + * @param \Smarty_Template_Cached $cached cached object * @param Smarty_Internal_Template $_template template object * * @return void */ - abstract public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template); + abstract public function populate(\Smarty_Template_Cached $cached, Smarty_Internal_Template $_template); /** * populate Cached Object with timestamp and exists from Resource @@ -50,8 +50,11 @@ abstract class Smarty_CacheResource * * @return boolean true or false if the cached content does not exist */ - abstract public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached = null, - $update = false); + abstract public function process( + Smarty_Internal_Template $_template, + Smarty_Template_Cached $cached = null, + $update = false + ); /** * Write the rendered template output to cache @@ -66,11 +69,11 @@ abstract class Smarty_CacheResource /** * Read cached template from cache * - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Internal_Template $_template template object * * @return string content */ - abstract function readCachedContent(Smarty_Internal_Template $_template); + abstract public function readCachedContent(Smarty_Internal_Template $_template); /** * Return cached content @@ -87,7 +90,6 @@ abstract class Smarty_CacheResource $unifunc($_template); return ob_get_clean(); } - return null; } @@ -133,7 +135,6 @@ abstract class Smarty_CacheResource } sleep(1); } - return $hadLock; } @@ -193,12 +194,10 @@ abstract class Smarty_CacheResource if (!isset($type)) { $type = $smarty->caching_type; } - // try smarty's cache if (isset($smarty->_cache[ 'cacheresource_handlers' ][ $type ])) { return $smarty->_cache[ 'cacheresource_handlers' ][ $type ]; } - // try registered resource if (isset($smarty->registered_cache_resources[ $type ])) { // do not cache these instances as they may vary from instance to instance diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource_custom.php b/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource_custom.php index 7a5920f43..68ad11289 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource_custom.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource_custom.php @@ -18,12 +18,12 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource /** * fetch cached content and its modification time from data source * - * @param string $id unique cache content identifier - * @param string $name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param string $content cached content - * @param integer $mtime cache modification timestamp (epoch) + * @param string $id unique cache content identifier + * @param string $name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param string $content cached content + * @param integer $mtime cache modification timestamp (epoch) * * @return void */ @@ -34,10 +34,10 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource * {@internal implementing this method is optional. * Only implement it if modification times can be accessed faster than loading the complete cached content.}} * - * @param string $id unique cache content identifier - * @param string $name template name - * @param string $cache_id cache id - * @param string $compile_id compile id + * @param string $id unique cache content identifier + * @param string $name template name + * @param string $cache_id cache id + * @param string $compile_id compile id * * @return integer|boolean timestamp (epoch) the template was modified, or false if not found */ @@ -49,12 +49,12 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource /** * Save content to cache * - * @param string $id unique cache content identifier - * @param string $name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param integer|null $exp_time seconds till expiration or null - * @param string $content content to cache + * @param string $id unique cache content identifier + * @param string $name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param integer|null $exp_time seconds till expiration or null + * @param string $content content to cache * * @return boolean success */ @@ -63,10 +63,10 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource /** * Delete content from cache * - * @param string|null $name template name - * @param string|null $cache_id cache id - * @param string|null $compile_id compile id - * @param integer|null $exp_time seconds till expiration time in seconds or null + * @param string|null $name template name + * @param string|null $cache_id cache id + * @param string|null $compile_id compile id + * @param integer|null $exp_time seconds till expiration time in seconds or null * * @return integer number of deleted caches */ @@ -75,8 +75,8 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource /** * populate Cached Object with meta data from Resource * - * @param Smarty_Template_Cached $cached cached object - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Template_Cached $cached cached object + * @param Smarty_Internal_Template $_template template object * * @return void */ @@ -106,12 +106,17 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource if ($mtime !== null) { $cached->timestamp = $mtime; $cached->exists = !!$cached->timestamp; - return; } $timestamp = null; - $this->fetch($cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id, $cached->content, - $timestamp); + $this->fetch( + $cached->filepath, + $cached->source->name, + $cached->cache_id, + $cached->compile_id, + $cached->content, + $timestamp + ); $cached->timestamp = isset($timestamp) ? $timestamp : false; $cached->exists = !!$cached->timestamp; } @@ -120,50 +125,63 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource * Read the cached template and process the header * * @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template - * @param Smarty_Template_Cached $cached cached object + * @param Smarty_Template_Cached $cached cached object * @param boolean $update flag if called because cache update * * @return boolean true or false if the cached content does not exist */ - public function process(Smarty_Internal_Template $_smarty_tpl, Smarty_Template_Cached $cached = null, - $update = false) - { + public function process( + Smarty_Internal_Template $_smarty_tpl, + Smarty_Template_Cached $cached = null, + $update = false + ) { if (!$cached) { $cached = $_smarty_tpl->cached; } $content = $cached->content ? $cached->content : null; $timestamp = $cached->timestamp ? $cached->timestamp : null; if ($content === null || !$timestamp) { - $this->fetch($_smarty_tpl->cached->filepath, $_smarty_tpl->source->name, $_smarty_tpl->cache_id, - $_smarty_tpl->compile_id, $content, $timestamp); + $this->fetch( + $_smarty_tpl->cached->filepath, + $_smarty_tpl->source->name, + $_smarty_tpl->cache_id, + $_smarty_tpl->compile_id, + $content, + $timestamp + ); } if (isset($content)) { eval('?>' . $content); $cached->content = null; return true; } - return false; } /** * Write the rendered template output to cache * - * @param Smarty_Internal_Template $_template template object - * @param string $content content to cache + * @param Smarty_Internal_Template $_template template object + * @param string $content content to cache * * @return boolean success */ public function writeCachedContent(Smarty_Internal_Template $_template, $content) { - return $this->save($_template->cached->filepath, $_template->source->name, $_template->cache_id, - $_template->compile_id, $_template->cache_lifetime, $content); + return $this->save( + $_template->cached->filepath, + $_template->source->name, + $_template->cache_id, + $_template->compile_id, + $_template->cache_lifetime, + $content + ); } /** * Read cached template from cache * - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Internal_Template $_template template object * * @return string|boolean content */ @@ -173,8 +191,14 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource $timestamp = null; if ($content === null) { $timestamp = null; - $this->fetch($_template->cached->filepath, $_template->source->name, $_template->cache_id, - $_template->compile_id, $content, $timestamp); + $this->fetch( + $_template->cached->filepath, + $_template->source->name, + $_template->cache_id, + $_template->compile_id, + $content, + $timestamp + ); } if (isset($content)) { return $content; @@ -185,8 +209,8 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource /** * Empty cache * - * @param Smarty $smarty Smarty object - * @param integer $exp_time expiration time (number of seconds, not timestamp) + * @param Smarty $smarty Smarty object + * @param integer $exp_time expiration time (number of seconds, not timestamp) * * @return integer number of cache files deleted */ @@ -198,11 +222,11 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource /** * Empty cache for a specific template * - * @param Smarty $smarty Smarty object - * @param string $resource_name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param integer $exp_time expiration time (number of seconds, not timestamp) + * @param Smarty $smarty Smarty object + * @param string $resource_name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param integer $exp_time expiration time (number of seconds, not timestamp) * * @return int number of cache files deleted * @throws \SmartyException @@ -210,7 +234,6 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time) { $cache_name = null; - if (isset($resource_name)) { $source = Smarty_Template_Source::load(null, $smarty, $resource_name); if ($source->exists) { @@ -219,15 +242,14 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource return 0; } } - return $this->delete($cache_name, $cache_id, $compile_id, $exp_time); } /** * Check is cache is locked for this template * - * @param Smarty $smarty Smarty object - * @param Smarty_Template_Cached $cached cached object + * @param Smarty $smarty Smarty object + * @param Smarty_Template_Cached $cached cached object * * @return boolean true or false if cache is locked */ @@ -235,7 +257,6 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource { $id = $cached->lock_id; $name = $cached->source->name . '.lock'; - $mtime = $this->fetchTimestamp($id, $name, $cached->cache_id, $cached->compile_id); if ($mtime === null) { $this->fetch($id, $name, $cached->cache_id, $cached->compile_id, $content, $mtime); diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php b/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php index ff065a278..59bf1d4a8 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php @@ -47,8 +47,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * populate Cached Object with meta data from Resource * - * @param Smarty_Template_Cached $cached cached object - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Template_Cached $cached cached object + * @param Smarty_Internal_Template $_template template object * * @return void */ @@ -56,26 +56,32 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource { $cached->filepath = $_template->source->uid . '#' . $this->sanitize($cached->source->resource) . '#' . $this->sanitize($cached->cache_id) . '#' . $this->sanitize($cached->compile_id); - $this->populateTimestamp($cached); } /** * populate Cached Object with timestamp and exists from Resource * - * @param Smarty_Template_Cached $cached cached object + * @param Smarty_Template_Cached $cached cached object * * @return void */ public function populateTimestamp(Smarty_Template_Cached $cached) { - if (!$this->fetch($cached->filepath, $cached->source->name, $cached->cache_id, $cached->compile_id, $content, - $timestamp, $cached->source->uid) + if (!$this->fetch( + $cached->filepath, + $cached->source->name, + $cached->cache_id, + $cached->compile_id, + $content, + $timestamp, + $cached->source->uid + ) ) { return; } $cached->content = $content; - $cached->timestamp = (int) $timestamp; + $cached->timestamp = (int)$timestamp; $cached->exists = !!$cached->timestamp; } @@ -83,54 +89,60 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource * Read the cached template and process the header * * @param \Smarty_Internal_Template $_smarty_tpl do not change variable name, is used by compiled template - * @param Smarty_Template_Cached $cached cached object + * @param Smarty_Template_Cached $cached cached object * @param boolean $update flag if called because cache update * * @return boolean true or false if the cached content does not exist */ - public function process(Smarty_Internal_Template $_smarty_tpl, Smarty_Template_Cached $cached = null, - $update = false) - { + public function process( + Smarty_Internal_Template $_smarty_tpl, + Smarty_Template_Cached $cached = null, + $update = false + ) { if (!$cached) { $cached = $_smarty_tpl->cached; } $content = $cached->content ? $cached->content : null; $timestamp = $cached->timestamp ? $cached->timestamp : null; if ($content === null || !$timestamp) { - if (!$this->fetch($_smarty_tpl->cached->filepath, $_smarty_tpl->source->name, $_smarty_tpl->cache_id, - $_smarty_tpl->compile_id, $content, $timestamp, $_smarty_tpl->source->uid) + if (!$this->fetch( + $_smarty_tpl->cached->filepath, + $_smarty_tpl->source->name, + $_smarty_tpl->cache_id, + $_smarty_tpl->compile_id, + $content, + $timestamp, + $_smarty_tpl->source->uid + ) ) { return false; } } if (isset($content)) { eval('?>' . $content); - return true; } - return false; } /** * Write the rendered template output to cache * - * @param Smarty_Internal_Template $_template template object - * @param string $content content to cache + * @param Smarty_Internal_Template $_template template object + * @param string $content content to cache * * @return boolean success */ public function writeCachedContent(Smarty_Internal_Template $_template, $content) { $this->addMetaTimestamp($content); - return $this->write(array($_template->cached->filepath => $content), $_template->cache_lifetime); } /** * Read cached template from cache * - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Internal_Template $_template template object * * @return string|false content */ @@ -139,8 +151,15 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource $content = $_template->cached->content ? $_template->cached->content : null; $timestamp = null; if ($content === null) { - if (!$this->fetch($_template->cached->filepath, $_template->source->name, $_template->cache_id, - $_template->compile_id, $content, $timestamp, $_template->source->uid) + if (!$this->fetch( + $_template->cached->filepath, + $_template->source->name, + $_template->cache_id, + $_template->compile_id, + $content, + $timestamp, + $_template->source->uid + ) ) { return false; } @@ -155,36 +174,36 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource * Empty cache * {@internal the $exp_time argument is ignored altogether }} * - * @param Smarty $smarty Smarty object - * @param integer $exp_time expiration time [being ignored] + * @param Smarty $smarty Smarty object + * @param integer $exp_time expiration time [being ignored] * * @return integer number of cache files deleted [always -1] - * @uses purge() to clear the whole store - * @uses invalidate() to mark everything outdated if purge() is inapplicable + * @uses purge() to clear the whole store + * @uses invalidate() to mark everything outdated if purge() is inapplicable */ public function clearAll(Smarty $smarty, $exp_time = null) { if (!$this->purge()) { $this->invalidate(null); } - return - 1; + return -1; } /** * Empty cache for a specific template * {@internal the $exp_time argument is ignored altogether}} * - * @param Smarty $smarty Smarty object - * @param string $resource_name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param integer $exp_time expiration time [being ignored] + * @param Smarty $smarty Smarty object + * @param string $resource_name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param integer $exp_time expiration time [being ignored] * * @return int number of cache files deleted [always -1] * @throws \SmartyException - * @uses buildCachedFilepath() to generate the CacheID - * @uses invalidate() to mark CacheIDs parent chain as outdated - * @uses delete() to remove CacheID from cache + * @uses buildCachedFilepath() to generate the CacheID + * @uses invalidate() to mark CacheIDs parent chain as outdated + * @uses delete() to remove CacheID from cache */ public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time) { @@ -193,18 +212,17 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource $this->sanitize($compile_id); $this->delete(array($cid)); $this->invalidate($cid, $resource_name, $cache_id, $compile_id, $uid); - return - 1; + return -1; } /** * Get template's unique ID * - * @param Smarty $smarty Smarty object - * @param string $resource_name template name + * @param Smarty $smarty Smarty object + * @param string $resource_name template name * * @return string filepath of cache file * @throws \SmartyException - * */ protected function getTemplateUid(Smarty $smarty, $resource_name) { @@ -220,7 +238,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Sanitize CacheID components * - * @param string $string CacheID component to sanitize + * @param string $string CacheID component to sanitize * * @return string sanitized CacheID component */ @@ -236,23 +254,28 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Fetch and prepare a cache object. * - * @param string $cid CacheID to fetch - * @param string $resource_name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param string $content cached content - * @param integer &$timestamp cached timestamp (epoch) - * @param string $resource_uid resource's uid + * @param string $cid CacheID to fetch + * @param string $resource_name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param string $content cached content + * @param integer &$timestamp cached timestamp (epoch) + * @param string $resource_uid resource's uid * * @return boolean success */ - protected function fetch($cid, $resource_name = null, $cache_id = null, $compile_id = null, &$content = null, - &$timestamp = null, $resource_uid = null) - { + protected function fetch( + $cid, + $resource_name = null, + $cache_id = null, + $compile_id = null, + &$content = null, + &$timestamp = null, + $resource_uid = null + ) { $t = $this->read(array($cid)); $content = !empty($t[ $cid ]) ? $t[ $cid ] : null; $timestamp = null; - if ($content && ($timestamp = $this->getMetaTimestamp($content))) { $invalidated = $this->getLatestInvalidationTimestamp($cid, $resource_name, $cache_id, $compile_id, $resource_uid); @@ -261,7 +284,6 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource $content = null; } } - return !!$content; } @@ -274,14 +296,14 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource protected function addMetaTimestamp(&$content) { $mt = explode(' ', microtime()); - $ts = pack('NN', $mt[ 1 ], (int) ($mt[ 0 ] * 100000000)); + $ts = pack('NN', $mt[ 1 ], (int)($mt[ 0 ] * 100000000)); $content = $ts . $content; } /** * Extract the timestamp the $content was cached * - * @param string &$content the cached content + * @param string &$content the cached content * * @return float the microtime the content was cached */ @@ -298,17 +320,21 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Invalidate CacheID * - * @param string $cid CacheID - * @param string $resource_name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param string $resource_uid source's uid + * @param string $cid CacheID + * @param string $resource_name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param string $resource_uid source's uid * * @return void */ - protected function invalidate($cid = null, $resource_name = null, $cache_id = null, $compile_id = null, - $resource_uid = null) - { + protected function invalidate( + $cid = null, + $resource_name = null, + $cache_id = null, + $compile_id = null, + $resource_uid = null + ) { $now = microtime(true); $key = null; // invalidate everything @@ -339,17 +365,21 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Determine the latest timestamp known to the invalidation chain * - * @param string $cid CacheID to determine latest invalidation timestamp of - * @param string $resource_name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param string $resource_uid source's filepath + * @param string $cid CacheID to determine latest invalidation timestamp of + * @param string $resource_name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param string $resource_uid source's filepath * * @return float the microtime the CacheID was invalidated */ - protected function getLatestInvalidationTimestamp($cid, $resource_name = null, $cache_id = null, $compile_id = null, - $resource_uid = null) - { + protected function getLatestInvalidationTimestamp( + $cid, + $resource_name = null, + $cache_id = null, + $compile_id = null, + $resource_uid = null + ) { // abort if there is no CacheID if (false && !$cid) { return 0; @@ -358,14 +388,12 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource if (!($_cid = $this->listInvalidationKeys($cid, $resource_name, $cache_id, $compile_id, $resource_uid))) { return 0; } - // there are no InValidationKeys if (!($values = $this->read($_cid))) { return 0; } // make sure we're dealing with floats $values = array_map('floatval', $values); - return max($values); } @@ -373,18 +401,22 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource * Translate a CacheID into the list of applicable InvalidationKeys. * Splits 'some|chain|into|an|array' into array( '#clearAll#', 'some', 'some|chain', 'some|chain|into', ... ) * - * @param string $cid CacheID to translate - * @param string $resource_name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param string $resource_uid source's filepath + * @param string $cid CacheID to translate + * @param string $resource_name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param string $resource_uid source's filepath * * @return array list of InvalidationKeys - * @uses $invalidationKeyPrefix to prepend to each InvalidationKey + * @uses $invalidationKeyPrefix to prepend to each InvalidationKey */ - protected function listInvalidationKeys($cid, $resource_name = null, $cache_id = null, $compile_id = null, - $resource_uid = null) - { + protected function listInvalidationKeys( + $cid, + $resource_name = null, + $cache_id = null, + $compile_id = null, + $resource_uid = null + ) { $t = array('IVK#ALL'); $_name = $_compile = '#'; if ($resource_name) { @@ -416,17 +448,16 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource $t[] = 'IVK#CACHE#' . $part; $t[] = 'IVK#CID' . $_name . $part . $_compile; // skip past delimiter position - $i ++; + $i++; } - return $t; } /** * Check is cache is locked for this template * - * @param Smarty $smarty Smarty object - * @param Smarty_Template_Cached $cached cached object + * @param Smarty $smarty Smarty object + * @param Smarty_Template_Cached $cached cached object * * @return boolean true or false if cache is locked */ @@ -434,7 +465,6 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource { $key = 'LOCK#' . $cached->filepath; $data = $this->read(array($key)); - return $data && time() - $data[ $key ] < $smarty->locking_timeout; } @@ -471,7 +501,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Read values for a set of keys from cache * - * @param array $keys list of keys to fetch + * @param array $keys list of keys to fetch * * @return array list of values with the given keys used as indexes */ @@ -480,8 +510,8 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Save values for a set of keys to cache * - * @param array $keys list of values to save - * @param int $expire expiration time + * @param array $keys list of values to save + * @param int $expire expiration time * * @return boolean true on success, false on failure */ @@ -490,7 +520,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource /** * Remove values from cache * - * @param array $keys list of keys to delete + * @param array $keys list of keys to delete * * @return boolean true on success, false on failure */ diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_data.php b/vendor/smarty/smarty/libs/sysplugins/smarty_data.php index 743b117bf..2545ed3a8 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_data.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_data.php @@ -22,7 +22,7 @@ class Smarty_Data extends Smarty_Internal_Data * * @var int */ - static $count = 0; + public static $count = 0; /** * Data block name @@ -50,7 +50,7 @@ class Smarty_Data extends Smarty_Internal_Data public function __construct($_parent = null, $smarty = null, $name = null) { parent::__construct(); - self::$count ++; + self::$count++; $this->dataObjectName = 'Data_object ' . (isset($name) ? "'{$name}'" : self::$count); $this->smarty = $smarty; if (is_object($_parent)) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_block.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_block.php index 780319f11..9956d642b 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_block.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_block.php @@ -87,4 +87,4 @@ class Smarty_Internal_Block public function callBlock(Smarty_Internal_Template $tpl) { } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php index f6ef09306..61618449d 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php @@ -7,6 +7,7 @@ * @author Uwe Tews * @author Rodney Rehm */ + /** * This class does contain all necessary methods for the HTML cache on file system * Implements the file system as resource for the HTML cache Version ussing nocache inserts. @@ -32,11 +33,17 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource $_filepath = sha1($source->uid . $smarty->_joined_template_dir); $cached->filepath = $smarty->getCacheDir(); if (isset($_template->cache_id)) { - $cached->filepath .= preg_replace(array('![^\w|]+!', - '![|]+!'), - array('_', - $_compile_dir_sep), - $_template->cache_id) . $_compile_dir_sep; + $cached->filepath .= preg_replace( + array( + '![^\w|]+!', + '![|]+!' + ), + array( + '_', + $_compile_dir_sep + ), + $_template->cache_id + ) . $_compile_dir_sep; } if (isset($_template->compile_id)) { $cached->filepath .= preg_replace('![^\w]+!', '_', $_template->compile_id) . $_compile_dir_sep; @@ -87,10 +94,11 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource * * @return boolean true or false if the cached content does not exist */ - public function process(Smarty_Internal_Template $_smarty_tpl, - Smarty_Template_Cached $cached = null, - $update = false) - { + public function process( + Smarty_Internal_Template $_smarty_tpl, + Smarty_Template_Cached $cached = null, + $update = false + ) { $_smarty_tpl->cached->valid = false; if ($update && defined('HHVM_VERSION')) { eval('?>' . file_get_contents($_smarty_tpl->cached->filepath)); @@ -111,15 +119,17 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource */ public function writeCachedContent(Smarty_Internal_Template $_template, $content) { - if ($_template->smarty->ext->_writeFile->writeFile($_template->cached->filepath, - $content, - $_template->smarty) === true + if ($_template->smarty->ext->_writeFile->writeFile( + $_template->cached->filepath, + $content, + $_template->smarty + ) === true ) { - if (function_exists('opcache_invalidate') && - (!function_exists('ini_get') || strlen(ini_get('opcache.restrict_api'))) < 1 + if (function_exists('opcache_invalidate') + && (!function_exists('ini_get') || strlen(ini_get('opcache.restrict_api'))) < 1 ) { opcache_invalidate($_template->cached->filepath, true); - } else if (function_exists('apc_compile_file')) { + } elseif (function_exists('apc_compile_file')) { apc_compile_file($_template->cached->filepath); } $cached = $_template->cached; @@ -135,7 +145,7 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource /** * Read cached template from cache * - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Internal_Template $_template template object * * @return string content */ diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_append.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_append.php index b3689e918..1a9befbf6 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_append.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_append.php @@ -19,9 +19,9 @@ class Smarty_Internal_Compile_Append extends Smarty_Internal_Compile_Assign /** * Compiles code for the {append} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $parameter array with compilation parameter * * @return string compiled code * @throws \SmartyCompilerException diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_assign.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_assign.php index cb2ea4257..4b9984888 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_assign.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_assign.php @@ -24,21 +24,23 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase */ public $option_flags = array('nocache', 'noscope'); - /** + /** * Valid scope names * * @var array */ - public $valid_scopes = array('local' => Smarty::SCOPE_LOCAL, 'parent' => Smarty::SCOPE_PARENT, - 'root' => Smarty::SCOPE_ROOT, 'global' => Smarty::SCOPE_GLOBAL, - 'tpl_root' => Smarty::SCOPE_TPL_ROOT, 'smarty' => Smarty::SCOPE_SMARTY); + public $valid_scopes = array( + 'local' => Smarty::SCOPE_LOCAL, 'parent' => Smarty::SCOPE_PARENT, + 'root' => Smarty::SCOPE_ROOT, 'global' => Smarty::SCOPE_GLOBAL, + 'tpl_root' => Smarty::SCOPE_TPL_ROOT, 'smarty' => Smarty::SCOPE_SMARTY + ); /** * Compiles code for the {assign} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $parameter array with compilation parameter * * @return string compiled code * @throws \SmartyCompilerException @@ -66,7 +68,7 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase } // scope setup if ($_attr[ 'noscope' ]) { - $_scope = - 1; + $_scope = -1; } else { $_scope = $compiler->convertScope($_attr, $this->valid_scopes); } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block.php index 88d6f37e9..8ff15d8e5 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block.php @@ -1,5 +1,5 @@ <?php -/* +/** * This file is part of Smarty. * * (c) 2015 Uwe Tews @@ -22,6 +22,7 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher * @see Smarty_Internal_CompileBase */ public $required_attributes = array('name'); + /** * Attribute definition: Overwrites base class. * @@ -29,6 +30,7 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher * @see Smarty_Internal_CompileBase */ public $shorttag_order = array('name'); + /** * Attribute definition: Overwrites base class. * @@ -36,6 +38,7 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher * @see Smarty_Internal_CompileBase */ public $option_flags = array('hide', 'nocache'); + /** * Attribute definition: Overwrites base class. * @@ -47,10 +50,9 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher /** * Compiles code for the {block} tag * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter - * + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object + * @param array $parameter array with compilation parameter */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) { @@ -67,16 +69,20 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher // check and get attributes $_attr = $this->getAttributes($compiler, $args); ++$compiler->_cache[ 'blockNesting' ]; - $_className = 'Block_' . preg_replace('![^\w]+!', '_', uniqid(rand(), true)); + $_className = 'Block_' . preg_replace('![^\w]+!', '_', uniqid(mt_rand(), true)); $compiler->_cache[ 'blockName' ][ $compiler->_cache[ 'blockNesting' ] ] = $_attr[ 'name' ]; $compiler->_cache[ 'blockClass' ][ $compiler->_cache[ 'blockNesting' ] ] = $_className; $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ] = array(); $compiler->_cache[ 'blockParams' ][ 1 ][ 'subBlocks' ][ trim($_attr[ 'name' ], '"\'') ][] = $_className; - $this->openTag($compiler, - 'block', - array($_attr, $compiler->nocache, $compiler->parser->current_buffer, - $compiler->template->compiled->has_nocache_code, - $compiler->template->caching)); + $this->openTag( + $compiler, + 'block', + array( + $_attr, $compiler->nocache, $compiler->parser->current_buffer, + $compiler->template->compiled->has_nocache_code, + $compiler->template->caching + ) + ); $compiler->saveRequiredPlugins(true); $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); @@ -84,18 +90,18 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inher $compiler->suppressNocacheProcessing = true; } } + /** * Smarty Internal Plugin Compile BlockClose Class - * */ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_Inheritance { /** * Compiles code for the {/block} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $parameter array with compilation parameter * * @return bool true */ @@ -118,13 +124,12 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_ $_functionCode = $compiler->parser->current_buffer; // setup buffer for template function code $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); - $output = "<?php\n"; $output .= "/* {block {$_name}} */\n"; $output .= "class {$_className} extends Smarty_Internal_Block\n"; $output .= "{\n"; foreach ($_block as $property => $value) { - $output .= "public \${$property} = " . var_export($value,true) .";\n"; + $output .= "public \${$property} = " . var_export($value, true) . ";\n"; } $output .= "public function callBlock(Smarty_Internal_Template \$_smarty_tpl) {\n"; $output .= $compiler->compileRequiredPlugins(); @@ -136,9 +141,13 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_ $output .= "ob_start();\n"; } $output .= "?>\n"; - $compiler->parser->current_buffer->append_subtree($compiler->parser, - new Smarty_Internal_ParseTree_Tag($compiler->parser, - $output)); + $compiler->parser->current_buffer->append_subtree( + $compiler->parser, + new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + $output + ) + ); $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode); $output = "<?php\n"; if (isset($_assign)) { @@ -148,9 +157,13 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_ $output .= "}\n"; $output .= "/* {/block {$_name}} */\n\n"; $output .= "?>\n"; - $compiler->parser->current_buffer->append_subtree($compiler->parser, - new Smarty_Internal_ParseTree_Tag($compiler->parser, - $output)); + $compiler->parser->current_buffer->append_subtree( + $compiler->parser, + new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + $output + ) + ); $compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser); $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); // restore old status diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_child.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_child.php index 1708f6482..588d18628 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_child.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_child.php @@ -1,5 +1,5 @@ <?php -/* +/** * This file is part of Smarty. * * (c) 2015 Uwe Tews @@ -21,4 +21,4 @@ class Smarty_Internal_Compile_Block_Child extends Smarty_Internal_Compile_Child * @var string */ public $tag = 'block_child'; -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_parent.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_parent.php index 4f094ad61..97f11ca43 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_parent.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_block_parent.php @@ -1,5 +1,5 @@ <?php -/* +/** * This file is part of Smarty. * * (c) 2015 Uwe Tews @@ -28,4 +28,4 @@ class Smarty_Internal_Compile_Block_Parent extends Smarty_Internal_Compile_Child * @var string */ public $blockType = 'Parent'; -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_break.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_break.php index 09c25d238..1ee8d75d7 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_break.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_break.php @@ -33,16 +33,16 @@ class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase public $shorttag_order = array('levels'); /** - * Tag name may be overloaded by Smarty_Internal_Compile_Continue - * - * @var string - */ + * Tag name may be overloaded by Smarty_Internal_Compile_Continue + * + * @var string + */ public $tag = 'break'; /** * Compiles code for the {break} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code @@ -67,7 +67,7 @@ class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase /** * check attributes and return array of break and foreach levels * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return array @@ -78,11 +78,9 @@ class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase static $_is_loopy = array('for' => true, 'foreach' => true, 'while' => true, 'section' => true); // check and get attributes $_attr = $this->getAttributes($compiler, $args); - if ($_attr[ 'nocache' ] === true) { $compiler->trigger_template_error('nocache option not allowed', null, true); } - if (isset($_attr[ 'levels' ])) { if (!is_numeric($_attr[ 'levels' ])) { $compiler->trigger_template_error('level attribute must be a numeric constant', null, true); @@ -101,18 +99,18 @@ class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase if ($level_count === 0) { break; } - $level_count --; + $level_count--; if ($compiler->_tag_stack[ $stack_count ][ 0 ] === 'foreach') { - $foreachLevels ++; + $foreachLevels++; } } - $stack_count --; + $stack_count--; } if ($level_count !== 0) { $compiler->trigger_template_error("cannot {$this->tag} {$levels} level(s)", null, true); } if ($lastTag === 'foreach' && $this->tag === 'break' && $foreachLevels > 0) { - $foreachLevels --; + $foreachLevels--; } return array($levels, $foreachLevels); } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_call.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_call.php index eb444d357..445cabc60 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_call.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_call.php @@ -43,8 +43,8 @@ class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase /** * Compiles the calls of user defined tags defined by {function} * - * @param array $args array with attributes from parser - * @param object $compiler compiler object + * @param array $args array with attributes from parser + * @param object $compiler compiler object * * @return string compiled code */ diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_capture.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_capture.php index 564b1f63e..a4ffbc9ea 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_capture.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_capture.php @@ -35,29 +35,27 @@ class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase /** * Compiles code for the {$smarty.capture.xxx} * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase$compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object + * @param array $parameter array with compilation parameter * * @return string compiled code - * @throws \SmartyCompilerException */ - public static function compileSpecialVariable($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter = null) - { - $tag = trim($parameter[ 0 ], '"\''); - $name = isset($parameter[ 1 ]) ? $compiler->getId($parameter[ 1 ]) : null; - if (!$name) { - //$compiler->trigger_template_error("missing or illegal \$smarty.{$tag} name attribute", null, true); - } - return '$_smarty_tpl->smarty->ext->_capture->getBuffer($_smarty_tpl'.(isset($name)?", '{$name}')":')'); + public static function compileSpecialVariable( + $args, + Smarty_Internal_TemplateCompilerBase $compiler, + $parameter = null + ) { + return '$_smarty_tpl->smarty->ext->_capture->getBuffer($_smarty_tpl' . + (isset($parameter[ 1 ]) ? ", {$parameter[ 1 ]})" : ')'); } /** * Compiles code for the {capture} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param null $parameter + * @param null $parameter * * @return string compiled code */ @@ -65,16 +63,13 @@ class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase { // check and get attributes $_attr = $this->getAttributes($compiler, $args, $parameter, 'capture'); - $buffer = isset($_attr[ 'name' ]) ? $_attr[ 'name' ] : "'default'"; $assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : 'null'; $append = isset($_attr[ 'append' ]) ? $_attr[ 'append' ] : 'null'; - $compiler->_cache[ 'capture_stack' ][] = array($compiler->nocache); // maybe nocache because of nocache variables $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; $_output = "<?php \$_smarty_tpl->smarty->ext->_capture->open(\$_smarty_tpl, $buffer, $assign, $append);?>"; - return $_output; } } @@ -90,9 +85,9 @@ class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase /** * Compiles code for the {/capture} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param null $parameter + * @param null $parameter * * @return string compiled code */ @@ -104,9 +99,7 @@ class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase if ($compiler->nocache) { $compiler->tag_nocache = true; } - list($compiler->nocache) = array_pop($compiler->_cache[ 'capture_stack' ]); - return "<?php \$_smarty_tpl->smarty->ext->_capture->close(\$_smarty_tpl);?>"; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_child.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_child.php index 8c7bbdf05..f728c18bf 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_child.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_child.php @@ -1,5 +1,5 @@ <?php -/* +/** * This file is part of Smarty. * * (c) 2015 Uwe Tews @@ -40,9 +40,9 @@ class Smarty_Internal_Compile_Child extends Smarty_Internal_CompileBase /** * Compiles code for the {child} tag * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object + * @param array $parameter array with compilation parameter * * @return string compiled code * @throws \SmartyCompilerException @@ -51,10 +51,12 @@ class Smarty_Internal_Compile_Child extends Smarty_Internal_CompileBase { // check and get attributes $_attr = $this->getAttributes($compiler, $args); - $tag = isset($parameter[0]) ? "'{$parameter[0]}'" : "'{{$this->tag}}'"; + $tag = isset($parameter[ 0 ]) ? "'{$parameter[0]}'" : "'{{$this->tag}}'"; if (!isset($compiler->_cache[ 'blockNesting' ])) { - $compiler->trigger_template_error("{$tag} used outside {block} tags ", - $compiler->parser->lex->taglineno); + $compiler->trigger_template_error( + "{$tag} used outside {block} tags ", + $compiler->parser->lex->taglineno + ); } $compiler->has_code = true; $compiler->suppressNocacheProcessing = true; @@ -67,11 +69,11 @@ class Smarty_Internal_Compile_Child extends Smarty_Internal_CompileBase $output .= "ob_start();\n"; } $output .= '$_smarty_tpl->inheritance->call' . $this->blockType . '($_smarty_tpl, $this' . - ($this->blockType === 'Child' ? '' : ", {$tag}"). ");\n"; + ($this->blockType === 'Child' ? '' : ", {$tag}") . ");\n"; if (isset($_assign)) { $output .= "\$_smarty_tpl->assign({$_assign}, ob_get_clean());\n"; } - $output .="?>\n"; + $output .= "?>\n"; return $output; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_config_load.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_config_load.php index 7c6e9b59e..8fe64ee10 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_config_load.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_config_load.php @@ -53,14 +53,16 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase * * @var array */ - public $valid_scopes = array('local' => Smarty::SCOPE_LOCAL, 'parent' => Smarty::SCOPE_PARENT, - 'root' => Smarty::SCOPE_ROOT, 'tpl_root' => Smarty::SCOPE_TPL_ROOT, - 'smarty' => Smarty::SCOPE_SMARTY, 'global' => Smarty::SCOPE_SMARTY); + public $valid_scopes = array( + 'local' => Smarty::SCOPE_LOCAL, 'parent' => Smarty::SCOPE_PARENT, + 'root' => Smarty::SCOPE_ROOT, 'tpl_root' => Smarty::SCOPE_TPL_ROOT, + 'smarty' => Smarty::SCOPE_SMARTY, 'global' => Smarty::SCOPE_SMARTY + ); /** * Compiles code for the {config_load} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code @@ -70,11 +72,9 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase { // check and get attributes $_attr = $this->getAttributes($compiler, $args); - if ($_attr[ 'nocache' ] === true) { $compiler->trigger_template_error('nocache option not allowed', null, true); } - // save possible attributes $conf_file = $_attr[ 'file' ]; if (isset($_attr[ 'section' ])) { @@ -84,15 +84,13 @@ class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase } // scope setup if ($_attr[ 'noscope' ]) { - $_scope = - 1; + $_scope = -1; } else { $_scope = $compiler->convertScope($_attr, $this->valid_scopes); } - // create config object $_output = "<?php\n\$_smarty_tpl->smarty->ext->configLoad->_loadConfigFile(\$_smarty_tpl, {$conf_file}, {$section}, {$_scope});\n?>\n"; - return $_output; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_continue.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_continue.php index 19e5d4bee..e545728ee 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_continue.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_continue.php @@ -17,9 +17,9 @@ class Smarty_Internal_Compile_Continue extends Smarty_Internal_Compile_Break { /** - * Tag name - * - * @var string - */ + * Tag name + * + * @var string + */ public $tag = 'continue'; } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_debug.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_debug.php index 1668e72e8..799416689 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_debug.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_debug.php @@ -20,8 +20,8 @@ class Smarty_Internal_Compile_Debug extends Smarty_Internal_CompileBase /** * Compiles code for the {debug} tag * - * @param array $args array with attributes from parser - * @param object $compiler compiler object + * @param array $args array with attributes from parser + * @param object $compiler compiler object * * @return string compiled code */ @@ -29,10 +29,8 @@ class Smarty_Internal_Compile_Debug extends Smarty_Internal_CompileBase { // check and get attributes $_attr = $this->getAttributes($compiler, $args); - // compile always as nocache $compiler->tag_nocache = true; - // display debug template $_output = "<?php \$_smarty_debug = new Smarty_Internal_Debug;\n \$_smarty_debug->display_debug(\$_smarty_tpl);\n"; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_eval.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_eval.php index 550f194e0..8e0174e3e 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_eval.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_eval.php @@ -43,8 +43,8 @@ class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase /** * Compiles code for the {eval} tag * - * @param array $args array with attributes from parser - * @param object $compiler compiler object + * @param array $args array with attributes from parser + * @param object $compiler compiler object * * @return string compiled code */ @@ -56,16 +56,15 @@ class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase // output will be stored in a smarty variable instead of being displayed $_assign = $_attr[ 'assign' ]; } - // create template object - $_output = "\$_template = new {$compiler->smarty->template_class}('eval:'.{$_attr[ 'var' ]}, \$_smarty_tpl->smarty, \$_smarty_tpl);"; + $_output = + "\$_template = new {$compiler->smarty->template_class}('eval:'.{$_attr[ 'var' ]}, \$_smarty_tpl->smarty, \$_smarty_tpl);"; //was there an assign attribute? if (isset($_assign)) { $_output .= "\$_smarty_tpl->assign($_assign,\$_template->fetch());"; } else { $_output .= 'echo $_template->fetch();'; } - return "<?php $_output ?>"; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_extends.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_extends.php index 37bf8dd3f..d72d2b76f 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_extends.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_extends.php @@ -1,5 +1,4 @@ <?php - /** * Smarty Internal Plugin Compile extend * Compiles the {extends} tag @@ -74,7 +73,7 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_Compile_Shared_Inh } else { $file = "'{$file}'"; } - $i ++; + $i++; if ($i === count($files) && isset($_attr[ 'extends_resource' ])) { $this->compileEndChild($compiler); } @@ -108,28 +107,36 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_Compile_Shared_Inh $inlineUids = $match[ 1 ]; } } - $compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag($compiler->parser, - '<?php $_smarty_tpl->inheritance->endChild($_smarty_tpl' . - (isset($template) ? - ", {$template}{$inlineUids}" : - '') . ");\n?>"); + $compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + '<?php $_smarty_tpl->inheritance->endChild($_smarty_tpl' . + (isset($template) ? + ", {$template}{$inlineUids}" : + '') . ");\n?>" + ); } /** * Add code for including subtemplate to end of template * * @param \Smarty_Internal_TemplateCompilerBase $compiler - * @param string $template subtemplate name + * @param string $template subtemplate name * * @throws \SmartyCompilerException * @throws \SmartyException */ private function compileInclude(Smarty_Internal_TemplateCompilerBase $compiler, $template) { - $compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag($compiler->parser, - $compiler->compileTag('include', - array($template, - array('scope' => 'parent')))); + $compiler->parser->template_postfix[] = new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + $compiler->compileTag( + 'include', + array( + $template, + array('scope' => 'parent') + ) + ) + ); } /** diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php index 79848e521..3f113e56d 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_for.php @@ -26,15 +26,15 @@ class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase * The parser is generating different sets of attribute by which this compiler can * determine which syntax is used. * - * @param array $args array with attributes from parser - * @param object $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param object $compiler compiler object + * @param array $parameter array with compilation parameter * * @return string compiled code */ public function compile($args, $compiler, $parameter) { - $compiler->loopNesting ++; + $compiler->loopNesting++; if ($parameter === 0) { $this->required_attributes = array('start', 'to'); $this->optional_attributes = array('max', 'step'); @@ -45,7 +45,6 @@ class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase $this->mapCache = array(); // check and get attributes $_attr = $this->getAttributes($compiler, $args); - $output = "<?php\n"; if ($parameter === 1) { foreach ($_attr[ 'start' ] as $_statement) { @@ -93,7 +92,6 @@ class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase $output .= "\$_smarty_tpl->tpl_vars[$var]->last = \$_smarty_tpl->tpl_vars[$var]->iteration === \$_smarty_tpl->tpl_vars[$var]->total;"; } $output .= '?>'; - $this->openTag($compiler, 'for', array('for', $compiler->nocache)); // maybe nocache because of nocache variables $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; @@ -113,9 +111,9 @@ class Smarty_Internal_Compile_Forelse extends Smarty_Internal_CompileBase /** * Compiles code for the {forelse} tag * - * @param array $args array with attributes from parser - * @param object $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param object $compiler compiler object + * @param array $parameter array with compilation parameter * * @return string compiled code */ @@ -123,10 +121,8 @@ class Smarty_Internal_Compile_Forelse extends Smarty_Internal_CompileBase { // check and get attributes $_attr = $this->getAttributes($compiler, $args); - list($openTag, $nocache) = $this->closeTag($compiler, array('for')); $this->openTag($compiler, 'forelse', array('forelse', $nocache)); - return "<?php }} else { ?>"; } } @@ -142,24 +138,22 @@ class Smarty_Internal_Compile_Forclose extends Smarty_Internal_CompileBase /** * Compiles code for the {/for} tag * - * @param array $args array with attributes from parser - * @param object $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param object $compiler compiler object + * @param array $parameter array with compilation parameter * * @return string compiled code */ public function compile($args, $compiler, $parameter) { - $compiler->loopNesting --; + $compiler->loopNesting--; // check and get attributes $_attr = $this->getAttributes($compiler, $args); // must endblock be nocache? if ($compiler->nocache) { $compiler->tag_nocache = true; } - list($openTag, $compiler->nocache) = $this->closeTag($compiler, array('for', 'forelse')); - $output = "<?php }\n"; if ($openTag !== 'forelse') { $output .= "}\n"; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php index 471e92c3e..78b45ea7e 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_foreach.php @@ -78,7 +78,7 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo /** * Compiles code for the {foreach} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code @@ -87,7 +87,7 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { - $compiler->loopNesting ++; + $compiler->loopNesting++; // init $this->isNamed = false; // check and get attributes @@ -119,14 +119,16 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo if ($fromName) { foreach (array('item', 'key') as $a) { if (isset($attributes[ $a ]) && $attributes[ $a ] === $fromName) { - $compiler->trigger_template_error("'{$a}' and 'from' may not have same variable name '{$fromName}'", - null, true); + $compiler->trigger_template_error( + "'{$a}' and 'from' may not have same variable name '{$fromName}'", + null, + true + ); } } } - $itemVar = "\$_smarty_tpl->tpl_vars['{$item}']"; - $local = '$__foreach_' . $attributes[ 'item' ] . '_' . $this->counter ++ . '_'; + $local = '$__foreach_' . $attributes[ 'item' ] . '_' . $this->counter++ . '_'; // search for used tag attributes $itemAttr = array(); $namedAttr = array(); @@ -187,8 +189,11 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo } $needTotal = isset($itemAttr[ 'total' ]); // Register tag - $this->openTag($compiler, 'foreach', - array('foreach', $compiler->nocache, $local, $itemVar, empty($itemAttr) ? 1 : 2)); + $this->openTag( + $compiler, + 'foreach', + array('foreach', $compiler->nocache, $local, $itemVar, empty($itemAttr) ? 1 : 2) + ); // maybe nocache because of nocache variables $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; // generate output code @@ -249,7 +254,6 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo $output .= "{$local}saved = {$itemVar};\n"; } $output .= '?>'; - return $output; } @@ -277,7 +281,7 @@ class Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase /** * Compiles code for the {foreachelse} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code @@ -286,7 +290,6 @@ class Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase { // check and get attributes $_attr = $this->getAttributes($compiler, $args); - list($openTag, $nocache, $local, $itemVar, $restore) = $this->closeTag($compiler, array('foreach')); $this->openTag($compiler, 'foreachelse', array('foreachelse', $nocache, $local, $itemVar, 0)); $output = "<?php\n"; @@ -309,24 +312,23 @@ class Smarty_Internal_Compile_Foreachclose extends Smarty_Internal_CompileBase /** * Compiles code for the {/foreach} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code * @throws \SmartyCompilerException - */ + */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { - $compiler->loopNesting --; + $compiler->loopNesting--; // must endblock be nocache? if ($compiler->nocache) { $compiler->tag_nocache = true; } - - list($openTag, $compiler->nocache, $local, $itemVar, $restore) = - $this->closeTag($compiler, array('foreach', 'foreachelse')); + list( + $openTag, $compiler->nocache, $local, $itemVar, $restore + ) = $this->closeTag($compiler, array('foreach', 'foreachelse')); $output = "<?php\n"; - if ($restore === 2) { $output .= "{$itemVar} = {$local}saved;\n"; } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_function.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_function.php index 909b767c8..6e408ca72 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_function.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_function.php @@ -16,7 +16,6 @@ */ class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase { - /** * Attribute definition: Overwrites base class. * @@ -44,7 +43,7 @@ class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase /** * Compiles code for the {function} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return bool true @@ -54,15 +53,16 @@ class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase { // check and get attributes $_attr = $this->getAttributes($compiler, $args); - if ($_attr[ 'nocache' ] === true) { $compiler->trigger_template_error('nocache option not allowed', null, true); } unset($_attr[ 'nocache' ]); $_name = trim($_attr[ 'name' ], '\'"'); $compiler->parent_compiler->tpl_function[ $_name ] = array(); - $save = array($_attr, $compiler->parser->current_buffer, $compiler->template->compiled->has_nocache_code, - $compiler->template->caching); + $save = array( + $_attr, $compiler->parser->current_buffer, $compiler->template->compiled->has_nocache_code, + $compiler->template->caching + ); $this->openTag($compiler, 'function', $save); // Init temporary context $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); @@ -80,7 +80,6 @@ class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase */ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase { - /** * Compiler object * @@ -91,7 +90,7 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase /** * Compiles code for the {/function} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param object|\Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return bool true @@ -125,7 +124,6 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase $_functionCode = $compiler->parser->current_buffer; // setup buffer for template function code $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); - $_funcName = "smarty_template_function_{$_name}_{$compiler->template->compiled->nocache_hash}"; $_funcNameCaching = $_funcName . '_nocache'; if ($compiler->template->compiled->has_nocache_code) { @@ -143,9 +141,13 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase $output .= "echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php "; $output .= "\\\$_smarty_tpl->smarty->ext->_tplFunction->saveTemplateVariables(\\\$_smarty_tpl, '{$_name}');\nforeach (\$params as \\\$key => \\\$value) {\n\\\$_smarty_tpl->tpl_vars[\\\$key] = new Smarty_Variable(\\\$value, \\\$_smarty_tpl->isRenderingCache);\n}\n?>"; $output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\";?>"; - $compiler->parser->current_buffer->append_subtree($compiler->parser, - new Smarty_Internal_ParseTree_Tag($compiler->parser, - $output)); + $compiler->parser->current_buffer->append_subtree( + $compiler->parser, + new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + $output + ) + ); $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode); $output = "<?php echo \"/*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/<?php "; $output .= "\\\$_smarty_tpl->smarty->ext->_tplFunction->restoreTemplateVariables(\\\$_smarty_tpl, '{$_name}');?>\n"; @@ -154,13 +156,21 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase $output .= "}\n}\n"; $output .= "/*/ {$_funcName}_nocache */\n\n"; $output .= "?>\n"; - $compiler->parser->current_buffer->append_subtree($compiler->parser, - new Smarty_Internal_ParseTree_Tag($compiler->parser, - $output)); - $_functionCode = new Smarty_Internal_ParseTree_Tag($compiler->parser, - preg_replace_callback("/((<\?php )?echo '\/\*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/([\S\s]*?)\/\*\/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", - array($this, 'removeNocache'), - $_functionCode->to_smarty_php($compiler->parser))); + $compiler->parser->current_buffer->append_subtree( + $compiler->parser, + new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + $output + ) + ); + $_functionCode = new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + preg_replace_callback( + "/((<\?php )?echo '\/\*%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/([\S\s]*?)\/\*\/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", + array($this, 'removeNocache'), + $_functionCode->to_smarty_php($compiler->parser) + ) + ); } $compiler->parent_compiler->tpl_function[ $_name ][ 'call_name' ] = $_funcName; $output = "<?php\n"; @@ -169,20 +179,29 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase $output .= "function {$_funcName}(Smarty_Internal_Template \$_smarty_tpl,\$params) {\n"; $output .= $_paramsCode; $output .= "foreach (\$params as \$key => \$value) {\n\$_smarty_tpl->tpl_vars[\$key] = new Smarty_Variable(\$value, \$_smarty_tpl->isRenderingCache);\n}\n"; - $output .= $compiler->compileCheckPlugins(array_merge($compiler->required_plugins[ 'compiled' ], $compiler->required_plugins[ 'nocache' ])); + $output .= $compiler->compileCheckPlugins(array_merge($compiler->required_plugins[ 'compiled' ], + $compiler->required_plugins[ 'nocache' ])); $output .= "?>\n"; - $compiler->parser->current_buffer->append_subtree($compiler->parser, - new Smarty_Internal_ParseTree_Tag($compiler->parser, - $output)); + $compiler->parser->current_buffer->append_subtree( + $compiler->parser, + new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + $output + ) + ); $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode); $output = "<?php\n}}\n"; $output .= "/*/ {$_funcName} */\n\n"; $output .= "?>\n"; - $compiler->parser->current_buffer->append_subtree($compiler->parser, - new Smarty_Internal_ParseTree_Tag($compiler->parser, - $output)); + $compiler->parser->current_buffer->append_subtree( + $compiler->parser, + new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + $output + ) + ); $compiler->parent_compiler->blockOrFunctionCode .= $compiler->parser->current_buffer->to_smarty_php($compiler->parser); - // restore old buffer + // restore old buffer $compiler->parser->current_buffer = $saved_data[ 1 ]; // restore old status $compiler->restoreRequiredPlugins(); @@ -198,11 +217,14 @@ class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase * * @return string */ - function removeNocache($match) + public function removeNocache($match) { $code = - preg_replace("/((<\?php )?echo '\/\*%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/)|(\/\*\/%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", - '', $match[ 0 ]); + preg_replace( + "/((<\?php )?echo '\/\*%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/)|(\/\*\/%%SmartyNocache:{$this->compiler->template->compiled->nocache_hash}%%\*\/';(\?>\n)?)/", + '', + $match[ 0 ] + ); $code = str_replace(array('\\\'', '\\\\\''), array('\'', '\\\''), $code); return $code; } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php index 82436c266..df3dc3fad 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_if.php @@ -33,11 +33,9 @@ class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase $this->openTag($compiler, 'if', array(1, $compiler->nocache)); // must whole block be nocache ? $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; - - if (!isset($parameter['if condition'])) { + if (!isset($parameter[ 'if condition' ])) { $compiler->trigger_template_error('missing if condition', null, true); } - if (is_array($parameter[ 'if condition' ])) { if (is_array($parameter[ 'if condition' ][ 'var' ])) { $var = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; @@ -55,8 +53,11 @@ class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase $assignCompiler = new Smarty_Internal_Compile_Assign(); if (is_array($parameter[ 'if condition' ][ 'var' ])) { $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; - $_output .= $assignCompiler->compile($assignAttr, $compiler, - array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])); + $_output .= $assignCompiler->compile( + $assignAttr, + $compiler, + array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ]) + ); } else { $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ]; $_output .= $assignCompiler->compile($assignAttr, $compiler, array()); @@ -84,12 +85,11 @@ class Smarty_Internal_Compile_Else extends Smarty_Internal_CompileBase * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code - */ + */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif')); $this->openTag($compiler, 'else', array($nesting, $compiler->tag_nocache)); - return '<?php } else { ?>'; } } @@ -116,13 +116,10 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase { // check and get attributes $_attr = $this->getAttributes($compiler, $args); - list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif')); - - if (!isset($parameter['if condition'])) { + if (!isset($parameter[ 'if condition' ])) { $compiler->trigger_template_error('missing elseif condition', null, true); } - $assignCode = ''; $var = ''; if (is_array($parameter[ 'if condition' ])) { @@ -143,8 +140,11 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase $assignAttr[][ 'value' ] = $prefixVar; if (is_array($parameter[ 'if condition' ][ 'var' ])) { $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; - $assignCode .= $assignCompiler->compile($assignAttr, $compiler, - array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])); + $assignCode .= $assignCompiler->compile( + $assignAttr, + $compiler, + array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ]) + ); } else { $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ]; $assignCode .= $assignCompiler->compile($assignAttr, $compiler, array()); @@ -152,7 +152,6 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase } else { $condition_by_assign = false; } - $prefixCode = $compiler->getPrefixCode(); if (empty($prefixCode)) { if ($condition_by_assign) { @@ -200,10 +199,9 @@ class Smarty_Internal_Compile_Ifclose extends Smarty_Internal_CompileBase } list($nesting, $compiler->nocache) = $this->closeTag($compiler, array('if', 'else', 'elseif')); $tmp = ''; - for ($i = 0; $i < $nesting; $i ++) { + for ($i = 0; $i < $nesting; $i++) { $tmp .= '}'; } - return "<?php {$tmp}?>"; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_include.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_include.php index 70f22546c..716c91d49 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_include.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_include.php @@ -7,6 +7,7 @@ * @subpackage Compiler * @author Uwe Tews */ + /** * Smarty Internal Plugin Compile Include Class * @@ -19,6 +20,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase * caching mode to create nocache code but no cache file */ const CACHING_NOCACHE_CODE = 9999; + /** * Attribute definition: Overwrites base class. * @@ -26,6 +28,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase * @see Smarty_Internal_CompileBase */ public $required_attributes = array('file'); + /** * Attribute definition: Overwrites base class. * @@ -33,6 +36,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase * @see Smarty_Internal_CompileBase */ public $shorttag_order = array('file'); + /** * Attribute definition: Overwrites base class. * @@ -40,6 +44,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase * @see Smarty_Internal_CompileBase */ public $option_flags = array('nocache', 'inline', 'caching'); + /** * Attribute definition: Overwrites base class. * @@ -47,20 +52,23 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase * @see Smarty_Internal_CompileBase */ public $optional_attributes = array('_any'); + /** * Valid scope names * * @var array */ - public $valid_scopes = array('parent' => Smarty::SCOPE_PARENT, 'root' => Smarty::SCOPE_ROOT, - 'global' => Smarty::SCOPE_GLOBAL, 'tpl_root' => Smarty::SCOPE_TPL_ROOT, - 'smarty' => Smarty::SCOPE_SMARTY); + public $valid_scopes = array( + 'parent' => Smarty::SCOPE_PARENT, 'root' => Smarty::SCOPE_ROOT, + 'global' => Smarty::SCOPE_GLOBAL, 'tpl_root' => Smarty::SCOPE_TPL_ROOT, + 'smarty' => Smarty::SCOPE_SMARTY + ); /** * Compiles code for the {include} tag * - * @param array $args array with attributes from parser - * @param Smarty_Internal_SmartyTemplateCompiler $compiler compiler object + * @param array $args array with attributes from parser + * @param Smarty_Internal_SmartyTemplateCompiler $compiler compiler object * * @return string * @throws \Exception @@ -193,9 +201,14 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase $t_hash = sha1($c_id . ($_caching ? '--caching' : '--nocaching')); $compiler->smarty->allow_ambiguous_resources = true; /* @var Smarty_Internal_Template $tpl */ - $tpl = new $compiler->smarty->template_class (trim($fullResourceName, '"\''), $compiler->smarty, - $compiler->template, $compiler->template->cache_id, $c_id, - $_caching); + $tpl = new $compiler->smarty->template_class( + trim($fullResourceName, '"\''), + $compiler->smarty, + $compiler->template, + $compiler->template->cache_id, + $c_id, + $_caching + ); $uid = $tpl->source->type . $tpl->source->uid; if (!isset($compiler->parent_compiler->mergedSubTemplatesData[ $uid ][ $t_hash ])) { $has_compiled_template = $this->compileInlineTemplate($compiler, $tpl, $t_hash); @@ -269,16 +282,17 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase * * @param \Smarty_Internal_SmartyTemplateCompiler $compiler * @param \Smarty_Internal_Template $tpl - * @param string $t_hash + * @param string $t_hash * * @return bool * @throws \Exception * @throws \SmartyException */ - public function compileInlineTemplate(Smarty_Internal_SmartyTemplateCompiler $compiler, - Smarty_Internal_Template $tpl, - $t_hash) - { + public function compileInlineTemplate( + Smarty_Internal_SmartyTemplateCompiler $compiler, + Smarty_Internal_Template $tpl, + $t_hash + ) { $uid = $tpl->source->type . $tpl->source->uid; if (!($tpl->source->handler->uncompiled) && $tpl->source->exists) { $compiler->parent_compiler->mergedSubTemplatesData[ $uid ][ $t_hash ][ 'uid' ] = $tpl->source->uid; @@ -317,9 +331,11 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase if ($tpl->compiled->has_nocache_code) { // replace nocache_hash $compiled_code = - str_replace("{$tpl->compiled->nocache_hash}", - $compiler->template->compiled->nocache_hash, - $compiled_code); + str_replace( + "{$tpl->compiled->nocache_hash}", + $compiler->template->compiled->nocache_hash, + $compiled_code + ); $compiler->template->compiled->has_nocache_code = true; } $compiler->parent_compiler->mergedSubTemplatesCode[ $tpl->compiled->unifunc ] = $compiled_code; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_include_php.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_include_php.php index e0aca93b3..1b0fdaad3 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_include_php.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_include_php.php @@ -7,6 +7,7 @@ * @subpackage Compiler * @author Uwe Tews */ + /** * Smarty Internal Plugin Compile Insert Class * @@ -42,7 +43,7 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase /** * Compiles code for the {include_php} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string @@ -56,7 +57,10 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase } // check and get attributes $_attr = $this->getAttributes($compiler, $args); - /** @var Smarty_Internal_Template $_smarty_tpl + /** + * + * + * @var Smarty_Internal_Template $_smarty_tpl * used in evaluated code */ $_smarty_tpl = $compiler->template; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_insert.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_insert.php index e71abdce3..56fbc5615 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_insert.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_insert.php @@ -23,6 +23,7 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase * @see Smarty_Internal_CompileBase */ public $required_attributes = array('name'); + /** * Attribute definition: Overwrites base class. * @@ -30,6 +31,7 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase * @see Smarty_Internal_CompileBase */ public $shorttag_order = array('name'); + /** * Attribute definition: Overwrites base class. * @@ -41,7 +43,7 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase /** * Compiles code for the {insert} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code @@ -104,11 +106,13 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase } // code for script file loading $_output .= "require_once '{$_filepath}' ;"; - require_once $_filepath; + include_once $_filepath; if (!is_callable($_function)) { - $compiler->trigger_template_error(" {insert} function '{$_function}' is not callable in script file '{$_script}'", - null, - true); + $compiler->trigger_template_error( + " {insert} function '{$_function}' is not callable in script file '{$_script}'", + null, + true + ); } } else { $_filepath = 'null'; @@ -117,9 +121,11 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase if (!is_callable($_function)) { // try plugin if (!$_function = $compiler->getPlugin($_name, 'insert')) { - $compiler->trigger_template_error("{insert} no function or plugin found for '{$_name}'", - null, - true); + $compiler->trigger_template_error( + "{insert} no function or plugin found for '{$_name}'", + null, + true + ); } } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_ldelim.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_ldelim.php index c22e1a637..5493d4ecc 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_ldelim.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_ldelim.php @@ -16,11 +16,11 @@ */ class Smarty_Internal_Compile_Ldelim extends Smarty_Internal_CompileBase { - /** + /** * Compiles code for the {ldelim} tag * This tag does output the left delimiter * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_make_nocache.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_make_nocache.php index f793ecbbf..8a34ccd0a 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_make_nocache.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_make_nocache.php @@ -41,11 +41,11 @@ class Smarty_Internal_Compile_Make_Nocache extends Smarty_Internal_CompileBase /** * Compiles code for the {make_nocache} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code - */ + */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { // check and get attributes diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_nocache.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_nocache.php index b29a993aa..12f64ed2e 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_nocache.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_nocache.php @@ -27,7 +27,7 @@ class Smarty_Internal_Compile_Nocache extends Smarty_Internal_CompileBase * Compiles code for the {nocache} tag * This tag does not generate compiled output. It only sets a compiler flag. * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return bool @@ -40,7 +40,6 @@ class Smarty_Internal_Compile_Nocache extends Smarty_Internal_CompileBase $compiler->nocache = true; // this tag does not return compiled code $compiler->has_code = false; - return true; } } @@ -57,7 +56,7 @@ class Smarty_Internal_Compile_Nocacheclose extends Smarty_Internal_CompileBase * Compiles code for the {/nocache} tag * This tag does not generate compiled output. It only sets a compiler flag. * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return bool @@ -69,7 +68,6 @@ class Smarty_Internal_Compile_Nocacheclose extends Smarty_Internal_CompileBase list($compiler->nocache) = $this->closeTag($compiler, array('nocache')); // this tag does not return compiled code $compiler->has_code = false; - return true; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_parent.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_parent.php index 052479aef..ff23edf73 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_parent.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_parent.php @@ -1,5 +1,5 @@ <?php -/* +/** * This file is part of Smarty. * * (c) 2015 Uwe Tews @@ -15,7 +15,6 @@ */ class Smarty_Internal_Compile_Parent extends Smarty_Internal_Compile_Child { - /** * Tag name * @@ -29,4 +28,4 @@ class Smarty_Internal_Compile_Parent extends Smarty_Internal_Compile_Child * @var string */ public $blockType = 'Parent'; -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_block_plugin.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_block_plugin.php index 6c3f05aaa..199a296c8 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_block_plugin.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_block_plugin.php @@ -34,11 +34,11 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi /** * Compiles code for the execution of block plugin * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter - * @param string $tag name of block plugin - * @param string $function PHP function name + * @param array $parameter array with compilation parameter + * @param string $tag name of block plugin + * @param string $function PHP function name * * @return string compiled code * @throws \SmartyCompilerException @@ -46,15 +46,14 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter, $tag, $function = null) { - if (!isset($tag[ 5 ]) || substr($tag, - 5) !== 'close') { + if (!isset($tag[ 5 ]) || substr($tag, -5) !== 'close') { // opening tag of block plugin // check and get attributes $_attr = $this->getAttributes($compiler, $args); - $this->nesting ++; + $this->nesting++; unset($_attr[ 'nocache' ]); list($callback, $_paramsArray, $callable) = $this->setup($compiler, $_attr, $tag, $function); $_params = 'array(' . implode(',', $_paramsArray) . ')'; - // compile code $output = "<?php "; if (is_array($callback)) { @@ -75,7 +74,7 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi $compiler->tag_nocache = true; } // closing tag of block plugin, restore nocache - list($_params, $compiler->nocache, $callback) = $this->closeTag($compiler, substr($tag, 0, - 5)); + list($_params, $compiler->nocache, $callback) = $this->closeTag($compiler, substr($tag, 0, -5)); // compile code if (!isset($parameter[ 'modifier_list' ])) { $mod_pre = $mod_post = $mod_content = ''; @@ -84,11 +83,17 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi $mod_content2 = "\$_block_content{$this->nesting}"; $mod_content = "\$_block_content{$this->nesting} = ob_get_clean();\n"; $mod_pre = "ob_start();\n"; - $mod_post = 'echo ' . $compiler->compileTag('private_modifier', array(), - array('modifierlist' => $parameter[ 'modifier_list' ], - 'value' => 'ob_get_clean()')) . ";\n"; + $mod_post = 'echo ' . $compiler->compileTag( + 'private_modifier', + array(), + array( + 'modifierlist' => $parameter[ 'modifier_list' ], + 'value' => 'ob_get_clean()' + ) + ) . ";\n"; } - $output = "<?php {$mod_content}\$_block_repeat=false;\n{$mod_pre}echo {$callback}({$_params}, {$mod_content2}, \$_smarty_tpl, \$_block_repeat);\n{$mod_post}}\n"; + $output = + "<?php {$mod_content}\$_block_repeat=false;\n{$mod_pre}echo {$callback}({$_params}, {$mod_content2}, \$_smarty_tpl, \$_block_repeat);\n{$mod_post}}\n"; $output .= 'array_pop($_smarty_tpl->smarty->_cache[\'_tag_stack\']);?>'; } return $output; @@ -98,9 +103,9 @@ class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_Compi * Setup callback and parameter array * * @param \Smarty_Internal_TemplateCompilerBase $compiler - * @param array $_attr attributes - * @param string $tag - * @param string $function + * @param array $_attr attributes + * @param string $tag + * @param string $function * * @return array */ diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php index 5161da645..d3aab24bb 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php @@ -16,28 +16,6 @@ */ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_CompileBase { - - /** - * Preg search pattern - * - * @var string - */ - private $propertyPreg = ''; - - /** - * Offsets in preg match result - * - * @var array - */ - private $resultOffsets = array(); - - /** - * Start offset - * - * @var int - */ - private $startOffset = 0; - /** * Name of this tag * @@ -72,9 +50,30 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com public $matchResults = array(); /** + * Preg search pattern + * + * @var string + */ + private $propertyPreg = ''; + + /** + * Offsets in preg match result + * + * @var array + */ + private $resultOffsets = array(); + + /** + * Start offset + * + * @var int + */ + private $startOffset = 0; + + /** * Scan sources for used tag attributes * - * @param array $attributes + * @param array $attributes * @param \Smarty_Internal_TemplateCompilerBase $compiler * * @throws \SmartyException @@ -82,10 +81,10 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com public function scanForProperties($attributes, Smarty_Internal_TemplateCompilerBase $compiler) { $this->propertyPreg = '~('; - $this->startOffset = 0; + $this->startOffset = 1; $this->resultOffsets = array(); $this->matchResults = array('named' => array(), 'item' => array()); - if ($this->isNamed) { + if (isset($attributes[ 'name' ])) { $this->buildPropertyPreg(true, $attributes); } if (isset($this->itemProperties)) { @@ -112,19 +111,19 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com public function buildPropertyPreg($named, $attributes) { if ($named) { - $this->resultOffsets[ 'named' ] = $this->startOffset + 4; - $this->propertyPreg .= "(([\$]smarty[.]{$this->tagName}[.]" . ($this->tagName === 'section' ? "|[\[]\s*" : '') - . "){$attributes['name']}[.]("; + $this->resultOffsets[ 'named' ] = $this->startOffset = $this->startOffset + 3; + $this->propertyPreg .= "(([\$]smarty[.]{$this->tagName}[.]" . + ($this->tagName === 'section' ? "|[\[]\s*" : '') . + "){$attributes['name']}[.]("; $properties = $this->nameProperties; } else { - $this->resultOffsets[ 'item' ] = $this->startOffset + 3; + $this->resultOffsets[ 'item' ] = $this->startOffset = $this->startOffset + 2; $this->propertyPreg .= "([\$]{$attributes['item']}[@]("; $properties = $this->itemProperties; } - $this->startOffset += count($properties) + 2; $propName = reset($properties); while ($propName) { - $this->propertyPreg .= "({$propName})"; + $this->propertyPreg .= "{$propName}"; $propName = next($properties); if ($propName) { $this->propertyPreg .= '|'; @@ -140,11 +139,11 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com */ public function matchProperty($source) { - preg_match_all($this->propertyPreg, $source, $match, PREG_SET_ORDER); + preg_match_all($this->propertyPreg, $source, $match); foreach ($this->resultOffsets as $key => $offset) { - foreach ($match as $m) { - if (isset($m[ $offset ]) && !empty($m[ $offset ])) { - $this->matchResults[ $key ][ strtolower($m[ $offset ]) ] = true; + foreach ($match[ $offset ] as $m) { + if (!empty($m)) { + $this->matchResults[ $key ][ strtolower($m) ] = true; } } } @@ -181,8 +180,11 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com if ((isset($nextCompiler->smarty->autoload_filters[ 'pre' ]) || isset($nextCompiler->smarty->registered_filters[ 'pre' ])) ) { - $_content = $nextCompiler->smarty->ext->_filterHandler->runFilter('pre', $_content, - $nextCompiler->template); + $_content = $nextCompiler->smarty->ext->_filterHandler->runFilter( + 'pre', + $_content, + $nextCompiler->template + ); } $this->matchProperty($_content); } @@ -202,9 +204,9 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com /** * Compiles code for the {$smarty.foreach.xxx} or {$smarty.section.xxx}tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $parameter array with compilation parameter * * @return string compiled code * @throws \SmartyCompilerException @@ -223,4 +225,4 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com $tagVar = "'__smarty_{$tag}_{$name}'"; return "(isset(\$_smarty_tpl->tpl_vars[{$tagVar}]->value['{$property}']) ? \$_smarty_tpl->tpl_vars[{$tagVar}]->value['{$property}'] : null)"; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php index 9e9c65f59..055823423 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php @@ -35,11 +35,11 @@ class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_Co /** * Compiles code for the execution of function plugin * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter - * @param string $tag name of function plugin - * @param string $function PHP function name + * @param array $parameter array with compilation parameter + * @param string $tag name of function plugin + * @param string $function PHP function name * * @return string compiled code * @throws \SmartyCompilerException @@ -49,7 +49,6 @@ class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_Co { // check and get attributes $_attr = $this->getAttributes($compiler, $args); - unset($_attr[ 'nocache' ]); // convert attributes into parameter array string $_paramsArray = array(); @@ -64,9 +63,14 @@ class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_Co // compile code $output = "{$function}({$_params},\$_smarty_tpl)"; if (!empty($parameter[ 'modifierlist' ])) { - $output = $compiler->compileTag('private_modifier', array(), - array('modifierlist' => $parameter[ 'modifierlist' ], - 'value' => $output)); + $output = $compiler->compileTag( + 'private_modifier', + array(), + array( + 'modifierlist' => $parameter[ 'modifierlist' ], + 'value' => $output + ) + ); } $output = "<?php echo {$output};?>\n"; return $output; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php index e83b7a243..72773fff8 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php @@ -1,5 +1,4 @@ <?php - /** * Smarty Internal Plugin Compile Modifier * Compiles code for modifier execution @@ -20,9 +19,9 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa /** * Compiles code for modifier execution * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $parameter array with compilation parameter * * @return string compiled code * @throws \SmartyCompilerException @@ -52,8 +51,12 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ])) { if (is_callable($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ])) { $output = - sprintf('call_user_func_array($_smarty_tpl->registered_plugins[ \'%s\' ][ %s ][ 0 ], array( %s ))', - Smarty::PLUGIN_MODIFIER, var_export($modifier, true), $params); + sprintf( + 'call_user_func_array($_smarty_tpl->registered_plugins[ \'%s\' ][ %s ][ 0 ], array( %s ))', + Smarty::PLUGIN_MODIFIER, + var_export($modifier, true), + $params + ); $compiler->known_modifier_type[ $modifier ] = $type; break 2; } @@ -63,8 +66,11 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa // registered modifier compiler if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ])) { $output = - call_user_func($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ], - $single_modifier, $compiler->smarty); + call_user_func( + $compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ], + $single_modifier, + $compiler->smarty + ); $compiler->known_modifier_type[ $modifier ] = $type; break 2; } @@ -73,8 +79,8 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa // modifiercompiler plugin if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) { // check if modifier allowed - if (!is_object($compiler->smarty->security_policy) || - $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler) + if (!is_object($compiler->smarty->security_policy) + || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler) ) { $plugin = 'smarty_modifiercompiler_' . $modifier; $output = $plugin($single_modifier, $compiler); @@ -87,8 +93,8 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa // modifier plugin if ($function = $compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) { // check if modifier allowed - if (!is_object($compiler->smarty->security_policy) || - $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler) + if (!is_object($compiler->smarty->security_policy) + || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler) ) { $output = "{$function}({$params})"; } @@ -100,8 +106,8 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa // PHP function if (is_callable($modifier)) { // check if modifier allowed - if (!is_object($compiler->smarty->security_policy) || - $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler) + if (!is_object($compiler->smarty->security_policy) + || $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler) ) { $output = "{$modifier}({$params})"; } @@ -111,26 +117,27 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa break; case 6: // default plugin handler - if (isset($compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ]) || - (is_callable($compiler->smarty->default_plugin_handler_func) && - $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER)) + if (isset($compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ]) + || (is_callable($compiler->smarty->default_plugin_handler_func) + && $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER)) ) { $function = $compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ]; // check if modifier allowed - if (!is_object($compiler->smarty->security_policy) || - $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler) + if (!is_object($compiler->smarty->security_policy) + || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler) ) { if (!is_array($function)) { $output = "{$function}({$params})"; } else { if (is_object($function[ 0 ])) { - $output = $function[ 0 ] . '->'. $function[ 1 ] . '(' . $params . ')'; + $output = $function[ 0 ] . '->' . $function[ 1 ] . '(' . $params . ')'; } else { $output = $function[ 0 ] . '::' . $function[ 1 ] . '(' . $params . ')'; } } } - if (isset($compiler->required_plugins[ 'nocache' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ]) || + if (isset($compiler->required_plugins[ 'nocache' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ]) + || isset($compiler->required_plugins[ 'compiled' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ]) ) { // was a plugin @@ -146,7 +153,6 @@ class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBa $compiler->trigger_template_error("unknown modifier '{$modifier}'", null, true); } } - return $output; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_block_function.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_block_function.php index 5c7fb6265..baac51b28 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_block_function.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_block_function.php @@ -20,9 +20,9 @@ class Smarty_Internal_Compile_Private_Object_Block_Function extends Smarty_Inter * Setup callback and parameter array * * @param \Smarty_Internal_TemplateCompilerBase $compiler - * @param array $_attr attributes - * @param string $tag - * @param string $method + * @param array $_attr attributes + * @param string $tag + * @param string $method * * @return array */ diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php index 8d6c7e397..2a763c6e3 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php @@ -27,11 +27,11 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co /** * Compiles code for the execution of function plugin * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter - * @param string $tag name of function - * @param string $method name of method to call + * @param array $parameter array with compilation parameter + * @param string $tag name of function + * @param string $method name of method to call * * @return string compiled code * @throws \SmartyCompilerException @@ -70,8 +70,11 @@ class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_Co $output = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}"; } if (!empty($parameter[ 'modifierlist' ])) { - $output = $compiler->compileTag('private_modifier', array(), - array('modifierlist' => $parameter[ 'modifierlist' ], 'value' => $output)); + $output = $compiler->compileTag( + 'private_modifier', + array(), + array('modifierlist' => $parameter[ 'modifierlist' ], 'value' => $output) + ); } if (empty($_assign)) { return "<?php echo {$output};?>\n"; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_php.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_php.php index 1d100f0d2..a3cf0a27b 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_php.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_php.php @@ -16,7 +16,6 @@ */ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase { - /** * Attribute definition: Overwrites base class. * @@ -43,10 +42,16 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase if ($_attr[ 'type' ] === 'xml') { $compiler->tag_nocache = true; $output = addcslashes($_attr[ 'code' ], "'\\"); - $compiler->parser->current_buffer->append_subtree($compiler->parser, - new Smarty_Internal_ParseTree_Tag($compiler->parser, - $compiler->processNocacheCode("<?php echo '{$output}';?>", - true))); + $compiler->parser->current_buffer->append_subtree( + $compiler->parser, + new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + $compiler->processNocacheCode( + "<?php echo '{$output}';?>", + true + ) + ) + ); return ''; } if ($_attr[ 'type' ] !== 'tag') { @@ -54,23 +59,37 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase return ''; } elseif ($compiler->php_handling === Smarty::PHP_QUOTE) { $output = - preg_replace_callback('#(<\?(?:php|=)?)|(<%)|(<script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*>)|(\?>)|(%>)|(<\/script>)#i', - array($this, 'quote'), $_attr[ 'code' ]); - $compiler->parser->current_buffer->append_subtree($compiler->parser, - new Smarty_Internal_ParseTree_Text($output)); + preg_replace_callback( + '#(<\?(?:php|=)?)|(<%)|(<script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*>)|(\?>)|(%>)|(<\/script>)#i', + array($this, 'quote'), + $_attr[ 'code' ] + ); + $compiler->parser->current_buffer->append_subtree( + $compiler->parser, + new Smarty_Internal_ParseTree_Text($output) + ); return ''; } elseif ($compiler->php_handling === Smarty::PHP_PASSTHRU || $_attr[ 'type' ] === 'unmatched') { $compiler->tag_nocache = true; $output = addcslashes($_attr[ 'code' ], "'\\"); - $compiler->parser->current_buffer->append_subtree($compiler->parser, - new Smarty_Internal_ParseTree_Tag($compiler->parser, - $compiler->processNocacheCode("<?php echo '{$output}';?>", - true))); + $compiler->parser->current_buffer->append_subtree( + $compiler->parser, + new Smarty_Internal_ParseTree_Tag( + $compiler->parser, + $compiler->processNocacheCode( + "<?php echo '{$output}';?>", + true + ) + ) + ); return ''; } elseif ($compiler->php_handling === Smarty::PHP_ALLOW) { if (!($compiler->smarty instanceof SmartyBC)) { - $compiler->trigger_template_error('$smarty->php_handling PHP_ALLOW not allowed. Use SmartyBC to enable it', - null, true); + $compiler->trigger_template_error( + '$smarty->php_handling PHP_ALLOW not allowed. Use SmartyBC to enable it', + null, + true + ); } $compiler->has_code = true; return $_attr[ 'code' ]; @@ -80,8 +99,11 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase } else { $compiler->has_code = true; if (!($compiler->smarty instanceof SmartyBC)) { - $compiler->trigger_template_error('{php}{/php} tags not allowed. Use SmartyBC to enable them', null, - true); + $compiler->trigger_template_error( + '{php}{/php} tags not allowed. Use SmartyBC to enable them', + null, + true + ); } $ldel = preg_quote($compiler->smarty->left_delimiter, '#'); $rdel = preg_quote($compiler->smarty->right_delimiter, '#'); @@ -93,8 +115,11 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase $compiler->trigger_template_error("illegal value of option flag '{$match[2]}'", null, true); } } - return preg_replace(array("#^{$ldel}\\s*php\\s*(.)*?{$rdel}#", "#{$ldel}\\s*/\\s*php\\s*{$rdel}$#"), - array('<?php ', '?>'), $_attr[ 'code' ]); + return preg_replace( + array("#^{$ldel}\\s*php\\s*(.)*?{$rdel}#", "#{$ldel}\\s*/\\s*php\\s*{$rdel}$#"), + array('<?php ', '?>'), + $_attr[ 'code' ] + ); } } @@ -148,8 +173,10 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase if ($lex->phpType === 'unmatched') { return; } - if (($lex->phpType === 'php' || $lex->phpType === 'asp') && - ($lex->compiler->php_handling === Smarty::PHP_PASSTHRU || $lex->compiler->php_handling === Smarty::PHP_QUOTE) + if (($lex->phpType === 'php' || $lex->phpType === 'asp') + && + ($lex->compiler->php_handling === Smarty::PHP_PASSTHRU || + $lex->compiler->php_handling === Smarty::PHP_QUOTE) ) { return; } @@ -161,8 +188,14 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase $lex->compiler->trigger_template_error("missing closing tag '{$closeTag}'"); } while ($body) { - if (preg_match('~([/][*])|([/][/][^\n]*)|(\'[^\'\\\\]*(?:\\.[^\'\\\\]*)*\')|("[^"\\\\]*(?:\\.[^"\\\\]*)*")~', - $lex->data, $match, PREG_OFFSET_CAPTURE, $start)) { + if (preg_match( + '~([/][*])|([/][/][^\n]*)|(\'[^\'\\\\]*(?:\\.[^\'\\\\]*)*\')|("[^"\\\\]*(?:\\.[^"\\\\]*)*")~', + $lex->data, + $match, + PREG_OFFSET_CAPTURE, + $start + ) + ) { $value = $match[ 0 ][ 0 ]; $from = $pos = $match[ 0 ][ 1 ]; if ($pos > $close) { @@ -178,8 +211,14 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase } } while ($close > $pos && $close < $start) { - if (preg_match('~' . preg_quote($closeTag, '~') . '~i', $lex->data, $match, PREG_OFFSET_CAPTURE, - $from)) { + if (preg_match( + '~' . preg_quote($closeTag, '~') . '~i', + $lex->data, + $match, + PREG_OFFSET_CAPTURE, + $from + ) + ) { $close = $match[ 0 ][ 1 ]; $from = $close + strlen($match[ 0 ][ 0 ]); } else { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php index 2dde69488..23cae8aef 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php @@ -49,9 +49,14 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C $output = $parameter[ 'value' ]; // tag modifier if (!empty($parameter[ 'modifierlist' ])) { - $output = $compiler->compileTag('private_modifier', array(), - array('modifierlist' => $parameter[ 'modifierlist' ], - 'value' => $output)); + $output = $compiler->compileTag( + 'private_modifier', + array(), + array( + 'modifierlist' => $parameter[ 'modifierlist' ], + 'value' => $output + ) + ); } if (isset($_attr[ 'assign' ])) { // assign output to variable @@ -64,9 +69,12 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C if (empty($compiler->default_modifier_list)) { $modifierlist = array(); foreach ($compiler->smarty->default_modifiers as $key => $single_default_modifier) { - preg_match_all('/(\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|:|[^:]+)/', - $single_default_modifier, $mod_array); - for ($i = 0, $count = count($mod_array[ 0 ]); $i < $count; $i ++) { + preg_match_all( + '/(\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|:|[^:]+)/', + $single_default_modifier, + $mod_array + ); + for ($i = 0, $count = count($mod_array[ 0 ]); $i < $count; $i++) { if ($mod_array[ 0 ][ $i ] !== ':') { $modifierlist[ $key ][] = $mod_array[ 0 ][ $i ]; } @@ -74,9 +82,14 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C } $compiler->default_modifier_list = $modifierlist; } - $output = $compiler->compileTag('private_modifier', array(), - array('modifierlist' => $compiler->default_modifier_list, - 'value' => $output)); + $output = $compiler->compileTag( + 'private_modifier', + array(), + array( + 'modifierlist' => $compiler->default_modifier_list, + 'value' => $output + ) + ); } // autoescape html if ($compiler->template->smarty->escape_html) { @@ -85,7 +98,7 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C // loop over registered filters if (!empty($compiler->template->smarty->registered_filters[ Smarty::FILTER_VARIABLE ])) { foreach ($compiler->template->smarty->registered_filters[ Smarty::FILTER_VARIABLE ] as $key => - $function) { + $function) { if (!is_array($function)) { $output = "{$function}({$output},\$_smarty_tpl)"; } elseif (is_object($function[ 0 ])) { @@ -98,8 +111,7 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C } // auto loaded filters if (isset($compiler->smarty->autoload_filters[ Smarty::FILTER_VARIABLE ])) { - foreach ((array) $compiler->template->smarty->autoload_filters[ Smarty::FILTER_VARIABLE ] as $name) - { + foreach ((array)$compiler->template->smarty->autoload_filters[ Smarty::FILTER_VARIABLE ] as $name) { $result = $this->compile_variable_filter($compiler, $name, $output); if ($result !== false) { $output = $result; @@ -110,19 +122,21 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C } } foreach ($compiler->variable_filters as $filter) { - if (count($filter) === 1 && - ($result = $this->compile_variable_filter($compiler, $filter[ 0 ], $output)) !== false + if (count($filter) === 1 + && ($result = $this->compile_variable_filter($compiler, $filter[ 0 ], $output)) !== false ) { $output = $result; } else { - $output = $compiler->compileTag('private_modifier', array(), - array('modifierlist' => array($filter), 'value' => $output)); + $output = $compiler->compileTag( + 'private_modifier', + array(), + array('modifierlist' => array($filter), 'value' => $output) + ); } } } $output = "<?php echo {$output};?>\n"; } - return $output; } @@ -136,12 +150,12 @@ class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_C */ private function compile_variable_filter(Smarty_Internal_TemplateCompilerBase $compiler, $name, $output) { - $function= $compiler->getPlugin($name, 'variablefilter'); - if ($function) { + $function = $compiler->getPlugin($name, 'variablefilter'); + if ($function) { return "{$function}({$output},\$_smarty_tpl)"; - } else { + } else { // not found return false; - } + } } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php index bd88f1bf1..0f818d1b3 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php @@ -20,9 +20,9 @@ class Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_C * Setup callback, parameter array and nocache mode * * @param \Smarty_Internal_TemplateCompilerBase $compiler - * @param array $_attr attributes - * @param string $tag - * @param null $function + * @param array $_attr attributes + * @param string $tag + * @param null $function * * @return array */ diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php index 467f9a49a..2591107d2 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php @@ -27,10 +27,10 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna /** * Compiles code for the execution of a registered function * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter - * @param string $tag name of function + * @param array $parameter array with compilation parameter + * @param string $tag name of function * * @return string compiled code * @throws \SmartyCompilerException @@ -45,8 +45,8 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna $tag_info = $compiler->smarty->registered_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ]; $is_registered = true; } else { - $tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ]; - $is_registered = false; + $tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_FUNCTION ][ $tag ]; + $is_registered = false; } // not cacheable? $compiler->tag_nocache = $compiler->tag_nocache || !$tag_info[ 1 ]; @@ -76,11 +76,16 @@ class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Interna } } if (!empty($parameter[ 'modifierlist' ])) { - $output = $compiler->compileTag('private_modifier', array(), - array('modifierlist' => $parameter[ 'modifierlist' ], - 'value' => $output)); + $output = $compiler->compileTag( + 'private_modifier', + array(), + array( + 'modifierlist' => $parameter[ 'modifierlist' ], + 'value' => $output + ) + ); } $output = "<?php echo {$output};?>\n"; return $output; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_special_variable.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_special_variable.php index 0c6be44f6..b317c9f33 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_special_variable.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_special_variable.php @@ -19,9 +19,9 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C /** * Compiles code for the special $smarty variables * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param $parameter + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object + * @param $parameter * * @return string compiled code * @throws \SmartyCompilerException @@ -33,8 +33,8 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C if ($variable === false) { $compiler->trigger_template_error("special \$Smarty variable name index can not be variable", null, true); } - if (!isset($compiler->smarty->security_policy) || - $compiler->smarty->security_policy->isTrustedSpecialSmartyVar($variable, $compiler) + if (!isset($compiler->smarty->security_policy) + || $compiler->smarty->security_policy->isTrustedSpecialSmartyVar($variable, $compiler) ) { switch ($variable) { case 'foreach': @@ -43,7 +43,11 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C $class = 'Smarty_Internal_Compile_' . ucfirst($variable); Smarty_Internal_TemplateCompilerBase::$_tag_objects[ $variable ] = new $class; } - return Smarty_Internal_TemplateCompilerBase::$_tag_objects[ $variable ]->compileSpecialVariable(array(), $compiler, $_index); + return Smarty_Internal_TemplateCompilerBase::$_tag_objects[ $variable ]->compileSpecialVariable( + array(), + $compiler, + $_index + ); case 'capture': if (class_exists('Smarty_Internal_Compile_Capture')) { return Smarty_Internal_Compile_Capture::compileSpecialVariable(array(), $compiler, $_index); @@ -52,8 +56,8 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C case 'now': return 'time()'; case 'cookies': - if (isset($compiler->smarty->security_policy) && - !$compiler->smarty->security_policy->allow_super_globals + if (isset($compiler->smarty->security_policy) + && !$compiler->smarty->security_policy->allow_super_globals ) { $compiler->trigger_template_error("(secure mode) super globals not permitted"); break; @@ -66,30 +70,25 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C case 'server': case 'session': case 'request': - if (isset($compiler->smarty->security_policy) && - !$compiler->smarty->security_policy->allow_super_globals + if (isset($compiler->smarty->security_policy) + && !$compiler->smarty->security_policy->allow_super_globals ) { $compiler->trigger_template_error("(secure mode) super globals not permitted"); break; } $compiled_ref = '$_' . strtoupper($variable); break; - case 'template': return 'basename($_smarty_tpl->source->filepath)'; - case 'template_object': return '$_smarty_tpl'; - case 'current_dir': return 'dirname($_smarty_tpl->source->filepath)'; - case 'version': return "Smarty::SMARTY_VERSION"; - case 'const': - if (isset($compiler->smarty->security_policy) && - !$compiler->smarty->security_policy->allow_constants + if (isset($compiler->smarty->security_policy) + && !$compiler->smarty->security_policy->allow_constants ) { $compiler->trigger_template_error("(secure mode) constants not permitted"); break; @@ -99,13 +98,14 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C } else { return "@constant({$_index[1]})"; } - + // no break case 'config': if (isset($_index[ 2 ])) { return "(is_array(\$tmp = \$_smarty_tpl->smarty->ext->configload->_getConfigVariable(\$_smarty_tpl, $_index[1])) ? \$tmp[$_index[2]] : null)"; } else { return "\$_smarty_tpl->smarty->ext->configload->_getConfigVariable(\$_smarty_tpl, $_index[1])"; } + // no break case 'ldelim': return "\$_smarty_tpl->smarty->left_delimiter"; case 'rdelim': diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_rdelim.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_rdelim.php index e3d034da1..1cc340c18 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_rdelim.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_rdelim.php @@ -20,7 +20,7 @@ class Smarty_Internal_Compile_Rdelim extends Smarty_Internal_Compile_Ldelim * Compiles code for the {rdelim} tag * This tag does output the right delimiter. * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code @@ -28,7 +28,7 @@ class Smarty_Internal_Compile_Rdelim extends Smarty_Internal_Compile_Ldelim */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { - parent::compile($args,$compiler); + parent::compile($args, $compiler); return $compiler->smarty->right_delimiter; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php index 6e80e0fde..0dee20820 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_section.php @@ -59,8 +59,10 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo * * @var array */ - public $nameProperties = array('first', 'last', 'index', 'iteration', 'show', 'total', 'rownum', 'index_prev', - 'index_next', 'loop'); + public $nameProperties = array( + 'first', 'last', 'index', 'iteration', 'show', 'total', 'rownum', 'index_prev', + 'index_next', 'loop' + ); /** * {section} tag has no item properties @@ -79,8 +81,8 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo /** * Compiles code for the {section} tag * - * @param array $args array with attributes from parser - * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object + * @param array $args array with attributes from parser + * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code * @throws \SmartyCompilerException @@ -88,7 +90,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { - $compiler->loopNesting ++; + $compiler->loopNesting++; // check and get attributes $_attr = $this->getAttributes($compiler, $args); $attributes = array('name' => $compiler->getId($_attr[ 'name' ])); @@ -98,20 +100,19 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $compiler->trigger_template_error("'{$a}' attribute/variable has illegal value", null, true); } } - $local = "\$__section_{$attributes['name']}_" . $this->counter ++ . '_'; + $local = "\$__section_{$attributes['name']}_" . $this->counter++ . '_'; $sectionVar = "\$_smarty_tpl->tpl_vars['__smarty_section_{$attributes['name']}']"; $this->openTag($compiler, 'section', array('section', $compiler->nocache, $local, $sectionVar)); // maybe nocache because of nocache variables $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; - $initLocal = array(); $initNamedProperty = array(); $initFor = array(); $incFor = array(); $cmpFor = array(); - $propValue = array('index' => "{$sectionVar}->value['index']", 'show' => 'true', 'step' => 1, - 'iteration' => "{$local}iteration", - + $propValue = array( + 'index' => "{$sectionVar}->value['index']", 'show' => 'true', 'step' => 1, + 'iteration' => "{$local}iteration", ); $propType = array('index' => 2, 'iteration' => 2, 'show' => 0, 'step' => 0,); // search for used tag attributes @@ -134,7 +135,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo switch ($attr_name) { case 'loop': if (is_numeric($attr_value)) { - $v = (int) $attr_value; + $v = (int)$attr_value; $t = 0; } else { $v = "(is_array(@\$_loop=$attr_value) ? count(\$_loop) : max(0, (int) \$_loop))"; @@ -156,7 +157,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo break; case 'step': if (is_numeric($attr_value)) { - $v = (int) $attr_value; + $v = (int)$attr_value; $v = ($v === 0) ? 1 : $v; $t = 0; break; @@ -165,11 +166,10 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $v = "{$local}step"; $t = 2; break; - case 'max': case 'start': if (is_numeric($attr_value)) { - $v = (int) $attr_value; + $v = (int)$attr_value; $t = 0; break; } @@ -183,7 +183,6 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $propValue[ $attr_name ] = $v; $propType[ $attr_name ] = $t; } - if (isset($namedAttr[ 'step' ])) { $initNamedProperty[ 'step' ] = $propValue[ 'step' ]; } @@ -192,19 +191,17 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo } $incFor[ 'iteration' ] = "{$propValue['iteration']}++"; $initFor[ 'iteration' ] = "{$propValue['iteration']} = 1"; - if ($propType[ 'step' ] === 0) { if ($propValue[ 'step' ] === 1) { $incFor[ 'index' ] = "{$sectionVar}->value['index']++"; } elseif ($propValue[ 'step' ] > 1) { $incFor[ 'index' ] = "{$sectionVar}->value['index'] += {$propValue['step']}"; } else { - $incFor[ 'index' ] = "{$sectionVar}->value['index'] -= " . - $propValue[ 'step' ]; + $incFor[ 'index' ] = "{$sectionVar}->value['index'] -= " . -$propValue[ 'step' ]; } } else { $incFor[ 'index' ] = "{$sectionVar}->value['index'] += {$propValue['step']}"; } - if (!isset($propValue[ 'max' ])) { $propValue[ 'max' ] = $propValue[ 'loop' ]; $propType[ 'max' ] = $propType[ 'loop' ]; @@ -217,7 +214,6 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $propType[ 'max' ] = $propType[ 'loop' ]; } } - if (!isset($propValue[ 'start' ])) { $start_code = array(1 => "{$propValue['step']} > 0 ? ", 2 => '0', 3 => ' : ', 4 => $propValue[ 'loop' ], 5 => ' - 1'); @@ -239,12 +235,14 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $propValue[ 'start' ] = join('', $start_code); } else { $start_code = - array(1 => "{$propValue['start']} < 0 ? ", 2 => 'max(', 3 => "{$propValue['step']} > 0 ? ", 4 => '0', - 5 => ' : ', 6 => '-1', 7 => ', ', 8 => "{$propValue['start']} + {$propValue['loop']}", 10 => ')', - 11 => ' : ', 12 => 'min(', 13 => $propValue[ 'start' ], 14 => ', ', - 15 => "{$propValue['step']} > 0 ? ", 16 => $propValue[ 'loop' ], 17 => ' : ', - 18 => $propType[ 'loop' ] === 0 ? $propValue[ 'loop' ] - 1 : "{$propValue['loop']} - 1", - 19 => ')'); + array( + 1 => "{$propValue['start']} < 0 ? ", 2 => 'max(', 3 => "{$propValue['step']} > 0 ? ", 4 => '0', + 5 => ' : ', 6 => '-1', 7 => ', ', 8 => "{$propValue['start']} + {$propValue['loop']}", 10 => ')', + 11 => ' : ', 12 => 'min(', 13 => $propValue[ 'start' ], 14 => ', ', + 15 => "{$propValue['step']} > 0 ? ", 16 => $propValue[ 'loop' ], 17 => ' : ', + 18 => $propType[ 'loop' ] === 0 ? $propValue[ 'loop' ] - 1 : "{$propValue['loop']} - 1", + 19 => ')' + ); if ($propType[ 'step' ] === 0) { $start_code[ 3 ] = $start_code[ 5 ] = $start_code[ 15 ] = $start_code[ 17 ] = ''; if ($propValue[ 'step' ] > 0) { @@ -260,21 +258,29 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $propType[ 'start' ] = $propType[ 'step' ] + $propType[ 'loop' ]; $start_code[ 1 ] = ''; if ($propValue[ 'start' ] < 0) { - for ($i = 11; $i <= 19; $i ++) { + for ($i = 11; $i <= 19; $i++) { $start_code[ $i ] = ''; } if ($propType[ 'start' ] === 0) { - $start_code = array(max($propValue[ 'step' ] > 0 ? 0 : - 1, - $propValue[ 'start' ] + $propValue[ 'loop' ])); + $start_code = array( + max( + $propValue[ 'step' ] > 0 ? 0 : -1, + $propValue[ 'start' ] + $propValue[ 'loop' ] + ) + ); } } else { - for ($i = 1; $i <= 11; $i ++) { + for ($i = 1; $i <= 11; $i++) { $start_code[ $i ] = ''; } if ($propType[ 'start' ] === 0) { $start_code = - array(min($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] : $propValue[ 'loop' ] - 1, - $propValue[ 'start' ])); + array( + min( + $propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] : $propValue[ 'loop' ] - 1, + $propValue[ 'start' ] + ) + ); } } } @@ -284,9 +290,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $initLocal[ 'start' ] = $propValue[ 'start' ]; $propValue[ 'start' ] = "{$local}start"; } - $initFor[ 'index' ] = "{$sectionVar}->value['index'] = {$propValue['start']}"; - if (!isset($_attr[ 'start' ]) && !isset($_attr[ 'step' ]) && !isset($_attr[ 'max' ])) { $propValue[ 'total' ] = $propValue[ 'loop' ]; $propType[ 'total' ] = $propType[ 'loop' ]; @@ -295,13 +299,20 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $propType[ 'start' ] + $propType[ 'loop' ] + $propType[ 'step' ] + $propType[ 'max' ]; if ($propType[ 'total' ] === 0) { $propValue[ 'total' ] = - min(ceil(($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] - $propValue[ 'start' ] : - (int) $propValue[ 'start' ] + 1) / abs($propValue[ 'step' ])), $propValue[ 'max' ]); + min( + ceil( + ($propValue[ 'step' ] > 0 ? $propValue[ 'loop' ] - $propValue[ 'start' ] : + (int)$propValue[ 'start' ] + 1) / abs($propValue[ 'step' ]) + ), + $propValue[ 'max' ] + ); } else { - $total_code = array(1 => 'min(', 2 => 'ceil(', 3 => '(', 4 => "{$propValue['step']} > 0 ? ", - 5 => $propValue[ 'loop' ], 6 => ' - ', 7 => $propValue[ 'start' ], 8 => ' : ', - 9 => $propValue[ 'start' ], 10 => '+ 1', 11 => ')', 12 => '/ ', 13 => 'abs(', - 14 => $propValue[ 'step' ], 15 => ')', 16 => ')', 17 => ", {$propValue['max']})",); + $total_code = array( + 1 => 'min(', 2 => 'ceil(', 3 => '(', 4 => "{$propValue['step']} > 0 ? ", + 5 => $propValue[ 'loop' ], 6 => ' - ', 7 => $propValue[ 'start' ], 8 => ' : ', + 9 => $propValue[ 'start' ], 10 => '+ 1', 11 => ')', 12 => '/ ', 13 => 'abs(', + 14 => $propValue[ 'step' ], 15 => ')', 16 => ')', 17 => ", {$propValue['max']})", + ); if (!isset($propValue[ 'max' ])) { $total_code[ 1 ] = $total_code[ 17 ] = ''; } @@ -310,15 +321,15 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $total_code[ 6 ] = $total_code[ 7 ] = ''; } if ($propType[ 'start' ] === 0) { - $total_code[ 9 ] = (int) $propValue[ 'start' ] + 1; + $total_code[ 9 ] = (int)$propValue[ 'start' ] + 1; $total_code[ 10 ] = ''; } if ($propType[ 'step' ] === 0) { $total_code[ 13 ] = $total_code[ 15 ] = ''; - if ($propValue[ 'step' ] === 1 || $propValue[ 'step' ] === - 1) { + if ($propValue[ 'step' ] === 1 || $propValue[ 'step' ] === -1) { $total_code[ 2 ] = $total_code[ 12 ] = $total_code[ 14 ] = $total_code[ 16 ] = ''; } elseif ($propValue[ 'step' ] < 0) { - $total_code[ 14 ] = - $propValue[ 'step' ]; + $total_code[ 14 ] = -$propValue[ 'step' ]; } $total_code[ 4 ] = ''; if ($propValue[ 'step' ] > 0) { @@ -330,7 +341,6 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $propValue[ 'total' ] = join('', $total_code); } } - if (isset($namedAttr[ 'loop' ])) { $initNamedProperty[ 'loop' ] = "'loop' => {$propValue['loop']}"; } @@ -343,13 +353,10 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $initLocal[ 'total' ] = $propValue[ 'total' ]; $propValue[ 'total' ] = "{$local}total"; } - $cmpFor[ 'iteration' ] = "{$propValue['iteration']} <= {$propValue['total']}"; - foreach ($initLocal as $key => $code) { $output .= "{$local}{$key} = {$code};\n"; } - $_vars = 'array(' . join(', ', $initNamedProperty) . ')'; $output .= "{$sectionVar} = new Smarty_Variable({$_vars});\n"; $cond_code = "{$propValue['total']} !== 0"; @@ -388,7 +395,6 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_Compile_Private_Fo $output .= "{$sectionVar}->value['last'] = ({$propValue['iteration']} === {$propValue['total']});\n"; } $output .= '?>'; - return $output; } } @@ -404,7 +410,7 @@ class Smarty_Internal_Compile_Sectionelse extends Smarty_Internal_CompileBase /** * Compiles code for the {sectionelse} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code @@ -413,10 +419,8 @@ class Smarty_Internal_Compile_Sectionelse extends Smarty_Internal_CompileBase { // check and get attributes $_attr = $this->getAttributes($compiler, $args); - list($openTag, $nocache, $local, $sectionVar) = $this->closeTag($compiler, array('section')); $this->openTag($compiler, 'sectionelse', array('sectionelse', $nocache, $local, $sectionVar)); - return "<?php }} else {\n ?>"; } } @@ -432,22 +436,20 @@ class Smarty_Internal_Compile_Sectionclose extends Smarty_Internal_CompileBase /** * Compiles code for the {/section} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { - $compiler->loopNesting --; + $compiler->loopNesting--; // must endblock be nocache? if ($compiler->nocache) { $compiler->tag_nocache = true; } - list($openTag, $compiler->nocache, $local, $sectionVar) = $this->closeTag($compiler, array('section', 'sectionelse')); - $output = "<?php\n"; if ($openTag === 'sectionelse') { $output .= "}\n"; @@ -455,7 +457,6 @@ class Smarty_Internal_Compile_Sectionclose extends Smarty_Internal_CompileBase $output .= "}\n}\n"; } $output .= '?>'; - return $output; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php index 1f3ba8d48..70e2e2f9f 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php @@ -19,9 +19,9 @@ class Smarty_Internal_Compile_Setfilter extends Smarty_Internal_CompileBase /** * Compiles code for setfilter tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $parameter array with compilation parameter * * @return string compiled code */ @@ -31,7 +31,6 @@ class Smarty_Internal_Compile_Setfilter extends Smarty_Internal_CompileBase $compiler->variable_filters = $parameter[ 'modifier_list' ]; // this tag does not return compiled code $compiler->has_code = false; - return true; } } @@ -48,7 +47,7 @@ class Smarty_Internal_Compile_Setfilterclose extends Smarty_Internal_CompileBase * Compiles code for the {/setfilter} tag * This tag does not generate compiled output. It resets variable filter. * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code @@ -64,7 +63,6 @@ class Smarty_Internal_Compile_Setfilterclose extends Smarty_Internal_CompileBase } // this tag does not return compiled code $compiler->has_code = false; - return true; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php index a32173cd6..d90262e60 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php @@ -22,7 +22,7 @@ class Smarty_Internal_Compile_Shared_Inheritance extends Smarty_Internal_Compile * @param \Smarty_Internal_TemplateCompilerBase $compiler * @param bool|false $initChildSequence if true force child template */ - static function postCompile(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false) + public static function postCompile(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false) { $compiler->prefixCompiledCode .= "<?php \$_smarty_tpl->_loadInheritance();\n\$_smarty_tpl->inheritance->init(\$_smarty_tpl, " . var_export($initChildSequence, true) . ");\n?>\n"; @@ -36,13 +36,14 @@ class Smarty_Internal_Compile_Shared_Inheritance extends Smarty_Internal_Compile */ public function registerInit(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false) { - if ($initChildSequence || !isset($compiler->_cache['inheritanceInit'])) { - $compiler->registerPostCompileCallback(array('Smarty_Internal_Compile_Shared_Inheritance', 'postCompile'), - array($initChildSequence), - 'inheritanceInit', - $initChildSequence); - - $compiler->_cache['inheritanceInit'] = true; + if ($initChildSequence || !isset($compiler->_cache[ 'inheritanceInit' ])) { + $compiler->registerPostCompileCallback( + array('Smarty_Internal_Compile_Shared_Inheritance', 'postCompile'), + array($initChildSequence), + 'inheritanceInit', + $initChildSequence + ); + $compiler->_cache[ 'inheritanceInit' ] = true; } } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_while.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_while.php index 328d6551d..5aa3a7330 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_while.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compile_while.php @@ -19,24 +19,22 @@ class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase /** * Compiles code for the {while} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $parameter array with compilation parameter * * @return string compiled code * @throws \SmartyCompilerException */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) { - $compiler->loopNesting ++; + $compiler->loopNesting++; // check and get attributes $_attr = $this->getAttributes($compiler, $args); $this->openTag($compiler, 'while', $compiler->nocache); - if (!array_key_exists('if condition', $parameter)) { $compiler->trigger_template_error('missing while condition', null, true); } - // maybe nocache because of nocache variables $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; if (is_array($parameter[ 'if condition' ])) { @@ -56,14 +54,16 @@ class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase if (is_array($parameter[ 'if condition' ][ 'var' ])) { $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ]; $_output = "<?php while ({$prefixVar} = {$parameter[ 'if condition' ][ 'value' ]}) {?>"; - $_output .= $assignCompiler->compile($assignAttr, $compiler, - array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ])); + $_output .= $assignCompiler->compile( + $assignAttr, + $compiler, + array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ]) + ); } else { $assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ]; $_output = "<?php while ({$prefixVar} = {$parameter[ 'if condition' ][ 'value' ]}) {?>"; $_output .= $assignCompiler->compile($assignAttr, $compiler, array()); } - return $_output; } else { return "<?php\n while ({$parameter['if condition']}) {?>"; @@ -82,14 +82,14 @@ class Smarty_Internal_Compile_Whileclose extends Smarty_Internal_CompileBase /** * Compiles code for the {/while} tag * - * @param array $args array with attributes from parser + * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * * @return string compiled code */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) { - $compiler->loopNesting --; + $compiler->loopNesting--; // must endblock be nocache? if ($compiler->nocache) { $compiler->tag_nocache = true; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compilebase.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compilebase.php index 656672b98..2a32e4373 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compilebase.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_compilebase.php @@ -65,8 +65,8 @@ abstract class Smarty_Internal_CompileBase * the corresponding list. The keyword '_any' specifies that any attribute will be accepted * as valid * - * @param object $compiler compiler object - * @param array $attributes attributes applied to the tag + * @param object $compiler compiler object + * @param array $attributes attributes applied to the tag * * @return array of mapped attributes for further processing */ @@ -103,8 +103,12 @@ abstract class Smarty_Internal_CompileBase if (isset($this->optionMap[ $v ])) { $_indexed_attr[ $k ] = $this->optionMap[ $v ]; } else { - $compiler->trigger_template_error("illegal value '" . var_export($v, true) . - "' for option flag '{$k}'", null, true); + $compiler->trigger_template_error( + "illegal value '" . var_export($v, true) . + "' for option flag '{$k}'", + null, + true + ); } } // must be named attribute @@ -124,8 +128,14 @@ abstract class Smarty_Internal_CompileBase if ($this->optional_attributes !== array('_any')) { if (!isset($this->mapCache[ 'all' ])) { $this->mapCache[ 'all' ] = - array_fill_keys(array_merge($this->required_attributes, $this->optional_attributes, - $this->option_flags), true); + array_fill_keys( + array_merge( + $this->required_attributes, + $this->optional_attributes, + $this->option_flags + ), + true + ); } foreach ($_indexed_attr as $key => $dummy) { if (!isset($this->mapCache[ 'all' ][ $key ]) && $key !== 0) { @@ -162,8 +172,8 @@ abstract class Smarty_Internal_CompileBase * Pop closing tag * Raise an error if this stack-top doesn't match with expected opening tags * - * @param object $compiler compiler object - * @param array|string $expectedTag the expected opening tag names + * @param object $compiler compiler object + * @param array|string $expectedTag the expected opening tag names * * @return mixed any type the opening tag's name or saved data */ @@ -173,7 +183,7 @@ abstract class Smarty_Internal_CompileBase // get stacked info list($_openTag, $_data) = array_pop($compiler->_tag_stack); // open tag must match with the expected ones - if (in_array($_openTag, (array) $expectedTag)) { + if (in_array($_openTag, (array)$expectedTag)) { if (is_null($_data)) { // return opening tag return $_openTag; @@ -184,12 +194,10 @@ abstract class Smarty_Internal_CompileBase } // wrong nesting of tags $compiler->trigger_template_error("unclosed '{$compiler->smarty->left_delimiter}{$_openTag}{$compiler->smarty->right_delimiter}' tag"); - return; } // wrong nesting of tags $compiler->trigger_template_error('unexpected closing tag', null, true); - return; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_config_file_compiler.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_config_file_compiler.php index ada38869d..a842fa8f3 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_config_file_compiler.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_config_file_compiler.php @@ -103,9 +103,11 @@ class Smarty_Internal_Config_File_Compiler { $this->template = $template; $this->template->compiled->file_dependency[ $this->template->source->uid ] = - array($this->template->source->filepath, - $this->template->source->getTimeStamp(), - $this->template->source->type); + array( + $this->template->source->filepath, + $this->template->source->getTimeStamp(), + $this->template->source->type + ); if ($this->smarty->debugging) { if (!isset($this->smarty->_debug)) { $this->smarty->_debug = new Smarty_Internal_Debug(); @@ -114,15 +116,22 @@ class Smarty_Internal_Config_File_Compiler } // init the lexer/parser to compile the config file /* @var Smarty_Internal_ConfigFileLexer $this ->lex */ - $this->lex = new $this->lexer_class(str_replace(array("\r\n", - "\r"), "\n", $template->source->getContent()) . "\n", - $this); + $this->lex = new $this->lexer_class( + str_replace( + array( + "\r\n", + "\r" + ), + "\n", + $template->source->getContent() + ) . "\n", + $this + ); /* @var Smarty_Internal_ConfigFileParser $this ->parser */ $this->parser = new $this->parser_class($this->lex, $this); - if (function_exists('mb_internal_encoding') && function_exists('ini_get') - && ((int) ini_get('mbstring.func_overload')) & 2 + && ((int)ini_get('mbstring.func_overload')) & 2 ) { $mbEncoding = mb_internal_encoding(); mb_internal_encoding('ASCII'); @@ -141,7 +150,6 @@ class Smarty_Internal_Config_File_Compiler } // finish parsing process $this->parser->doParse(0, 0); - if ($mbEncoding) { mb_internal_encoding($mbEncoding); } @@ -153,7 +161,6 @@ class Smarty_Internal_Config_File_Compiler "<?php /* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") . "\n"; $template_header .= " compiled from '{$this->template->source->filepath}' */ ?>\n"; - $code = '<?php $_smarty_tpl->smarty->ext->configLoad->_loadConfigVars($_smarty_tpl, ' . var_export($this->config_data, true) . '); ?>'; return $template_header . $this->template->smarty->ext->_codeFrame->create($this->template, $code); diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_configfilelexer.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_configfilelexer.php index 454c9f828..afb3efcb0 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_configfilelexer.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_configfilelexer.php @@ -27,73 +27,86 @@ class Smarty_Internal_Configfilelexer const COMMENT = 4; const SECTION = 5; const TRIPPLE = 6; + /** * Source * * @var string */ public $data; + /** * Source length * * @var int */ public $dataLength = null; + /** * byte counter * * @var int */ public $counter; + /** * token number * * @var int */ public $token; + /** * token value * * @var string */ public $value; + /** * current line * * @var int */ public $line; + /** * state number * * @var int */ public $state = 1; + /** * Smarty object * * @var Smarty */ public $smarty = null; + /** * trace file * * @var resource */ public $yyTraceFILE; + /** * trace prompt * * @var string */ public $yyTracePrompt; + /** * state names * * @var array */ - public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', - 6 => 'TRIPPLE'); + public $state_name = array( + 1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', 6 => 'TRIPPLE' + ); + /** * token names * @@ -101,30 +114,40 @@ class Smarty_Internal_Configfilelexer */ public $smarty_token_names = array( // Text for parser error messages ); + /** * compiler object * * @var Smarty_Internal_Config_File_Compiler */ private $compiler = null; + /** * copy of config_booleanize * * @var bool */ private $configBooleanize = false; + /** * storage for assembled token patterns * * @var string */ private $yy_global_pattern1 = null; + private $yy_global_pattern2 = null; + private $yy_global_pattern3 = null; + private $yy_global_pattern4 = null; + private $yy_global_pattern5 = null; + private $yy_global_pattern6 = null; + private $_yy_state = 1; + private $_yy_stack = array(); /** @@ -133,7 +156,7 @@ class Smarty_Internal_Configfilelexer * @param string $data template source * @param Smarty_Internal_Config_File_Compiler $compiler */ - function __construct($data, Smarty_Internal_Config_File_Compiler $compiler) + public function __construct($data, Smarty_Internal_Config_File_Compiler $compiler) { $this->data = $data . "\n"; //now all lines are \n-terminated $this->dataLength = strlen($data); @@ -166,39 +189,43 @@ class Smarty_Internal_Configfilelexer public function yypushstate($state) { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%sState push %s\n", - $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf( + $this->yyTraceFILE, + "%sState push %s\n", + $this->yyTracePrompt, + isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state + ); } array_push($this->_yy_stack, $this->_yy_state); $this->_yy_state = $state; if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%snew State %s\n", - $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf( + $this->yyTraceFILE, + "%snew State %s\n", + $this->yyTracePrompt, + isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state + ); } } public function yypopstate() { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%sState pop %s\n", - $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf( + $this->yyTraceFILE, + "%sState pop %s\n", + $this->yyTracePrompt, + isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state + ); } $this->_yy_state = array_pop($this->_yy_stack); if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%snew State %s\n", - $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf( + $this->yyTraceFILE, + "%snew State %s\n", + $this->yyTracePrompt, + isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state + ); } } @@ -206,11 +233,12 @@ class Smarty_Internal_Configfilelexer { $this->_yy_state = $state; if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%sState set %s\n", - $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf( + $this->yyTraceFILE, + "%sState set %s\n", + $this->yyTracePrompt, + isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state + ); } } @@ -235,9 +263,11 @@ class Smarty_Internal_Configfilelexer } if (empty($yymatches)) { throw new Exception('Error: lexing failed because a rule matched' . - ' an empty string. Input "' . substr($this->data, - $this->counter, - 5) . '... state START'); + ' an empty string. Input "' . substr( + $this->data, + $this->counter, + 5 + ) . '... state START'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -248,11 +278,11 @@ class Smarty_Internal_Configfilelexer $this->line += substr_count($this->value, "\n"); // accept this token return true; - } else if ($r === true) { + } elseif ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } else if ($r === false) { + } elseif ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -269,45 +299,45 @@ class Smarty_Internal_Configfilelexer } while (true); } - function yy_r1_1() + public function yy_r1_1() { $this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART; $this->yypushstate(self::COMMENT); } - function yy_r1_2() + public function yy_r1_2() { $this->token = Smarty_Internal_Configfileparser::TPC_OPENB; $this->yypushstate(self::SECTION); } - function yy_r1_3() + public function yy_r1_3() { $this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB; } - function yy_r1_4() + public function yy_r1_4() { $this->token = Smarty_Internal_Configfileparser::TPC_EQUAL; $this->yypushstate(self::VALUE); } // end function - function yy_r1_5() + public function yy_r1_5() { return false; } - function yy_r1_6() + public function yy_r1_6() { $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE; } - function yy_r1_7() + public function yy_r1_7() { $this->token = Smarty_Internal_Configfileparser::TPC_ID; } - function yy_r1_8() + public function yy_r1_8() { $this->token = Smarty_Internal_Configfileparser::TPC_OTHER; } @@ -333,9 +363,11 @@ class Smarty_Internal_Configfilelexer } if (empty($yymatches)) { throw new Exception('Error: lexing failed because a rule matched' . - ' an empty string. Input "' . substr($this->data, - $this->counter, - 5) . '... state VALUE'); + ' an empty string. Input "' . substr( + $this->data, + $this->counter, + 5 + ) . '... state VALUE'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -346,11 +378,11 @@ class Smarty_Internal_Configfilelexer $this->line += substr_count($this->value, "\n"); // accept this token return true; - } else if ($r === true) { + } elseif ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } else if ($r === false) { + } elseif ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -367,42 +399,42 @@ class Smarty_Internal_Configfilelexer } while (true); } - function yy_r2_1() + public function yy_r2_1() { return false; } - function yy_r2_2() + public function yy_r2_2() { $this->token = Smarty_Internal_Configfileparser::TPC_FLOAT; $this->yypopstate(); } - function yy_r2_3() + public function yy_r2_3() { $this->token = Smarty_Internal_Configfileparser::TPC_INT; $this->yypopstate(); } - function yy_r2_4() + public function yy_r2_4() { $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES; $this->yypushstate(self::TRIPPLE); } - function yy_r2_5() + public function yy_r2_5() { $this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING; $this->yypopstate(); } - function yy_r2_6() + public function yy_r2_6() { $this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING; $this->yypopstate(); } // end function - function yy_r2_7() + public function yy_r2_7() { if (!$this->configBooleanize || !in_array(strtolower($this->value), array('true', 'false', 'on', 'off', 'yes', 'no'))) { @@ -415,13 +447,13 @@ class Smarty_Internal_Configfilelexer } } - function yy_r2_8() + public function yy_r2_8() { $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; $this->yypopstate(); } - function yy_r2_9() + public function yy_r2_9() { $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; $this->value = ''; @@ -448,9 +480,11 @@ class Smarty_Internal_Configfilelexer } if (empty($yymatches)) { throw new Exception('Error: lexing failed because a rule matched' . - ' an empty string. Input "' . substr($this->data, - $this->counter, - 5) . '... state NAKED_STRING_VALUE'); + ' an empty string. Input "' . substr( + $this->data, + $this->counter, + 5 + ) . '... state NAKED_STRING_VALUE'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -461,11 +495,11 @@ class Smarty_Internal_Configfilelexer $this->line += substr_count($this->value, "\n"); // accept this token return true; - } else if ($r === true) { + } elseif ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } else if ($r === false) { + } elseif ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -482,7 +516,7 @@ class Smarty_Internal_Configfilelexer } while (true); } - function yy_r3_1() + public function yy_r3_1() { $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; $this->yypopstate(); @@ -508,9 +542,11 @@ class Smarty_Internal_Configfilelexer } if (empty($yymatches)) { throw new Exception('Error: lexing failed because a rule matched' . - ' an empty string. Input "' . substr($this->data, - $this->counter, - 5) . '... state COMMENT'); + ' an empty string. Input "' . substr( + $this->data, + $this->counter, + 5 + ) . '... state COMMENT'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -521,11 +557,11 @@ class Smarty_Internal_Configfilelexer $this->line += substr_count($this->value, "\n"); // accept this token return true; - } else if ($r === true) { + } elseif ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } else if ($r === false) { + } elseif ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -542,17 +578,17 @@ class Smarty_Internal_Configfilelexer } while (true); } - function yy_r4_1() + public function yy_r4_1() { return false; } - function yy_r4_2() + public function yy_r4_2() { $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; } // end function - function yy_r4_3() + public function yy_r4_3() { $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE; $this->yypopstate(); @@ -578,9 +614,11 @@ class Smarty_Internal_Configfilelexer } if (empty($yymatches)) { throw new Exception('Error: lexing failed because a rule matched' . - ' an empty string. Input "' . substr($this->data, - $this->counter, - 5) . '... state SECTION'); + ' an empty string. Input "' . substr( + $this->data, + $this->counter, + 5 + ) . '... state SECTION'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -591,11 +629,11 @@ class Smarty_Internal_Configfilelexer $this->line += substr_count($this->value, "\n"); // accept this token return true; - } else if ($r === true) { + } elseif ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } else if ($r === false) { + } elseif ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -612,12 +650,12 @@ class Smarty_Internal_Configfilelexer } while (true); } - function yy_r5_1() + public function yy_r5_1() { $this->token = Smarty_Internal_Configfileparser::TPC_DOT; } - function yy_r5_2() + public function yy_r5_2() { $this->token = Smarty_Internal_Configfileparser::TPC_SECTION; $this->yypopstate(); @@ -643,9 +681,11 @@ class Smarty_Internal_Configfilelexer } if (empty($yymatches)) { throw new Exception('Error: lexing failed because a rule matched' . - ' an empty string. Input "' . substr($this->data, - $this->counter, - 5) . '... state TRIPPLE'); + ' an empty string. Input "' . substr( + $this->data, + $this->counter, + 5 + ) . '... state TRIPPLE'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -656,11 +696,11 @@ class Smarty_Internal_Configfilelexer $this->line += substr_count($this->value, "\n"); // accept this token return true; - } else if ($r === true) { + } elseif ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } else if ($r === false) { + } elseif ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -677,21 +717,21 @@ class Smarty_Internal_Configfilelexer } while (true); } - function yy_r6_1() + public function yy_r6_1() { $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END; $this->yypopstate(); $this->yypushstate(self::START); } - function yy_r6_2() + public function yy_r6_2() { $to = strlen($this->data); preg_match("/\"\"\"[ \t\r]*[\n#;]/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter); if (isset($match[ 0 ][ 1 ])) { $to = $match[ 0 ][ 1 ]; } else { - $this->compiler->trigger_template_error('missing or misspelled literal closing tag'); + $this->compiler->trigger_config_file_error('missing or misspelled literal closing tag'); } $this->value = substr($this->data, $this->counter, $to - $this->counter); $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_configfileparser.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_configfileparser.php index 1c76f7bc8..36fdb76ee 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_configfileparser.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_configfileparser.php @@ -9,7 +9,7 @@ class TPC_yyStackEntry ** is the value of the token */ } -#line 12 "../smarty/lexer/smarty_internal_configfileparser.y" +// line 12 "../smarty/lexer/smarty_internal_configfileparser.y" /** * Smarty Internal Plugin Configfileparse @@ -23,7 +23,7 @@ class TPC_yyStackEntry */ class Smarty_Internal_Configfileparser { - #line 25 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 25 "../smarty/lexer/smarty_internal_configfileparser.y" const TPC_OPENB = 1; const TPC_SECTION = 2; const TPC_CLOSEB = 3; @@ -48,7 +48,7 @@ class Smarty_Internal_Configfileparser const YY_SZ_ACTTAB = 38; const YY_SHIFT_USE_DFLT = -8; const YY_SHIFT_MAX = 19; - const YY_REDUCE_USE_DFLT = -21; + const YY_REDUCE_USE_DFLT = -17; const YY_REDUCE_MAX = 10; const YYNOCODE = 29; const YYSTACKDEPTH = 100; @@ -57,27 +57,32 @@ class Smarty_Internal_Configfileparser const YYERRORSYMBOL = 19; const YYERRSYMDT = 'yy0'; const YYFALLBACK = 0; - static public $yy_action = array( - 29, 30, 34, 33, 24, 13, 19, 25, 35, 21, - 59, 8, 3, 1, 20, 12, 14, 31, 20, 12, - 15, 17, 23, 18, 27, 26, 4, 5, 6, 32, - 2, 11, 28, 22, 16, 9, 7, 10, + + public static $yy_action = array( + 32, 31, 30, 29, 35, 13, 19, 3, 24, 26, + 59, 9, 14, 1, 16, 25, 11, 28, 25, 11, + 17, 27, 34, 20, 18, 15, 23, 5, 6, 22, + 10, 8, 4, 12, 2, 33, 7, 21, ); - static public $yy_lookahead = array( - 7, 8, 9, 10, 11, 12, 5, 27, 15, 16, - 20, 21, 23, 23, 17, 18, 13, 14, 17, 18, - 15, 2, 17, 4, 25, 26, 6, 3, 3, 14, - 23, 1, 24, 17, 2, 25, 22, 25, + + public static $yy_lookahead = array( + 7, 8, 9, 10, 11, 12, 5, 23, 15, 16, + 20, 21, 2, 23, 4, 17, 18, 14, 17, 18, + 13, 14, 25, 26, 15, 2, 17, 3, 3, 17, + 25, 25, 6, 1, 23, 27, 22, 24, ); - static public $yy_shift_ofst = array( - -8, 1, 1, 1, -7, -3, -3, 30, -8, -8, - -8, 19, 5, 3, 15, 16, 24, 25, 32, 20, + + public static $yy_shift_ofst = array( + -8, 1, 1, 1, -7, -2, -2, 32, -8, -8, + -8, 9, 10, 7, 25, 24, 23, 3, 12, 26, ); - static public $yy_reduce_ofst = array( - -10, -1, -1, -1, -20, 10, 12, 8, 14, 7, - -11, + + public static $yy_reduce_ofst = array( + -10, -3, -3, -3, 8, 6, 5, 13, 11, 14, + -16, ); - static public $yyExpectedTokens = array( + + public static $yyExpectedTokens = array( array(), array(5, 17, 18,), array(5, 17, 18,), @@ -89,14 +94,14 @@ class Smarty_Internal_Configfileparser array(), array(), array(), - array(2, 4,), array(15, 17,), + array(2, 4,), array(13, 14,), - array(14,), - array(17,), array(3,), array(3,), array(2,), + array(14,), + array(17,), array(6,), array(), array(), @@ -115,13 +120,16 @@ class Smarty_Internal_Configfileparser array(), array(), ); - static public $yy_default = array( - 44, 37, 41, 40, 58, 58, 58, 36, 39, 44, + + public static $yy_default = array( + 44, 37, 41, 40, 58, 58, 58, 36, 44, 39, 44, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 55, 54, 57, 56, 50, 45, 43, 42, 38, 46, - 47, 52, 51, 49, 48, 53, + 43, 38, 57, 56, 53, 55, 54, 52, 51, 49, + 48, 47, 46, 45, 42, 50, ); + public static $yyFallback = array(); + public static $yyRuleName = array( 'start ::= global_vars sections', 'global_vars ::= var_list', @@ -146,6 +154,7 @@ class Smarty_Internal_Configfileparser 'newline ::= COMMENTSTART NEWLINE', 'newline ::= COMMENTSTART NAKED_STRING NEWLINE', ); + public static $yyRuleInfo = array( array(0 => 20, 1 => 2), array(0 => 21, 1 => 1), @@ -170,6 +179,7 @@ class Smarty_Internal_Configfileparser array(0 => 25, 1 => 2), array(0 => 25, 1 => 3), ); + public static $yyReduceMap = array( 0 => 0, 2 => 0, @@ -194,46 +204,60 @@ class Smarty_Internal_Configfileparser 17 => 17, 18 => 17, ); + /** * helper map * * @var array */ - private static $escapes_single = array('\\' => '\\', - '\'' => '\''); + private static $escapes_single = array( + '\\' => '\\', + '\'' => '\'' + ); + /** * result status * * @var bool */ public $successful = true; + /** * return value * * @var mixed */ public $retvalue = 0; + /** * @var */ public $yymajor; + /** * compiler object * * @var Smarty_Internal_Config_File_Compiler */ public $compiler = null; + /** * smarty object * * @var Smarty */ public $smarty = null; + public $yyTraceFILE; + public $yyTracePrompt; + public $yyidx; + public $yyerrcnt; + public $yystack = array(); + public $yyTokenName = array( '$', 'OPENB', 'SECTION', 'CLOSEB', 'DOT', 'ID', 'EQUAL', 'FLOAT', @@ -243,30 +267,35 @@ class Smarty_Internal_Configfileparser 'start', 'global_vars', 'sections', 'var_list', 'section', 'newline', 'var', 'value', ); + /** * lexer object * * @var Smarty_Internal_Configfilelexer */ private $lex; + /** * internal error flag * * @var bool */ private $internalError = false; + /** * copy of config_overwrite property * * @var bool */ private $configOverwrite = false; + /** * copy of config_read_hidden property * * @var bool */ private $configReadHidden = false; + private $_retvalue; /** @@ -275,7 +304,7 @@ class Smarty_Internal_Configfileparser * @param Smarty_Internal_Configfilelexer $lex * @param Smarty_Internal_Config_File_Compiler $compiler */ - function __construct(Smarty_Internal_Configfilelexer $lex, Smarty_Internal_Config_File_Compiler $compiler) + public function __construct(Smarty_Internal_Configfilelexer $lex, Smarty_Internal_Config_File_Compiler $compiler) { $this->lex = $lex; $this->smarty = $compiler->smarty; @@ -343,7 +372,7 @@ class Smarty_Internal_Configfileparser { if (!$TraceFILE) { $zTracePrompt = 0; - } else if (!$zTracePrompt) { + } elseif (!$zTracePrompt) { $TraceFILE = 0; } $this->yyTraceFILE = $TraceFILE; @@ -375,9 +404,11 @@ class Smarty_Internal_Configfileparser } $yytos = array_pop($this->yystack); if ($this->yyTraceFILE && $this->yyidx >= 0) { - fwrite($this->yyTraceFILE, - $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . - "\n"); + fwrite( + $this->yyTraceFILE, + $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . + "\n" + ); } $yymajor = $yytos->major; self::yy_destructor($yymajor, $yytos->minor); @@ -387,7 +418,7 @@ class Smarty_Internal_Configfileparser public function __destruct() { - while ($this->yystack !== Array()) { + while ($this->yystack !== array()) { $this->yy_pop_parser_stack(); } if (is_resource($this->yyTraceFILE)) { @@ -429,7 +460,8 @@ class Smarty_Internal_Configfileparser $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ]; $nextstate = $this->yy_find_reduce_action( $this->yystack[ $this->yyidx ]->stateno, - self::$yyRuleInfo[ $yyruleno ][ 0 ]); + self::$yyRuleInfo[ $yyruleno ][ 0 ] + ); if (isset(self::$yyExpectedTokens[ $nextstate ])) { $expected = array_merge($expected, self::$yyExpectedTokens[ $nextstate ]); if (isset($res4[ $nextstate ][ $token ])) { @@ -455,14 +487,14 @@ class Smarty_Internal_Configfileparser $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ]; $this->yystack[ $this->yyidx ] = $x; continue 2; - } else if ($nextstate === self::YYNSTATE + self::YYNRULE + 1) { + } elseif ($nextstate === self::YYNSTATE + self::YYNRULE + 1) { $this->yyidx = $yyidx; $this->yystack = $stack; // the last token was just ignored, we can't accept // by ignoring input, this is in essence ignoring a // syntax error! return array_unique($expected); - } else if ($nextstate === self::YY_NO_ACTION) { + } elseif ($nextstate === self::YY_NO_ACTION) { $this->yyidx = $yyidx; $this->yystack = $stack; // input accepted, but not shifted (I guess) @@ -515,7 +547,8 @@ class Smarty_Internal_Configfileparser $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ]; $nextstate = $this->yy_find_reduce_action( $this->yystack[ $this->yyidx ]->stateno, - self::$yyRuleInfo[ $yyruleno ][ 0 ]); + self::$yyRuleInfo[ $yyruleno ][ 0 ] + ); if (isset($res2[ $nextstate ][ $token ])) { if ($res2[ $nextstate ][ $token ]) { $this->yyidx = $yyidx; @@ -523,10 +556,9 @@ class Smarty_Internal_Configfileparser return true; } } else { - if ($res2[ $nextstate ][ $token ] = (isset(self::$yyExpectedTokens[ $nextstate ]) && - in_array($token, - self::$yyExpectedTokens[ $nextstate ], - true))) { + if ($res2[ $nextstate ][ $token ] = + (isset(self::$yyExpectedTokens[ $nextstate ]) && + in_array($token, self::$yyExpectedTokens[ $nextstate ], true))) { $this->yyidx = $yyidx; $this->yystack = $stack; return true; @@ -540,7 +572,7 @@ class Smarty_Internal_Configfileparser $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ]; $this->yystack[ $this->yyidx ] = $x; continue 2; - } else if ($nextstate === self::YYNSTATE + self::YYNRULE + 1) { + } elseif ($nextstate === self::YYNSTATE + self::YYNRULE + 1) { $this->yyidx = $yyidx; $this->yystack = $stack; if (!$token) { @@ -551,7 +583,7 @@ class Smarty_Internal_Configfileparser // by ignoring input, this is in essence ignoring a // syntax error! return false; - } else if ($nextstate === self::YY_NO_ACTION) { + } elseif ($nextstate === self::YY_NO_ACTION) { $this->yyidx = $yyidx; $this->yystack = $stack; // input accepted, but not shifted (I guess) @@ -589,10 +621,9 @@ class Smarty_Internal_Configfileparser if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback) && ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0) { if ($this->yyTraceFILE) { - fwrite($this->yyTraceFILE, - $this->yyTracePrompt . 'FALLBACK ' . - $this->yyTokenName[ $iLookAhead ] . ' => ' . - $this->yyTokenName[ $iFallback ] . "\n"); + fwrite($this->yyTraceFILE, $this->yyTracePrompt . 'FALLBACK ' . + $this->yyTokenName[ $iLookAhead ] . ' => ' . + $this->yyTokenName[ $iFallback ] . "\n"); } return $this->yy_find_shift_action($iFallback); } @@ -635,7 +666,7 @@ class Smarty_Internal_Configfileparser while ($this->yyidx >= 0) { $this->yy_pop_parser_stack(); } - #line 239 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 239 "../smarty/lexer/smarty_internal_configfileparser.y" $this->internalError = true; $this->compiler->trigger_config_file_error('Stack overflow in configfile parser'); return; @@ -646,131 +677,142 @@ class Smarty_Internal_Configfileparser $yytos->minor = $yypMinor; $this->yystack[] = $yytos; if ($this->yyTraceFILE && $this->yyidx > 0) { - fprintf($this->yyTraceFILE, - "%sShift %d\n", - $this->yyTracePrompt, - $yyNewState); + fprintf( + $this->yyTraceFILE, + "%sShift %d\n", + $this->yyTracePrompt, + $yyNewState + ); fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt); for ($i = 1; $i <= $this->yyidx; $i++) { - fprintf($this->yyTraceFILE, - " %s", - $this->yyTokenName[ $this->yystack[ $i ]->major ]); + fprintf( + $this->yyTraceFILE, + " %s", + $this->yyTokenName[ $this->yystack[ $i ]->major ] + ); } fwrite($this->yyTraceFILE, "\n"); } } - function yy_r0() + public function yy_r0() { $this->_retvalue = null; } - function yy_r1() + public function yy_r1() { $this->add_global_vars($this->yystack[ $this->yyidx + 0 ]->minor); $this->_retvalue = null; } - function yy_r4() + public function yy_r4() { $this->add_section_vars($this->yystack[ $this->yyidx + -3 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor); $this->_retvalue = null; } - #line 245 "../smarty/lexer/smarty_internal_configfileparser.y" - function yy_r5() + // line 245 "../smarty/lexer/smarty_internal_configfileparser.y" + public function yy_r5() { if ($this->configReadHidden) { - $this->add_section_vars($this->yystack[ $this->yyidx + -3 ]->minor, - $this->yystack[ $this->yyidx + 0 ]->minor); + $this->add_section_vars( + $this->yystack[ $this->yyidx + -3 ]->minor, + $this->yystack[ $this->yyidx + 0 ]->minor + ); } $this->_retvalue = null; } - #line 250 "../smarty/lexer/smarty_internal_configfileparser.y" - function yy_r6() + // line 250 "../smarty/lexer/smarty_internal_configfileparser.y" + public function yy_r6() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; } - #line 264 "../smarty/lexer/smarty_internal_configfileparser.y" - function yy_r7() + // line 264 "../smarty/lexer/smarty_internal_configfileparser.y" + public function yy_r7() { $this->_retvalue = array_merge($this->yystack[ $this->yyidx + -1 ]->minor, array($this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 269 "../smarty/lexer/smarty_internal_configfileparser.y" - function yy_r8() + // line 269 "../smarty/lexer/smarty_internal_configfileparser.y" + public function yy_r8() { $this->_retvalue = array(); } - #line 277 "../smarty/lexer/smarty_internal_configfileparser.y" - function yy_r9() + // line 277 "../smarty/lexer/smarty_internal_configfileparser.y" + public function yy_r9() { - $this->_retvalue = array('key' => $this->yystack[ $this->yyidx + -2 ]->minor, - 'value' => $this->yystack[ $this->yyidx + 0 ]->minor); + $this->_retvalue = + array( + 'key' => $this->yystack[ $this->yyidx + -2 ]->minor, + 'value' => $this->yystack[ $this->yyidx + 0 ]->minor + ); } - #line 281 "../smarty/lexer/smarty_internal_configfileparser.y" - function yy_r10() + // line 281 "../smarty/lexer/smarty_internal_configfileparser.y" + public function yy_r10() { $this->_retvalue = (float)$this->yystack[ $this->yyidx + 0 ]->minor; } - #line 285 "../smarty/lexer/smarty_internal_configfileparser.y" - function yy_r11() + // line 285 "../smarty/lexer/smarty_internal_configfileparser.y" + public function yy_r11() { $this->_retvalue = (int)$this->yystack[ $this->yyidx + 0 ]->minor; } - #line 291 "../smarty/lexer/smarty_internal_configfileparser.y" - function yy_r12() + // line 291 "../smarty/lexer/smarty_internal_configfileparser.y" + public function yy_r12() { $this->_retvalue = $this->parse_bool($this->yystack[ $this->yyidx + 0 ]->minor); } - #line 296 "../smarty/lexer/smarty_internal_configfileparser.y" - function yy_r13() + // line 296 "../smarty/lexer/smarty_internal_configfileparser.y" + public function yy_r13() { $this->_retvalue = self::parse_single_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor); } - #line 300 "../smarty/lexer/smarty_internal_configfileparser.y" - function yy_r14() + // line 300 "../smarty/lexer/smarty_internal_configfileparser.y" + public function yy_r14() { $this->_retvalue = self::parse_double_quoted_string($this->yystack[ $this->yyidx + 0 ]->minor); } - #line 304 "../smarty/lexer/smarty_internal_configfileparser.y" - function yy_r15() + // line 304 "../smarty/lexer/smarty_internal_configfileparser.y" + public function yy_r15() { $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[ $this->yyidx + -1 ]->minor); } - #line 308 "../smarty/lexer/smarty_internal_configfileparser.y" - function yy_r16() + // line 308 "../smarty/lexer/smarty_internal_configfileparser.y" + public function yy_r16() { $this->_retvalue = ''; } - #line 312 "../smarty/lexer/smarty_internal_configfileparser.y" - function yy_r17() + // line 312 "../smarty/lexer/smarty_internal_configfileparser.y" + public function yy_r17() { $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 316 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 316 "../smarty/lexer/smarty_internal_configfileparser.y" public function yy_reduce($yyruleno) { if ($this->yyTraceFILE && $yyruleno >= 0 && $yyruleno < count(self::$yyRuleName)) { - fprintf($this->yyTraceFILE, - "%sReduce (%d) [%s].\n", - $this->yyTracePrompt, - $yyruleno, - self::$yyRuleName[ $yyruleno ]); + fprintf( + $this->yyTraceFILE, + "%sReduce (%d) [%s].\n", + $this->yyTracePrompt, + $yyruleno, + self::$yyRuleName[ $yyruleno ] + ); } $this->_retvalue = $yy_lefthand_side = null; if (isset(self::$yyReduceMap[ $yyruleno ])) { @@ -798,12 +840,12 @@ class Smarty_Internal_Configfileparser } else { $this->yy_shift($yyact, $yygoto, $yy_lefthand_side); } - } else if ($yyact === self::YYNSTATE + self::YYNRULE + 1) { + } elseif ($yyact === self::YYNSTATE + self::YYNRULE + 1) { $this->yy_accept(); } } - #line 320 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 320 "../smarty/lexer/smarty_internal_configfileparser.y" public function yy_parse_failed() { if ($this->yyTraceFILE) { @@ -814,10 +856,10 @@ class Smarty_Internal_Configfileparser } } - #line 324 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 324 "../smarty/lexer/smarty_internal_configfileparser.y" public function yy_syntax_error($yymajor, $TOKEN) { - #line 232 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 232 "../smarty/lexer/smarty_internal_configfileparser.y" $this->internalError = true; $this->yymajor = $yymajor; $this->compiler->trigger_config_file_error(); @@ -831,7 +873,7 @@ class Smarty_Internal_Configfileparser while ($this->yyidx >= 0) { $this->yy_pop_parser_stack(); } - #line 225 "../smarty/lexer/smarty_internal_configfileparser.y" + // line 225 "../smarty/lexer/smarty_internal_configfileparser.y" $this->successful = !$this->internalError; $this->internalError = false; $this->retvalue = $this->_retvalue; @@ -851,10 +893,12 @@ class Smarty_Internal_Configfileparser } $yyendofinput = ($yymajor == 0); if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%sInput %s\n", - $this->yyTracePrompt, - $this->yyTokenName[ $yymajor ]); + fprintf( + $this->yyTraceFILE, + "%sInput %s\n", + $this->yyTracePrompt, + $this->yyTokenName[ $yymajor ] + ); } do { $yyact = $this->yy_find_shift_action($yymajor); @@ -871,13 +915,15 @@ class Smarty_Internal_Configfileparser } else { $yymajor = self::YYNOCODE; } - } else if ($yyact < self::YYNSTATE + self::YYNRULE) { + } elseif ($yyact < self::YYNSTATE + self::YYNRULE) { $this->yy_reduce($yyact - self::YYNSTATE); - } else if ($yyact === self::YY_ERROR_ACTION) { + } elseif ($yyact === self::YY_ERROR_ACTION) { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%sSyntax Error!\n", - $this->yyTracePrompt); + fprintf( + $this->yyTraceFILE, + "%sSyntax Error!\n", + $this->yyTracePrompt + ); } if (self::YYERRORSYMBOL) { if ($this->yyerrcnt < 0) { @@ -886,10 +932,12 @@ class Smarty_Internal_Configfileparser $yymx = $this->yystack[ $this->yyidx ]->major; if ($yymx === self::YYERRORSYMBOL || $yyerrorhit) { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%sDiscard input token %s\n", - $this->yyTracePrompt, - $this->yyTokenName[ $yymajor ]); + fprintf( + $this->yyTraceFILE, + "%sDiscard input token %s\n", + $this->yyTracePrompt, + $this->yyTokenName[ $yymajor ] + ); } $this->yy_destructor($yymajor, $yytokenvalue); $yymajor = self::YYNOCODE; @@ -904,7 +952,7 @@ class Smarty_Internal_Configfileparser $this->yy_destructor($yymajor, $yytokenvalue); $this->yy_parse_failed(); $yymajor = self::YYNOCODE; - } else if ($yymx !== self::YYERRORSYMBOL) { + } elseif ($yymx !== self::YYERRORSYMBOL) { $u2 = 0; $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2); } @@ -996,4 +1044,3 @@ class Smarty_Internal_Configfileparser } } } - diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_data.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_data.php index 37b917b14..98e3e57b3 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_data.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_data.php @@ -87,9 +87,9 @@ abstract class Smarty_Internal_Data /** * assigns a Smarty variable * - * @param array|string $tpl_var the template variable name(s) - * @param mixed $value the value to assign - * @param boolean $nocache if true any output of this variable will be not cached + * @param array|string $tpl_var the template variable name(s) + * @param mixed $value the value to assign + * @param boolean $nocache if true any output of this variable will be not cached * * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for * chaining @@ -103,7 +103,11 @@ abstract class Smarty_Internal_Data } else { if ($tpl_var !== '') { if ($this->_objType === 2) { - /** @var Smarty_Internal_Template $this */ + /** + * + * + * @var Smarty_Internal_Template $this + */ $this->_assignInScope($tpl_var, $value, $nocache); } else { $this->tpl_vars[ $tpl_var ] = new Smarty_Variable($value, $nocache); @@ -119,11 +123,11 @@ abstract class Smarty_Internal_Data * @api Smarty::append() * @link http://www.smarty.net/docs/en/api.append.tpl * - * @param array|string $tpl_var the template variable name(s) - * @param mixed $value the value to append - * @param bool $merge flag if array elements shall be merged - * @param bool $nocache if true any output of this variable will - * be not cached + * @param array|string $tpl_var the template variable name(s) + * @param mixed $value the value to append + * @param bool $merge flag if array elements shall be merged + * @param bool $nocache if true any output of this variable will + * be not cached * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ @@ -135,9 +139,9 @@ abstract class Smarty_Internal_Data /** * assigns a global Smarty variable * - * @param string $varName the global variable name - * @param mixed $value the value to assign - * @param boolean $nocache if true any output of this variable will be not cached + * @param string $varName the global variable name + * @param mixed $value the value to assign + * @param boolean $nocache if true any output of this variable will be not cached * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ @@ -149,9 +153,9 @@ abstract class Smarty_Internal_Data /** * appends values to template variables by reference * - * @param string $tpl_var the template variable name - * @param mixed &$value the referenced value to append - * @param boolean $merge flag if array elements shall be merged + * @param string $tpl_var the template variable name + * @param mixed &$value the referenced value to append + * @param boolean $merge flag if array elements shall be merged * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ @@ -163,9 +167,9 @@ abstract class Smarty_Internal_Data /** * assigns values to template variables by reference * - * @param string $tpl_var the template variable name - * @param $value - * @param boolean $nocache if true any output of this variable will be not cached + * @param string $tpl_var the template variable name + * @param $value + * @param boolean $nocache if true any output of this variable will be not cached * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ @@ -180,9 +184,9 @@ abstract class Smarty_Internal_Data * @api Smarty::getTemplateVars() * @link http://www.smarty.net/docs/en/api.get.template.vars.tpl * - * @param string $varName variable name or null + * @param string $varName variable name or null * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr optional pointer to data object - * @param bool $searchParents include parent templates? + * @param bool $searchParents include parent templates? * * @return mixed variable value or or array of variables */ @@ -194,17 +198,20 @@ abstract class Smarty_Internal_Data /** * gets the object of a Smarty variable * - * @param string $variable the name of the Smarty variable - * @param Smarty_Internal_Data $_ptr optional pointer to data object - * @param boolean $searchParents search also in parent data - * @param bool $error_enable + * @param string $variable the name of the Smarty variable + * @param Smarty_Internal_Data $_ptr optional pointer to data object + * @param boolean $searchParents search also in parent data + * @param bool $error_enable * - * @return Smarty_Variable|Smarty_Undefined_Variable the object of the variable + * @return Smarty_Variable|Smarty_Undefined_Variable the object of the variable * @deprecated since 3.1.28 please use Smarty_Internal_Data::getTemplateVars() instead. */ - public function getVariable($variable = null, Smarty_Internal_Data $_ptr = null, $searchParents = true, - $error_enable = true) - { + public function getVariable( + $variable = null, + Smarty_Internal_Data $_ptr = null, + $searchParents = true, + $error_enable = true + ) { return $this->ext->getTemplateVars->_getVariable($this, $variable, $_ptr, $searchParents, $error_enable); } @@ -277,7 +284,6 @@ abstract class Smarty_Internal_Data * @param array $args argument array * * @return mixed - * @throws SmartyException */ public function __call($name, $args) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_debug.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_debug.php index c826a1786..24b233e26 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_debug.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_debug.php @@ -53,8 +53,8 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data public function start_template(Smarty_Internal_Template $template, $mode = null) { if (isset($mode) && !$template->_isSubTpl()) { - $this->index ++; - $this->offset ++; + $this->index++; + $this->offset++; $this->template_data[ $this->index ] = null; } $key = $this->get_key($template); @@ -117,7 +117,6 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data if (isset($this->ignore_uid[ $template->source->uid ])) { return; } - $key = $this->get_key($template); } $this->template_data[ $this->index ][ $key ][ 'compile_time' ] += @@ -200,7 +199,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data public function display_debug($obj, $full = false) { if (!$full) { - $this->offset ++; + $this->offset++; $savedIndex = $this->index; $this->index = 9999; } @@ -211,7 +210,8 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data // copy the working dirs from application $debObj->setCompileDir($smarty->getCompileDir()); // init properties by hand as user may have edited the original Smarty class - $debObj->setPluginsDir(is_dir(__DIR__ . '/../plugins') ? __DIR__ . '/../plugins' : $smarty->getPluginsDir()); + $debObj->setPluginsDir(is_dir(dirname(__FILE__) . '/../plugins') ? dirname(__FILE__) . + '/../plugins' : $smarty->getPluginsDir()); $debObj->force_compile = false; $debObj->compile_check = Smarty::COMPILECHECK_ON; $debObj->left_delimiter = '{'; @@ -220,7 +220,8 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data $debObj->debugging = false; $debObj->debugging_ctrl = 'NONE'; $debObj->error_reporting = E_ALL & ~E_NOTICE; - $debObj->debug_tpl = isset($smarty->debug_tpl) ? $smarty->debug_tpl : 'file:' . __DIR__ . '/../debug.tpl'; + $debObj->debug_tpl = + isset($smarty->debug_tpl) ? $smarty->debug_tpl : 'file:' . dirname(__FILE__) . '/../debug.tpl'; $debObj->registered_plugins = array(); $debObj->registered_resources = array(); $debObj->registered_filters = array(); @@ -237,7 +238,6 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data $_config_vars = $ptr->config_vars; ksort($_config_vars); $debugging = $smarty->debugging; - $_template = new Smarty_Internal_Template($debObj->debug_tpl, $debObj); if ($obj->_isTplObj()) { $_template->assign('template_name', $obj->source->type . ':' . $obj->source->name); @@ -254,7 +254,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data $_template->assign('offset', $this->offset * 50); echo $_template->fetch(); if (isset($full)) { - $this->index --; + $this->index--; } if (!$full) { $this->index = $savedIndex; @@ -264,7 +264,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data /** * Recursively gets variables from all template/data scopes * - * @param Smarty_Internal_Template|Smarty_Data $obj object to debug + * @param Smarty_Internal_Template|Smarty_Data $obj object to debug * * @return StdClass */ @@ -306,7 +306,6 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data $tpl_vars[ $key ][ 'scope' ] = 'Smarty object'; } } - if (isset($obj->parent)) { $parent = $this->get_debug_vars($obj->parent); foreach ($parent->tpl_vars as $name => $pvar) { @@ -315,7 +314,6 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data } } $tpl_vars = array_merge($parent->tpl_vars, $tpl_vars); - foreach ($parent->config_vars as $name => $pvar) { if (isset($config_vars[ $name ]) && $config_vars[ $name ][ 'value' ] === $pvar[ 'value' ]) { $config_vars[ $name ][ 'scope' ] = $pvar[ 'scope' ]; @@ -344,8 +342,7 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data } } } - - return (object) array('tpl_vars' => $tpl_vars, 'config_vars' => $config_vars); + return (object)array('tpl_vars' => $tpl_vars, 'config_vars' => $config_vars); } /** @@ -376,7 +373,6 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data $this->template_data[ $this->index ][ $key ][ 'render_time' ] = 0; $this->template_data[ $this->index ][ $key ][ 'cache_time' ] = 0; $this->template_data[ $this->index ][ $key ][ 'total_time' ] = 0; - return $key; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_errorhandler.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_errorhandler.php index 831421833..0ba00659d 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_errorhandler.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_errorhandler.php @@ -3,7 +3,6 @@ /** * Smarty error handler * - * * @package Smarty * @subpackage PluginsInternal * @author Uwe Tews @@ -17,6 +16,7 @@ class Smarty_Internal_ErrorHandler * contains directories outside of SMARTY_DIR that are to be muted by muteExpectedErrors() */ public static $mutedDirectories = array(); + /** * error handler returned by set_error_handler() in self::muteExpectedErrors() */ @@ -25,7 +25,6 @@ class Smarty_Internal_ErrorHandler /** * Enable error handler to mute expected messages * - * @return boolean */ public static function muteExpectedErrors() { @@ -58,11 +57,11 @@ class Smarty_Internal_ErrorHandler * * @link http://php.net/set_error_handler * - * @param integer $errno Error level - * @param $errstr - * @param $errfile - * @param $errline - * @param $errcontext + * @param integer $errno Error level + * @param $errstr + * @param $errfile + * @param $errline + * @param $errcontext * * @return bool */ @@ -98,15 +97,17 @@ class Smarty_Internal_ErrorHandler // or the error was within smarty but masked to be ignored if (!$_is_muted_directory || ($errno && $errno & error_reporting())) { if (self::$previousErrorHandler) { - return call_user_func(self::$previousErrorHandler, - $errno, - $errstr, - $errfile, - $errline, - $errcontext); + return call_user_func( + self::$previousErrorHandler, + $errno, + $errstr, + $errfile, + $errline, + $errcontext + ); } else { return false; } } } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_extension_handler.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_extension_handler.php index 90d3b81ea..b07615526 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_extension_handler.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_extension_handler.php @@ -5,41 +5,39 @@ * * Load extensions dynamically * - * * @package Smarty * @subpackage PluginsInternal * @author Uwe Tews * * Runtime extensions - * @property Smarty_Internal_Runtime_CacheModify $_cacheModify - * @property Smarty_Internal_Runtime_CacheResourceFile $_cacheResourceFile - * @property Smarty_Internal_Runtime_Capture $_capture - * @property Smarty_Internal_Runtime_CodeFrame $_codeFrame - * @property Smarty_Internal_Runtime_FilterHandler $_filterHandler - * @property Smarty_Internal_Runtime_Foreach $_foreach - * @property Smarty_Internal_Runtime_GetIncludePath $_getIncludePath - * @property Smarty_Internal_Runtime_Make_Nocache $_make_nocache - * @property Smarty_Internal_Runtime_UpdateCache $_updateCache - * @property Smarty_Internal_Runtime_UpdateScope $_updateScope - * @property Smarty_Internal_Runtime_TplFunction $_tplFunction - * @property Smarty_Internal_Runtime_WriteFile $_writeFile + * @property Smarty_Internal_Runtime_CacheModify $_cacheModify + * @property Smarty_Internal_Runtime_CacheResourceFile $_cacheResourceFile + * @property Smarty_Internal_Runtime_Capture $_capture + * @property Smarty_Internal_Runtime_CodeFrame $_codeFrame + * @property Smarty_Internal_Runtime_FilterHandler $_filterHandler + * @property Smarty_Internal_Runtime_Foreach $_foreach + * @property Smarty_Internal_Runtime_GetIncludePath $_getIncludePath + * @property Smarty_Internal_Runtime_Make_Nocache $_make_nocache + * @property Smarty_Internal_Runtime_UpdateCache $_updateCache + * @property Smarty_Internal_Runtime_UpdateScope $_updateScope + * @property Smarty_Internal_Runtime_TplFunction $_tplFunction + * @property Smarty_Internal_Runtime_WriteFile $_writeFile * * Method extensions - * @property Smarty_Internal_Method_GetTemplateVars $getTemplateVars - * @property Smarty_Internal_Method_Append $append - * @property Smarty_Internal_Method_AppendByRef $appendByRef - * @property Smarty_Internal_Method_AssignGlobal $assignGlobal - * @property Smarty_Internal_Method_AssignByRef $assignByRef - * @property Smarty_Internal_Method_LoadFilter $loadFilter - * @property Smarty_Internal_Method_LoadPlugin $loadPlugin - * @property Smarty_Internal_Method_RegisterFilter $registerFilter - * @property Smarty_Internal_Method_RegisterObject $registerObject - * @property Smarty_Internal_Method_RegisterPlugin $registerPlugin - * @property mixed|\Smarty_Template_Cached configLoad + * @property Smarty_Internal_Method_GetTemplateVars $getTemplateVars + * @property Smarty_Internal_Method_Append $append + * @property Smarty_Internal_Method_AppendByRef $appendByRef + * @property Smarty_Internal_Method_AssignGlobal $assignGlobal + * @property Smarty_Internal_Method_AssignByRef $assignByRef + * @property Smarty_Internal_Method_LoadFilter $loadFilter + * @property Smarty_Internal_Method_LoadPlugin $loadPlugin + * @property Smarty_Internal_Method_RegisterFilter $registerFilter + * @property Smarty_Internal_Method_RegisterObject $registerObject + * @property Smarty_Internal_Method_RegisterPlugin $registerPlugin + * @property mixed|\Smarty_Template_Cached configLoad */ class Smarty_Internal_Extension_Handler { - public $objType = null; /** @@ -48,9 +46,11 @@ class Smarty_Internal_Extension_Handler * * @var array */ - private $_property_info = array('AutoloadFilters' => 0, 'DefaultModifiers' => 0, 'ConfigVars' => 0, - 'DebugTemplate' => 0, 'RegisteredObject' => 0, 'StreamVariable' => 0, - 'TemplateVars' => 0, 'Literals' => 'Literals',);# + private $_property_info = array( + 'AutoloadFilters' => 0, 'DefaultModifiers' => 0, 'ConfigVars' => 0, + 'DebugTemplate' => 0, 'RegisteredObject' => 0, 'StreamVariable' => 0, + 'TemplateVars' => 0, 'Literals' => 'Literals', + );// private $resolvedProperties = array(); @@ -62,7 +62,6 @@ class Smarty_Internal_Extension_Handler * @param array $args argument array * * @return mixed - * @throws SmartyException */ public function _callExternalMethod(Smarty_Internal_Data $data, $name, $args) { @@ -70,9 +69,10 @@ class Smarty_Internal_Extension_Handler $smarty = isset($data->smarty) ? $data->smarty : $data; if (!isset($smarty->ext->$name)) { if (preg_match('/^((set|get)|(.*?))([A-Z].*)$/', $name, $match)) { - $basename = $this->upperCase($match[4]); - if (!isset($smarty->ext->$basename) && isset($this->_property_info[ $basename ]) && - is_string($this->_property_info[ $basename ])) { + $basename = $this->upperCase($match[ 4 ]); + if (!isset($smarty->ext->$basename) && isset($this->_property_info[ $basename ]) + && is_string($this->_property_info[ $basename ]) + ) { $class = 'Smarty_Internal_Method_' . $this->_property_info[ $basename ]; if (class_exists($class)) { $classObj = new $class(); @@ -82,40 +82,45 @@ class Smarty_Internal_Extension_Handler } } } - if (!empty($match[2]) && !isset($smarty->ext->$name)) { + if (!empty($match[ 2 ]) && !isset($smarty->ext->$name)) { $class = 'Smarty_Internal_Method_' . $this->upperCase($name); if (!class_exists($class)) { $objType = $data->_objType; $propertyType = false; - if (!isset($this->resolvedProperties[ $match[0] ][ $objType ])) { - $property = isset($this->resolvedProperties['property'][ $basename ]) ? - $this->resolvedProperties['property'][ $basename ] : - $property = $this->resolvedProperties['property'][ $basename ] = strtolower(join('_', - preg_split('/([A-Z][^A-Z]*)/', - $basename, - -1, - PREG_SPLIT_NO_EMPTY | - PREG_SPLIT_DELIM_CAPTURE))); - + if (!isset($this->resolvedProperties[ $match[ 0 ] ][ $objType ])) { + $property = isset($this->resolvedProperties[ 'property' ][ $basename ]) ? + $this->resolvedProperties[ 'property' ][ $basename ] : + $property = $this->resolvedProperties[ 'property' ][ $basename ] = strtolower( + join( + '_', + preg_split( + '/([A-Z][^A-Z]*)/', + $basename, + -1, + PREG_SPLIT_NO_EMPTY | + PREG_SPLIT_DELIM_CAPTURE + ) + ) + ); if ($property !== false) { if (property_exists($data, $property)) { - $propertyType = $this->resolvedProperties[ $match[0] ][ $objType ] = 1; - } else if (property_exists($smarty, $property)) { - $propertyType = $this->resolvedProperties[ $match[0] ][ $objType ] = 2; + $propertyType = $this->resolvedProperties[ $match[ 0 ] ][ $objType ] = 1; + } elseif (property_exists($smarty, $property)) { + $propertyType = $this->resolvedProperties[ $match[ 0 ] ][ $objType ] = 2; } else { - $this->resolvedProperties['property'][ $basename ] = $property = false; + $this->resolvedProperties[ 'property' ][ $basename ] = $property = false; } } } else { - $propertyType = $this->resolvedProperties[ $match[0] ][ $objType ]; - $property = $this->resolvedProperties['property'][ $basename ]; + $propertyType = $this->resolvedProperties[ $match[ 0 ] ][ $objType ]; + $property = $this->resolvedProperties[ 'property' ][ $basename ]; } if ($propertyType) { $obj = $propertyType === 1 ? $data : $smarty; - if ($match[2] === 'get') { + if ($match[ 2 ] === 'get') { return $obj->$property; - } else if ($match[2] === 'set') { - return $obj->$property = $args[0]; + } elseif ($match[ 2 ] === 'set') { + return $obj->$property = $args[ 0 ]; } } } @@ -124,7 +129,7 @@ class Smarty_Internal_Extension_Handler } $callback = array($smarty->ext->$name, $name); array_unshift($args, $data); - if (isset($callback) && $callback[0]->objMap | $data->_objType) { + if (isset($callback) && $callback[ 0 ]->objMap | $data->_objType) { return call_user_func_array($callback, $args); } return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), $args); @@ -150,12 +155,11 @@ class Smarty_Internal_Extension_Handler * @param string $property_name property name * * @return mixed|Smarty_Template_Cached - * @throws SmartyException */ public function __get($property_name) { // object properties of runtime template extensions will start with '_' - if ($property_name[0] === '_') { + if ($property_name[ 0 ] === '_') { $class = 'Smarty_Internal_Runtime' . $this->upperCase($property_name); } else { $class = 'Smarty_Internal_Method_' . $this->upperCase($property_name); @@ -172,7 +176,6 @@ class Smarty_Internal_Extension_Handler * @param string $property_name property name * @param mixed $value value * - * @throws SmartyException */ public function __set($property_name, $value) { @@ -186,11 +189,9 @@ class Smarty_Internal_Extension_Handler * @param array $args argument array * * @return mixed - * @throws SmartyException */ public function __call($name, $args) { return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), array($this)); } - -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php index 7bd75bfb5..a05f55a82 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php @@ -17,11 +17,12 @@ class Smarty_Internal_Method_AddAutoloadFilters extends Smarty_Internal_Method_S * @api Smarty::setAutoloadFilters() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param array $filters filters to load automatically - * @param string $type "pre", "output", … specify the - * filter type to set. Defaults to - * none treating $filters' keys as - * the appropriate types + * @param array $filters filters to load automatically + * @param string $type "pre", "output", … specify + * the filter type to set. + * Defaults to none treating + * $filters' keys as the + * appropriate types * * @return \Smarty|\Smarty_Internal_Template * @throws \SmartyException @@ -32,21 +33,21 @@ class Smarty_Internal_Method_AddAutoloadFilters extends Smarty_Internal_Method_S if ($type !== null) { $this->_checkFilterType($type); if (!empty($smarty->autoload_filters[ $type ])) { - $smarty->autoload_filters[ $type ] = array_merge($smarty->autoload_filters[ $type ], (array) $filters); + $smarty->autoload_filters[ $type ] = array_merge($smarty->autoload_filters[ $type ], (array)$filters); } else { - $smarty->autoload_filters[ $type ] = (array) $filters; + $smarty->autoload_filters[ $type ] = (array)$filters; } } else { - foreach ((array) $filters as $type => $value) { + foreach ((array)$filters as $type => $value) { $this->_checkFilterType($type); if (!empty($smarty->autoload_filters[ $type ])) { $smarty->autoload_filters[ $type ] = - array_merge($smarty->autoload_filters[ $type ], (array) $value); + array_merge($smarty->autoload_filters[ $type ], (array)$value); } else { - $smarty->autoload_filters[ $type ] = (array) $value; + $smarty->autoload_filters[ $type ] = (array)$value; } } } return $obj; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php index afb0b68d5..c3feb3d8b 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php @@ -24,7 +24,7 @@ class Smarty_Internal_Method_AddDefaultModifiers * @api Smarty::addDefaultModifiers() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param array|string $modifiers modifier or list of modifiers + * @param array|string $modifiers modifier or list of modifiers * to add * * @return \Smarty|\Smarty_Internal_Template @@ -39,4 +39,4 @@ class Smarty_Internal_Method_AddDefaultModifiers } return $obj; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_append.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_append.php index a1422cf5a..881375efe 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_append.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_append.php @@ -25,10 +25,10 @@ class Smarty_Internal_Method_Append * @link http://www.smarty.net/docs/en/api.append.tpl * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data - * @param array|string $tpl_var the template variable name(s) - * @param mixed $value the value to append - * @param bool $merge flag if array elements shall be merged - * @param bool $nocache if true any output of this variable will + * @param array|string $tpl_var the template variable name(s) + * @param mixed $value the value to append + * @param bool $merge flag if array elements shall be merged + * @param bool $nocache if true any output of this variable will * be not cached * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty @@ -52,8 +52,8 @@ class Smarty_Internal_Method_Append $data->tpl_vars[ $tpl_var ] = clone $tpl_var_inst; } } - if (!(is_array($data->tpl_vars[ $tpl_var ]->value) || - $data->tpl_vars[ $tpl_var ]->value instanceof ArrayAccess) + if (!(is_array($data->tpl_vars[ $tpl_var ]->value) + || $data->tpl_vars[ $tpl_var ]->value instanceof ArrayAccess) ) { settype($data->tpl_vars[ $tpl_var ]->value, 'array'); } @@ -71,4 +71,4 @@ class Smarty_Internal_Method_Append } return $data; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_appendbyref.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_appendbyref.php index 9185a8e83..c95904460 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_appendbyref.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_appendbyref.php @@ -11,7 +11,6 @@ */ class Smarty_Internal_Method_AppendByRef { - /** * appends values to template variables by reference * @@ -19,9 +18,9 @@ class Smarty_Internal_Method_AppendByRef * @link http://www.smarty.net/docs/en/api.append.by.ref.tpl * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data - * @param string $tpl_var the template variable name - * @param mixed &$value the referenced value to append - * @param bool $merge flag if array elements shall be merged + * @param string $tpl_var the template variable name + * @param mixed &$value the referenced value to append + * @param bool $merge flag if array elements shall be merged * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ @@ -47,4 +46,4 @@ class Smarty_Internal_Method_AppendByRef } return $data; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_assignbyref.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_assignbyref.php index 1c513ce99..fa705bb80 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_assignbyref.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_assignbyref.php @@ -11,14 +11,14 @@ */ class Smarty_Internal_Method_AssignByRef { - /** * assigns values to template variables by reference * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data * @param string $tpl_var the template variable name * @param $value - * @param boolean $nocache if true any output of this variable will be not cached + * @param boolean $nocache if true any output of this variable will + * be not cached * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ @@ -33,4 +33,4 @@ class Smarty_Internal_Method_AssignByRef } return $data; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_assignglobal.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_assignglobal.php index 0e1690418..08cfa4693 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_assignglobal.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_assignglobal.php @@ -22,9 +22,10 @@ class Smarty_Internal_Method_AssignGlobal * assigns a global Smarty variable * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data - * @param string $varName the global variable name - * @param mixed $value the value to assign - * @param boolean $nocache if true any output of this variable will be not cached + * @param string $varName the global variable name + * @param mixed $value the value to assign + * @param boolean $nocache if true any output of this variable will + * be not cached * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ @@ -40,4 +41,4 @@ class Smarty_Internal_Method_AssignGlobal } return $data; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallassign.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallassign.php index 1e5fec4bd..29ff2ffb0 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallassign.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallassign.php @@ -31,7 +31,6 @@ class Smarty_Internal_Method_ClearAllAssign public function clearAllAssign(Smarty_Internal_Data $data) { $data->tpl_vars = array(); - return $data; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallcache.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallcache.php index 9641e2baa..30d55f7d2 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallcache.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearallcache.php @@ -24,9 +24,9 @@ class Smarty_Internal_Method_ClearAllCache * @api Smarty::clearAllCache() * @link http://www.smarty.net/docs/en/api.clear.all.cache.tpl * - * @param \Smarty $smarty - * @param integer $exp_time expiration time - * @param string $type resource type + * @param \Smarty $smarty + * @param integer $exp_time expiration time + * @param string $type resource type * * @return int number of cache files deleted * @throws \SmartyException @@ -38,4 +38,4 @@ class Smarty_Internal_Method_ClearAllCache $_cache_resource = Smarty_CacheResource::load($smarty, $type); return $_cache_resource->clearAll($smarty, $exp_time); } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearassign.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearassign.php index 060a2ac49..22bfa2d31 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearassign.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearassign.php @@ -25,7 +25,7 @@ class Smarty_Internal_Method_ClearAssign * @link http://www.smarty.net/docs/en/api.clear.assign.tpl * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data - * @param string|array $tpl_var the template variable(s) to clear + * @param string|array $tpl_var the template variable(s) to clear * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ @@ -38,7 +38,6 @@ class Smarty_Internal_Method_ClearAssign } else { unset($data->tpl_vars[ $tpl_var ]); } - return $data; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcache.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcache.php index 6d56c13d5..a5dd4e26e 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcache.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcache.php @@ -24,22 +24,27 @@ class Smarty_Internal_Method_ClearCache * @api Smarty::clearCache() * @link http://www.smarty.net/docs/en/api.clear.cache.tpl * - * @param \Smarty $smarty - * @param string $template_name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param integer $exp_time expiration time - * @param string $type resource type + * @param \Smarty $smarty + * @param string $template_name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param integer $exp_time expiration time + * @param string $type resource type * * @return int number of cache files deleted * @throws \SmartyException */ - public function clearCache(Smarty $smarty, $template_name, $cache_id = null, $compile_id = null, $exp_time = null, - $type = null) - { + public function clearCache( + Smarty $smarty, + $template_name, + $cache_id = null, + $compile_id = null, + $exp_time = null, + $type = null + ) { $smarty->_clearTemplateCache(); // load cache resource and call clear $_cache_resource = Smarty_CacheResource::load($smarty, $type); return $_cache_resource->clear($smarty, $template_name, $cache_id, $compile_id, $exp_time); } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php index c019c59db..bf4929807 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php @@ -24,10 +24,10 @@ class Smarty_Internal_Method_ClearCompiledTemplate * @api Smarty::clearCompiledTemplate() * @link http://www.smarty.net/docs/en/api.clear.compiled.template.tpl * - * @param \Smarty $smarty - * @param string $resource_name template name - * @param string $compile_id compile id - * @param integer $exp_time expiration time + * @param \Smarty $smarty + * @param string $resource_name template name + * @param string $compile_id compile id + * @param integer $exp_time expiration time * * @return int number of template files deleted * @throws \SmartyException @@ -69,8 +69,7 @@ class Smarty_Internal_Method_ClearCompiledTemplate try { $_compileDirs = new RecursiveDirectoryIterator($_dir); // NOTE: UnexpectedValueException thrown for PHP >= 5.3 - } - catch (Exception $e) { + } catch (Exception $e) { return 0; } $_compile = new RecursiveIteratorIterator($_compileDirs, RecursiveIteratorIterator::CHILD_FIRST); @@ -90,18 +89,22 @@ class Smarty_Internal_Method_ClearCompiledTemplate continue; } $unlink = false; - if ((!isset($_compile_id) || (isset($_filepath[ $_compile_id_part_length ]) && $a = - !strncmp($_filepath, $_compile_id_part, $_compile_id_part_length))) && - (!isset($resource_name) || (isset($_filepath[ $_resource_part_1_length ]) && - substr_compare($_filepath, - $_resource_part_1, - -$_resource_part_1_length, - $_resource_part_1_length) === - 0) || (isset($_filepath[ $_resource_part_2_length ]) && - substr_compare($_filepath, - $_resource_part_2, - -$_resource_part_2_length, - $_resource_part_2_length) === 0)) + if ((!isset($_compile_id) || + (isset($_filepath[ $_compile_id_part_length ]) && + $a = !strncmp($_filepath, $_compile_id_part, $_compile_id_part_length))) + && (!isset($resource_name) || (isset($_filepath[ $_resource_part_1_length ]) + && substr_compare( + $_filepath, + $_resource_part_1, + -$_resource_part_1_length, + $_resource_part_1_length + ) === 0) || (isset($_filepath[ $_resource_part_2_length ]) + && substr_compare( + $_filepath, + $_resource_part_2, + -$_resource_part_2_length, + $_resource_part_2_length + ) === 0)) ) { if (isset($exp_time)) { if (is_file($_filepath) && time() - filemtime($_filepath) >= $exp_time) { @@ -117,7 +120,7 @@ class Smarty_Internal_Method_ClearCompiledTemplate && (!function_exists('ini_get') || strlen(ini_get('opcache.restrict_api')) < 1) ) { opcache_invalidate($_filepath, true); - } else if (function_exists('apc_delete_file')) { + } elseif (function_exists('apc_delete_file')) { apc_delete_file($_filepath); } } @@ -125,4 +128,4 @@ class Smarty_Internal_Method_ClearCompiledTemplate } return $_count; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearconfig.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearconfig.php index 371247807..15bf492a1 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearconfig.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_clearconfig.php @@ -25,7 +25,7 @@ class Smarty_Internal_Method_ClearConfig * @link http://www.smarty.net/docs/en/api.clear.config.tpl * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data - * @param string|null $name variable name or null + * @param string|null $name variable name or null * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ @@ -38,4 +38,4 @@ class Smarty_Internal_Method_ClearConfig } return $data; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php index 767031bd9..3934ca042 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php @@ -11,23 +11,26 @@ */ class Smarty_Internal_Method_CompileAllConfig extends Smarty_Internal_Method_CompileAllTemplates { - /** * Compile all config files * - * @api Smarty::compileAllConfig() + * @api Smarty::compileAllConfig() * * @param \Smarty $smarty passed smarty object - * @param string $extension file extension - * @param bool $force_compile force all to recompile - * @param int $time_limit - * @param int $max_errors + * @param string $extension file extension + * @param bool $force_compile force all to recompile + * @param int $time_limit + * @param int $max_errors * * @return int number of template files recompiled */ - public function compileAllConfig(Smarty $smarty, $extension = '.conf', $force_compile = false, $time_limit = 0, - $max_errors = null) - { + public function compileAllConfig( + Smarty $smarty, + $extension = '.conf', + $force_compile = false, + $time_limit = 0, + $max_errors = null + ) { return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors, true); } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php index 64912599f..5c046da40 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php @@ -1,4 +1,5 @@ <?php + /** * Smarty Method CompileAllTemplates * @@ -20,22 +21,23 @@ class Smarty_Internal_Method_CompileAllTemplates /** * Compile all template files * - * @api Smarty::compileAllTemplates() + * @api Smarty::compileAllTemplates() * * @param \Smarty $smarty passed smarty object - * @param string $extension file extension - * @param bool $force_compile force all to recompile - * @param int $time_limit - * @param int $max_errors + * @param string $extension file extension + * @param bool $force_compile force all to recompile + * @param int $time_limit + * @param int $max_errors * * @return integer number of template files recompiled */ - public function compileAllTemplates(Smarty $smarty, - $extension = '.tpl', - $force_compile = false, - $time_limit = 0, - $max_errors = null) - { + public function compileAllTemplates( + Smarty $smarty, + $extension = '.tpl', + $force_compile = false, + $time_limit = 0, + $max_errors = null + ) { return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors); } @@ -43,21 +45,22 @@ class Smarty_Internal_Method_CompileAllTemplates * Compile all template or config files * * @param \Smarty $smarty - * @param string $extension template file name extension - * @param bool $force_compile force all to recompile - * @param int $time_limit set maximum execution time - * @param int $max_errors set maximum allowed errors + * @param string $extension template file name extension + * @param bool $force_compile force all to recompile + * @param int $time_limit set maximum execution time + * @param int $max_errors set maximum allowed errors * @param bool $isConfig flag true if called for config files * * @return int number of template files compiled */ - protected function compileAll(Smarty $smarty, - $extension, - $force_compile, - $time_limit, - $max_errors, - $isConfig = false) - { + protected function compileAll( + Smarty $smarty, + $extension, + $force_compile, + $time_limit, + $max_errors, + $isConfig = false + ) { // switch off time limit if (function_exists('set_time_limit')) { @set_time_limit($time_limit); @@ -67,15 +70,18 @@ class Smarty_Internal_Method_CompileAllTemplates $sourceDir = $isConfig ? $smarty->getConfigDir() : $smarty->getTemplateDir(); // loop over array of source directories foreach ($sourceDir as $_dir) { - $_dir_1 = new RecursiveDirectoryIterator($_dir, defined('FilesystemIterator::FOLLOW_SYMLINKS') ? - FilesystemIterator::FOLLOW_SYMLINKS : 0); + $_dir_1 = new RecursiveDirectoryIterator( + $_dir, + defined('FilesystemIterator::FOLLOW_SYMLINKS') ? + FilesystemIterator::FOLLOW_SYMLINKS : 0 + ); $_dir_2 = new RecursiveIteratorIterator($_dir_1); foreach ($_dir_2 as $_fileinfo) { $_file = $_fileinfo->getFilename(); if (substr(basename($_fileinfo->getPathname()), 0, 1) === '.' || strpos($_file, '.svn') !== false) { continue; } - if (!substr_compare($_file, $extension, -strlen($extension)) === 0) { + if (substr_compare($_file, $extension, -strlen($extension)) !== 0) { continue; } if ($_fileinfo->getPath() !== substr($_dir, 0, -1)) { @@ -105,8 +111,7 @@ class Smarty_Internal_Method_CompileAllTemplates echo ' is up to date'; flush(); } - } - catch (Exception $e) { + } catch (Exception $e) { echo "\n<br> ------>Error: ", $e->getMessage(), "<br><br>\n"; $_error_count++; } @@ -122,4 +127,4 @@ class Smarty_Internal_Method_CompileAllTemplates echo "\n<br>"; return $_count; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_configload.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_configload.php index eb8672fe9..2e6254880 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_configload.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_configload.php @@ -25,8 +25,8 @@ class Smarty_Internal_Method_ConfigLoad * @link http://www.smarty.net/docs/en/api.config.load.tpl * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data - * @param string $config_file filename - * @param mixed $sections array of section names, single + * @param string $config_file filename + * @param mixed $sections array of section names, single * section or null * * @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template @@ -45,13 +45,12 @@ class Smarty_Internal_Method_ConfigLoad * @link http://www.smarty.net/docs/en/api.config.load.tpl * * @param \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template $data - * @param string $config_file filename - * @param mixed $sections array of section names, single + * @param string $config_file filename + * @param mixed $sections array of section names, single * section or null * @param int $scope scope into which config variables * shall be loaded * - * @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template * @throws \Exception */ public function _loadConfigFile(Smarty_Internal_Data $data, $config_file, $sections = null, $scope = 0) @@ -75,8 +74,7 @@ class Smarty_Internal_Method_ConfigLoad * load config variables into template object * * @param \Smarty_Internal_Template $tpl - * @param array $new_config_vars - * + * @param array $new_config_vars */ public function _loadConfigVars(Smarty_Internal_Template $tpl, $new_config_vars) { @@ -111,7 +109,7 @@ class Smarty_Internal_Method_ConfigLoad * * @param array $config_vars config variables in scope * @param \Smarty_Internal_Template $tpl - * @param array $new_config_vars loaded config variables + * @param array $new_config_vars loaded config variables */ public function _assignConfigVars(&$config_vars, Smarty_Internal_Template $tpl, $new_config_vars) { @@ -120,19 +118,19 @@ class Smarty_Internal_Method_ConfigLoad if ($tpl->smarty->config_overwrite || !isset($config_vars[ $variable ])) { $config_vars[ $variable ] = $value; } else { - $config_vars[ $variable ] = array_merge((array) $config_vars[ $variable ], (array) $value); + $config_vars[ $variable ] = array_merge((array)$config_vars[ $variable ], (array)$value); } } // scan sections $sections = $tpl->source->config_sections; if (!empty($sections)) { - foreach ((array) $sections as $tpl_section) { + foreach ((array)$sections as $tpl_section) { if (isset($new_config_vars[ 'sections' ][ $tpl_section ])) { foreach ($new_config_vars[ 'sections' ][ $tpl_section ][ 'vars' ] as $variable => $value) { if ($tpl->smarty->config_overwrite || !isset($config_vars[ $variable ])) { $config_vars[ $variable ] = $value; } else { - $config_vars[ $variable ] = array_merge((array) $config_vars[ $variable ], (array) $value); + $config_vars[ $variable ] = array_merge((array)$config_vars[ $variable ], (array)$value); } } } @@ -151,7 +149,7 @@ class Smarty_Internal_Method_ConfigLoad $i = 0; while (isset($tpl->_cache[ 'varStack' ][ $i ])) { $this->_assignConfigVars($tpl->_cache[ 'varStack' ][ $i ][ 'config' ], $tpl, $config_vars); - $i ++; + $i++; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_createdata.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_createdata.php index 43ce89432..f95097519 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_createdata.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_createdata.php @@ -29,7 +29,7 @@ class Smarty_Internal_Method_CreateData * variables * @param string $name optional data block name * - * @returns Smarty_Data data object + * @return \Smarty_Data data object */ public function createData(Smarty_Internal_TemplateBase $obj, Smarty_Internal_Data $parent = null, $name = null) { @@ -41,4 +41,4 @@ class Smarty_Internal_Method_CreateData } return $dataObj; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php index b957b60d2..4145db10b 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php @@ -17,7 +17,7 @@ class Smarty_Internal_Method_GetAutoloadFilters extends Smarty_Internal_Method_S * @api Smarty::getAutoloadFilters() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $type type of filter to get auto loads + * @param string $type type of filter to get auto loads * for. Defaults to all autoload * filters * @@ -34,4 +34,4 @@ class Smarty_Internal_Method_GetAutoloadFilters extends Smarty_Internal_Method_S } return $smarty->autoload_filters; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getconfigvariable.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getconfigvariable.php index 4dd398208..b54815123 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getconfigvariable.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getconfigvariable.php @@ -31,4 +31,4 @@ class Smarty_Internal_Method_GetConfigVariable { return $data->ext->configLoad->_getConfigVariable($data, $varName, $errorEnable); } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php index b75cf8179..1d11e44c1 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php @@ -25,8 +25,8 @@ class Smarty_Internal_Method_GetConfigVars * @link http://www.smarty.net/docs/en/api.get.config.vars.tpl * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data - * @param string $varname variable name or null - * @param bool $search_parents include parent templates? + * @param string $varname variable name or null + * @param bool $search_parents include parent templates? * * @return mixed variable value or or array of variables */ @@ -55,4 +55,4 @@ class Smarty_Internal_Method_GetConfigVars return $var_array; } } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php index 52073c14e..77d908c15 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php @@ -32,4 +32,4 @@ class Smarty_Internal_Method_GetDebugTemplate $smarty = $obj->_getSmartyObj(); return $smarty->debug_tpl; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php index f65ab7914..57da85c49 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php @@ -32,4 +32,4 @@ class Smarty_Internal_Method_GetDefaultModifiers $smarty = $obj->_getSmartyObj(); return $smarty->default_modifiers; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getglobal.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getglobal.php index 0f00da53c..2be11d7e8 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getglobal.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getglobal.php @@ -21,10 +21,10 @@ class Smarty_Internal_Method_GetGlobal /** * Returns a single or all global variables * - * @api Smarty::getGlobal() + * @api Smarty::getGlobal() * * @param \Smarty_Internal_Data $data - * @param string $varName variable name or null + * @param string $varName variable name or null * * @return string|array variable value or or array of variables */ @@ -38,10 +38,10 @@ class Smarty_Internal_Method_GetGlobal } } else { $_result = array(); - foreach (Smarty::$global_tpl_vars AS $key => $var) { + foreach (Smarty::$global_tpl_vars as $key => $var) { $_result[ $key ] = $var->value; } return $_result; } } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php index c5c064665..df6ede130 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php @@ -25,7 +25,7 @@ class Smarty_Internal_Method_GetRegisteredObject * @link http://www.smarty.net/docs/en/api.get.registered.object.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $object_name object name + * @param string $object_name object name * * @return object * @throws \SmartyException if no such object is found @@ -41,4 +41,4 @@ class Smarty_Internal_Method_GetRegisteredObject } return $smarty->registered_objects[ $object_name ][ 0 ]; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php index b922fd088..8db39c525 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php @@ -24,7 +24,7 @@ class Smarty_Internal_Method_GetStreamVariable * @api Smarty::getStreamVariable() * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data - * @param string $variable the stream of the variable + * @param string $variable the stream of the variable * * @return mixed * @throws \SmartyException @@ -38,7 +38,6 @@ class Smarty_Internal_Method_GetStreamVariable $_result .= $current_line; } fclose($fp); - return $_result; } $smarty = isset($data->smarty) ? $data->smarty : $data; @@ -48,4 +47,4 @@ class Smarty_Internal_Method_GetStreamVariable return null; } } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_gettags.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_gettags.php index afaa4b913..c07ae07ec 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_gettags.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_gettags.php @@ -60,4 +60,4 @@ class Smarty_Internal_Method_GetTags } throw new SmartyException('Missing template specification'); } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php index 510bab0fc..9ef7d46bb 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php @@ -25,15 +25,18 @@ class Smarty_Internal_Method_GetTemplateVars * @link http://www.smarty.net/docs/en/api.get.template.vars.tpl * * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data - * @param string $varName variable name or null + * @param string $varName variable name or null * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr optional pointer to data object - * @param bool $searchParents include parent templates? + * @param bool $searchParents include parent templates? * * @return mixed variable value or or array of variables */ - public function getTemplateVars(Smarty_Internal_Data $data, $varName = null, Smarty_Internal_Data $_ptr = null, - $searchParents = true) - { + public function getTemplateVars( + Smarty_Internal_Data $data, + $varName = null, + Smarty_Internal_Data $_ptr = null, + $searchParents = true + ) { if (isset($varName)) { $_var = $this->_getVariable($data, $varName, $_ptr, $searchParents, false); if (is_object($_var)) { @@ -47,7 +50,7 @@ class Smarty_Internal_Method_GetTemplateVars $_ptr = $data; } while ($_ptr !== null) { - foreach ($_ptr->tpl_vars AS $key => $var) { + foreach ($_ptr->tpl_vars as $key => $var) { if (!array_key_exists($key, $_result)) { $_result[ $key ] = $var->value; } @@ -60,7 +63,7 @@ class Smarty_Internal_Method_GetTemplateVars } } if ($searchParents && isset(Smarty::$global_tpl_vars)) { - foreach (Smarty::$global_tpl_vars AS $key => $var) { + foreach (Smarty::$global_tpl_vars as $key => $var) { if (!array_key_exists($key, $_result)) { $_result[ $key ] = $var->value; } @@ -81,9 +84,13 @@ class Smarty_Internal_Method_GetTemplateVars * * @return \Smarty_Variable */ - public function _getVariable(Smarty_Internal_Data $data, $varName, Smarty_Internal_Data $_ptr = null, - $searchParents = true, $errorEnable = true) - { + public function _getVariable( + Smarty_Internal_Data $data, + $varName, + Smarty_Internal_Data $_ptr = null, + $searchParents = true, + $errorEnable = true + ) { if ($_ptr === null) { $_ptr = $data; } @@ -107,7 +114,6 @@ class Smarty_Internal_Method_GetTemplateVars // force a notice $x = $$varName; } - return new Smarty_Undefined_Variable; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_literals.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_literals.php index 08e1a473b..bfa3f58ec 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_literals.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_literals.php @@ -39,8 +39,8 @@ class Smarty_Internal_Method_Literals * @api Smarty::addLiterals() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param array|string $literals literal or list of literals - * to add + * @param array|string $literals literal or list of literals + * to addto add * * @return \Smarty|\Smarty_Internal_Template * @throws \SmartyException @@ -59,8 +59,8 @@ class Smarty_Internal_Method_Literals * @api Smarty::setLiterals() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param array|string $literals literal or list of literals - * to set + * @param array|string $literals literal or list of literals + * to setto set * * @return \Smarty|\Smarty_Internal_Template * @throws \SmartyException @@ -80,7 +80,7 @@ class Smarty_Internal_Method_Literals * Smarty::$literals array gets filled with identical key values * * @param \Smarty $smarty - * @param array $literals + * @param array $literals * * @throws \SmartyException */ @@ -90,9 +90,11 @@ class Smarty_Internal_Method_Literals $error = isset($literals[ $smarty->left_delimiter ]) ? array($smarty->left_delimiter) : array(); $error = isset($literals[ $smarty->right_delimiter ]) ? $error[] = $smarty->right_delimiter : $error; if (!empty($error)) { - throw new SmartyException('User defined literal(s) "' . $error . - '" may not be identical with left or right delimiter'); + throw new SmartyException( + 'User defined literal(s) "' . $error . + '" may not be identical with left or right delimiter' + ); } $smarty->literals = array_merge((array)$smarty->literals, (array)$literals); } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_loadfilter.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_loadfilter.php index 239fd6dd3..66d80d474 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_loadfilter.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_loadfilter.php @@ -33,8 +33,8 @@ class Smarty_Internal_Method_LoadFilter * @link http://www.smarty.net/docs/en/api.load.filter.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $type filter type - * @param string $name filter name + * @param string $type filter type + * @param string $name filter name * * @return bool * @throws SmartyException if filter could not be loaded @@ -74,4 +74,4 @@ class Smarty_Internal_Method_LoadFilter throw new SmartyException("Illegal filter type '{$type}'"); } } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_loadplugin.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_loadplugin.php index 2454d9c9c..3bd659cb8 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_loadplugin.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_loadplugin.php @@ -24,8 +24,8 @@ class Smarty_Internal_Method_LoadPlugin * plugin filename format: plugintype.pluginname.php * * @param \Smarty $smarty - * @param string $plugin_name class plugin name to load - * @param bool $check check if already loaded + * @param string $plugin_name class plugin name to load + * @param bool $check check if already loaded * * @return bool|string * @throws \SmartyException @@ -50,7 +50,7 @@ class Smarty_Internal_Method_LoadPlugin } else { if (is_file($file)) { $this->plugin_files[ $file ] = $file; - require_once($file); + include_once $file; return $file; } else { $this->plugin_files[ $file ] = false; @@ -87,7 +87,7 @@ class Smarty_Internal_Method_LoadPlugin $file = $_plugin_dir . $name; if (is_file($file)) { $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] = $file; - require_once($file); + include_once $file; return $file; } $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] = false; @@ -100,7 +100,7 @@ class Smarty_Internal_Method_LoadPlugin $file = $smarty->ext->_getIncludePath->getIncludePath($_p_dirs, $_file_name, $smarty); $this->plugin_files[ 'include_path' ][ $_lower_filename ] = $file; if ($file !== false) { - require_once($file); + include_once $file; return $file; } } @@ -108,4 +108,4 @@ class Smarty_Internal_Method_LoadPlugin // no plugin loaded return false; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_mustcompile.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_mustcompile.php index 62c16f626..39318838e 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_mustcompile.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_mustcompile.php @@ -45,7 +45,6 @@ class Smarty_Internal_Method_MustCompile $_template->compiled->getTimeStamp() < $_template->source->getTimeStamp()))); } - return $_template->mustCompile; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php index ae3872722..648365619 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php @@ -25,16 +25,18 @@ class Smarty_Internal_Method_RegisterCacheResource * @link http://www.smarty.net/docs/en/api.register.cacheresource.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $name name of resource type + * @param string $name name of resource type * @param \Smarty_CacheResource $resource_handler * * @return \Smarty|\Smarty_Internal_Template */ - public function registerCacheResource(Smarty_Internal_TemplateBase $obj, $name, - Smarty_CacheResource $resource_handler) - { + public function registerCacheResource( + Smarty_Internal_TemplateBase $obj, + $name, + Smarty_CacheResource $resource_handler + ) { $smarty = $obj->_getSmartyObj(); $smarty->registered_cache_resources[ $name ] = $resource_handler; return $obj; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerclass.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerclass.php index 5469b98aa..8d18547e2 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerclass.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerclass.php @@ -25,8 +25,8 @@ class Smarty_Internal_Method_RegisterClass * @link http://www.smarty.net/docs/en/api.register.class.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $class_name - * @param string $class_impl the referenced PHP class to + * @param string $class_name + * @param string $class_impl the referenced PHP class to * register * * @return \Smarty|\Smarty_Internal_Template @@ -43,4 +43,4 @@ class Smarty_Internal_Method_RegisterClass $smarty->registered_classes[ $class_name ] = $class_impl; return $obj; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php index c8c5ae73f..b340f178d 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php @@ -21,10 +21,10 @@ class Smarty_Internal_Method_RegisterDefaultConfigHandler /** * Register config default handler * - * @api Smarty::registerDefaultConfigHandler() + * @api Smarty::registerDefaultConfigHandler() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param callable $callback class/method name + * @param callable $callback class/method name * * @return \Smarty|\Smarty_Internal_Template * @throws SmartyException if $callback is not callable @@ -39,4 +39,4 @@ class Smarty_Internal_Method_RegisterDefaultConfigHandler } return $obj; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php index d9aecb4a9..a9fb78dc6 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php @@ -25,7 +25,7 @@ class Smarty_Internal_Method_RegisterDefaultPluginHandler * @link http://www.smarty.net/docs/en/api.register.default.plugin.handler.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param callable $callback class/method name + * @param callable $callback class/method name * * @return \Smarty|\Smarty_Internal_Template * @throws SmartyException if $callback is not callable @@ -40,4 +40,4 @@ class Smarty_Internal_Method_RegisterDefaultPluginHandler } return $obj; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php index 4c5d396ed..cbc133ccd 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php @@ -21,10 +21,10 @@ class Smarty_Internal_Method_RegisterDefaultTemplateHandler /** * Register template default handler * - * @api Smarty::registerDefaultTemplateHandler() + * @api Smarty::registerDefaultTemplateHandler() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param callable $callback class/method name + * @param callable $callback class/method name * * @return \Smarty|\Smarty_Internal_Template * @throws SmartyException if $callback is not callable @@ -55,16 +55,20 @@ class Smarty_Internal_Method_RegisterDefaultTemplateHandler $default_handler = $source->smarty->default_template_handler_func; } $_content = $_timestamp = null; - $_return = call_user_func_array($default_handler, - array($source->type, $source->name, &$_content, &$_timestamp, $source->smarty)); + $_return = call_user_func_array( + $default_handler, + array($source->type, $source->name, &$_content, &$_timestamp, $source->smarty) + ); if (is_string($_return)) { $source->exists = is_file($_return); if ($source->exists) { $source->timestamp = filemtime($_return); } else { - throw new SmartyException('Default handler: Unable to load ' . - ($source->isConfig ? 'config' : 'template') . - " default file '{$_return}' for '{$source->type}:{$source->name}'"); + throw new SmartyException( + 'Default handler: Unable to load ' . + ($source->isConfig ? 'config' : 'template') . + " default file '{$_return}' for '{$source->type}:{$source->name}'" + ); } $source->name = $source->filepath = $_return; $source->uid = sha1($source->filepath); @@ -75,8 +79,10 @@ class Smarty_Internal_Method_RegisterDefaultTemplateHandler $source->handler = Smarty_Resource::load($source->smarty, 'eval'); } else { $source->exists = false; - throw new SmartyException('Default handler: No ' . ($source->isConfig ? 'config' : 'template') . - " default content for '{$source->type}:{$source->name}'"); + throw new SmartyException( + 'Default handler: No ' . ($source->isConfig ? 'config' : 'template') . + " default content for '{$source->type}:{$source->name}'" + ); } } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerfilter.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerfilter.php index 77e41f37c..c0f9fff10 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerfilter.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerfilter.php @@ -33,9 +33,9 @@ class Smarty_Internal_Method_RegisterFilter * @link http://www.smarty.net/docs/en/api.register.filter.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $type filter type - * @param callback $callback - * @param string|null $name optional filter name + * @param string $type filter type + * @param callback $callback + * @param string|null $name optional filter name * * @return \Smarty|\Smarty_Internal_Template * @throws \SmartyException @@ -55,7 +55,7 @@ class Smarty_Internal_Method_RegisterFilter /** * Return internal filter name * - * @param callback $function_name + * @param callback $function_name * * @return string internal filter name */ @@ -63,7 +63,6 @@ class Smarty_Internal_Method_RegisterFilter { if (is_array($function_name)) { $_class_name = (is_object($function_name[ 0 ]) ? get_class($function_name[ 0 ]) : $function_name[ 0 ]); - return $_class_name . '_' . $function_name[ 1 ]; } elseif (is_string($function_name)) { return $function_name; @@ -85,4 +84,4 @@ class Smarty_Internal_Method_RegisterFilter throw new SmartyException("Illegal filter type '{$type}'"); } } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerobject.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerobject.php index ba699b219..4646e4f22 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerobject.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerobject.php @@ -25,32 +25,44 @@ class Smarty_Internal_Method_RegisterObject * @link http://www.smarty.net/docs/en/api.register.object.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $object_name - * @param object $object the + * @param string $object_name + * @param object $object the * referenced - * PHP object to + * PHP + * object + * to * register - * @param array $allowed_methods_properties list of + * + * @param array $allowed_methods_properties list of * allowed * methods - * (empty = all) - * @param bool $format smarty + * (empty + * = all) + * + * @param bool $format smarty * argument - * format, else + * format, + * else * traditional - * @param array $block_methods list of + * + * @param array $block_methods list of * block-methods * * @return \Smarty|\Smarty_Internal_Template * @throws \SmartyException */ - public function registerObject(Smarty_Internal_TemplateBase $obj, $object_name, $object, - $allowed_methods_properties = array(), $format = true, $block_methods = array()) - { + public function registerObject( + Smarty_Internal_TemplateBase $obj, + $object_name, + $object, + $allowed_methods_properties = array(), + $format = true, + $block_methods = array() + ) { $smarty = $obj->_getSmartyObj(); // test if allowed methods callable if (!empty($allowed_methods_properties)) { - foreach ((array) $allowed_methods_properties as $method) { + foreach ((array)$allowed_methods_properties as $method) { if (!is_callable(array($object, $method)) && !property_exists($object, $method)) { throw new SmartyException("Undefined method or property '$method' in registered object"); } @@ -58,7 +70,7 @@ class Smarty_Internal_Method_RegisterObject } // test if block methods callable if (!empty($block_methods)) { - foreach ((array) $block_methods as $method) { + foreach ((array)$block_methods as $method) { if (!is_callable(array($object, $method))) { throw new SmartyException("Undefined method '$method' in registered object"); } @@ -66,7 +78,7 @@ class Smarty_Internal_Method_RegisterObject } // register the object $smarty->registered_objects[ $object_name ] = - array($object, (array) $allowed_methods_properties, (boolean) $format, (array) $block_methods); + array($object, (array)$allowed_methods_properties, (boolean)$format, (array)$block_methods); return $obj; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php index 64bf0ef15..f987f6da5 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php @@ -25,27 +25,32 @@ class Smarty_Internal_Method_RegisterPlugin * @link http://www.smarty.net/docs/en/api.register.plugin.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $type plugin type - * @param string $name name of template tag - * @param callback $callback PHP callback to register - * @param bool $cacheable if true (default) this + * @param string $type plugin type + * @param string $name name of template tag + * @param callback $callback PHP callback to register + * @param bool $cacheable if true (default) this * function is cache able - * @param mixed $cache_attr caching attributes if any + * @param mixed $cache_attr caching attributes if any * * @return \Smarty|\Smarty_Internal_Template * @throws SmartyException when the plugin tag is invalid */ - public function registerPlugin(Smarty_Internal_TemplateBase $obj, $type, $name, $callback, $cacheable = true, - $cache_attr = null) - { + public function registerPlugin( + Smarty_Internal_TemplateBase $obj, + $type, + $name, + $callback, + $cacheable = true, + $cache_attr = null + ) { $smarty = $obj->_getSmartyObj(); if (isset($smarty->registered_plugins[ $type ][ $name ])) { throw new SmartyException("Plugin tag '{$name}' already registered"); } elseif (!is_callable($callback)) { throw new SmartyException("Plugin '{$name}' not callable"); } else { - $smarty->registered_plugins[ $type ][ $name ] = array($callback, (bool) $cacheable, (array) $cache_attr); + $smarty->registered_plugins[ $type ][ $name ] = array($callback, (bool)$cacheable, (array)$cache_attr); } return $obj; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerresource.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerresource.php index 44534b738..7c7d0f78a 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerresource.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_registerresource.php @@ -25,11 +25,13 @@ class Smarty_Internal_Method_RegisterResource * @link http://www.smarty.net/docs/en/api.register.resource.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $name name of resource type - * @param Smarty_Resource|array $resource_handler or instance of - * Smarty_Resource, or - * array of callbacks to - * handle resource + * @param string $name name of resource type + * @param Smarty_Resource|array $resource_handler or instance of + * Smarty_Resource, + * or array of + * callbacks to + * handle + * resource * (deprecated) * * @return \Smarty|\Smarty_Internal_Template @@ -41,4 +43,4 @@ class Smarty_Internal_Method_RegisterResource $resource_handler instanceof Smarty_Resource ? $resource_handler : array($resource_handler, false); return $obj; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php index 29653b08e..2972f3ce1 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php @@ -31,11 +31,12 @@ class Smarty_Internal_Method_SetAutoloadFilters * @api Smarty::setAutoloadFilters() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param array $filters filters to load automatically - * @param string $type "pre", "output", … specify the - * filter type to set. Defaults to - * none treating $filters' keys as - * the appropriate types + * @param array $filters filters to load automatically + * @param string $type "pre", "output", … specify + * the filter type to set. + * Defaults to none treating + * $filters' keys as the + * appropriate types * * @return \Smarty|\Smarty_Internal_Template * @throws \SmartyException @@ -45,12 +46,12 @@ class Smarty_Internal_Method_SetAutoloadFilters $smarty = $obj->_getSmartyObj(); if ($type !== null) { $this->_checkFilterType($type); - $smarty->autoload_filters[ $type ] = (array) $filters; + $smarty->autoload_filters[ $type ] = (array)$filters; } else { - foreach ((array) $filters as $type => $value) { + foreach ((array)$filters as $type => $value) { $this->_checkFilterType($type); } - $smarty->autoload_filters = (array) $filters; + $smarty->autoload_filters = (array)$filters; } return $obj; } @@ -68,4 +69,4 @@ class Smarty_Internal_Method_SetAutoloadFilters throw new SmartyException("Illegal filter type '{$type}'"); } } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php index 76c87deb6..cc9d23e2a 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php @@ -24,7 +24,7 @@ class Smarty_Internal_Method_SetDebugTemplate * @api Smarty::setDebugTemplate() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $tpl_name + * @param string $tpl_name * * @return \Smarty|\Smarty_Internal_Template * @throws SmartyException if file is not readable @@ -38,4 +38,4 @@ class Smarty_Internal_Method_SetDebugTemplate $smarty->debug_tpl = $tpl_name; return $obj; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php index 81434b968..eadc2de1b 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php @@ -24,7 +24,7 @@ class Smarty_Internal_Method_SetDefaultModifiers * @api Smarty::setDefaultModifiers() * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param array|string $modifiers modifier or list of modifiers + * @param array|string $modifiers modifier or list of modifiers * to set * * @return \Smarty|\Smarty_Internal_Template @@ -32,7 +32,7 @@ class Smarty_Internal_Method_SetDefaultModifiers public function setDefaultModifiers(Smarty_Internal_TemplateBase $obj, $modifiers) { $smarty = $obj->_getSmartyObj(); - $smarty->default_modifiers = (array) $modifiers; + $smarty->default_modifiers = (array)$modifiers; return $obj; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php index 1a5fdf19b..55e1596be 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php @@ -19,8 +19,8 @@ class Smarty_Internal_Method_UnloadFilter extends Smarty_Internal_Method_LoadFil * @link http://www.smarty.net/docs/en/api.unload.filter.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $type filter type - * @param string $name filter name + * @param string $type filter type + * @param string $name filter name * * @return Smarty_Internal_TemplateBase * @throws \SmartyException @@ -32,7 +32,7 @@ class Smarty_Internal_Method_UnloadFilter extends Smarty_Internal_Method_LoadFil if (isset($smarty->registered_filters[ $type ])) { $_filter_name = "smarty_{$type}filter_{$name}"; if (isset($smarty->registered_filters[ $type ][ $_filter_name ])) { - unset ($smarty->registered_filters[ $type ][ $_filter_name ]); + unset($smarty->registered_filters[ $type ][ $_filter_name ]); if (empty($smarty->registered_filters[ $type ])) { unset($smarty->registered_filters[ $type ]); } @@ -40,4 +40,4 @@ class Smarty_Internal_Method_UnloadFilter extends Smarty_Internal_Method_LoadFil } return $obj; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php index 1a157ffb6..b99903867 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php @@ -21,8 +21,8 @@ class Smarty_Internal_Method_UnregisterCacheResource /** * Registers a resource to fetch a template * - * @api Smarty::unregisterCacheResource() - * @link http://www.smarty.net/docs/en/api.unregister.cacheresource.tpl + * @api Smarty::unregisterCacheResource() + * @link http://www.smarty.net/docs/en/api.unregister.cacheresource.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param $name @@ -37,4 +37,4 @@ class Smarty_Internal_Method_UnregisterCacheResource } return $obj; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php index fcc4e5d89..9cb494a52 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php @@ -19,8 +19,8 @@ class Smarty_Internal_Method_UnregisterFilter extends Smarty_Internal_Method_Reg * @link http://www.smarty.net/docs/en/api.unregister.filter.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $type filter type - * @param callback|string $callback + * @param string $type filter type + * @param callback|string $callback * * @return \Smarty|\Smarty_Internal_Template * @throws \SmartyException @@ -40,4 +40,4 @@ class Smarty_Internal_Method_UnregisterFilter extends Smarty_Internal_Method_Reg } return $obj; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php index 76d48661e..1e592b339 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php @@ -25,7 +25,7 @@ class Smarty_Internal_Method_UnregisterObject * @link http://www.smarty.net/docs/en/api.unregister.object.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $object_name name of object + * @param string $object_name name of object * * @return \Smarty|\Smarty_Internal_Template */ @@ -37,4 +37,4 @@ class Smarty_Internal_Method_UnregisterObject } return $obj; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php index b5f0d505b..f39e31678 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php @@ -25,8 +25,8 @@ class Smarty_Internal_Method_UnregisterPlugin * @link http://www.smarty.net/docs/en/api.unregister.plugin.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $type plugin type - * @param string $name name of template tag + * @param string $type plugin type + * @param string $name name of template tag * * @return \Smarty|\Smarty_Internal_Template */ @@ -38,4 +38,4 @@ class Smarty_Internal_Method_UnregisterPlugin } return $obj; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php index ed4801d48..a79db4299 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php @@ -25,7 +25,7 @@ class Smarty_Internal_Method_UnregisterResource * @link http://www.smarty.net/docs/en/api.unregister.resource.tpl * * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj - * @param string $type name of resource type + * @param string $type name of resource type * * @return \Smarty|\Smarty_Internal_Template */ @@ -37,4 +37,4 @@ class Smarty_Internal_Method_UnregisterResource } return $obj; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_nocache_insert.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_nocache_insert.php index 2629d51f7..88694dcfd 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_nocache_insert.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_nocache_insert.php @@ -19,11 +19,11 @@ class Smarty_Internal_Nocache_Insert /** * Compiles code for the {insert} tag into cache file * - * @param string $_function insert function name - * @param array $_attr array with parameter - * @param Smarty_Internal_Template $_template template object - * @param string $_script script name to load or 'null' - * @param string $_assign optional variable name + * @param string $_function insert function name + * @param array $_attr array with parameter + * @param Smarty_Internal_Template $_template template object + * @param string $_script script name to load or 'null' + * @param string $_assign optional variable name * * @return string compiled code */ @@ -46,7 +46,6 @@ class Smarty_Internal_Nocache_Insert while ($_tpl->_isSubTpl()) { $_tpl = $_tpl->parent; } - return "/*%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/{$_output}/*/%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/"; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree.php index b3e202efb..9f7678526 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree.php @@ -16,7 +16,6 @@ */ abstract class Smarty_Internal_ParseTree { - /** * Buffer content * @@ -48,7 +47,4 @@ abstract class Smarty_Internal_ParseTree $this->data = null; $this->subtrees = null; } - } - - diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_dq.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_dq.php index a57e629c6..8655f5869 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_dq.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_dq.php @@ -1,5 +1,4 @@ <?php - /** * Double quoted string inside a tag. * @@ -40,17 +39,21 @@ class Smarty_Internal_ParseTree_Dq extends Smarty_Internal_ParseTree public function append_subtree(Smarty_Internal_Templateparser $parser, Smarty_Internal_ParseTree $subtree) { $last_subtree = count($this->subtrees) - 1; - if ($last_subtree >= 0 && $this->subtrees[ $last_subtree ] instanceof Smarty_Internal_ParseTree_Tag && - $this->subtrees[ $last_subtree ]->saved_block_nesting < $parser->block_nesting_level + if ($last_subtree >= 0 && $this->subtrees[ $last_subtree ] instanceof Smarty_Internal_ParseTree_Tag + && $this->subtrees[ $last_subtree ]->saved_block_nesting < $parser->block_nesting_level ) { if ($subtree instanceof Smarty_Internal_ParseTree_Code) { $this->subtrees[ $last_subtree ]->data = - $parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data, - '<?php echo ' . $subtree->data . ';?>'); + $parser->compiler->appendCode( + $this->subtrees[ $last_subtree ]->data, + '<?php echo ' . $subtree->data . ';?>' + ); } elseif ($subtree instanceof Smarty_Internal_ParseTree_DqContent) { $this->subtrees[ $last_subtree ]->data = - $parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data, - '<?php echo "' . $subtree->data . '";?>'); + $parser->compiler->appendCode( + $this->subtrees[ $last_subtree ]->data, + '<?php echo "' . $subtree->data . '";?>' + ); } else { $this->subtrees[ $last_subtree ]->data = $parser->compiler->appendCode($this->subtrees[ $last_subtree ]->data, $subtree->data); @@ -82,14 +85,11 @@ class Smarty_Internal_ParseTree_Dq extends Smarty_Internal_ParseTree } else { $more_php = $subtree->to_smarty_php($parser); } - $code .= $more_php; - if (!$subtree instanceof Smarty_Internal_ParseTree_DqContent) { $parser->compiler->has_variable_string = true; } } - return $code; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_tag.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_tag.php index 8e19ec294..e6c755604 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_tag.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_tag.php @@ -18,7 +18,6 @@ */ class Smarty_Internal_ParseTree_Tag extends Smarty_Internal_ParseTree { - /** * Saved block nesting level * @@ -63,7 +62,6 @@ class Smarty_Internal_ParseTree_Tag extends Smarty_Internal_ParseTree $tmp = $parser->compiler->appendCode('<?php ob_start();?>', $this->data); $tmp = $parser->compiler->appendCode($tmp, "<?php {$var}=ob_get_clean();?>"); $parser->compiler->prefix_code[] = sprintf('%s', $tmp); - return $var; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_template.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_template.php index 26612d4c7..8e716bd5d 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_template.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_parsetree_template.php @@ -18,17 +18,15 @@ */ class Smarty_Internal_ParseTree_Template extends Smarty_Internal_ParseTree { - /** * Array of template elements * * @var array */ - public $subtrees = Array(); + public $subtrees = array(); /** * Create root of parse tree for template elements - * */ public function __construct() { @@ -60,7 +58,7 @@ class Smarty_Internal_ParseTree_Template extends Smarty_Internal_ParseTree public function append_array(Smarty_Internal_Templateparser $parser, $array = array()) { if (!empty($array)) { - $this->subtrees = array_merge($this->subtrees, (array) $array); + $this->subtrees = array_merge($this->subtrees, (array)$array); } } @@ -73,7 +71,7 @@ class Smarty_Internal_ParseTree_Template extends Smarty_Internal_ParseTree public function prepend_array(Smarty_Internal_Templateparser $parser, $array = array()) { if (!empty($array)) { - $this->subtrees = array_merge((array) $array, $this->subtrees); + $this->subtrees = array_merge((array)$array, $this->subtrees); } } @@ -87,12 +85,12 @@ class Smarty_Internal_ParseTree_Template extends Smarty_Internal_ParseTree public function to_smarty_php(Smarty_Internal_Templateparser $parser) { $code = ''; - for ($key = 0, $cnt = count($this->subtrees); $key < $cnt; $key ++) { + for ($key = 0, $cnt = count($this->subtrees); $key < $cnt; $key++) { if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Text) { $subtree = $this->subtrees[ $key ]->to_smarty_php($parser); while ($key + 1 < $cnt && ($this->subtrees[ $key + 1 ] instanceof Smarty_Internal_ParseTree_Text || $this->subtrees[ $key + 1 ]->data === '')) { - $key ++; + $key++; if ($this->subtrees[ $key ]->data === '') { continue; } @@ -101,15 +99,18 @@ class Smarty_Internal_ParseTree_Template extends Smarty_Internal_ParseTree if ($subtree === '') { continue; } - $code .= preg_replace('/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/', "<?php echo '\$1'; ?>\n", - $subtree); + $code .= preg_replace( + '/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/', + "<?php echo '\$1'; ?>\n", + $subtree + ); continue; } if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Tag) { $subtree = $this->subtrees[ $key ]->to_smarty_php($parser); while ($key + 1 < $cnt && ($this->subtrees[ $key + 1 ] instanceof Smarty_Internal_ParseTree_Tag || $this->subtrees[ $key + 1 ]->data === '')) { - $key ++; + $key++; if ($this->subtrees[ $key ]->data === '') { continue; } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_eval.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_eval.php index d3088bdd9..3b552a589 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_eval.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_eval.php @@ -21,8 +21,8 @@ class Smarty_Internal_Resource_Eval extends Smarty_Resource_Recompiled /** * populate Source Object with meta data from Resource * - * @param Smarty_Template_Source $source source object - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Template_Source $source source object + * @param Smarty_Internal_Template $_template template object * * @return void */ @@ -37,7 +37,7 @@ class Smarty_Internal_Resource_Eval extends Smarty_Resource_Recompiled * * @uses decode() to decode base64 and urlencoded template_resources * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string template source */ @@ -49,7 +49,7 @@ class Smarty_Internal_Resource_Eval extends Smarty_Resource_Recompiled /** * decode base64 and urlencode * - * @param string $string template_resource to decode + * @param string $string template_resource to decode * * @return string decoded template_resource */ @@ -63,16 +63,15 @@ class Smarty_Internal_Resource_Eval extends Smarty_Resource_Recompiled return urldecode(substr($string, 10)); } } - return $string; } /** * modify resource_name according to resource handlers specifications * - * @param Smarty $smarty Smarty instance - * @param string $resource_name resource_name to make unique - * @param boolean $isConfig flag for config resource + * @param Smarty $smarty Smarty instance + * @param string $resource_name resource_name to make unique + * @param boolean $isConfig flag for config resource * * @return string unique resource name */ @@ -84,7 +83,7 @@ class Smarty_Internal_Resource_Eval extends Smarty_Resource_Recompiled /** * Determine basename for compiled filename * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string resource's basename */ diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_extends.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_extends.php index 23a624729..80946932e 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_extends.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_extends.php @@ -88,9 +88,7 @@ class Smarty_Internal_Resource_Extends extends Smarty_Resource if (!$source->exists) { throw new SmartyException("Unable to load template '{$source->type}:{$source->name}'"); } - $_components = array_reverse($source->components); - $_content = ''; /* @var \Smarty_Template_Source $_s */ foreach ($_components as $_s) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_file.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_file.php index 9dcda7fcb..ae2060673 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_file.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_file.php @@ -18,10 +18,82 @@ class Smarty_Internal_Resource_File extends Smarty_Resource { /** + * populate Source Object with meta data from Resource + * + * @param Smarty_Template_Source $source source object + * @param Smarty_Internal_Template $_template template object + * + * @throws \SmartyException + */ + public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) + { + $source->filepath = $this->buildFilepath($source, $_template); + if ($source->filepath !== false) { + if (isset($source->smarty->security_policy) && is_object($source->smarty->security_policy)) { + $source->smarty->security_policy->isTrustedResourceDir($source->filepath, $source->isConfig); + } + $source->exists = true; + $source->uid = sha1( + $source->filepath . ($source->isConfig ? $source->smarty->_joined_config_dir : + $source->smarty->_joined_template_dir) + ); + $source->timestamp = filemtime($source->filepath); + } else { + $source->timestamp = $source->exists = false; + } + } + + /** + * populate Source Object with timestamp and exists from Resource + * + * @param Smarty_Template_Source $source source object + */ + public function populateTimestamp(Smarty_Template_Source $source) + { + if (!$source->exists) { + $source->timestamp = $source->exists = is_file($source->filepath); + } + if ($source->exists) { + $source->timestamp = filemtime($source->filepath); + } + } + + /** + * Load template's source from file into current template object + * + * @param Smarty_Template_Source $source source object + * + * @return string template source + * @throws SmartyException if source cannot be loaded + */ + public function getContent(Smarty_Template_Source $source) + { + if ($source->exists) { + return file_get_contents($source->filepath); + } + throw new SmartyException( + 'Unable to read ' . ($source->isConfig ? 'config' : 'template') . + " {$source->type} '{$source->name}'" + ); + } + + /** + * Determine basename for compiled filename + * + * @param Smarty_Template_Source $source source object + * + * @return string resource's basename + */ + public function getBasename(Smarty_Template_Source $source) + { + return basename($source->filepath); + } + + /** * build template filepath by traversing the template_dir array * - * @param Smarty_Template_Source $source source object - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Template_Source $source source object + * @param Smarty_Internal_Template $_template template object * * @return string fully qualified filepath * @throws SmartyException @@ -35,16 +107,17 @@ class Smarty_Internal_Resource_File extends Smarty_Resource return is_file($file) ? $file : false; } // go relative to a given template? - if ($file[ 0 ] === '.' && $_template && $_template->_isSubTpl() && - preg_match('#^[.]{1,2}[\\\/]#', $file) + if ($file[ 0 ] === '.' && $_template && $_template->_isSubTpl() + && preg_match('#^[.]{1,2}[\\\/]#', $file) ) { - if ($_template->parent->source->type !== 'file' && $_template->parent->source->type !== 'extends' && - !isset($_template->parent->_cache[ 'allow_relative_path' ]) + if ($_template->parent->source->type !== 'file' && $_template->parent->source->type !== 'extends' + && !isset($_template->parent->_cache[ 'allow_relative_path' ]) ) { throw new SmartyException("Template '{$file}' cannot be relative to template of resource type '{$_template->parent->source->type}'"); } // normalize path - $path = $source->smarty->_realpath(dirname($_template->parent->source->filepath) . DIRECTORY_SEPARATOR . $file); + $path = + $source->smarty->_realpath(dirname($_template->parent->source->filepath) . DIRECTORY_SEPARATOR . $file); // files relative to a template only get one shot return is_file($path) ? $path : false; } @@ -52,7 +125,6 @@ class Smarty_Internal_Resource_File extends Smarty_Resource if (strpos($file, DIRECTORY_SEPARATOR === '/' ? '\\' : '/') !== false) { $file = str_replace(DIRECTORY_SEPARATOR === '/' ? '\\' : '/', DIRECTORY_SEPARATOR, $file); } - $_directories = $source->smarty->getTemplateDir(null, $source->isConfig); // template_dir index? if ($file[ 0 ] === '[' && preg_match('#^\[([^\]]+)\](.+)$#', $file, $fileMatch)) { @@ -66,7 +138,7 @@ class Smarty_Internal_Resource_File extends Smarty_Resource $_index_dirs[] = $_directories[ $index ]; } elseif (is_numeric($index)) { // try numeric index - $index = (int) $index; + $index = (int)$index; if (isset($_directories[ $index ])) { $_index_dirs[] = $_directories[ $index ]; } else { @@ -85,7 +157,6 @@ class Smarty_Internal_Resource_File extends Smarty_Resource $_directories = $_index_dirs; } } - // relative file name? foreach ($_directories as $_directory) { $path = $_directory . $file; @@ -106,73 +177,4 @@ class Smarty_Internal_Resource_File extends Smarty_Resource } return false; } - - /** - * populate Source Object with meta data from Resource - * - * @param Smarty_Template_Source $source source object - * @param Smarty_Internal_Template $_template template object - * - * @throws \SmartyException - */ - public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) - { - $source->filepath = $this->buildFilepath($source, $_template); - - if ($source->filepath !== false) { - if (isset($source->smarty->security_policy) && is_object($source->smarty->security_policy)) { - $source->smarty->security_policy->isTrustedResourceDir($source->filepath, $source->isConfig); - } - $source->exists = true; - $source->uid = sha1($source->filepath . ($source->isConfig ? $source->smarty->_joined_config_dir : - $source->smarty->_joined_template_dir)); - $source->timestamp = filemtime($source->filepath); - } else { - $source->timestamp = $source->exists = false; - } - } - - /** - * populate Source Object with timestamp and exists from Resource - * - * @param Smarty_Template_Source $source source object - */ - public function populateTimestamp(Smarty_Template_Source $source) - { - if (!$source->exists) { - $source->timestamp = $source->exists = is_file($source->filepath); - } - if ($source->exists) { - $source->timestamp = filemtime($source->filepath); - } - } - - /** - * Load template's source from file into current template object - * - * @param Smarty_Template_Source $source source object - * - * @return string template source - * @throws SmartyException if source cannot be loaded - */ - public function getContent(Smarty_Template_Source $source) - { - if ($source->exists) { - return file_get_contents($source->filepath); - } - throw new SmartyException('Unable to read ' . ($source->isConfig ? 'config' : 'template') . - " {$source->type} '{$source->name}'"); - } - - /** - * Determine basename for compiled filename - * - * @param Smarty_Template_Source $source source object - * - * @return string resource's basename - */ - public function getBasename(Smarty_Template_Source $source) - { - return basename($source->filepath); - } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_php.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_php.php index 6f685abe4..9d98ae181 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_php.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_php.php @@ -43,7 +43,7 @@ class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File /** * Load template's source from file into current template object * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string template source * @throws SmartyException if source cannot be loaded @@ -68,16 +68,18 @@ class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File $compiled->timestamp = $_template->source->timestamp; $compiled->exists = $_template->source->exists; $compiled->file_dependency[ $_template->source->uid ] = - array($compiled->filepath, - $compiled->timestamp, - $_template->source->type,); + array( + $compiled->filepath, + $compiled->timestamp, + $_template->source->type, + ); } /** * Render and output the template (without using the compiler) * - * @param Smarty_Template_Source $source source object - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Template_Source $source source object + * @param Smarty_Internal_Template $_template template object * * @return void * @throws SmartyException if template cannot be loaded or allow_php_templates is disabled @@ -88,22 +90,25 @@ class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File throw new SmartyException('PHP templates are disabled'); } if (!$source->exists) { - throw new SmartyException("Unable to load template '{$source->type}:{$source->name}'" . - ($_template->_isSubTpl() ? " in '{$_template->parent->template_resource}'" : '')); + throw new SmartyException( + "Unable to load template '{$source->type}:{$source->name}'" . + ($_template->_isSubTpl() ? " in '{$_template->parent->template_resource}'" : '') + ); } - // prepare variables extract($_template->getTemplateVars()); - // include PHP template with short open tags enabled if (function_exists('ini_set')) { ini_set('short_open_tag', '1'); } - /** @var Smarty_Internal_Template $_smarty_template + /** + * + * + * @var Smarty_Internal_Template $_smarty_template * used in included file */ $_smarty_template = $_template; - include($source->filepath); + include $source->filepath; if (function_exists('ini_set')) { ini_set('short_open_tag', $this->short_open_tag); } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_registered.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_registered.php index 8535257ab..df526101f 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_registered.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_registered.php @@ -21,8 +21,8 @@ class Smarty_Internal_Resource_Registered extends Smarty_Resource /** * populate Source Object with meta data from Resource * - * @param Smarty_Template_Source $source source object - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Template_Source $source source object + * @param Smarty_Internal_Template $_template template object * * @return void */ @@ -37,7 +37,7 @@ class Smarty_Internal_Resource_Registered extends Smarty_Resource /** * populate Source Object with timestamp and exists from Resource * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return void */ @@ -50,7 +50,7 @@ class Smarty_Internal_Resource_Registered extends Smarty_Resource /** * Get timestamp (epoch) the template source was modified * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return integer|boolean timestamp (epoch) the template was modified, false if resources has no timestamp */ @@ -58,16 +58,17 @@ class Smarty_Internal_Resource_Registered extends Smarty_Resource { // return timestamp $time_stamp = false; - call_user_func_array($source->smarty->registered_resources[ $source->type ][ 0 ][ 1 ], - array($source->name, &$time_stamp, $source->smarty)); - - return is_numeric($time_stamp) ? (int) $time_stamp : $time_stamp; + call_user_func_array( + $source->smarty->registered_resources[ $source->type ][ 0 ][ 1 ], + array($source->name, &$time_stamp, $source->smarty) + ); + return is_numeric($time_stamp) ? (int)$time_stamp : $time_stamp; } /** * Load template's source by invoking the registered callback into current template object * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string template source * @throws SmartyException if source cannot be loaded @@ -76,19 +77,20 @@ class Smarty_Internal_Resource_Registered extends Smarty_Resource { // return template string $content = null; - $t = call_user_func_array($source->smarty->registered_resources[ $source->type ][ 0 ][ 0 ], - array($source->name, &$content, $source->smarty)); + $t = call_user_func_array( + $source->smarty->registered_resources[ $source->type ][ 0 ][ 0 ], + array($source->name, &$content, $source->smarty) + ); if (is_bool($t) && !$t) { throw new SmartyException("Unable to read template {$source->type} '{$source->name}'"); } - return $content; } /** * Determine basename for compiled filename * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string resource's basename */ diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_stream.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_stream.php index f358db01d..9956bd073 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_stream.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_stream.php @@ -26,7 +26,6 @@ class Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled * @param Smarty_Internal_Template $_template template object * * @return void - * @throws \SmartyException */ public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) { @@ -46,7 +45,6 @@ class Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled * @param Smarty_Template_Source $source source object * * @return string template source - * @throws SmartyException if source cannot be loaded */ public function getContent(Smarty_Template_Source $source) { @@ -58,7 +56,6 @@ class Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled $t .= $current_line; } fclose($fp); - return $t; } else { return false; @@ -68,9 +65,9 @@ class Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled /** * modify resource_name according to resource handlers specifications * - * @param Smarty $smarty Smarty instance - * @param string $resource_name resource_name to make unique - * @param boolean $isConfig flag for config resource + * @param Smarty $smarty Smarty instance + * @param string $resource_name resource_name to make unique + * @param boolean $isConfig flag for config resource * * @return string unique resource name */ diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_string.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_string.php index 0175d5182..3fecbb7ef 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_string.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_resource_string.php @@ -21,8 +21,8 @@ class Smarty_Internal_Resource_String extends Smarty_Resource /** * populate Source Object with meta data from Resource * - * @param Smarty_Template_Source $source source object - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Template_Source $source source object + * @param Smarty_Internal_Template $_template template object * * @return void */ @@ -37,7 +37,7 @@ class Smarty_Internal_Resource_String extends Smarty_Resource * * @uses decode() to decode base64 and urlencoded template_resources * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string template source */ @@ -49,7 +49,7 @@ class Smarty_Internal_Resource_String extends Smarty_Resource /** * decode base64 and urlencode * - * @param string $string template_resource to decode + * @param string $string template_resource to decode * * @return string decoded template_resource */ @@ -63,16 +63,15 @@ class Smarty_Internal_Resource_String extends Smarty_Resource return urldecode(substr($string, 10)); } } - return $string; } /** * modify resource_name according to resource handlers specifications * - * @param Smarty $smarty Smarty instance - * @param string $resource_name resource_name to make unique - * @param boolean $isConfig flag for config resource + * @param Smarty $smarty Smarty instance + * @param string $resource_name resource_name to make unique + * @param boolean $isConfig flag for config resource * * @return string unique resource name */ @@ -85,7 +84,7 @@ class Smarty_Internal_Resource_String extends Smarty_Resource * Determine basename for compiled filename * Always returns an empty string. * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string resource's basename */ @@ -107,4 +106,3 @@ class Smarty_Internal_Resource_String extends Smarty_Resource return false; } } - diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php index dfbf7115b..6e12d2ae1 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php @@ -6,7 +6,6 @@ * @package Smarty * @subpackage PluginsInternal * @author Uwe Tews - * **/ class Smarty_Internal_Runtime_CacheModify { @@ -15,7 +14,7 @@ class Smarty_Internal_Runtime_CacheModify * * @param \Smarty_Template_Cached $cached * @param \Smarty_Internal_Template $_template - * @param string $content + * @param string $content * * @throws \Exception * @throws \SmartyException @@ -32,17 +31,15 @@ class Smarty_Internal_Runtime_CacheModify case 'fpm-fcgi': // php-fpm >= 5.3.3 header('Status: 304 Not Modified'); break; - case 'cli': - if ( /* ^phpunit */ + if (/* ^phpunit */ !empty($_SERVER[ 'SMARTY_PHPUNIT_DISABLE_HEADERS' ]) /* phpunit$ */ ) { $_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] = '304 Not Modified'; } break; - default: - if ( /* ^phpunit */ + if (/* ^phpunit */ !empty($_SERVER[ 'SMARTY_PHPUNIT_DISABLE_HEADERS' ]) /* phpunit$ */ ) { $_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] = '304 Not Modified'; @@ -54,7 +51,7 @@ class Smarty_Internal_Runtime_CacheModify } else { switch (PHP_SAPI) { case 'cli': - if ( /* ^phpunit */ + if (/* ^phpunit */ !empty($_SERVER[ 'SMARTY_PHPUNIT_DISABLE_HEADERS' ]) /* phpunit$ */ ) { $_SERVER[ 'SMARTY_PHPUNIT_HEADERS' ][] = diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php index a9ff5789a..287096438 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_cacheresourcefile.php @@ -6,6 +6,7 @@ * @subpackage PluginsInternal * @author Uwe Tews */ + /** * Smarty Internal Runtime Cache Resource File Class * @@ -41,7 +42,7 @@ class Smarty_Internal_Runtime_CacheResourceFile $_cache_id_parts_count = count($_cache_id_parts); if ($smarty->use_sub_dirs) { foreach ($_cache_id_parts as $id_part) { - $_dir .= $id_part . DIRECTORY_SEPARATOR; + $_dir .= $id_part . '/'; } } } @@ -88,8 +89,8 @@ class Smarty_Internal_Runtime_CacheResourceFile } } // check compile id - if (isset($_compile_id) && (!isset($_parts[ $_parts_count - 2 - $_compile_id_offset ]) || - $_parts[ $_parts_count - 2 - $_compile_id_offset ] !== $_compile_id) + if (isset($_compile_id) && (!isset($_parts[ $_parts_count - 2 - $_compile_id_offset ]) + || $_parts[ $_parts_count - 2 - $_compile_id_offset ] !== $_compile_id) ) { continue; } @@ -126,7 +127,7 @@ class Smarty_Internal_Runtime_CacheResourceFile && (!function_exists('ini_get') || strlen(ini_get("opcache.restrict_api")) < 1) ) { opcache_invalidate($_filepath, true); - } else if (function_exists('apc_delete_file')) { + } elseif (function_exists('apc_delete_file')) { apc_delete_file($_filepath); } } @@ -135,4 +136,4 @@ class Smarty_Internal_Runtime_CacheResourceFile } return $_count; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_capture.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_capture.php index 80ffa35b2..c9dca83d9 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_capture.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_capture.php @@ -64,10 +64,12 @@ class Smarty_Internal_Runtime_Capture if (!$this->isRegistered) { $this->register($_template); } - $this->captureStack[] = array($buffer, - $assign, - $append); - $this->captureCount ++; + $this->captureStack[] = array( + $buffer, + $assign, + $append + ); + $this->captureCount++; ob_start(); } @@ -78,10 +80,14 @@ class Smarty_Internal_Runtime_Capture */ private function register(Smarty_Internal_Template $_template) { - $_template->startRenderCallbacks[] = array($this, - 'startRender'); - $_template->endRenderCallbacks[] = array($this, - 'endRender'); + $_template->startRenderCallbacks[] = array( + $this, + 'startRender' + ); + $_template->endRenderCallbacks[] = array( + $this, + 'endRender' + ); $this->startRender($_template); $this->isRegistered = true; } @@ -108,7 +114,7 @@ class Smarty_Internal_Runtime_Capture { if ($this->captureCount) { list($buffer, $assign, $append) = array_pop($this->captureStack); - $this->captureCount --; + $this->captureCount--; if (isset($assign)) { $_template->assign($assign, ob_get_contents()); } @@ -137,7 +143,7 @@ class Smarty_Internal_Runtime_Capture * Return content of named capture buffer by key or as array * * @param \Smarty_Internal_Template $_template - * @param string|null $name + * @param string|null $name * * @return string|string[]|null */ @@ -165,5 +171,4 @@ class Smarty_Internal_Runtime_Capture $this->captureCount = array_pop($this->countStack); } } - -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php index f792496f9..983ca6180 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php @@ -25,9 +25,13 @@ class Smarty_Internal_Runtime_CodeFrame * * @return string */ - public function create(Smarty_Internal_Template $_template, $content = '', $functions = '', $cache = false, - Smarty_Internal_TemplateCompilerBase $compiler = null) - { + public function create( + Smarty_Internal_Template $_template, + $content = '', + $functions = '', + $cache = false, + Smarty_Internal_TemplateCompilerBase $compiler = null + ) { // build property code $properties[ 'version' ] = Smarty::SMARTY_VERSION; $properties[ 'unifunc' ] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true)); @@ -35,14 +39,14 @@ class Smarty_Internal_Runtime_CodeFrame $properties[ 'has_nocache_code' ] = $_template->compiled->has_nocache_code; $properties[ 'file_dependency' ] = $_template->compiled->file_dependency; $properties[ 'includes' ] = $_template->compiled->includes; - } else { + } else { $properties[ 'has_nocache_code' ] = $_template->cached->has_nocache_code; $properties[ 'file_dependency' ] = $_template->cached->file_dependency; $properties[ 'cache_lifetime' ] = $_template->cache_lifetime; } $output = "<?php\n"; $output .= "/* Smarty version {$properties[ 'version' ]}, created on " . strftime("%Y-%m-%d %H:%M:%S") . - "\n from '" . str_replace('*/','* /',$_template->source->filepath) . "' */\n\n"; + "\n from '" . str_replace('*/', '* /', $_template->source->filepath) . "' */\n\n"; $output .= "/* @var Smarty_Internal_Template \$_smarty_tpl */\n"; $dec = "\$_smarty_tpl->_decodeProperties(\$_smarty_tpl, " . var_export($properties, true) . ',' . ($cache ? 'true' : 'false') . ')'; @@ -56,11 +60,6 @@ class Smarty_Internal_Runtime_CodeFrame if ($cache && isset($_template->smarty->ext->_tplFunction)) { $output .= "\$_smarty_tpl->smarty->ext->_tplFunction->registerTplFunctions(\$_smarty_tpl, " . var_export($_template->smarty->ext->_tplFunction->getTplFunction($_template), true) . ");\n"; - - } - // include code for required plugins - if (!$cache && isset($compiler)) { - $output .= $compiler->compileRequiredPlugins(); } $output .= "?>"; $output .= $content; @@ -69,11 +68,15 @@ class Smarty_Internal_Runtime_CodeFrame $output .= "<?php }\n"; // remove unneeded PHP tags if (preg_match('/\s*\?>[\n]?<\?php\s*/', $output)) { - $curr_split = preg_split('/\s*\?>[\n]?<\?php\s*/', - $output); - preg_match_all('/\s*\?>[\n]?<\?php\s*/', - $output, - $curr_parts); + $curr_split = preg_split( + '/\s*\?>[\n]?<\?php\s*/', + $output + ); + preg_match_all( + '/\s*\?>[\n]?<\?php\s*/', + $output, + $curr_parts + ); $output = ''; foreach ($curr_split as $idx => $curr_output) { $output .= $curr_output; @@ -83,8 +86,10 @@ class Smarty_Internal_Runtime_CodeFrame } } if (preg_match('/\?>\s*$/', $output)) { - $curr_split = preg_split('/\?>\s*$/', - $output); + $curr_split = preg_split( + '/\?>\s*$/', + $output + ); $output = ''; foreach ($curr_split as $idx => $curr_output) { $output .= $curr_output; @@ -92,4 +97,4 @@ class Smarty_Internal_Runtime_CodeFrame } return $output; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php index 9d7d2db2e..9f868e1a4 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php @@ -23,9 +23,9 @@ class Smarty_Internal_Runtime_FilterHandler * plugin filename format: filtertype.filtername.php * Smarty2 filter plugins could be used * - * @param string $type the type of filter ('pre','post','output') which shall run - * @param string $content the content which shall be processed by the filters - * @param Smarty_Internal_Template $template template object + * @param string $type the type of filter ('pre','post','output') which shall run + * @param string $content the content which shall be processed by the filters + * @param Smarty_Internal_Template $template template object * * @throws SmartyException * @return string the filtered content @@ -34,7 +34,7 @@ class Smarty_Internal_Runtime_FilterHandler { // loop over autoload filters of specified type if (!empty($template->smarty->autoload_filters[ $type ])) { - foreach ((array) $template->smarty->autoload_filters[ $type ] as $name) { + foreach ((array)$template->smarty->autoload_filters[ $type ] as $name) { $plugin_name = "Smarty_{$type}filter_{$name}"; if (function_exists($plugin_name)) { $callback = $plugin_name; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_foreach.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_foreach.php index 8b60768bc..badead165 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_foreach.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_foreach.php @@ -6,11 +6,9 @@ * @package Smarty * @subpackage PluginsInternal * @author Uwe Tews - * */ class Smarty_Internal_Runtime_Foreach { - /** * Stack of saved variables * @@ -34,24 +32,35 @@ class Smarty_Internal_Runtime_Foreach * * @return mixed $from */ - public function init(Smarty_Internal_Template $tpl, $from, $item, $needTotal = false, $key = null, $name = null, - $properties = array()) - { + public function init( + Smarty_Internal_Template $tpl, + $from, + $item, + $needTotal = false, + $key = null, + $name = null, + $properties = array() + ) { + $needTotal = $needTotal || isset($properties[ 'total' ]); $saveVars = array(); $total = null; if (!is_array($from)) { if (is_object($from)) { - $total = $this->count($from); + if ($needTotal) { + $total = $this->count($from); + } } else { settype($from, 'array'); } } if (!isset($total)) { - $total = empty($from) ? 0 : (($needTotal || isset($properties[ 'total' ])) ? count($from) : 1); + $total = empty($from) ? 0 : ($needTotal ? count($from) : 1); } if (isset($tpl->tpl_vars[ $item ])) { - $saveVars[ 'item' ] = array($item, - $tpl->tpl_vars[ $item ]); + $saveVars[ 'item' ] = array( + $item, + $tpl->tpl_vars[ $item ] + ); } $tpl->tpl_vars[ $item ] = new Smarty_Variable(null, $tpl->isRenderingCache); if ($total === 0) { @@ -59,8 +68,10 @@ class Smarty_Internal_Runtime_Foreach } else { if ($key) { if (isset($tpl->tpl_vars[ $key ])) { - $saveVars[ 'key' ] = array($key, - $tpl->tpl_vars[ $key ]); + $saveVars[ 'key' ] = array( + $key, + $tpl->tpl_vars[ $key ] + ); } $tpl->tpl_vars[ $key ] = new Smarty_Variable(null, $tpl->isRenderingCache); } @@ -71,8 +82,10 @@ class Smarty_Internal_Runtime_Foreach if ($name) { $namedVar = "__smarty_foreach_{$name}"; if (isset($tpl->tpl_vars[ $namedVar ])) { - $saveVars[ 'named' ] = array($namedVar, - $tpl->tpl_vars[ $namedVar ]); + $saveVars[ 'named' ] = array( + $namedVar, + $tpl->tpl_vars[ $namedVar ] + ); } $namedProp = array(); if (isset($properties[ 'total' ])) { @@ -82,7 +95,7 @@ class Smarty_Internal_Runtime_Foreach $namedProp[ 'iteration' ] = 0; } if (isset($properties[ 'index' ])) { - $namedProp[ 'index' ] = - 1; + $namedProp[ 'index' ] = -1; } if (isset($properties[ 'show' ])) { $namedProp[ 'show' ] = ($total > 0); @@ -94,10 +107,9 @@ class Smarty_Internal_Runtime_Foreach } /** - * * [util function] counts an array, arrayAccess/traversable or PDOStatement object * - * @param mixed $value + * @param mixed $value * * @return int the count for arrays and objects that implement countable, 1 for other objects that don't, and 0 * for empty elements @@ -117,7 +129,7 @@ class Smarty_Internal_Runtime_Foreach } elseif ($value instanceof Traversable) { return iterator_count($value); } - return count((array) $value); + return count((array)$value); } /** @@ -144,8 +156,7 @@ class Smarty_Internal_Runtime_Foreach $tpl->tpl_vars[ $saveVars[ 'named' ][ 0 ] ] = $saveVars[ 'named' ][ 1 ]; } } - $levels --; + $levels--; } } - } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php index 54b1bb3d5..5ae98304e 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php @@ -21,42 +21,49 @@ class Smarty_Internal_Runtime_GetIncludePath * @var string */ public $_include_path = ''; + /** * include path directory cache * * @var array */ public $_include_dirs = array(); + /** * include path directory cache * * @var array */ public $_user_dirs = array(); + /** * stream cache * * @var string[][] */ public $isFile = array(); + /** * stream cache * * @var string[] */ public $isPath = array(); + /** * stream cache * * @var int[] */ public $number = array(); + /** * status cache * * @var bool */ public $_has_stream_include = null; + /** * Number for array index * @@ -104,12 +111,11 @@ class Smarty_Internal_Runtime_GetIncludePath /** * Return full file path from PHP include_path * - * @param string[] $dirs - * @param string $file - * @param \Smarty $smarty + * @param string[] $dirs + * @param string $file + * @param \Smarty $smarty * * @return bool|string full filepath or false - * */ public function getIncludePath($dirs, $file, Smarty $smarty) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php index b593b78eb..6392d4cb3 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php @@ -6,11 +6,9 @@ * @package Smarty * @subpackage PluginsInternal * @author Uwe Tews - * **/ class Smarty_Internal_Runtime_Inheritance { - /** * State machine * - 0 idle next extends will create a new inheritance tree @@ -42,7 +40,7 @@ class Smarty_Internal_Runtime_Inheritance * * @var int */ - public $tplIndex = - 1; + public $tplIndex = -1; /** * Array of template source objects @@ -64,7 +62,6 @@ class Smarty_Internal_Runtime_Inheritance * @param \Smarty_Internal_Template $tpl template object of caller * @param bool $initChild if true init for child template * @param array $blockNames outer level block name - * */ public function init(Smarty_Internal_Template $tpl, $initChild, $blockNames = array()) { @@ -76,7 +73,6 @@ class Smarty_Internal_Runtime_Inheritance } ++$this->tplIndex; $this->sources[ $this->tplIndex ] = $tpl->source; - // start of child sub template(s) if ($initChild) { $this->state = 1; @@ -113,18 +109,21 @@ class Smarty_Internal_Runtime_Inheritance ob_end_clean(); $this->state = 2; } - if (isset($template) && (($tpl->parent->_isTplObj() && $tpl->parent->source->type !== 'extends') || - $tpl->smarty->extends_recursion)) { - $tpl->_subTemplateRender($template, - $tpl->cache_id, - $tpl->compile_id, - $tpl->caching ? 9999 : 0, - $tpl->cache_lifetime, - array(), - 2, - false, - $uid, - $func); + if (isset($template) && (($tpl->parent->_isTplObj() && $tpl->parent->source->type !== 'extends') + || $tpl->smarty->extends_recursion) + ) { + $tpl->_subTemplateRender( + $template, + $tpl->cache_id, + $tpl->compile_id, + $tpl->caching ? 9999 : 0, + $tpl->cache_lifetime, + array(), + 2, + false, + $uid, + $func + ); } } @@ -166,9 +165,11 @@ class Smarty_Internal_Runtime_Inheritance * * @throws \SmartyException */ - public function process(Smarty_Internal_Template $tpl, Smarty_Internal_Block $block, - Smarty_Internal_Block $parent = null) - { + public function process( + Smarty_Internal_Template $tpl, + Smarty_Internal_Block $block, + Smarty_Internal_Block $parent = null + ) { if ($block->hide && !isset($block->child)) { return; } @@ -187,8 +188,8 @@ class Smarty_Internal_Runtime_Inheritance if ($block->prepend && isset($parent)) { $this->callParent($tpl, $block, '{block prepend}'); if ($block->append) { - if ($block->callsChild || !isset($block->child) || - ($block->child->hide && !isset($block->child->child)) + if ($block->callsChild || !isset($block->child) + || ($block->child->hide && !isset($block->child->child)) ) { $this->callBlock($block, $tpl); } else { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_make_nocache.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_make_nocache.php index 65382772d..53069148d 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_make_nocache.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_make_nocache.php @@ -6,11 +6,9 @@ * @package Smarty * @subpackage PluginsInternal * @author Uwe Tews - * */ class Smarty_Internal_Runtime_Make_Nocache { - /** * Save current variable value while rendering compiled template and inject nocache code to * assign variable value in cahed template @@ -38,8 +36,8 @@ class Smarty_Internal_Runtime_Make_Nocache * Store variable value saved while rendering compiled template in cached template context * * @param \Smarty_Internal_Template $tpl - * @param string $var variable name - * @param array $properties + * @param string $var variable name + * @param array $properties */ public function store(Smarty_Internal_Template $tpl, $var, $properties) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php index b86563cb3..e5f8e48f7 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php @@ -6,7 +6,6 @@ * @package Smarty * @subpackage PluginsInternal * @author Uwe Tews - * **/ class Smarty_Internal_Runtime_TplFunction { @@ -36,14 +35,14 @@ class Smarty_Internal_Runtime_TplFunction } if (function_exists($function)) { $this->saveTemplateVariables($tpl, $name); - $function ($tpl, $params); + $function($tpl, $params); $this->restoreTemplateVariables($tpl, $name); return; } // try to load template function dynamically if ($this->addTplFuncToCache($tpl, $name, $function)) { $this->saveTemplateVariables($tpl, $name); - $function ($tpl, $params); + $function($tpl, $params); $this->restoreTemplateVariables($tpl, $name); return; } @@ -55,8 +54,11 @@ class Smarty_Internal_Runtime_TplFunction * Register template functions defined by template * * @param \Smarty|\Smarty_Internal_Template|\Smarty_Internal_TemplateBase $obj - * @param array $tplFunctions source information array of template functions defined in template - * @param bool $override if true replace existing functions with same name + * @param array $tplFunctions source information array of + * template functions defined + * in template + * @param bool $override if true replace existing + * functions with same name */ public function registerTplFunctions(Smarty_Internal_TemplateBase $obj, $tplFunctions, $override = true) { @@ -90,7 +92,6 @@ class Smarty_Internal_Runtime_TplFunction } /** - * * Add template function to cache file for nocache calls * * @param Smarty_Internal_Template $tpl @@ -126,11 +127,18 @@ class Smarty_Internal_Runtime_TplFunction if (!preg_match("/'{$funcParam['uid']}'(.*?)'nocache_hash'/", $content, $match2)) { $content = preg_replace("/('file_dependency'(.*?)\()/", "\\1{$match1[0]}", $content); } - $tplPtr->smarty->ext->_updateCache->write($tplPtr, - preg_replace('/\s*\?>\s*$/', "\n", $content) . - "\n" . preg_replace(array('/^\s*<\?php\s+/', - '/\s*\?>\s*$/',), "\n", - $match[ 0 ])); + $tplPtr->smarty->ext->_updateCache->write( + $tplPtr, + preg_replace('/\s*\?>\s*$/', "\n", $content) . + "\n" . preg_replace( + array( + '/^\s*<\?php\s+/', + '/\s*\?>\s*$/', + ), + "\n", + $match[ 0 ] + ) + ); } } return true; @@ -144,7 +152,7 @@ class Smarty_Internal_Runtime_TplFunction * Save current template variables on stack * * @param \Smarty_Internal_Template $tpl - * @param string $name stack name + * @param string $name stack name */ public function saveTemplateVariables(Smarty_Internal_Template $tpl, $name) { @@ -156,7 +164,7 @@ class Smarty_Internal_Runtime_TplFunction * Restore saved variables into template objects * * @param \Smarty_Internal_Template $tpl - * @param string $name stack name + * @param string $name stack name */ public function restoreTemplateVariables(Smarty_Internal_Template $tpl, $name) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php index bb3e4e138..c1abbb321 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php @@ -6,7 +6,6 @@ * @package Smarty * @subpackage PluginsInternal * @author Uwe Tews - * **/ class Smarty_Internal_Runtime_UpdateCache { @@ -15,7 +14,7 @@ class Smarty_Internal_Runtime_UpdateCache * * @param \Smarty_Template_Cached $cached * @param Smarty_Internal_Template $_template - * @param string $content + * @param string $content */ public function cacheModifiedCheck(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $content) { @@ -65,35 +64,44 @@ class Smarty_Internal_Runtime_UpdateCache * * @throws \SmartyException */ - public function removeNoCacheHash(Smarty_Template_Cached $cached, - Smarty_Internal_Template $_template, - $no_output_filter) - { + public function removeNoCacheHash( + Smarty_Template_Cached $cached, + Smarty_Internal_Template $_template, + $no_output_filter + ) { $php_pattern = '/(<%|%>|<\?php|<\?|\?>|<script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*>)/'; $content = ob_get_clean(); $hash_array = $cached->hashes; - $hash_array[$_template->compiled->nocache_hash] = true; + $hash_array[ $_template->compiled->nocache_hash ] = true; $hash_array = array_keys($hash_array); $nocache_hash = '(' . implode('|', $hash_array) . ')'; $_template->cached->has_nocache_code = false; // get text between non-cached items $cache_split = - preg_split("!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s", - $content); + preg_split( + "!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s", + $content + ); // get non-cached items - preg_match_all("!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s", - $content, - $cache_parts); + preg_match_all( + "!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s", + $content, + $cache_parts + ); $content = ''; // loop over items, stitch back together foreach ($cache_split as $curr_idx => $curr_split) { if (preg_match($php_pattern, $curr_split)) { // escape PHP tags in template content - $php_split = preg_split($php_pattern, - $curr_split); - preg_match_all($php_pattern, - $curr_split, - $php_parts); + $php_split = preg_split( + $php_pattern, + $curr_split + ); + preg_match_all( + $php_pattern, + $curr_split, + $php_parts + ); foreach ($php_split as $idx_php => $curr_php) { $content .= $curr_php; if (isset($php_parts[ 0 ][ $idx_php ])) { @@ -108,9 +116,9 @@ class Smarty_Internal_Runtime_UpdateCache $content .= $cache_parts[ 2 ][ $curr_idx ]; } } - if (!$no_output_filter && !$_template->cached->has_nocache_code && - (isset($_template->smarty->autoload_filters[ 'output' ]) || - isset($_template->smarty->registered_filters[ 'output' ])) + if (!$no_output_filter && !$_template->cached->has_nocache_code + && (isset($_template->smarty->autoload_filters[ 'output' ]) + || isset($_template->smarty->registered_filters[ 'output' ])) ) { $content = $_template->smarty->ext->_filterHandler->runFilter('output', $content, $_template); } @@ -162,7 +170,6 @@ class Smarty_Internal_Runtime_UpdateCache if ($_template->smarty->cache_locking) { $cached->handler->releaseLock($_template->smarty, $cached); } - return true; } $cached->content = null; @@ -171,7 +178,6 @@ class Smarty_Internal_Runtime_UpdateCache $cached->valid = false; $cached->processed = false; } - return false; } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php index 2d62c60bb..2240f97ca 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php @@ -6,25 +6,24 @@ * @package Smarty * @subpackage PluginsInternal * @author Uwe Tews - * **/ class Smarty_Internal_Runtime_UpdateScope { - /** * Update new assigned template or config variable in other effected scopes * - * @param Smarty_Internal_Template $tpl data object - * @param string|null $varName variable name - * @param int $tagScope tag scope to which bubble up variable value - * + * @param Smarty_Internal_Template $tpl data object + * @param string|null $varName variable name + * @param int $tagScope tag scope to which bubble up variable value */ public function _updateScope(Smarty_Internal_Template $tpl, $varName, $tagScope = 0) { if ($tagScope) { $this->_updateVarStack($tpl, $varName); $tagScope = $tagScope & ~Smarty::SCOPE_LOCAL; - if (!$tpl->scope && !$tagScope) return; + if (!$tpl->scope && !$tagScope) { + return; + } } $mergedScope = $tagScope | $tpl->scope; if ($mergedScope) { @@ -34,8 +33,9 @@ class Smarty_Internal_Runtime_UpdateScope // update scopes foreach ($this->_getAffectedScopes($tpl, $mergedScope) as $ptr) { $this->_updateVariableInOtherScope($ptr->tpl_vars, $tpl, $varName); - if($tagScope && $ptr->_isTplObj() && isset($tpl->_cache[ 'varStack' ])) { - $this->_updateVarStack($ptr, $varName); } + if ($tagScope && $ptr->_isTplObj() && isset($tpl->_cache[ 'varStack' ])) { + $this->_updateVarStack($ptr, $varName); + } } } } @@ -62,8 +62,8 @@ class Smarty_Internal_Runtime_UpdateScope $ptr = $ptr->parent; } while (isset($ptr) && $ptr->_isTplObj()) { - $_stack[] = $ptr; - $ptr = $ptr->parent; + $_stack[] = $ptr; + $ptr = $ptr->parent; } if ($mergedScope & Smarty::SCOPE_SMARTY) { if (isset($tpl->smarty)) { @@ -84,9 +84,9 @@ class Smarty_Internal_Runtime_UpdateScope /** * Update variable in other scope * - * @param array $tpl_vars template variable array + * @param array $tpl_vars template variable array * @param \Smarty_Internal_Template $from - * @param string $varName variable name + * @param string $varName variable name */ public function _updateVariableInOtherScope(&$tpl_vars, Smarty_Internal_Template $from, $varName) { @@ -109,7 +109,7 @@ class Smarty_Internal_Runtime_UpdateScope $i = 0; while (isset($tpl->_cache[ 'varStack' ][ $i ])) { $this->_updateVariableInOtherScope($tpl->_cache[ 'varStack' ][ $i ][ 'tpl' ], $tpl, $varName); - $i ++; + $i++; } } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_writefile.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_writefile.php index dc9019f49..4383e6f38 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_writefile.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_writefile.php @@ -6,6 +6,7 @@ * @subpackage PluginsInternal * @author Monte Ohrt */ + /** * Smarty Internal Write File Class * @@ -17,9 +18,9 @@ class Smarty_Internal_Runtime_WriteFile /** * Writes file in a safe way to disk * - * @param string $_filepath complete filepath - * @param string $_contents file content - * @param Smarty $smarty smarty instance + * @param string $_filepath complete filepath + * @param string $_contents file content + * @param Smarty $smarty smarty instance * * @throws SmartyException * @return boolean true diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php index bdf74065d..21f4e3fdd 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php @@ -76,8 +76,8 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom /** * method to compile a Smarty template * - * @param mixed $_content template source - * @param bool $isTemplateSource + * @param mixed $_content template source + * @param bool $isTemplateSource * * @return bool true if compiling succeeded, false if it failed * @throws \SmartyCompilerException @@ -89,22 +89,32 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom then written to compiled files. */ // init the lexer/parser to compile the template $this->parser = - new $this->parser_class(new $this->lexer_class(str_replace(array("\r\n", - "\r"), "\n", $_content), $this), - $this); + new $this->parser_class( + new $this->lexer_class( + str_replace( + array( + "\r\n", + "\r" + ), + "\n", + $_content + ), + $this + ), + $this + ); if ($isTemplateSource && $this->template->caching) { $this->parser->insertPhpCode("<?php\n\$_smarty_tpl->compiled->nocache_hash = '{$this->nocache_hash}';\n?>\n"); } if (function_exists('mb_internal_encoding') && function_exists('ini_get') - && ((int) ini_get('mbstring.func_overload')) & 2 + && ((int)ini_get('mbstring.func_overload')) & 2 ) { $mbEncoding = mb_internal_encoding(); mb_internal_encoding('ASCII'); } else { $mbEncoding = null; } - if ($this->smarty->_parserdebug) { $this->parser->PrintTrace(); $this->parser->lex->PrintTrace(); @@ -117,7 +127,6 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom } $this->parser->doParse($this->parser->lex->token, $this->parser->lex->value); } - // finish parsing process $this->parser->doParse(0, 0); if ($mbEncoding) { @@ -127,8 +136,10 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom if (count($this->_tag_stack) > 0) { // get stacked info list($openTag, $_data) = array_pop($this->_tag_stack); - $this->trigger_template_error("unclosed {$this->smarty->left_delimiter}" . $openTag . - "{$this->smarty->right_delimiter} tag"); + $this->trigger_template_error( + "unclosed {$this->smarty->left_delimiter}" . $openTag . + "{$this->smarty->right_delimiter} tag" + ); } // call post compile callbacks foreach ($this->postCompileCallbacks as $cb) { @@ -148,7 +159,6 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom * @param array $parameter optional parameter array * @param string $key optional key for callback * @param bool $replace if true replace existing keyed callback - * */ public function registerPostCompileCallback($callback, $parameter = array(), $key = null, $replace = false) { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php index 21f60f991..bae22a7d5 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php @@ -27,6 +27,29 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase { /** + * Template object cache + * + * @var Smarty_Internal_Template[] + */ + public static $tplObjCache = array(); + + /** + * Template object cache for Smarty::isCached() === true + * + * @var Smarty_Internal_Template[] + */ + public static $isCacheTplObj = array(); + + /** + * Sub template Info Cache + * - index name + * - value use count + * + * @var int[] + */ + public static $subTplInfo = array(); + + /** * This object type (Smarty = 1, template = 2, data = 4) * * @var int @@ -104,49 +127,34 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase public $endRenderCallbacks = array(); /** - * Template object cache - * - * @var Smarty_Internal_Template[] - */ - public static $tplObjCache = array(); - - /** - * Template object cache for Smarty::isCached() === true - * - * @var Smarty_Internal_Template[] - */ - public static $isCacheTplObj = array(); - - /** - * Sub template Info Cache - * - index name - * - value use count - * - * @var int[] - */ - public static $subTplInfo = array(); - - /** * Create template data object * Some of the global Smarty settings copied to template scope * It load the required template resources and caching plugins * * @param string $template_resource template resource string * @param Smarty $smarty Smarty instance - * @param null|\Smarty_Internal_Template|\Smarty|\Smarty_Internal_Data $_parent back pointer to parent object - * with variables or null + * @param null|\Smarty_Internal_Template|\Smarty|\Smarty_Internal_Data $_parent back pointer to parent + * object with variables or + * null * @param mixed $_cache_id cache id or null * @param mixed $_compile_id compile id or null * @param bool|int|null $_caching use caching? - * @param int|null $_cache_lifetime cache life-time in seconds + * @param int|null $_cache_lifetime cache life-time in + * seconds * @param bool $_isConfig * * @throws \SmartyException */ - public function __construct($template_resource, Smarty $smarty, Smarty_Internal_Data $_parent = null, - $_cache_id = null, $_compile_id = null, $_caching = null, $_cache_lifetime = null, - $_isConfig = false) - { + public function __construct( + $template_resource, + Smarty $smarty, + Smarty_Internal_Data $_parent = null, + $_cache_id = null, + $_compile_id = null, + $_caching = null, + $_cache_lifetime = null, + $_isConfig = false + ) { $this->smarty = $smarty; // Smarty parameter $this->cache_id = $_cache_id === null ? $this->smarty->cache_id : $_cache_id; @@ -167,8 +175,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase /** * render template * - * @param bool $no_output_filter if true do not run output filter - * @param null|bool $display true: display, false: fetch null: sub-template + * @param bool $no_output_filter if true do not run output filter + * @param null|bool $display true: display, false: fetch null: sub-template * * @return string * @throws \Exception @@ -184,8 +192,10 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase } // checks if template exists if (!$this->source->exists) { - throw new SmartyException("Unable to load template '{$this->source->type}:{$this->source->name}'" . - ($this->_isSubTpl() ? " in '{$this->parent->template_resource}'" : '')); + throw new SmartyException( + "Unable to load template '{$this->source->type}:{$this->source->name}'" . + ($this->_isSubTpl() ? " in '{$this->parent->template_resource}'" : '') + ); } // disable caching for evaluated code if ($this->source->handler->recompiled) { @@ -193,8 +203,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase } // read from cache or render if ($this->caching === Smarty::CACHING_LIFETIME_CURRENT || $this->caching === Smarty::CACHING_LIFETIME_SAVED) { - if (!isset($this->cached) || $this->cached->cache_id !== $this->cache_id || - $this->cached->compile_id !== $this->compile_id + if (!isset($this->cached) || $this->cached->cache_id !== $this->cache_id + || $this->cached->compile_id !== $this->compile_id ) { $this->loadCached(true); } @@ -205,16 +215,18 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase } $this->compiled->render($this); } - // display or fetch if ($display) { if ($this->caching && $this->smarty->cache_modified_check) { - $this->smarty->ext->_cacheModify->cacheModifiedCheck($this->cached, $this, - isset($content) ? $content : ob_get_clean()); + $this->smarty->ext->_cacheModify->cacheModifiedCheck( + $this->cached, + $this, + isset($content) ? $content : ob_get_clean() + ); } else { - if ((!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) && - !$no_output_filter && (isset($this->smarty->autoload_filters[ 'output' ]) || - isset($this->smarty->registered_filters[ 'output' ])) + if ((!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) + && !$no_output_filter && (isset($this->smarty->autoload_filters[ 'output' ]) + || isset($this->smarty->registered_filters[ 'output' ])) ) { echo $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this); } else { @@ -234,10 +246,10 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase $this->smarty->_debug->display_debug($this, true); } } - if (!$no_output_filter && - (!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) && - (isset($this->smarty->autoload_filters[ 'output' ]) || - isset($this->smarty->registered_filters[ 'output' ])) + if (!$no_output_filter + && (!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) + && (isset($this->smarty->autoload_filters[ 'output' ]) + || isset($this->smarty->registered_filters[ 'output' ])) ) { return $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this); } @@ -263,9 +275,18 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase * @throws \Exception * @throws \SmartyException */ - public function _subTemplateRender($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $scope, - $forceTplCache, $uid = null, $content_func = null) - { + public function _subTemplateRender( + $template, + $cache_id, + $compile_id, + $caching, + $cache_lifetime, + $data, + $scope, + $forceTplCache, + $uid = null, + $content_func = null + ) { $tpl = clone $this; $tpl->parent = $this; $smarty = &$this->smarty; @@ -322,14 +343,13 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase $tpl->scope = $scope; if (!isset(self::$tplObjCache[ $tpl->templateId ]) && !$tpl->source->handler->recompiled) { // check if template object should be cached - if ($forceTplCache || (isset(self::$subTplInfo[ $tpl->template_resource ]) && - self::$subTplInfo[ $tpl->template_resource ] > 1) || - ($tpl->_isSubTpl() && isset(self::$tplObjCache[ $tpl->parent->templateId ])) + if ($forceTplCache || (isset(self::$subTplInfo[ $tpl->template_resource ]) + && self::$subTplInfo[ $tpl->template_resource ] > 1) + || ($tpl->_isSubTpl() && isset(self::$tplObjCache[ $tpl->parent->templateId ])) ) { self::$tplObjCache[ $tpl->templateId ] = $tpl; } } - if (!empty($data)) { // set up variable values foreach ($data as $_key => $_val) { @@ -369,7 +389,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase /** * Get called sub-templates and save call count - * */ public function _subTemplateRegister() { @@ -399,7 +418,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase * @param mixed $value value * @param bool $nocache nocache flag * @param int $scope scope into which variable shall be assigned - * */ public function _assignInScope($varName, $value, $nocache = false, $scope = 0) { @@ -426,15 +444,16 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase * * @throws \SmartyException */ - public function _checkPlugins($plugins) { + public function _checkPlugins($plugins) + { static $checked = array(); - foreach($plugins as $plugin) { + foreach ($plugins as $plugin) { $name = join('::', (array)$plugin[ 'function' ]); - if (!isset($checked[$name])) { - if (!is_callable($plugin['function'])) { - if (is_file($plugin['file'])) { - require_once $plugin['file']; - if (is_callable($plugin['function'])) { + if (!isset($checked[ $name ])) { + if (!is_callable($plugin[ 'function' ])) { + if (is_file($plugin[ 'file' ])) { + include_once $plugin[ 'file' ]; + if (is_callable($plugin[ 'function' ])) { $checked[ $name ] = true; } } @@ -458,8 +477,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase * - Check if compiled or cache file is valid * * @param \Smarty_Internal_Template $tpl - * @param array $properties special template properties - * @param bool $cache flag if called from cache file + * @param array $properties special template properties + * @param bool $cache flag if called from cache file * * @return bool flag if compiled or cache file is valid * @throws \SmartyException @@ -476,8 +495,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase return false; } $is_valid = true; - if (!empty($properties[ 'file_dependency' ]) && - ((!$cache && $tpl->compile_check) || $tpl->compile_check === Smarty::COMPILECHECK_ON) + if (!empty($properties[ 'file_dependency' ]) + && ((!$cache && $tpl->compile_check) || $tpl->compile_check === Smarty::COMPILECHECK_ON) ) { // check file dependencies at compiled code foreach ($properties[ 'file_dependency' ] as $_file_to_check) { @@ -507,8 +526,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase } if ($cache) { // CACHING_LIFETIME_SAVED cache expiry has to be validated here since otherwise we'd define the unifunc - if ($tpl->caching === Smarty::CACHING_LIFETIME_SAVED && $properties[ 'cache_lifetime' ] >= 0 && - (time() > ($tpl->cached->timestamp + $properties[ 'cache_lifetime' ])) + if ($tpl->caching === Smarty::CACHING_LIFETIME_SAVED && $properties[ 'cache_lifetime' ] >= 0 + && (time() > ($tpl->cached->timestamp + $properties[ 'cache_lifetime' ])) ) { $is_valid = false; } @@ -532,6 +551,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase /** * Compiles the template * If the template is not evaluated the compiled template is saved on disk + * + * @throws \Exception */ public function compileTemplateSource() { @@ -564,6 +585,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase /** * runtime error not matching capture tags + * + * @throws \SmartyException */ public function capture_error() { @@ -596,7 +619,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase /** * Load inheritance object - * */ public function _loadInheritance() { @@ -607,7 +629,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase /** * Unload inheritance object - * */ public function _cleanUp() { @@ -627,8 +648,11 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase $this->smarty->loadPlugin($this->source->compiler_class); } $this->compiler = - new $this->source->compiler_class($this->source->template_lexer_class, $this->source->template_parser_class, - $this->smarty); + new $this->source->compiler_class( + $this->source->template_lexer_class, + $this->source->template_parser_class, + $this->smarty + ); } /** @@ -638,7 +662,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase * @param array $args argument array * * @return mixed - * @throws SmartyException */ public function __call($name, $args) { @@ -651,60 +674,58 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase } /** - * set Smarty property in template context + * get Smarty property in template context * * @param string $property_name property name - * @param mixed $value value * + * @return mixed|Smarty_Template_Cached * @throws SmartyException */ - public function __set($property_name, $value) + public function __get($property_name) { switch ($property_name) { case 'compiled': + $this->loadCompiled(); + return $this->compiled; case 'cached': + $this->loadCached(); + return $this->cached; case 'compiler': - $this->$property_name = $value; - return; + $this->loadCompiler(); + return $this->compiler; default: // Smarty property ? if (property_exists($this->smarty, $property_name)) { - $this->smarty->$property_name = $value; - return; + return $this->smarty->$property_name; } } - throw new SmartyException("invalid template property '$property_name'."); + throw new SmartyException("template property '$property_name' does not exist."); } /** - * get Smarty property in template context + * set Smarty property in template context * * @param string $property_name property name + * @param mixed $value value * - * @return mixed|Smarty_Template_Cached * @throws SmartyException */ - public function __get($property_name) + public function __set($property_name, $value) { switch ($property_name) { case 'compiled': - $this->loadCompiled(); - return $this->compiled; - case 'cached': - $this->loadCached(); - return $this->cached; - case 'compiler': - $this->loadCompiler(); - return $this->compiler; + $this->$property_name = $value; + return; default: // Smarty property ? if (property_exists($this->smarty, $property_name)) { - return $this->smarty->$property_name; + $this->smarty->$property_name = $value; + return; } } - throw new SmartyException("template property '$property_name' does not exist."); + throw new SmartyException("invalid template property '$property_name'."); } /** diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php index 6b959404c..4476f120f 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php @@ -11,8 +11,8 @@ /** * Class with shared smarty/template methods * - * @package Smarty - * @subpackage Template + * @package Smarty + * @subpackage Template * * @property int $_objType * @@ -20,7 +20,7 @@ * They are located in a corresponding Smarty_Internal_Method_xxxx class * * @method Smarty_Internal_TemplateBase addAutoloadFilters(mixed $filters, string $type = null) - * @method Smarty_Internal_TemplateBase addDefaultModifier(mixed $modifiers) + * @method Smarty_Internal_TemplateBase addDefaultModifiers(mixed $modifiers) * @method Smarty_Internal_TemplateBase addLiterals(mixed $literals) * @method Smarty_Internal_TemplateBase createData(Smarty_Internal_Data $parent = null, string $name = null) * @method array getAutoloadFilters(string $type = null) @@ -102,10 +102,10 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data /** * fetches a rendered Smarty template * - * @param string $template the resource handle of the template file or template object - * @param mixed $cache_id cache id to be used with this template - * @param mixed $compile_id compile id to be used with this template - * @param object $parent next higher level of Smarty variables + * @param string $template the resource handle of the template file or template object + * @param mixed $cache_id cache id to be used with this template + * @param mixed $compile_id compile id to be used with this template + * @param object $parent next higher level of Smarty variables * * @throws Exception * @throws SmartyException @@ -140,10 +140,11 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data * @api Smarty::isCached() * @link http://www.smarty.net/docs/en/api.is.cached.tpl * - * @param null|string|\Smarty_Internal_Template $template the resource handle of the template file or template object - * @param mixed $cache_id cache id to be used with this template - * @param mixed $compile_id compile id to be used with this template - * @param object $parent next higher level of Smarty variables + * @param null|string|\Smarty_Internal_Template $template the resource handle of the template file or template + * object + * @param mixed $cache_id cache id to be used with this template + * @param mixed $compile_id compile id to be used with this template + * @param object $parent next higher level of Smarty variables * * @return bool cache status * @throws \Exception @@ -157,11 +158,11 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data /** * fetches a rendered Smarty template * - * @param string $template the resource handle of the template file or template object - * @param mixed $cache_id cache id to be used with this template - * @param mixed $compile_id compile id to be used with this template - * @param object $parent next higher level of Smarty variables - * @param string $function function type 0 = fetch, 1 = display, 2 = isCache + * @param string $template the resource handle of the template file or template object + * @param mixed $cache_id cache id to be used with this template + * @param mixed $compile_id compile id to be used with this template + * @param object $parent next higher level of Smarty variables + * @param string $function function type 0 = fetch, 1 = display, 2 = isCache * * @return mixed * @throws \Exception @@ -185,7 +186,6 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data } else { // get template object $saveVars = false; - $template = $smarty->createTemplate($template, $cache_id, $compile_id, $parent ? $parent : $this, false); if ($this->_objType === 1) { // set caching in template object @@ -246,8 +246,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data error_reporting($_smarty_old_error_level); } return $result; - } - catch (Exception $e) { + } catch (Exception $e) { while (ob_get_level() > $level) { ob_end_clean(); } @@ -264,14 +263,14 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data * @api Smarty::registerPlugin() * @link http://www.smarty.net/docs/en/api.register.plugin.tpl * - * @param string $type plugin type - * @param string $name name of template tag - * @param callback $callback PHP callback to register - * @param bool $cacheable if true (default) this function is cache able - * @param mixed $cache_attr caching attributes if any + * @param string $type plugin type + * @param string $name name of template tag + * @param callback $callback PHP callback to register + * @param bool $cacheable if true (default) this function is cache able + * @param mixed $cache_attr caching attributes if any * * @return \Smarty|\Smarty_Internal_Template - * @throws SmartyException when the plugin tag is invalid + * @throws \SmartyException */ public function registerPlugin($type, $name, $callback, $cacheable = true, $cache_attr = null) { @@ -284,11 +283,11 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data * @api Smarty::loadFilter() * @link http://www.smarty.net/docs/en/api.load.filter.tpl * - * @param string $type filter type - * @param string $name filter name + * @param string $type filter type + * @param string $name filter name * * @return bool - * @throws SmartyException if filter could not be loaded + * @throws \SmartyException */ public function loadFilter($type, $name) { @@ -301,9 +300,9 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data * @api Smarty::registerFilter() * @link http://www.smarty.net/docs/en/api.register.filter.tpl * - * @param string $type filter type - * @param callback $callback - * @param string|null $name optional filter name + * @param string $type filter type + * @param callback $callback + * @param string|null $name optional filter name * * @return \Smarty|\Smarty_Internal_Template * @throws \SmartyException @@ -319,20 +318,30 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data * @api Smarty::registerObject() * @link http://www.smarty.net/docs/en/api.register.object.tpl * - * @param string $object_name - * @param object $object the referenced PHP object to register - * @param array $allowed_methods_properties list of allowed methods (empty = all) - * @param bool $format smarty argument format, else traditional - * @param array $block_methods list of block-methods + * @param string $object_name + * @param object $object the referenced PHP object to register + * @param array $allowed_methods_properties list of allowed methods (empty = all) + * @param bool $format smarty argument format, else traditional + * @param array $block_methods list of block-methods * * @return \Smarty|\Smarty_Internal_Template * @throws \SmartyException */ - public function registerObject($object_name, $object, $allowed_methods_properties = array(), $format = true, - $block_methods = array()) - { - return $this->ext->registerObject->registerObject($this, $object_name, $object, $allowed_methods_properties, - $format, $block_methods); + public function registerObject( + $object_name, + $object, + $allowed_methods_properties = array(), + $format = true, + $block_methods = array() + ) { + return $this->ext->registerObject->registerObject( + $this, + $object_name, + $object, + $allowed_methods_properties, + $format, + $block_methods + ); } /** @@ -374,6 +383,4 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data { $this->cache_id = $cache_id; } - } - diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php index 0d7284a0a..a72f3a4ab 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -16,8 +16,8 @@ * * @property Smarty_Internal_SmartyTemplateCompiler $prefixCompiledCode = '' * @property Smarty_Internal_SmartyTemplateCompiler $postfixCompiledCode = '' - * @method registerPostCompileCallback($callback, $parameter = array(), $key = null, $replace = false) - * @method unregisterPostCompileCallback($key) + * @method registerPostCompileCallback($callback, $parameter = array(), $key = null, $replace = false) + * @method unregisterPostCompileCallback($key) */ abstract class Smarty_Internal_TemplateCompilerBase { @@ -26,31 +26,36 @@ abstract class Smarty_Internal_TemplateCompilerBase * * @var array */ - static $_tag_objects = array(); + public static $_tag_objects = array(); + /** * counter for prefix variable number * * @var int */ public static $prefixVariableNumber = 0; + /** * Smarty object * * @var Smarty */ public $smarty = null; + /** * Parser object * * @var Smarty_Internal_Templateparser */ public $parser = null; + /** * hash for nocache sections * * @var mixed */ public $nocache_hash = null; + /** * suppress generation of nocache code * @@ -71,174 +76,203 @@ abstract class Smarty_Internal_TemplateCompilerBase * @var array */ public $_tag_stack = array(); + /** * tag stack count * * @var array */ public $_tag_stack_count = array(); + /** * Plugins used by template * * @var array */ public $required_plugins = array('compiled' => array(), 'nocache' => array()); + /** * Required plugins stack * * @var array */ public $required_plugins_stack = array(); + /** * current template * * @var Smarty_Internal_Template */ public $template = null; + /** * merged included sub template data * * @var array */ public $mergedSubTemplatesData = array(); + /** * merged sub template code * * @var array */ public $mergedSubTemplatesCode = array(); + /** * collected template properties during compilation * * @var array */ public $templateProperties = array(); + /** * source line offset for error messages * * @var int */ public $trace_line_offset = 0; + /** * trace uid * * @var string */ public $trace_uid = ''; + /** * trace file path * * @var string */ public $trace_filepath = ''; + /** * stack for tracing file and line of nested {block} tags * * @var array */ public $trace_stack = array(); + /** * plugins loaded by default plugin handler * * @var array */ public $default_handler_plugins = array(); + /** * saved preprocessed modifier list * * @var mixed */ public $default_modifier_list = null; + /** * force compilation of complete template as nocache * * @var boolean */ public $forceNocache = false; + /** * flag if compiled template file shall we written * * @var bool */ public $write_compiled_code = true; + /** * Template functions * * @var array */ public $tpl_function = array(); + /** * called sub functions from template function * * @var array */ public $called_functions = array(); + /** * compiled template or block function code * * @var string */ public $blockOrFunctionCode = ''; + /** * php_handling setting either from Smarty or security * * @var int */ public $php_handling = 0; + /** * flags for used modifier plugins * * @var array */ public $modifier_plugins = array(); + /** * type of already compiled modifier * * @var array */ public $known_modifier_type = array(); + /** * parent compiler object for merged subtemplates and template functions * * @var Smarty_Internal_TemplateCompilerBase */ public $parent_compiler = null; + /** * Flag true when compiling nocache section * * @var bool */ public $nocache = false; + /** * Flag true when tag is compiled as nocache * * @var bool */ public $tag_nocache = false; + /** * Compiled tag prefix code * * @var array */ public $prefix_code = array(); + /** * used prefix variables by current compiled tag * * @var array */ public $usedPrefixVariables = array(); + /** * Prefix code stack * * @var array */ public $prefixCodeStack = array(); + /** * Tag has compiled code * * @var bool */ public $has_code = false; + /** * A variable string was compiled * @@ -252,63 +286,75 @@ abstract class Smarty_Internal_TemplateCompilerBase * @var array */ public $variable_filter_stack = array(); + /** * variable filters for {setfilter} {/setfilter} * * @var array */ public $variable_filters = array(); + /** * Nesting count of looping tags like {foreach}, {for}, {section}, {while} * * @var int */ public $loopNesting = 0; + /** * Strip preg pattern * * @var string */ public $stripRegEx = '![\t ]*[\r\n]+[\t ]*!'; + /** * plugin search order * * @var array */ - public $plugin_search_order = array('function', - 'block', - 'compiler', - 'class'); + public $plugin_search_order = array( + 'function', + 'block', + 'compiler', + 'class' + ); + /** * General storage area for tag compiler plugins * * @var array */ public $_cache = array(); + /** * Lexer preg pattern for left delimiter * * @var string */ private $ldelPreg = '[{]'; + /** * Lexer preg pattern for right delimiter * * @var string */ private $rdelPreg = '[}]'; + /** * Length of right delimiter * * @var int */ private $rdelLength = 0; + /** * Length of left delimiter * * @var int */ private $ldelLength = 0; + /** * Lexer preg pattern for user literals * @@ -324,35 +370,44 @@ abstract class Smarty_Internal_TemplateCompilerBase public function __construct(Smarty $smarty) { $this->smarty = $smarty; - $this->nocache_hash = str_replace(array('.', - ','), - '_', - uniqid(rand(), true)); + $this->nocache_hash = str_replace( + array( + '.', + ',' + ), + '_', + uniqid(mt_rand(), true) + ); } /** * Method to compile a Smarty template * - * @param Smarty_Internal_Template $template template object to compile - * @param bool $nocache true is shall be compiled in nocache mode + * @param Smarty_Internal_Template $template template object to compile + * @param bool $nocache true is shall be compiled in nocache mode * @param null|Smarty_Internal_TemplateCompilerBase $parent_compiler * * @return bool true if compiling succeeded, false if it failed * @throws \Exception */ - public function compileTemplate(Smarty_Internal_Template $template, - $nocache = null, - Smarty_Internal_TemplateCompilerBase $parent_compiler = null) - { + public function compileTemplate( + Smarty_Internal_Template $template, + $nocache = null, + Smarty_Internal_TemplateCompilerBase $parent_compiler = null + ) { // get code frame of compiled template - $_compiled_code = $template->smarty->ext->_codeFrame->create($template, - $this->compileTemplateSource($template, - $nocache, - $parent_compiler), - $this->postFilter($this->blockOrFunctionCode) . - join('', $this->mergedSubTemplatesCode), - false, - $this); + $_compiled_code = $template->smarty->ext->_codeFrame->create( + $template, + $this->compileTemplateSource( + $template, + $nocache, + $parent_compiler + ), + $this->postFilter($this->blockOrFunctionCode) . + join('', $this->mergedSubTemplatesCode), + false, + $this + ); return $_compiled_code; } @@ -366,10 +421,11 @@ abstract class Smarty_Internal_TemplateCompilerBase * @return string * @throws \Exception */ - public function compileTemplateSource(Smarty_Internal_Template $template, - $nocache = null, - Smarty_Internal_TemplateCompilerBase $parent_compiler = null) - { + public function compileTemplateSource( + Smarty_Internal_Template $template, + $nocache = null, + Smarty_Internal_TemplateCompilerBase $parent_compiler = null + ) { try { // save template object in compiler class $this->template = $template; @@ -405,9 +461,11 @@ abstract class Smarty_Internal_TemplateCompilerBase // add file dependency if ($this->smarty->merge_compiled_includes || $this->template->source->handler->checkTimestamps()) { $this->parent_compiler->template->compiled->file_dependency[ $this->template->source->uid ] = - array($this->template->source->filepath, - $this->template->source->getTimeStamp(), - $this->template->source->type,); + array( + $this->template->source->filepath, + $this->template->source->getTimeStamp(), + $this->template->source->type, + ); } $this->smarty->_current_file = $this->template->source->filepath; // get template source @@ -421,8 +479,10 @@ abstract class Smarty_Internal_TemplateCompilerBase $_content = $this->template->source->getContent(); } $_compiled_code = $this->postFilter($this->doCompile($this->preFilter($_content), true)); - } - catch (Exception $e) { + if (!empty($this->required_plugins[ 'compiled' ]) || !empty($this->required_plugins[ 'nocache' ])) { + $_compiled_code = '<?php ' . $this->compileRequiredPlugins() . "?>\n" . $_compiled_code; + } + } catch (Exception $e) { if ($this->smarty->debugging) { $this->smarty->_debug->end_compile($this->template); } @@ -452,8 +512,8 @@ abstract class Smarty_Internal_TemplateCompilerBase public function postFilter($code) { // run post filter if on code - if (!empty($code) && - (isset($this->smarty->autoload_filters[ 'post' ]) || isset($this->smarty->registered_filters[ 'post' ])) + if (!empty($code) + && (isset($this->smarty->autoload_filters[ 'post' ]) || isset($this->smarty->registered_filters[ 'post' ])) ) { return $this->smarty->ext->_filterHandler->runFilter('post', $code, $this->template); } else { @@ -472,8 +532,8 @@ abstract class Smarty_Internal_TemplateCompilerBase public function preFilter($_content) { // run pre filter if required - if ($_content !== '' && - ((isset($this->smarty->autoload_filters[ 'pre' ]) || isset($this->smarty->registered_filters[ 'pre' ]))) + if ($_content !== '' + && ((isset($this->smarty->autoload_filters[ 'pre' ]) || isset($this->smarty->registered_filters[ 'pre' ]))) ) { return $this->smarty->ext->_filterHandler->runFilter('pre', $_content, $this->template); } else { @@ -490,9 +550,9 @@ abstract class Smarty_Internal_TemplateCompilerBase * Merge tag prefix code with saved one * (required nested tags in attributes) * - * @param string $tag tag name - * @param array $args array with tag attributes - * @param array $parameter array with compilation parameter + * @param string $tag tag name + * @param array $args array with tag attributes + * @param array $parameter array with compilation parameter * * @throws SmartyCompilerException * @throws SmartyException @@ -520,11 +580,13 @@ abstract class Smarty_Internal_TemplateCompilerBase // not a variable variable $var = trim($variable, '\''); $this->tag_nocache = $this->tag_nocache | - $this->template->ext->getTemplateVars->_getVariable($this->template, - $var, - null, - true, - false)->nocache; + $this->template->ext->getTemplateVars->_getVariable( + $this->template, + $var, + null, + true, + false + )->nocache; // todo $this->template->compiled->properties['variables'][$var] = $this->tag_nocache | $this->nocache; } return '$_smarty_tpl->tpl_vars[' . $variable . ']->value'; @@ -546,8 +608,8 @@ abstract class Smarty_Internal_TemplateCompilerBase /** * compile PHP function call * - * @param string $name - * @param array $parameter + * @param string $name + * @param array $parameter * * @return string * @throws \SmartyCompilerException @@ -555,8 +617,8 @@ abstract class Smarty_Internal_TemplateCompilerBase public function compilePHPFunctionCall($name, $parameter) { if (!$this->smarty->security_policy || $this->smarty->security_policy->isTrustedPhpFunction($name, $this)) { - if (strcasecmp($name, 'isset') === 0 || strcasecmp($name, 'empty') === 0 || - strcasecmp($name, 'array') === 0 || is_callable($name) + if (strcasecmp($name, 'isset') === 0 || strcasecmp($name, 'empty') === 0 + || strcasecmp($name, 'array') === 0 || is_callable($name) ) { $func_name = strtolower($name); $par = implode(',', $parameter); @@ -575,13 +637,18 @@ abstract class Smarty_Internal_TemplateCompilerBase $isset_par = str_replace("')->value", "',null,true,false)->value", $par); } return $name . '(' . $isset_par . ')'; - } else if (in_array($func_name, - array('empty', - 'reset', - 'current', - 'end', - 'prev', - 'next'))) { + } elseif (in_array( + $func_name, + array( + 'empty', + 'reset', + 'current', + 'end', + 'prev', + 'next' + ) + ) + ) { if (count($parameter) !== 1) { $this->trigger_template_error("Illegal number of parameter in '{$func_name()}'"); } @@ -615,24 +682,27 @@ abstract class Smarty_Internal_TemplateCompilerBase */ public function processText($text) { - if ((string)$text !== '') { + if ((string)$text != '') { $store = array(); $_store = 0; if ($this->parser->strip) { if (strpos($text, '<') !== false) { // capture html elements not to be messed with $_offset = 0; - if (preg_match_all('#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is', - $text, - $matches, - PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { + if (preg_match_all( + '#(<script[^>]*>.*?</script[^>]*>)|(<textarea[^>]*>.*?</textarea[^>]*>)|(<pre[^>]*>.*?</pre[^>]*>)#is', + $text, + $matches, + PREG_OFFSET_CAPTURE | PREG_SET_ORDER + ) + ) { foreach ($matches as $match) { $store[] = $match[ 0 ][ 0 ]; $_length = strlen($match[ 0 ][ 0 ]); $replace = '@!@SMARTY:' . $_store . ':SMARTY@!@'; $text = substr_replace($text, $replace, $match[ 0 ][ 1 ] - $_offset, $_length); $_offset += $_length - strlen($replace); - ++$_store; + $_store++; } } $expressions = array(// replace multiple spaces between tags by a single space @@ -643,19 +713,23 @@ abstract class Smarty_Internal_TemplateCompilerBase '#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5', '#>[\040\011]+$#Ss' => '> ', '#>[\040\011]*[\n]\s*$#Ss' => '>', - $this->stripRegEx => '',); + $this->stripRegEx => '', + ); $text = preg_replace(array_keys($expressions), array_values($expressions), $text); $_offset = 0; - if (preg_match_all('#@!@SMARTY:([0-9]+):SMARTY@!@#is', - $text, - $matches, - PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { + if (preg_match_all( + '#@!@SMARTY:([0-9]+):SMARTY@!@#is', + $text, + $matches, + PREG_OFFSET_CAPTURE | PREG_SET_ORDER + ) + ) { foreach ($matches as $match) { $_length = strlen($match[ 0 ][ 0 ]); $replace = $store[ $match[ 1 ][ 0 ] ]; $text = substr_replace($text, $replace, $match[ 0 ][ 1 ] + $_offset, $_length); $_offset += strlen($replace) - $_length; - ++$_store; + $_store++; } } } else { @@ -673,11 +747,11 @@ abstract class Smarty_Internal_TemplateCompilerBase * class name format: Smarty_Internal_Compile_TagName * plugin filename format: Smarty_Internal_TagName.php * - * @param string $tag tag name - * @param array $args list of tag attributes - * @param mixed $param1 optional parameter - * @param mixed $param2 optional parameter - * @param mixed $param3 optional parameter + * @param string $tag tag name + * @param array $args list of tag attributes + * @param mixed $param1 optional parameter + * @param mixed $param2 optional parameter + * @param mixed $param3 optional parameter * * @return bool|string compiled code or false * @throws \SmartyCompilerException @@ -696,10 +770,9 @@ abstract class Smarty_Internal_TemplateCompilerBase * class name format: Smarty_Internal_Compile_TagName * plugin filename format: Smarty_Internal_TagName.php * - * @param string $tag tag name + * @param string $tag tag name * * @return bool|\Smarty_Internal_CompileBase tag compiler object or false if not found - * @throws \SmartyCompilerException */ public function getTagCompiler($tag) { @@ -709,8 +782,8 @@ abstract class Smarty_Internal_TemplateCompilerBase $_tag = explode('_', $tag); $_tag = array_map('ucfirst', $_tag); $class_name = 'Smarty_Internal_Compile_' . implode('_', $_tag); - if (class_exists($class_name) && - (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) + if (class_exists($class_name) + && (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) ) { self::$_tag_objects[ $tag ] = new $class_name; } else { @@ -723,8 +796,8 @@ abstract class Smarty_Internal_TemplateCompilerBase /** * Check for plugins and return function name * - * @param $plugin_name - * @param string $plugin_type type of plugin + * @param $plugin_name + * @param string $plugin_type type of plugin * * @return string call name of function * @throws \SmartyException @@ -736,7 +809,7 @@ abstract class Smarty_Internal_TemplateCompilerBase if (isset($this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ])) { $function = $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'function' ]; - } else if (isset($this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ])) { + } elseif (isset($this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ])) { $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ] = $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ]; $function = @@ -746,7 +819,7 @@ abstract class Smarty_Internal_TemplateCompilerBase if (isset($this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ])) { $function = $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'function' ]; - } else if (isset($this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ])) { + } elseif (isset($this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ])) { $this->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ] = $this->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ]; $function = @@ -789,8 +862,8 @@ abstract class Smarty_Internal_TemplateCompilerBase /** * Check for plugins by default plugin handler * - * @param string $tag name of tag - * @param string $plugin_type type of plugin + * @param string $tag name of tag + * @param string $plugin_type type of plugin * * @return bool true if found * @throws \SmartyCompilerException @@ -800,13 +873,17 @@ abstract class Smarty_Internal_TemplateCompilerBase $callback = null; $script = null; $cacheable = true; - $result = call_user_func_array($this->smarty->default_plugin_handler_func, - array($tag, - $plugin_type, - $this->template, - &$callback, - &$script, - &$cacheable,)); + $result = call_user_func_array( + $this->smarty->default_plugin_handler_func, + array( + $tag, + $plugin_type, + $this->template, + &$callback, + &$script, + &$cacheable, + ) + ); if ($result) { $this->tag_nocache = $this->tag_nocache || !$cacheable; if ($script !== null) { @@ -822,15 +899,17 @@ abstract class Smarty_Internal_TemplateCompilerBase $this->required_plugins[ 'compiled' ][ $tag ][ $plugin_type ][ 'function' ] = $callback; } - require_once $script; + include_once $script; } else { $this->trigger_template_error("Default plugin handler: Returned script file '{$script}' for '{$tag}' not found"); } } if (is_callable($callback)) { - $this->default_handler_plugins[ $plugin_type ][ $tag ] = array($callback, - true, - array()); + $this->default_handler_plugins[ $plugin_type ][ $tag ] = array( + $callback, + true, + array() + ); return true; } else { $this->trigger_template_error("Default plugin handler: Returned callback for '{$tag}' not callable"); @@ -864,8 +943,8 @@ abstract class Smarty_Internal_TemplateCompilerBase * If the content is compiled code and it should be not cached the code is injected * into the rendered output. * - * @param string $content content of template element - * @param boolean $is_code true if content is compiled code + * @param string $content content of template element + * @param boolean $is_code true if content is compiled code * * @return string content */ @@ -874,13 +953,14 @@ abstract class Smarty_Internal_TemplateCompilerBase // If the template is not evaluated and we have a nocache section and or a nocache tag if ($is_code && !empty($content)) { // generate replacement code - if ((!($this->template->source->handler->recompiled) || $this->forceNocache) && $this->caching && - !$this->suppressNocacheProcessing && ($this->nocache || $this->tag_nocache) + if ((!($this->template->source->handler->recompiled) || $this->forceNocache) && $this->caching + && !$this->suppressNocacheProcessing && ($this->nocache || $this->tag_nocache) ) { $this->template->compiled->has_nocache_code = true; $_output = addcslashes($content, '\'\\'); $_output = str_replace('^#^', '\'', $_output); - $_output = "<?php echo '/*%%SmartyNocache:{$this->nocache_hash}%%*/{$_output}/*/%%SmartyNocache:{$this->nocache_hash}%%*/';?>\n"; + $_output = + "<?php echo '/*%%SmartyNocache:{$this->nocache_hash}%%*/{$_output}/*/%%SmartyNocache:{$this->nocache_hash}%%*/';?>\n"; // make sure we include modifier plugins for nocache code foreach ($this->modifier_plugins as $plugin_name => $dummy) { if (isset($this->required_plugins[ 'compiled' ][ $plugin_name ][ 'modifier' ])) { @@ -962,7 +1042,7 @@ abstract class Smarty_Internal_TemplateCompilerBase $_scopeName = trim($_attr[ 'scope' ], '\'"'); if (is_numeric($_scopeName) && in_array($_scopeName, $validScopes)) { $_scope = $_scopeName; - } else if (is_string($_scopeName)) { + } elseif (is_string($_scopeName)) { $_scopeName = trim($_scopeName, '\'"'); $_scope = isset($validScopes[ $_scopeName ]) ? $validScopes[ $_scopeName ] : false; } else { @@ -996,8 +1076,8 @@ abstract class Smarty_Internal_TemplateCompilerBase * In this case the parser is called to obtain information about expected tokens. * If parameter $args contains a string this is used as error message * - * @param string $args individual error message or null - * @param string $line line-number + * @param string $args individual error message or null + * @param string $line line-number * @param null|bool $tagline if true the line number of last tag * * @throws \SmartyCompilerException when an unexpected token is found @@ -1008,20 +1088,29 @@ abstract class Smarty_Internal_TemplateCompilerBase if ($tagline === true) { // get line number of Tag $line = $lex->taglineno; - } else if (!isset($line)) { + } elseif (!isset($line)) { // get template source line which has error $line = $lex->line; } else { $line = (int)$line; } - if (in_array($this->template->source->type, - array('eval', - 'string'))) { - $templateName = $this->template->source->type . ':' . trim(preg_replace('![\t\r\n]+!', - ' ', - strlen($lex->data) > 40 ? - substr($lex->data, 0, 40) . - '...' : $lex->data)); + if (in_array( + $this->template->source->type, + array( + 'eval', + 'string' + ) + ) + ) { + $templateName = $this->template->source->type . ':' . trim( + preg_replace( + '![\t\r\n]+!', + ' ', + strlen($lex->data) > 40 ? + substr($lex->data, 0, 40) . + '...' : $lex->data + ) + ); } else { $templateName = $this->template->source->type . ':' . $this->template->source->filepath; } @@ -1068,7 +1157,7 @@ abstract class Smarty_Internal_TemplateCompilerBase /** * Return var_export() value with all white spaces removed * - * @param mixed $value + * @param mixed $value * * @return string */ @@ -1103,11 +1192,15 @@ abstract class Smarty_Internal_TemplateCompilerBase */ public function replaceDelimiter($lexerPreg) { - return str_replace(array('SMARTYldel', 'SMARTYliteral', 'SMARTYrdel', 'SMARTYautoliteral', 'SMARTYal'), - array($this->ldelPreg, $this->literalPreg, $this->rdelPreg, - $this->smarty->getAutoLiteral() ? '{1,}' : '{9}', - $this->smarty->getAutoLiteral() ? '' : '\\s*'), - $lexerPreg); + return str_replace( + array('SMARTYldel', 'SMARTYliteral', 'SMARTYrdel', 'SMARTYautoliteral', 'SMARTYal'), + array( + $this->ldelPreg, $this->literalPreg, $this->rdelPreg, + $this->smarty->getAutoLiteral() ? '{1,}' : '{9}', + $this->smarty->getAutoLiteral() ? '' : '\\s*' + ), + $lexerPreg + ); } /** @@ -1119,20 +1212,20 @@ abstract class Smarty_Internal_TemplateCompilerBase $this->ldelLength = strlen($ldel); $this->ldelPreg = ''; foreach (str_split($ldel, 1) as $chr) { - $this->ldelPreg .= '[' . ($chr === '\\' ? '\\' : '') . $chr . ']'; + $this->ldelPreg .= '[' . preg_quote($chr,'/') . ']'; } $rdel = $this->smarty->getRightDelimiter(); $this->rdelLength = strlen($rdel); $this->rdelPreg = ''; foreach (str_split($rdel, 1) as $chr) { - $this->rdelPreg .= '[' . ($chr === '\\' ? '\\' : '') . $chr . ']'; + $this->rdelPreg .= '[' . preg_quote($chr,'/') . ']'; } $literals = $this->smarty->getLiterals(); if (!empty($literals)) { foreach ($literals as $key => $literal) { $literalPreg = ''; foreach (str_split($literal, 1) as $chr) { - $literalPreg .= '[' . ($chr === '\\' ? '\\' : '') . $chr . ']'; + $literalPreg .= '[' . preg_quote($chr,'/') . ']'; } $literals[ $key ] = $literalPreg; } @@ -1152,9 +1245,11 @@ abstract class Smarty_Internal_TemplateCompilerBase { if (array_pop($this->_tag_stack_count) !== $this->getTagStackCount()) { $tag = $this->getOpenBlockTag(); - $this->trigger_template_error("unclosed '{{$tag}}' in doubled quoted string", - null, - true); + $this->trigger_template_error( + "unclosed '{{$tag}}' in doubled quoted string", + null, + true + ); } } @@ -1292,7 +1387,7 @@ abstract class Smarty_Internal_TemplateCompilerBase * * @param bool $init if true init required plugins */ - public function saveRequiredPlugins($init=false) + public function saveRequiredPlugins($init = false) { $this->required_plugins_stack[] = $this->required_plugins; if ($init) { @@ -1359,9 +1454,9 @@ abstract class Smarty_Internal_TemplateCompilerBase /** * Compile Tag * - * @param string $tag tag name - * @param array $args array with tag attributes - * @param array $parameter array with compilation parameter + * @param string $tag tag name + * @param array $args array with tag attributes + * @param array $parameter array with compilation parameter * * @throws SmartyCompilerException * @throws SmartyException @@ -1375,8 +1470,10 @@ abstract class Smarty_Internal_TemplateCompilerBase $this->has_code = true; // log tag/attributes if (isset($this->smarty->_cache[ 'get_used_tags' ])) { - $this->template->_cache[ 'used_tags' ][] = array($tag, - $args); + $this->template->_cache[ 'used_tags' ][] = array( + $tag, + $args + ); } // check nocache option flag foreach ($args as $arg) { @@ -1394,9 +1491,9 @@ abstract class Smarty_Internal_TemplateCompilerBase } // compile the smarty tag (required compile classes to compile the tag are auto loaded) if (($_output = $this->callTagCompiler($tag, $args, $parameter)) === false) { - if (isset($this->parent_compiler->tpl_function[ $tag ]) || - (isset ($this->template->smarty->ext->_tplFunction) && - $this->template->smarty->ext->_tplFunction->getTplFunction($this->template, $tag) !== false) + if (isset($this->parent_compiler->tpl_function[ $tag ]) + || (isset($this->template->smarty->ext->_tplFunction) + && $this->template->smarty->ext->_tplFunction->getTplFunction($this->template, $tag) !== false) ) { // template defined by {template} tag $args[ '_attr' ][ 'name' ] = "'{$tag}'"; @@ -1427,29 +1524,35 @@ abstract class Smarty_Internal_TemplateCompilerBase // check if tag is a registered object if (isset($this->smarty->registered_objects[ $tag ]) && isset($parameter[ 'object_method' ])) { $method = $parameter[ 'object_method' ]; - if (!in_array($method, $this->smarty->registered_objects[ $tag ][ 3 ]) && - (empty($this->smarty->registered_objects[ $tag ][ 1 ]) || - in_array($method, $this->smarty->registered_objects[ $tag ][ 1 ])) + if (!in_array($method, $this->smarty->registered_objects[ $tag ][ 3 ]) + && (empty($this->smarty->registered_objects[ $tag ][ 1 ]) + || in_array($method, $this->smarty->registered_objects[ $tag ][ 1 ])) ) { return $this->callTagCompiler('private_object_function', $args, $parameter, $tag, $method); - } else if (in_array($method, $this->smarty->registered_objects[ $tag ][ 3 ])) { - return $this->callTagCompiler('private_object_block_function', - $args, - $parameter, - $tag, - $method); + } elseif (in_array($method, $this->smarty->registered_objects[ $tag ][ 3 ])) { + return $this->callTagCompiler( + 'private_object_block_function', + $args, + $parameter, + $tag, + $method + ); } else { // throw exception - $this->trigger_template_error('not allowed method "' . $method . '" in registered object "' . - $tag . '"', - null, - true); + $this->trigger_template_error( + 'not allowed method "' . $method . '" in registered object "' . + $tag . '"', + null, + true + ); } } // check if tag is registered - foreach (array(Smarty::PLUGIN_COMPILER, - Smarty::PLUGIN_FUNCTION, - Smarty::PLUGIN_BLOCK,) as $plugin_type) { + foreach (array( + Smarty::PLUGIN_COMPILER, + Smarty::PLUGIN_FUNCTION, + Smarty::PLUGIN_BLOCK, + ) as $plugin_type) { if (isset($this->smarty->registered_plugins[ $plugin_type ][ $tag ])) { // if compiler function plugin call it now if ($plugin_type === Smarty::PLUGIN_COMPILER) { @@ -1464,25 +1567,31 @@ abstract class Smarty_Internal_TemplateCompilerBase if (!$this->smarty->registered_plugins[ $plugin_type ][ $tag ][ 1 ]) { $this->tag_nocache = true; } - return call_user_func_array($this->smarty->registered_plugins[ $plugin_type ][ $tag ][ 0 ], - array($new_args, - $this)); + return call_user_func_array( + $this->smarty->registered_plugins[ $plugin_type ][ $tag ][ 0 ], + array( + $new_args, + $this + ) + ); } // compile registered function or block function if ($plugin_type === Smarty::PLUGIN_FUNCTION || $plugin_type === Smarty::PLUGIN_BLOCK) { - return $this->callTagCompiler('private_registered_' . $plugin_type, - $args, - $parameter, - $tag); + return $this->callTagCompiler( + 'private_registered_' . $plugin_type, + $args, + $parameter, + $tag + ); } } } // check plugins from plugins folder foreach ($this->plugin_search_order as $plugin_type) { - if ($plugin_type === Smarty::PLUGIN_COMPILER && - $this->smarty->loadPlugin('smarty_compiler_' . $tag) && - (!isset($this->smarty->security_policy) || - $this->smarty->security_policy->isTrustedTag($tag, $this)) + if ($plugin_type === Smarty::PLUGIN_COMPILER + && $this->smarty->loadPlugin('smarty_compiler_' . $tag) + && (!isset($this->smarty->security_policy) + || $this->smarty->security_policy->isTrustedTag($tag, $this)) ) { $plugin = 'smarty_compiler_' . $tag; if (is_callable($plugin)) { @@ -1506,14 +1615,16 @@ abstract class Smarty_Internal_TemplateCompilerBase throw new SmartyException("Plugin '{$tag}' not callable"); } else { if ($function = $this->getPlugin($tag, $plugin_type)) { - if (!isset($this->smarty->security_policy) || - $this->smarty->security_policy->isTrustedTag($tag, $this) + if (!isset($this->smarty->security_policy) + || $this->smarty->security_policy->isTrustedTag($tag, $this) ) { - return $this->callTagCompiler('private_' . $plugin_type . '_plugin', - $args, - $parameter, - $tag, - $function); + return $this->callTagCompiler( + 'private_' . $plugin_type . '_plugin', + $args, + $parameter, + $tag, + $function + ); } } } @@ -1547,14 +1658,20 @@ abstract class Smarty_Internal_TemplateCompilerBase $new_args[ $key ] = $mixed; } } - return call_user_func_array($this->default_handler_plugins[ $plugin_type ][ $tag ][ 0 ], - array($new_args, - $this)); + return call_user_func_array( + $this->default_handler_plugins[ $plugin_type ][ $tag ][ 0 ], + array( + $new_args, + $this + ) + ); } else { - return $this->callTagCompiler('private_registered_' . $plugin_type, - $args, - $parameter, - $tag); + return $this->callTagCompiler( + 'private_registered_' . $plugin_type, + $args, + $parameter, + $tag + ); } } } @@ -1565,22 +1682,26 @@ abstract class Smarty_Internal_TemplateCompilerBase if (isset($this->smarty->registered_objects[ $base_tag ]) && isset($parameter[ 'object_method' ])) { $method = $parameter[ 'object_method' ]; if (in_array($method, $this->smarty->registered_objects[ $base_tag ][ 3 ])) { - return $this->callTagCompiler('private_object_block_function', - $args, - $parameter, - $tag, - $method); + return $this->callTagCompiler( + 'private_object_block_function', + $args, + $parameter, + $tag, + $method + ); } else { // throw exception - $this->trigger_template_error('not allowed closing tag method "' . $method . - '" in registered object "' . $base_tag . '"', - null, - true); + $this->trigger_template_error( + 'not allowed closing tag method "' . $method . + '" in registered object "' . $base_tag . '"', + null, + true + ); } } // registered block tag ? - if (isset($this->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $base_tag ]) || - isset($this->default_handler_plugins[ Smarty::PLUGIN_BLOCK ][ $base_tag ]) + if (isset($this->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $base_tag ]) + || isset($this->default_handler_plugins[ Smarty::PLUGIN_BLOCK ][ $base_tag ]) ) { return $this->callTagCompiler('private_registered_block', $args, $parameter, $tag); } @@ -1594,8 +1715,8 @@ abstract class Smarty_Internal_TemplateCompilerBase } // function plugin? if ($function = $this->getPlugin($tag, Smarty::PLUGIN_FUNCTION)) { - if (!isset($this->smarty->security_policy) || - $this->smarty->security_policy->isTrustedTag($tag, $this) + if (!isset($this->smarty->security_policy) + || $this->smarty->security_policy->isTrustedTag($tag, $this) ) { return $this->callTagCompiler('private_function_plugin', $args, $parameter, $tag, $function); } @@ -1607,9 +1728,13 @@ abstract class Smarty_Internal_TemplateCompilerBase if (!$this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 1 ]) { $this->tag_nocache = true; } - return call_user_func_array($this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 0 ], - array($args, - $this)); + return call_user_func_array( + $this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 0 ], + array( + $args, + $this + ) + ); } if ($this->smarty->loadPlugin('smarty_compiler_' . $tag)) { $plugin = 'smarty_compiler_' . $tag; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatelexer.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatelexer.php index 3045a7b0c..c6c49ef59 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatelexer.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatelexer.php @@ -18,101 +18,117 @@ */ class Smarty_Internal_Templatelexer { - const TEXT = 1; - const TAG = 2; - const TAGBODY = 3; - const LITERAL = 4; + const TEXT = 1; + const TAG = 2; + const TAGBODY = 3; + const LITERAL = 4; const DOUBLEQUOTEDSTRING = 5; + /** * Source * * @var string */ public $data; + /** * Source length * * @var int */ public $dataLength = null; + /** * byte counter * * @var int */ public $counter; + /** * token number * * @var int */ public $token; + /** * token value * * @var string */ public $value; + /** * current line * * @var int */ public $line; + /** * tag start line * * @var */ public $taglineno; + /** * php code type * * @var string */ public $phpType = ''; + /** * state number * * @var int */ public $state = 1; + /** * Smarty object * * @var Smarty */ public $smarty = null; + /** * compiler object * * @var Smarty_Internal_TemplateCompilerBase */ public $compiler = null; + /** * trace file * * @var resource */ public $yyTraceFILE; + /** * trace prompt * * @var string */ public $yyTracePrompt; + /** * XML flag true while processing xml * * @var bool */ public $is_xml = false; + /** * state names * * @var array */ public $state_name = array(1 => 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING',); + /** * token names * @@ -156,44 +172,52 @@ class Smarty_Internal_Templatelexer 'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition', 'SCOND' => '"is even" ... if condition', ); + /** * literal tag nesting level * * @var int */ private $literal_cnt = 0; + /** * preg token pattern for state TEXT * * @var string */ private $yy_global_pattern1 = null; + /** * preg token pattern for state TAG * * @var string */ private $yy_global_pattern2 = null; + /** * preg token pattern for state TAGBODY * * @var string */ private $yy_global_pattern3 = null; + /** * preg token pattern for state LITERAL * * @var string */ private $yy_global_pattern4 = null; + /** * preg token pattern for state DOUBLEQUOTEDSTRING * * @var null */ private $yy_global_pattern5 = null; - private $_yy_state = 1; - private $_yy_stack = array(); + + private $_yy_state = 1; + + private $_yy_stack = array(); /** * constructor @@ -201,7 +225,7 @@ class Smarty_Internal_Templatelexer * @param string $source template source * @param Smarty_Internal_TemplateCompilerBase $compiler */ - function __construct($source, Smarty_Internal_TemplateCompilerBase $compiler) + public function __construct($source, Smarty_Internal_TemplateCompilerBase $compiler) { $this->data = $source; $this->dataLength = strlen($this->data); @@ -239,7 +263,7 @@ class Smarty_Internal_Templatelexer return $this->compiler->replaceDelimiter($preg); } - /** + /** * check if current value is an autoliteral left delimiter * * @return bool @@ -258,39 +282,27 @@ class Smarty_Internal_Templatelexer public function yypushstate($state) { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%sState push %s\n", - $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, + isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state); } array_push($this->_yy_stack, $this->_yy_state); $this->_yy_state = $state; if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%snew State %s\n", - $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, + isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state); } } public function yypopstate() { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%sState pop %s\n", - $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt, + isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state); } $this->_yy_state = array_pop($this->_yy_stack); if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%snew State %s\n", - $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, + isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state); } } @@ -298,15 +310,12 @@ class Smarty_Internal_Templatelexer { $this->_yy_state = $state; if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%sState set %s\n", - $this->yyTracePrompt, - isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : - $this->_yy_state); + fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, + isset($this->state_name[ $this->_yy_state ]) ? $this->state_name[ $this->_yy_state ] : $this->_yy_state); } } -public function yylex1() + public function yylex1() { if (!isset($this->yy_global_pattern1)) { $this->yy_global_pattern1 = @@ -327,9 +336,11 @@ public function yylex1() } if (empty($yymatches)) { throw new Exception('Error: lexing failed because a rule matched' . - ' an empty string. Input "' . substr($this->data, - $this->counter, - 5) . '... state TEXT'); + ' an empty string. Input "' . substr( + $this->data, + $this->counter, + 5 + ) . '... state TEXT'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -340,11 +351,11 @@ public function yylex1() $this->line += substr_count($this->value, "\n"); // accept this token return true; - } else if ($r === true) { + } elseif ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } else if ($r === false) { + } elseif ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -361,18 +372,15 @@ public function yylex1() } while (true); } - function yy_r1_1() + public function yy_r1_1() { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r1_2() + public function yy_r1_2() { - preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/", - $this->data, - $match, - PREG_OFFSET_CAPTURE, - $this->counter); + preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/", $this->data, $match, PREG_OFFSET_CAPTURE, + $this->counter); if (isset($match[ 0 ][ 1 ])) { $to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]); } else { @@ -382,45 +390,45 @@ public function yylex1() return false; } - function yy_r1_4() + public function yy_r1_4() { $this->compiler->getTagCompiler('private_php')->parsePhp($this); } - function yy_r1_8() + public function yy_r1_8() { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r1_10() + public function yy_r1_10() { $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART; $this->yypushstate(self::LITERAL); } - function yy_r1_12() + public function yy_r1_12() { $this->token = Smarty_Internal_Templateparser::TP_LITERALEND; $this->yypushstate(self::LITERAL); } // end function - function yy_r1_14() + public function yy_r1_14() { $this->yypushstate(self::TAG); return true; } - function yy_r1_16() + public function yy_r1_16() { $this->compiler->getTagCompiler('private_php')->parsePhp($this); } - function yy_r1_19() + public function yy_r1_19() { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } -public function yylex2() + public function yylex2() { if (!isset($this->yy_global_pattern2)) { $this->yy_global_pattern2 = @@ -441,9 +449,11 @@ public function yylex2() } if (empty($yymatches)) { throw new Exception('Error: lexing failed because a rule matched' . - ' an empty string. Input "' . substr($this->data, - $this->counter, - 5) . '... state TAG'); + ' an empty string. Input "' . substr( + $this->data, + $this->counter, + 5 + ) . '... state TAG'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -454,11 +464,11 @@ public function yylex2() $this->line += substr_count($this->value, "\n"); // accept this token return true; - } else if ($r === true) { + } elseif ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } else if ($r === false) { + } elseif ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -475,63 +485,63 @@ public function yylex2() } while (true); } - function yy_r2_1() + public function yy_r2_1() { $this->token = Smarty_Internal_Templateparser::TP_LDELIF; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } - function yy_r2_4() + public function yy_r2_4() { $this->token = Smarty_Internal_Templateparser::TP_LDELFOR; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } - function yy_r2_6() + public function yy_r2_6() { $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } - function yy_r2_8() + public function yy_r2_8() { $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } - function yy_r2_10() + public function yy_r2_10() { $this->token = Smarty_Internal_Templateparser::TP_LDELMAKENOCACHE; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } - function yy_r2_12() + public function yy_r2_12() { $this->yypopstate(); $this->token = Smarty_Internal_Templateparser::TP_SIMPLETAG; $this->taglineno = $this->line; } - function yy_r2_15() + public function yy_r2_15() { $this->yypopstate(); $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT; $this->taglineno = $this->line; } - function yy_r2_18() + public function yy_r2_18() { $this->yypopstate(); $this->token = Smarty_Internal_Templateparser::TP_CLOSETAG; $this->taglineno = $this->line; } - function yy_r2_20() + public function yy_r2_20() { if ($this->_yy_stack[ count($this->_yy_stack) - 1 ] === self::TEXT) { $this->yypopstate(); @@ -545,21 +555,21 @@ public function yylex2() } } // end function - function yy_r2_23() + public function yy_r2_23() { $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } - function yy_r2_25() + public function yy_r2_25() { $this->token = Smarty_Internal_Templateparser::TP_LDEL; $this->yybegin(self::TAGBODY); $this->taglineno = $this->line; } -public function yylex3() + public function yylex3() { if (!isset($this->yy_global_pattern3)) { $this->yy_global_pattern3 = @@ -580,9 +590,11 @@ public function yylex3() } if (empty($yymatches)) { throw new Exception('Error: lexing failed because a rule matched' . - ' an empty string. Input "' . substr($this->data, - $this->counter, - 5) . '... state TAGBODY'); + ' an empty string. Input "' . substr( + $this->data, + $this->counter, + 5 + ) . '... state TAGBODY'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -593,11 +605,11 @@ public function yylex3() $this->line += substr_count($this->value, "\n"); // accept this token return true; - } else if ($r === true) { + } elseif ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } else if ($r === false) { + } elseif ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -614,156 +626,156 @@ public function yylex3() } while (true); } - function yy_r3_1() + public function yy_r3_1() { $this->token = Smarty_Internal_Templateparser::TP_RDEL; $this->yypopstate(); } - function yy_r3_2() + public function yy_r3_2() { $this->yypushstate(self::TAG); return true; } - function yy_r3_4() + public function yy_r3_4() { $this->token = Smarty_Internal_Templateparser::TP_QUOTE; $this->yypushstate(self::DOUBLEQUOTEDSTRING); $this->compiler->enterDoubleQuote(); } - function yy_r3_5() + public function yy_r3_5() { $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING; } - function yy_r3_6() + public function yy_r3_6() { $this->token = Smarty_Internal_Templateparser::TP_DOLLARID; } - function yy_r3_7() + public function yy_r3_7() { $this->token = Smarty_Internal_Templateparser::TP_DOLLAR; } - function yy_r3_8() + public function yy_r3_8() { $this->token = Smarty_Internal_Templateparser::TP_ISIN; } - function yy_r3_9() + public function yy_r3_9() { $this->token = Smarty_Internal_Templateparser::TP_AS; } - function yy_r3_10() + public function yy_r3_10() { $this->token = Smarty_Internal_Templateparser::TP_TO; } - function yy_r3_11() + public function yy_r3_11() { $this->token = Smarty_Internal_Templateparser::TP_STEP; } - function yy_r3_12() + public function yy_r3_12() { $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF; } - function yy_r3_13() + public function yy_r3_13() { $this->token = Smarty_Internal_Templateparser::TP_LOGOP; } - function yy_r3_15() + public function yy_r3_15() { $this->token = Smarty_Internal_Templateparser::TP_SLOGOP; } - function yy_r3_17() + public function yy_r3_17() { $this->token = Smarty_Internal_Templateparser::TP_TLOGOP; } - function yy_r3_20() + public function yy_r3_20() { $this->token = Smarty_Internal_Templateparser::TP_SINGLECOND; } - function yy_r3_23() + public function yy_r3_23() { $this->token = Smarty_Internal_Templateparser::TP_NOT; } - function yy_r3_24() + public function yy_r3_24() { $this->token = Smarty_Internal_Templateparser::TP_TYPECAST; } - function yy_r3_28() + public function yy_r3_28() { $this->token = Smarty_Internal_Templateparser::TP_OPENP; } - function yy_r3_29() + public function yy_r3_29() { $this->token = Smarty_Internal_Templateparser::TP_CLOSEP; } - function yy_r3_30() + public function yy_r3_30() { $this->token = Smarty_Internal_Templateparser::TP_OPENB; } - function yy_r3_31() + public function yy_r3_31() { $this->token = Smarty_Internal_Templateparser::TP_CLOSEB; } - function yy_r3_32() + public function yy_r3_32() { $this->token = Smarty_Internal_Templateparser::TP_PTR; } - function yy_r3_33() + public function yy_r3_33() { $this->token = Smarty_Internal_Templateparser::TP_APTR; } - function yy_r3_34() + public function yy_r3_34() { $this->token = Smarty_Internal_Templateparser::TP_EQUAL; } - function yy_r3_35() + public function yy_r3_35() { $this->token = Smarty_Internal_Templateparser::TP_INCDEC; } - function yy_r3_37() + public function yy_r3_37() { $this->token = Smarty_Internal_Templateparser::TP_UNIMATH; } - function yy_r3_39() + public function yy_r3_39() { $this->token = Smarty_Internal_Templateparser::TP_MATH; } - function yy_r3_41() + public function yy_r3_41() { $this->token = Smarty_Internal_Templateparser::TP_AT; } - function yy_r3_42() + public function yy_r3_42() { $this->token = Smarty_Internal_Templateparser::TP_HATCH; } - function yy_r3_43() + public function yy_r3_43() { // resolve conflicts with shorttag and right_delimiter starting with '=' if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) === @@ -776,78 +788,78 @@ public function yylex3() } } - function yy_r3_44() + public function yy_r3_44() { $this->token = Smarty_Internal_Templateparser::TP_NAMESPACE; } - function yy_r3_47() + public function yy_r3_47() { $this->token = Smarty_Internal_Templateparser::TP_ID; } - function yy_r3_48() + public function yy_r3_48() { $this->token = Smarty_Internal_Templateparser::TP_INTEGER; } - function yy_r3_49() + public function yy_r3_49() { $this->token = Smarty_Internal_Templateparser::TP_BACKTICK; $this->yypopstate(); } - function yy_r3_50() + public function yy_r3_50() { $this->token = Smarty_Internal_Templateparser::TP_VERT; } - function yy_r3_51() + public function yy_r3_51() { $this->token = Smarty_Internal_Templateparser::TP_DOT; } - function yy_r3_52() + public function yy_r3_52() { $this->token = Smarty_Internal_Templateparser::TP_COMMA; } - function yy_r3_53() + public function yy_r3_53() { $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON; } - function yy_r3_54() + public function yy_r3_54() { $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON; } - function yy_r3_55() + public function yy_r3_55() { $this->token = Smarty_Internal_Templateparser::TP_COLON; } - function yy_r3_56() + public function yy_r3_56() { $this->token = Smarty_Internal_Templateparser::TP_QMARK; } - function yy_r3_57() + public function yy_r3_57() { $this->token = Smarty_Internal_Templateparser::TP_HEX; } - function yy_r3_58() + public function yy_r3_58() { $this->token = Smarty_Internal_Templateparser::TP_SPACE; } // end function - function yy_r3_59() + public function yy_r3_59() { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } -public function yylex4() + public function yylex4() { if (!isset($this->yy_global_pattern4)) { $this->yy_global_pattern4 = @@ -868,9 +880,11 @@ public function yylex4() } if (empty($yymatches)) { throw new Exception('Error: lexing failed because a rule matched' . - ' an empty string. Input "' . substr($this->data, - $this->counter, - 5) . '... state LITERAL'); + ' an empty string. Input "' . substr( + $this->data, + $this->counter, + 5 + ) . '... state LITERAL'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -881,11 +895,11 @@ public function yylex4() $this->line += substr_count($this->value, "\n"); // accept this token return true; - } else if ($r === true) { + } elseif ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } else if ($r === false) { + } elseif ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -902,13 +916,13 @@ public function yylex4() } while (true); } - function yy_r4_1() + public function yy_r4_1() { $this->literal_cnt++; $this->token = Smarty_Internal_Templateparser::TP_LITERAL; } - function yy_r4_3() + public function yy_r4_3() { if ($this->literal_cnt) { $this->literal_cnt--; @@ -919,12 +933,12 @@ public function yylex4() } } - function yy_r4_5() + public function yy_r4_5() { $this->token = Smarty_Internal_Templateparser::TP_LITERAL; } // end function -public function yylex5() + public function yylex5() { if (!isset($this->yy_global_pattern5)) { $this->yy_global_pattern5 = @@ -945,9 +959,11 @@ public function yylex5() } if (empty($yymatches)) { throw new Exception('Error: lexing failed because a rule matched' . - ' an empty string. Input "' . substr($this->data, - $this->counter, - 5) . '... state DOUBLEQUOTEDSTRING'); + ' an empty string. Input "' . substr( + $this->data, + $this->counter, + 5 + ) . '... state DOUBLEQUOTEDSTRING'); } next($yymatches); // skip global match $this->token = key($yymatches); // token number @@ -958,11 +974,11 @@ public function yylex5() $this->line += substr_count($this->value, "\n"); // accept this token return true; - } else if ($r === true) { + } elseif ($r === true) { // we have changed state // process this token in the new state return $this->yylex(); - } else if ($r === false) { + } elseif ($r === false) { $this->counter += strlen($this->value); $this->line += substr_count($this->value, "\n"); if ($this->counter >= $this->dataLength) { @@ -979,47 +995,47 @@ public function yylex5() } while (true); } - function yy_r5_1() + public function yy_r5_1() { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r5_3() + public function yy_r5_3() { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r5_5() + public function yy_r5_5() { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r5_7() + public function yy_r5_7() { $this->yypushstate(self::TAG); return true; } - function yy_r5_9() + public function yy_r5_9() { $this->yypushstate(self::TAG); return true; } - function yy_r5_11() + public function yy_r5_11() { $this->token = Smarty_Internal_Templateparser::TP_LDEL; $this->taglineno = $this->line; $this->yypushstate(self::TAGBODY); } - function yy_r5_13() + public function yy_r5_13() { $this->token = Smarty_Internal_Templateparser::TP_QUOTE; $this->yypopstate(); } - function yy_r5_14() + public function yy_r5_14() { $this->token = Smarty_Internal_Templateparser::TP_BACKTICK; $this->value = substr($this->value, 0, -1); @@ -1027,20 +1043,18 @@ public function yylex5() $this->taglineno = $this->line; } - function yy_r5_15() + public function yy_r5_15() { $this->token = Smarty_Internal_Templateparser::TP_DOLLARID; } - function yy_r5_16() + public function yy_r5_16() { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r5_17() + public function yy_r5_17() { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } } - -
\ No newline at end of file diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php index d8219daed..b008715f7 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templateparser.php @@ -4,13 +4,14 @@ class TP_yyStackEntry { public $stateno; /* The state-number */ public $major; /* The major token value. This is the code - ** number for the token at this stack level */ - public $minor; /* The user-supplied minor token value. This - ** is the value of the token */ + * number for the token at this stack level + */ + public $minor; /* The user-supplied minor token value. This + * is the value of the token + */ } -; -#line 11 "../smarty/lexer/smarty_internal_templateparser.y" +// line 11 "../smarty/lexer/smarty_internal_templateparser.y" /** * Smarty Template Parser Class @@ -22,10 +23,10 @@ class TP_yyStackEntry */ class Smarty_Internal_Templateparser { - #line 23 "../smarty/lexer/smarty_internal_templateparser.y" - const Err1 = 'Security error: Call to private object member not allowed'; - const Err2 = 'Security error: Call to dynamic object member not allowed'; - const Err3 = 'PHP in template not allowed. Use SmartyBC to enable it'; + // line 23 "../smarty/lexer/smarty_internal_templateparser.y" + const ERR1 = 'Security error: Call to private object member not allowed'; + const ERR2 = 'Security error: Call to dynamic object member not allowed'; + const ERR3 = 'PHP in template not allowed. Use SmartyBC to enable it'; const TP_VERT = 1; const TP_COLON = 2; const TP_UNIMATH = 3; @@ -89,339 +90,231 @@ class Smarty_Internal_Templateparser const YY_NO_ACTION = 511; const YY_ACCEPT_ACTION = 510; const YY_ERROR_ACTION = 509; - const YY_SZ_ACTTAB = 2178; - const YY_SHIFT_USE_DFLT = -23; - const YY_SHIFT_MAX = 227; - const YY_REDUCE_USE_DFLT = -68; - const YY_REDUCE_MAX = 176; - const YYNOCODE = 108; - const YYSTACKDEPTH = 500; - const YYNSTATE = 323; - const YYNRULE = 186; - const YYERRORSYMBOL = 61; - const YYERRSYMDT = 'yy0'; - const YYFALLBACK = 0; - /** - * result status - * - * @var bool - */ - public $successful = true; - /** - * return value - * - * @var mixed - */ - public $retvalue = 0; - /** - * @var - */ - public $yymajor; - /** - * last index of array variable - * - * @var mixed - */ - public $last_index; - /** - * last variable name - * - * @var string - */ - public $last_variable; - /** - * root parse tree buffer - * - * @var Smarty_Internal_ParseTree - */ - public $root_buffer; - /** - * current parse tree object - * - * @var Smarty_Internal_ParseTree - */ - public $current_buffer; - /** - * lexer object - * - * @var Smarty_Internal_Templatelexer - */ - public $lex; - /** - * internal error flag - * - * @var bool - */ - private $internalError = false; - /** - * {strip} status - * - * @var bool - */ - public $strip = false; - /** - * compiler object - * - * @var Smarty_Internal_TemplateCompilerBase - */ - public $compiler = null; - /** - * smarty object - * - * @var Smarty - */ - public $smarty = null; - /** - * template object - * - * @var Smarty_Internal_Template - */ - public $template = null; - /** - * block nesting level - * - * @var int - */ - public $block_nesting_level = 0; - /** - * security object - * - * @var Smarty_Security - */ - public $security = null; - /** - * template prefix array - * - * @var \Smarty_Internal_ParseTree[] - */ - public $template_prefix = array(); - /** - * template prefix array - * - * @var \Smarty_Internal_ParseTree[] - */ - public $template_postfix = array(); - static public $yy_action = array( - 43, 266, 267, 379, 115, 203, 33, 201, 274, 275, - 281, 1, 13, 124, 93, 183, 379, 217, 6, 79, - 253, 89, 379, 16, 102, 425, 304, 252, 218, 249, - 211, 129, 190, 302, 26, 213, 425, 33, 11, 39, - 42, 283, 209, 13, 223, 385, 195, 233, 77, 3, - 236, 290, 43, 385, 170, 385, 75, 17, 385, 94, - 274, 275, 281, 1, 385, 128, 385, 196, 385, 217, - 6, 79, 80, 298, 158, 210, 102, 156, 174, 133, - 218, 249, 211, 85, 208, 290, 28, 264, 101, 264, - 199, 39, 42, 283, 209, 31, 312, 182, 195, 259, - 77, 3, 43, 290, 23, 172, 239, 174, 75, 288, - 274, 275, 281, 1, 167, 127, 256, 196, 248, 217, - 6, 79, 345, 40, 20, 305, 102, 248, 345, 157, - 218, 249, 211, 83, 208, 290, 26, 8, 174, 264, - 74, 39, 42, 283, 209, 131, 312, 292, 195, 74, - 77, 3, 43, 290, 295, 99, 243, 174, 75, 345, - 274, 275, 281, 1, 15, 126, 86, 196, 248, 217, - 6, 79, 345, 322, 161, 289, 102, 87, 345, 165, - 218, 249, 211, 290, 208, 115, 26, 128, 255, 221, - 74, 39, 42, 283, 209, 93, 312, 210, 195, 162, - 77, 3, 43, 290, 254, 235, 247, 304, 75, 27, - 274, 275, 281, 1, 172, 127, 425, 177, 248, 217, - 6, 79, 77, 174, 250, 290, 102, 425, 198, 14, - 218, 249, 211, 248, 208, 34, 26, 222, 206, 139, - 74, 39, 42, 283, 209, 198, 312, 23, 195, 291, - 77, 3, 43, 290, 300, 74, 198, 438, 75, 346, - 274, 275, 281, 1, 438, 127, 176, 196, 267, 217, - 6, 79, 346, 161, 289, 290, 102, 23, 346, 238, - 218, 249, 211, 33, 178, 263, 26, 160, 289, 13, - 37, 39, 42, 283, 209, 198, 312, 212, 195, 250, - 77, 3, 43, 290, 216, 189, 155, 97, 75, 381, - 274, 275, 281, 1, 149, 127, 264, 179, 18, 217, - 6, 79, 381, 94, 97, 237, 102, 140, 381, 251, - 218, 249, 211, 4, 194, 94, 26, 264, 198, 37, - 30, 39, 42, 283, 209, 198, 312, 212, 195, 129, - 77, 3, 43, 290, 219, 172, 11, 97, 75, 378, - 274, 275, 281, 1, 101, 127, 438, 186, 210, 217, - 6, 79, 378, 438, 12, 163, 102, 220, 378, 425, - 218, 249, 211, 302, 208, 213, 26, 225, 215, 187, - 425, 39, 42, 283, 209, 234, 312, 7, 195, 212, - 77, 3, 43, 290, 134, 9, 240, 425, 75, 97, - 274, 275, 281, 1, 264, 91, 109, 76, 425, 217, - 6, 79, 253, 293, 426, 16, 102, 251, 198, 252, - 218, 249, 211, 198, 208, 426, 26, 148, 198, 135, - 132, 39, 42, 283, 209, 143, 312, 264, 195, 264, - 77, 3, 43, 290, 138, 264, 205, 24, 75, 166, - 274, 275, 281, 1, 264, 125, 276, 196, 19, 217, - 6, 79, 454, 153, 13, 454, 102, 168, 290, 454, - 218, 249, 211, 174, 208, 314, 5, 136, 210, 251, - 152, 39, 42, 283, 209, 268, 312, 213, 195, 308, - 77, 3, 43, 290, 94, 169, 111, 144, 75, 251, - 274, 275, 281, 1, 229, 128, 7, 196, 313, 217, - 6, 79, 510, 90, 175, 111, 102, 164, 289, 174, - 218, 249, 211, 101, 208, 265, 28, 32, 128, 150, - 261, 39, 42, 283, 209, 10, 312, 317, 195, 224, - 77, 21, 269, 290, 232, 230, 282, 114, 75, 307, - 214, 213, 279, 22, 84, 103, 246, 181, 92, 64, - 260, 262, 454, 77, 93, 454, 290, 257, 316, 454, - 438, 228, 311, 197, 309, 78, 304, 271, 272, 273, - 270, 121, 258, 310, 274, 275, 281, 1, 17, 280, - 110, 284, 81, 217, 6, 79, 438, 146, 94, 438, - 102, 454, 151, 438, 218, 249, 211, 307, 214, 213, - 279, 278, 84, 103, 104, 180, 92, 56, 263, 159, - 130, 152, 93, 295, 137, 257, 316, 295, 251, 88, - 311, 197, 309, 82, 304, 307, 295, 213, 303, 295, - 100, 295, 295, 193, 105, 59, 295, 295, 295, 295, - 93, 295, 295, 257, 316, 295, 295, 295, 311, 197, - 309, 307, 304, 213, 277, 295, 100, 103, 295, 181, - 92, 64, 200, 297, 295, 253, 93, 295, 16, 257, - 316, 295, 252, 295, 311, 197, 309, 295, 304, 295, - 299, 295, 295, 295, 295, 295, 274, 275, 281, 2, - 295, 301, 295, 295, 295, 217, 6, 79, 253, 295, - 295, 16, 102, 299, 204, 252, 218, 249, 211, 274, - 275, 281, 2, 295, 301, 33, 295, 154, 217, 6, - 79, 13, 295, 295, 295, 102, 295, 295, 295, 218, - 249, 211, 295, 295, 286, 25, 307, 295, 213, 295, - 295, 100, 295, 295, 193, 105, 59, 295, 295, 295, - 295, 93, 295, 295, 257, 316, 295, 287, 25, 311, - 197, 309, 307, 304, 213, 295, 454, 100, 295, 454, - 193, 118, 67, 454, 296, 253, 295, 93, 16, 295, - 257, 316, 252, 295, 295, 311, 197, 309, 295, 304, - 295, 295, 307, 295, 213, 295, 188, 100, 295, 295, - 193, 118, 67, 295, 295, 454, 295, 93, 295, 295, - 257, 316, 295, 295, 226, 311, 197, 309, 295, 304, - 295, 295, 307, 295, 213, 295, 192, 100, 295, 295, - 193, 118, 67, 295, 295, 295, 295, 93, 295, 295, - 257, 316, 295, 295, 295, 311, 197, 309, 295, 304, - 295, 295, 307, 295, 213, 295, 191, 98, 295, 295, - 193, 118, 46, 295, 108, 295, 295, 93, 295, 295, - 257, 316, 295, 295, 295, 311, 197, 309, 307, 304, - 213, 295, 295, 98, 295, 295, 193, 118, 47, 295, - 219, 295, 295, 93, 295, 295, 257, 316, 295, 295, - 295, 311, 197, 309, 307, 304, 213, 295, 295, 100, - 295, 295, 193, 118, 45, 295, 295, 295, 295, 93, - 295, 295, 257, 316, 295, 295, 295, 311, 197, 309, - 295, 304, 295, 295, 307, 295, 213, 295, 295, 100, - 295, 295, 193, 118, 70, 295, 295, 295, 295, 93, - 295, 295, 257, 316, 295, 295, 295, 311, 197, 309, - 307, 304, 213, 295, 295, 100, 295, 295, 193, 118, - 49, 295, 295, 295, 295, 93, 295, 295, 257, 316, - 295, 295, 295, 311, 197, 309, 307, 304, 213, 295, - 295, 100, 295, 295, 193, 96, 66, 295, 295, 295, - 295, 93, 295, 295, 257, 316, 295, 295, 295, 311, - 197, 309, 295, 304, 295, 295, 307, 295, 213, 295, - 295, 100, 295, 295, 193, 118, 44, 295, 295, 295, - 295, 93, 295, 295, 257, 316, 295, 295, 295, 311, - 197, 309, 307, 304, 213, 295, 295, 100, 295, 295, - 193, 118, 58, 295, 295, 295, 295, 93, 295, 295, - 257, 316, 295, 295, 295, 311, 197, 309, 307, 304, - 213, 295, 295, 100, 295, 295, 193, 118, 54, 295, - 295, 295, 295, 93, 295, 295, 257, 316, 295, 295, - 295, 311, 197, 309, 295, 304, 295, 295, 307, 295, - 213, 295, 295, 100, 295, 295, 193, 118, 71, 295, - 295, 295, 295, 93, 295, 295, 257, 316, 295, 295, - 295, 311, 197, 309, 307, 304, 213, 295, 295, 100, - 295, 295, 193, 118, 65, 295, 295, 295, 295, 93, - 295, 295, 257, 316, 295, 295, 295, 311, 197, 309, - 307, 304, 213, 295, 295, 100, 295, 295, 193, 96, - 57, 295, 295, 295, 295, 93, 295, 295, 257, 316, - 295, 295, 295, 311, 197, 309, 295, 304, 295, 295, - 307, 295, 213, 295, 295, 100, 295, 295, 185, 106, - 53, 295, 295, 295, 295, 93, 295, 295, 257, 316, - 295, 295, 295, 311, 197, 309, 307, 304, 213, 295, - 295, 100, 295, 295, 193, 118, 60, 295, 295, 295, - 295, 93, 295, 295, 257, 316, 295, 295, 295, 311, - 197, 309, 307, 304, 213, 295, 295, 100, 295, 295, - 193, 118, 73, 295, 295, 295, 295, 93, 295, 295, - 257, 316, 295, 295, 295, 311, 197, 309, 295, 304, - 295, 295, 307, 295, 213, 295, 295, 100, 295, 295, - 193, 118, 55, 295, 295, 295, 295, 93, 295, 295, - 257, 316, 295, 295, 295, 311, 197, 309, 307, 304, - 213, 295, 295, 100, 295, 295, 193, 95, 68, 295, - 295, 295, 295, 93, 295, 295, 257, 316, 295, 295, - 295, 311, 197, 309, 307, 304, 213, 295, 295, 100, - 295, 295, 193, 118, 69, 295, 295, 295, 295, 93, - 295, 295, 257, 316, 295, 295, 295, 311, 197, 309, - 295, 304, 295, 295, 307, 295, 213, 295, 295, 100, - 295, 295, 193, 118, 51, 295, 295, 295, 295, 93, - 295, 295, 257, 316, 295, 295, 295, 311, 197, 309, - 307, 304, 213, 295, 295, 100, 295, 295, 184, 118, - 52, 295, 295, 295, 295, 93, 295, 295, 257, 316, - 295, 295, 295, 311, 197, 309, 307, 304, 213, 295, - 295, 100, 295, 295, 193, 118, 47, 295, 295, 295, - 295, 93, 295, 295, 257, 316, 295, 295, 295, 311, - 197, 309, 295, 304, 295, 295, 307, 295, 213, 295, - 295, 100, 295, 295, 193, 118, 50, 295, 295, 295, - 295, 93, 295, 295, 257, 316, 295, 295, 295, 311, - 197, 309, 307, 304, 213, 295, 295, 100, 295, 295, - 193, 118, 62, 295, 295, 295, 295, 93, 295, 295, - 257, 316, 295, 295, 295, 311, 197, 309, 307, 304, - 213, 295, 295, 100, 295, 295, 193, 118, 63, 295, - 295, 295, 295, 93, 295, 295, 257, 316, 295, 295, - 295, 311, 197, 309, 295, 304, 295, 295, 307, 295, - 213, 295, 295, 100, 295, 295, 193, 118, 61, 295, - 295, 295, 295, 93, 295, 295, 257, 316, 295, 295, - 295, 311, 197, 309, 307, 304, 213, 295, 295, 100, - 295, 295, 193, 118, 48, 295, 295, 295, 295, 93, - 295, 295, 257, 316, 391, 391, 391, 311, 197, 309, - 307, 304, 213, 295, 295, 100, 295, 295, 193, 118, - 72, 295, 295, 295, 295, 93, 295, 295, 257, 316, - 295, 295, 295, 311, 197, 309, 295, 304, 295, 295, - 425, 295, 391, 391, 295, 295, 295, 295, 307, 295, - 213, 425, 198, 100, 38, 295, 193, 112, 391, 391, - 391, 391, 38, 93, 295, 295, 295, 306, 295, 295, - 295, 311, 197, 309, 295, 304, 295, 35, 307, 33, - 213, 295, 295, 100, 295, 13, 193, 120, 295, 295, - 41, 36, 198, 93, 38, 295, 295, 231, 41, 36, - 295, 311, 197, 309, 295, 304, 319, 318, 315, 245, - 295, 207, 295, 295, 319, 318, 315, 245, 295, 33, - 454, 295, 295, 454, 295, 13, 207, 454, 438, 295, - 41, 36, 295, 295, 295, 454, 295, 295, 454, 295, - 295, 14, 454, 438, 295, 295, 319, 318, 315, 245, - 295, 198, 295, 38, 438, 295, 295, 438, 307, 454, - 213, 438, 320, 100, 295, 241, 193, 122, 295, 438, - 295, 295, 438, 93, 454, 295, 438, 295, 198, 295, - 38, 311, 197, 309, 295, 304, 307, 295, 213, 41, - 36, 100, 295, 295, 193, 117, 295, 295, 295, 295, - 295, 93, 295, 295, 295, 319, 318, 315, 245, 311, - 197, 309, 207, 304, 295, 295, 41, 36, 295, 295, - 295, 454, 295, 295, 454, 295, 295, 4, 454, 438, - 295, 295, 319, 318, 315, 245, 295, 294, 295, 295, - 295, 307, 295, 213, 295, 295, 100, 295, 295, 193, - 123, 295, 295, 295, 295, 438, 93, 295, 438, 141, - 454, 295, 438, 167, 311, 197, 309, 295, 304, 264, - 295, 295, 40, 20, 305, 295, 295, 307, 295, 213, - 295, 198, 100, 38, 295, 193, 116, 174, 307, 295, - 213, 295, 93, 100, 295, 295, 193, 113, 295, 295, - 311, 197, 309, 93, 304, 295, 198, 295, 38, 295, - 295, 311, 197, 309, 295, 304, 307, 295, 213, 41, - 36, 100, 295, 295, 193, 119, 295, 295, 295, 295, - 295, 93, 295, 321, 145, 319, 318, 315, 245, 311, - 197, 309, 207, 304, 41, 36, 295, 295, 295, 295, - 295, 454, 295, 295, 454, 295, 295, 295, 454, 438, - 319, 318, 315, 245, 198, 295, 38, 295, 198, 295, - 38, 295, 198, 295, 38, 295, 295, 295, 242, 295, - 295, 295, 285, 295, 295, 438, 171, 295, 438, 295, - 454, 295, 438, 295, 295, 295, 295, 454, 295, 295, - 454, 295, 41, 36, 454, 438, 41, 36, 295, 295, - 41, 36, 198, 295, 38, 295, 295, 295, 319, 318, - 315, 245, 319, 318, 315, 245, 319, 318, 315, 245, - 295, 438, 295, 147, 438, 295, 454, 167, 438, 295, - 295, 295, 295, 264, 295, 295, 40, 20, 305, 227, - 41, 36, 295, 295, 295, 295, 295, 295, 295, 295, - 295, 174, 295, 295, 295, 295, 319, 318, 315, 245, - 198, 295, 38, 295, 198, 295, 38, 142, 198, 295, - 38, 167, 295, 295, 173, 295, 295, 264, 295, 295, - 40, 20, 305, 295, 295, 295, 107, 295, 198, 29, - 38, 295, 198, 295, 38, 174, 295, 295, 41, 36, - 295, 295, 41, 36, 295, 244, 41, 36, 295, 295, - 295, 295, 295, 295, 319, 318, 315, 245, 319, 318, - 315, 245, 319, 318, 315, 245, 41, 36, 295, 295, - 41, 36, 295, 295, 295, 295, 295, 295, 295, 295, - 295, 295, 319, 318, 315, 245, 319, 318, 315, 245, - 198, 295, 295, 295, 295, 295, 295, 295, 295, 295, - 295, 295, 295, 295, 349, 295, 295, 295, 202, 295, - 295, 295, 295, 295, 295, 295, 295, 33, 295, 295, - 295, 295, 295, 13, 295, 295, 425, 295, 295, 295, - 295, 295, 295, 295, 295, 295, 295, 425, + const YY_SZ_ACTTAB = 2076; + const YY_SHIFT_USE_DFLT = -23; + const YY_SHIFT_MAX = 227; + const YY_REDUCE_USE_DFLT = -68; + const YY_REDUCE_MAX = 176; + const YYNOCODE = 108; + const YYSTACKDEPTH = 500; + const YYNSTATE = 323; + const YYNRULE = 186; + const YYERRORSYMBOL = 61; + const YYERRSYMDT = 'yy0'; + const YYFALLBACK = 0; + + public static $yy_action = array( + 42, 266, 267, 379, 115, 202, 27, 204, 260, 235, + 237, 1, 17, 125, 94, 182, 379, 215, 10, 79, + 317, 168, 379, 12, 107, 425, 308, 318, 224, 298, + 218, 129, 189, 292, 21, 203, 425, 27, 11, 39, + 38, 299, 219, 17, 213, 385, 191, 245, 77, 3, + 303, 315, 42, 385, 160, 385, 75, 29, 385, 95, + 260, 235, 237, 1, 385, 126, 385, 193, 385, 215, + 10, 79, 80, 290, 145, 226, 107, 148, 172, 150, + 224, 298, 218, 85, 217, 315, 21, 280, 101, 280, + 141, 39, 38, 299, 219, 20, 287, 183, 191, 232, + 77, 3, 42, 315, 16, 176, 316, 172, 75, 275, + 260, 235, 237, 1, 167, 128, 236, 193, 319, 215, + 10, 79, 345, 40, 14, 257, 107, 319, 345, 5, + 224, 298, 218, 89, 217, 315, 30, 292, 172, 203, + 74, 39, 38, 299, 219, 132, 287, 205, 191, 74, + 77, 3, 42, 315, 210, 194, 310, 99, 75, 345, + 260, 235, 237, 1, 425, 126, 87, 179, 319, 215, + 10, 79, 345, 95, 195, 425, 107, 272, 345, 176, + 224, 298, 218, 315, 199, 115, 21, 128, 278, 209, + 74, 39, 38, 299, 219, 94, 287, 226, 191, 129, + 77, 3, 42, 315, 277, 309, 11, 308, 75, 13, + 260, 235, 237, 1, 163, 127, 425, 193, 319, 215, + 10, 79, 77, 254, 19, 315, 107, 425, 137, 34, + 224, 298, 218, 196, 217, 33, 21, 220, 280, 159, + 74, 39, 38, 299, 219, 196, 287, 8, 191, 162, + 77, 3, 42, 315, 294, 222, 196, 438, 75, 378, + 260, 235, 237, 1, 438, 126, 16, 193, 271, 215, + 10, 79, 378, 172, 302, 315, 107, 175, 378, 267, + 224, 298, 218, 27, 178, 252, 21, 164, 296, 17, + 83, 39, 38, 299, 219, 196, 287, 205, 191, 170, + 77, 3, 42, 315, 270, 18, 144, 99, 75, 346, + 260, 235, 237, 1, 142, 126, 280, 177, 84, 215, + 10, 79, 346, 172, 280, 4, 107, 95, 346, 321, + 224, 298, 218, 438, 217, 131, 21, 321, 426, 24, + 438, 39, 38, 299, 219, 196, 287, 205, 191, 426, + 77, 3, 42, 315, 201, 9, 101, 99, 75, 381, + 260, 235, 237, 1, 149, 124, 102, 193, 22, 215, + 10, 79, 381, 315, 99, 231, 107, 311, 381, 425, + 224, 298, 218, 23, 217, 319, 7, 207, 196, 17, + 425, 39, 38, 299, 219, 307, 287, 36, 191, 154, + 77, 3, 42, 315, 161, 296, 227, 74, 75, 280, + 260, 235, 237, 1, 16, 91, 273, 76, 312, 215, + 10, 79, 317, 208, 190, 12, 107, 176, 196, 318, + 224, 298, 218, 135, 217, 321, 21, 196, 35, 95, + 263, 39, 38, 299, 219, 157, 287, 111, 191, 88, + 77, 3, 42, 315, 169, 280, 225, 15, 75, 285, + 260, 235, 237, 1, 155, 126, 226, 184, 101, 215, + 10, 79, 454, 172, 280, 454, 107, 246, 253, 454, + 224, 298, 218, 152, 217, 111, 21, 161, 296, 265, + 6, 39, 38, 299, 219, 269, 287, 203, 191, 119, + 77, 3, 42, 315, 158, 262, 321, 274, 75, 97, + 260, 235, 237, 1, 153, 128, 165, 193, 151, 215, + 10, 79, 317, 43, 280, 12, 107, 320, 280, 318, + 224, 298, 218, 8, 217, 171, 30, 306, 196, 36, + 172, 39, 38, 299, 219, 264, 287, 256, 191, 128, + 77, 288, 78, 315, 510, 90, 166, 296, 75, 41, + 37, 223, 104, 228, 250, 251, 255, 122, 226, 289, + 260, 235, 237, 1, 239, 233, 238, 240, 241, 215, + 10, 79, 229, 305, 77, 304, 107, 315, 281, 300, + 224, 298, 218, 261, 211, 203, 314, 28, 86, 108, + 140, 181, 96, 61, 214, 247, 317, 454, 94, 12, + 454, 297, 322, 318, 454, 29, 259, 192, 249, 248, + 308, 313, 138, 27, 302, 143, 130, 82, 95, 17, + 261, 211, 203, 314, 252, 86, 108, 286, 180, 96, + 50, 136, 139, 100, 152, 94, 454, 81, 297, 322, + 295, 321, 146, 259, 192, 249, 295, 308, 261, 295, + 203, 295, 295, 110, 295, 295, 197, 105, 64, 295, + 295, 295, 295, 94, 295, 295, 297, 322, 295, 295, + 295, 259, 192, 249, 261, 308, 203, 276, 295, 110, + 108, 295, 181, 96, 61, 187, 282, 295, 317, 94, + 295, 12, 297, 322, 295, 318, 295, 259, 192, 249, + 295, 308, 295, 291, 295, 295, 295, 295, 295, 260, + 235, 237, 2, 295, 293, 295, 295, 295, 215, 10, + 79, 295, 295, 295, 295, 107, 291, 206, 295, 224, + 298, 218, 260, 235, 237, 2, 295, 293, 295, 295, + 295, 215, 10, 79, 295, 295, 295, 295, 107, 295, + 295, 295, 224, 298, 218, 295, 295, 295, 26, 261, + 295, 203, 295, 295, 110, 295, 295, 197, 113, 60, + 295, 295, 295, 295, 94, 156, 295, 297, 322, 167, + 284, 26, 259, 192, 249, 280, 308, 295, 40, 14, + 257, 295, 261, 200, 203, 295, 295, 110, 295, 295, + 197, 105, 64, 172, 295, 295, 295, 94, 295, 295, + 297, 322, 295, 295, 295, 259, 192, 249, 295, 308, + 295, 295, 295, 295, 261, 295, 203, 295, 295, 98, + 283, 295, 197, 113, 51, 295, 201, 295, 295, 94, + 295, 295, 297, 322, 295, 295, 295, 259, 192, 249, + 261, 308, 203, 295, 295, 110, 295, 295, 197, 113, + 60, 295, 295, 295, 295, 94, 295, 295, 297, 322, + 295, 295, 295, 259, 192, 249, 295, 308, 261, 295, + 203, 295, 295, 110, 188, 295, 197, 113, 60, 196, + 31, 43, 295, 94, 295, 295, 297, 322, 295, 295, + 295, 259, 192, 249, 295, 308, 261, 295, 203, 295, + 295, 98, 198, 295, 197, 113, 45, 295, 109, 295, + 295, 94, 295, 295, 297, 322, 295, 41, 37, 259, + 192, 249, 261, 308, 203, 295, 295, 110, 295, 295, + 197, 113, 67, 233, 238, 240, 241, 94, 295, 295, + 297, 322, 295, 295, 295, 259, 192, 249, 295, 308, + 261, 295, 203, 295, 295, 110, 295, 295, 197, 113, + 57, 196, 295, 43, 295, 94, 295, 295, 297, 322, + 295, 295, 295, 259, 192, 249, 295, 308, 261, 295, + 203, 295, 295, 110, 295, 295, 197, 113, 46, 295, + 295, 295, 295, 94, 295, 295, 297, 322, 295, 41, + 37, 259, 192, 249, 261, 308, 203, 295, 295, 110, + 295, 295, 197, 113, 66, 233, 238, 240, 241, 94, + 301, 295, 297, 322, 295, 295, 295, 259, 192, 249, + 295, 308, 261, 295, 203, 295, 295, 110, 295, 295, + 197, 113, 72, 196, 295, 43, 295, 94, 295, 295, + 297, 322, 295, 295, 295, 259, 192, 249, 295, 308, + 261, 295, 203, 295, 295, 110, 295, 295, 197, 113, + 53, 295, 295, 295, 295, 94, 295, 295, 297, 322, + 230, 41, 37, 259, 192, 249, 261, 308, 203, 295, + 295, 110, 295, 295, 197, 113, 48, 233, 238, 240, + 241, 94, 295, 295, 297, 322, 295, 295, 295, 259, + 192, 249, 295, 308, 261, 295, 203, 295, 295, 110, + 295, 295, 185, 103, 49, 196, 295, 43, 295, 94, + 295, 295, 297, 322, 295, 295, 295, 259, 192, 249, + 295, 308, 261, 295, 203, 295, 295, 110, 295, 295, + 197, 113, 55, 134, 295, 295, 295, 94, 295, 295, + 297, 322, 295, 41, 37, 259, 192, 249, 261, 308, + 203, 295, 295, 110, 295, 295, 197, 113, 71, 233, + 238, 240, 241, 94, 295, 295, 297, 322, 295, 295, + 295, 259, 192, 249, 295, 308, 261, 295, 203, 295, + 295, 110, 295, 295, 197, 113, 59, 196, 295, 43, + 295, 94, 295, 295, 297, 322, 295, 295, 295, 259, + 192, 249, 295, 308, 261, 295, 203, 295, 295, 110, + 295, 295, 197, 113, 63, 295, 295, 295, 295, 94, + 295, 295, 297, 322, 216, 41, 37, 259, 192, 249, + 261, 308, 203, 295, 295, 110, 295, 295, 197, 113, + 62, 233, 238, 240, 241, 94, 295, 295, 297, 322, + 295, 295, 295, 259, 192, 249, 295, 308, 261, 295, + 203, 295, 295, 110, 295, 295, 197, 92, 69, 196, + 295, 43, 295, 94, 295, 295, 297, 322, 295, 295, + 295, 259, 192, 249, 295, 308, 261, 295, 203, 295, + 295, 110, 295, 295, 197, 113, 52, 295, 295, 295, + 295, 94, 295, 295, 297, 322, 295, 41, 37, 259, + 192, 249, 261, 308, 203, 295, 295, 110, 295, 295, + 197, 113, 65, 233, 238, 240, 241, 94, 295, 295, + 297, 322, 295, 196, 295, 259, 192, 249, 295, 308, + 261, 295, 203, 295, 295, 110, 295, 349, 197, 113, + 58, 221, 295, 295, 295, 94, 295, 295, 297, 322, + 27, 295, 295, 259, 192, 249, 17, 308, 261, 425, + 203, 295, 295, 110, 295, 295, 197, 113, 56, 295, + 425, 295, 295, 94, 295, 295, 297, 322, 295, 295, + 295, 259, 192, 249, 261, 308, 203, 295, 295, 110, + 295, 295, 197, 113, 44, 295, 295, 295, 295, 94, + 295, 295, 297, 322, 295, 295, 295, 259, 192, 249, + 295, 308, 261, 295, 203, 295, 295, 110, 295, 295, + 197, 93, 70, 295, 295, 295, 295, 94, 295, 295, + 297, 322, 295, 295, 295, 259, 192, 249, 295, 308, + 261, 295, 203, 295, 295, 110, 295, 295, 186, 113, + 54, 295, 295, 295, 295, 94, 295, 295, 297, 322, + 295, 295, 295, 259, 192, 249, 261, 308, 203, 295, + 295, 110, 295, 295, 197, 113, 73, 295, 295, 295, + 295, 94, 295, 295, 297, 322, 295, 295, 295, 259, + 192, 249, 295, 308, 261, 295, 203, 295, 295, 110, + 295, 295, 197, 113, 68, 295, 295, 295, 295, 94, + 295, 295, 297, 322, 295, 295, 295, 259, 192, 249, + 295, 308, 261, 295, 203, 295, 295, 110, 295, 295, + 197, 93, 47, 295, 295, 295, 295, 94, 295, 295, + 297, 322, 391, 391, 391, 259, 192, 249, 261, 308, + 203, 295, 295, 110, 295, 295, 197, 113, 51, 295, + 295, 295, 295, 94, 295, 295, 297, 322, 196, 295, + 43, 259, 192, 249, 295, 308, 295, 295, 425, 295, + 391, 391, 295, 295, 295, 261, 295, 203, 295, 425, + 110, 295, 295, 197, 118, 27, 391, 391, 391, 391, + 94, 17, 295, 295, 258, 295, 41, 37, 259, 192, + 249, 261, 308, 203, 295, 196, 110, 43, 295, 197, + 120, 295, 233, 238, 240, 241, 94, 295, 295, 295, + 243, 295, 295, 295, 259, 192, 249, 295, 308, 295, + 32, 295, 27, 212, 295, 295, 295, 295, 17, 295, + 295, 295, 454, 41, 37, 454, 295, 295, 295, 454, + 438, 295, 295, 295, 295, 295, 295, 295, 295, 233, + 238, 240, 241, 295, 295, 261, 295, 203, 295, 295, + 110, 295, 295, 197, 112, 295, 438, 295, 295, 438, + 94, 454, 212, 438, 268, 295, 295, 295, 259, 192, + 249, 454, 308, 212, 454, 295, 295, 34, 454, 438, + 295, 295, 454, 295, 295, 454, 295, 133, 4, 454, + 438, 167, 295, 295, 295, 295, 295, 280, 295, 295, + 40, 14, 257, 295, 295, 438, 295, 295, 438, 261, + 454, 203, 438, 295, 110, 172, 438, 197, 121, 438, + 261, 454, 203, 438, 94, 110, 295, 295, 197, 117, + 295, 295, 259, 192, 249, 94, 308, 295, 295, 295, + 295, 295, 295, 259, 192, 249, 261, 308, 203, 295, + 295, 110, 295, 295, 197, 116, 295, 261, 295, 203, + 295, 94, 110, 295, 295, 197, 114, 295, 295, 259, + 192, 249, 94, 308, 196, 295, 43, 295, 295, 295, + 259, 192, 249, 261, 308, 203, 295, 196, 110, 43, + 295, 197, 123, 295, 295, 295, 106, 295, 94, 295, + 196, 174, 43, 295, 295, 295, 259, 192, 249, 196, + 308, 43, 41, 37, 244, 295, 295, 295, 295, 295, + 295, 295, 295, 234, 295, 41, 37, 295, 233, 238, + 240, 241, 295, 295, 295, 295, 295, 295, 41, 37, + 295, 233, 238, 240, 241, 295, 295, 41, 37, 295, + 295, 295, 295, 295, 233, 238, 240, 241, 25, 196, + 295, 43, 295, 233, 238, 240, 241, 454, 295, 295, + 454, 295, 295, 279, 454, 438, 212, 295, 295, 295, + 295, 295, 295, 295, 295, 454, 295, 295, 454, 295, + 295, 295, 454, 438, 196, 295, 43, 41, 37, 295, + 295, 438, 295, 196, 438, 43, 454, 295, 438, 295, + 295, 295, 295, 233, 238, 240, 241, 173, 295, 438, + 295, 295, 438, 295, 454, 295, 438, 454, 295, 295, + 454, 295, 41, 37, 454, 438, 295, 295, 295, 295, + 295, 41, 37, 295, 295, 295, 242, 295, 233, 238, + 240, 241, 295, 295, 295, 295, 295, 233, 238, 240, + 241, 438, 295, 295, 438, 295, 454, 147, 438, 295, + 295, 167, 295, 295, 295, 295, 295, 280, 295, 295, + 40, 14, 257, 295, 295, 295, 295, 295, 295, 295, + 295, 295, 295, 295, 295, 172, ); - static public $yy_lookahead = array( + + public static $yy_lookahead = array( 3, 9, 10, 15, 71, 17, 28, 74, 11, 12, 13, 14, 34, 16, 81, 18, 28, 20, 21, 22, 11, 82, 34, 14, 27, 37, 93, 18, 31, 32, @@ -431,262 +324,255 @@ class Smarty_Internal_Templateparser 11, 12, 13, 14, 34, 16, 36, 18, 38, 20, 21, 22, 105, 106, 94, 45, 27, 73, 101, 73, 31, 32, 33, 77, 35, 54, 37, 83, 48, 83, - 65, 42, 43, 44, 45, 14, 47, 16, 49, 18, + 94, 42, 43, 44, 45, 14, 47, 16, 49, 18, 51, 52, 3, 54, 36, 101, 38, 101, 59, 15, 11, 12, 13, 14, 77, 16, 35, 18, 24, 20, - 21, 22, 28, 86, 87, 88, 27, 24, 34, 73, - 31, 32, 33, 77, 35, 54, 37, 36, 101, 83, - 46, 42, 43, 44, 45, 16, 47, 70, 49, 46, - 51, 52, 3, 54, 53, 81, 53, 101, 59, 15, - 11, 12, 13, 14, 23, 16, 37, 18, 24, 20, - 21, 22, 28, 99, 97, 98, 27, 36, 34, 82, + 21, 22, 28, 86, 87, 88, 27, 24, 34, 37, + 31, 32, 33, 82, 35, 54, 37, 66, 101, 68, + 46, 42, 43, 44, 45, 16, 47, 71, 49, 46, + 51, 52, 3, 54, 78, 79, 53, 81, 59, 15, + 11, 12, 13, 14, 37, 16, 37, 18, 24, 20, + 21, 22, 28, 19, 65, 48, 27, 106, 34, 101, 31, 32, 33, 54, 35, 71, 37, 16, 74, 18, - 46, 42, 43, 44, 45, 81, 47, 45, 49, 77, - 51, 52, 3, 54, 90, 53, 18, 93, 59, 30, - 11, 12, 13, 14, 101, 16, 37, 18, 24, 20, - 21, 22, 51, 101, 102, 54, 27, 48, 1, 17, - 31, 32, 33, 24, 35, 14, 37, 16, 50, 18, - 46, 42, 43, 44, 45, 1, 47, 36, 49, 38, - 51, 52, 3, 54, 60, 46, 1, 45, 59, 15, - 11, 12, 13, 14, 52, 16, 8, 18, 10, 20, - 21, 22, 28, 97, 98, 54, 27, 36, 34, 38, + 46, 42, 43, 44, 45, 81, 47, 45, 49, 45, + 51, 52, 3, 54, 90, 53, 52, 93, 59, 30, + 11, 12, 13, 14, 82, 16, 37, 18, 24, 20, + 21, 22, 51, 18, 14, 54, 27, 48, 73, 17, + 31, 32, 33, 1, 35, 14, 37, 16, 83, 18, + 46, 42, 43, 44, 45, 1, 47, 37, 49, 77, + 51, 52, 3, 54, 60, 50, 1, 45, 59, 15, + 11, 12, 13, 14, 52, 16, 36, 18, 38, 20, + 21, 22, 28, 101, 102, 54, 27, 8, 34, 10, 31, 32, 33, 28, 35, 95, 37, 97, 98, 34, - 2, 42, 43, 44, 45, 1, 47, 71, 49, 102, - 51, 52, 3, 54, 78, 79, 73, 81, 59, 15, - 11, 12, 13, 14, 71, 16, 83, 18, 17, 20, - 21, 22, 28, 19, 81, 24, 27, 73, 34, 96, - 31, 32, 33, 17, 35, 19, 37, 83, 1, 2, - 17, 42, 43, 44, 45, 1, 47, 71, 49, 45, - 51, 52, 3, 54, 78, 101, 52, 81, 59, 15, - 11, 12, 13, 14, 48, 16, 45, 18, 45, 20, - 21, 22, 28, 52, 14, 16, 27, 18, 34, 37, - 31, 32, 33, 66, 35, 68, 37, 45, 64, 65, - 48, 42, 43, 44, 45, 53, 47, 37, 49, 71, - 51, 52, 3, 54, 73, 37, 78, 37, 59, 81, - 11, 12, 13, 14, 83, 16, 48, 18, 48, 20, - 21, 22, 11, 106, 37, 14, 27, 96, 1, 18, - 31, 32, 33, 1, 35, 48, 37, 73, 1, 73, - 16, 42, 43, 44, 45, 73, 47, 83, 49, 83, - 51, 52, 3, 54, 73, 83, 19, 30, 59, 77, - 11, 12, 13, 14, 83, 16, 70, 18, 28, 20, - 21, 22, 11, 94, 34, 14, 27, 82, 54, 18, - 31, 32, 33, 101, 35, 53, 37, 94, 45, 96, - 94, 42, 43, 44, 45, 66, 47, 68, 49, 92, - 51, 52, 3, 54, 19, 77, 99, 94, 59, 96, - 11, 12, 13, 14, 38, 16, 37, 18, 92, 20, - 21, 22, 62, 63, 18, 99, 27, 97, 98, 101, - 31, 32, 33, 48, 35, 16, 37, 25, 16, 51, - 18, 42, 43, 44, 45, 37, 47, 18, 49, 18, - 51, 41, 9, 54, 53, 53, 15, 18, 59, 66, - 67, 68, 69, 2, 71, 72, 18, 74, 75, 76, - 18, 49, 11, 51, 81, 14, 54, 84, 85, 18, - 19, 18, 89, 90, 91, 18, 93, 4, 5, 6, - 7, 8, 18, 35, 11, 12, 13, 14, 17, 15, - 18, 35, 81, 20, 21, 22, 45, 51, 19, 48, - 27, 50, 94, 52, 31, 32, 33, 66, 67, 68, - 69, 83, 71, 72, 80, 74, 75, 76, 95, 94, - 81, 94, 81, 107, 94, 84, 85, 107, 96, 94, - 89, 90, 91, 81, 93, 66, 107, 68, 98, 107, - 71, 107, 107, 74, 75, 76, 107, 107, 107, 107, - 81, 107, 107, 84, 85, 107, 107, 107, 89, 90, - 91, 66, 93, 68, 69, 107, 71, 72, 107, 74, - 75, 76, 103, 104, 107, 11, 81, 107, 14, 84, - 85, 107, 18, 107, 89, 90, 91, 107, 93, 107, - 5, 107, 107, 107, 107, 107, 11, 12, 13, 14, - 107, 16, 107, 107, 107, 20, 21, 22, 11, 107, - 107, 14, 27, 5, 50, 18, 31, 32, 33, 11, - 12, 13, 14, 107, 16, 28, 107, 30, 20, 21, - 22, 34, 107, 107, 107, 27, 107, 107, 107, 31, - 32, 33, 107, 107, 59, 60, 66, 107, 68, 107, - 107, 71, 107, 107, 74, 75, 76, 107, 107, 107, - 107, 81, 107, 107, 84, 85, 107, 59, 60, 89, - 90, 91, 66, 93, 68, 107, 11, 71, 107, 14, - 74, 75, 76, 18, 104, 11, 107, 81, 14, 107, - 84, 85, 18, 107, 107, 89, 90, 91, 107, 93, - 107, 107, 66, 107, 68, 107, 100, 71, 107, 107, - 74, 75, 76, 107, 107, 50, 107, 81, 107, 107, - 84, 85, 107, 107, 50, 89, 90, 91, 107, 93, - 107, 107, 66, 107, 68, 107, 100, 71, 107, 107, - 74, 75, 76, 107, 107, 107, 107, 81, 107, 107, - 84, 85, 107, 107, 107, 89, 90, 91, 107, 93, - 107, 107, 66, 107, 68, 107, 100, 71, 107, 107, - 74, 75, 76, 107, 78, 107, 107, 81, 107, 107, - 84, 85, 107, 107, 107, 89, 90, 91, 66, 93, + 94, 42, 43, 44, 45, 1, 47, 71, 49, 77, + 51, 52, 3, 54, 78, 23, 73, 81, 59, 15, + 11, 12, 13, 14, 73, 16, 83, 18, 36, 20, + 21, 22, 28, 101, 83, 17, 27, 19, 34, 96, + 31, 32, 33, 45, 35, 16, 37, 96, 37, 41, + 52, 42, 43, 44, 45, 1, 47, 71, 49, 48, + 51, 52, 3, 54, 78, 37, 48, 81, 59, 15, + 11, 12, 13, 14, 71, 16, 48, 18, 17, 20, + 21, 22, 28, 54, 81, 24, 27, 70, 34, 37, + 31, 32, 33, 28, 35, 24, 37, 45, 1, 34, + 48, 42, 43, 44, 45, 53, 47, 2, 49, 73, + 51, 52, 3, 54, 97, 98, 19, 46, 59, 83, + 11, 12, 13, 14, 36, 16, 38, 18, 98, 20, + 21, 22, 11, 64, 65, 14, 27, 101, 1, 18, + 31, 32, 33, 94, 35, 96, 37, 1, 17, 19, + 92, 42, 43, 44, 45, 73, 47, 99, 49, 77, + 51, 52, 3, 54, 16, 83, 18, 30, 59, 70, + 11, 12, 13, 14, 73, 16, 45, 18, 48, 20, + 21, 22, 11, 101, 83, 14, 27, 35, 92, 18, + 31, 32, 33, 94, 35, 99, 37, 97, 98, 53, + 36, 42, 43, 44, 45, 66, 47, 68, 49, 18, + 51, 52, 3, 54, 94, 38, 96, 53, 59, 81, + 11, 12, 13, 14, 73, 16, 77, 18, 73, 20, + 21, 22, 11, 3, 83, 14, 27, 99, 83, 18, + 31, 32, 33, 37, 35, 18, 37, 18, 1, 2, + 101, 42, 43, 44, 45, 35, 47, 18, 49, 16, + 51, 18, 18, 54, 62, 63, 97, 98, 59, 39, + 40, 50, 18, 4, 5, 6, 7, 8, 45, 16, + 11, 12, 13, 14, 18, 55, 56, 57, 58, 20, + 21, 22, 49, 53, 51, 53, 27, 54, 18, 15, + 31, 32, 33, 66, 67, 68, 69, 25, 71, 72, + 51, 74, 75, 76, 18, 18, 11, 11, 81, 14, + 14, 84, 85, 18, 18, 17, 89, 90, 91, 9, + 93, 15, 51, 28, 102, 30, 81, 81, 19, 34, + 66, 67, 68, 69, 95, 71, 72, 83, 74, 75, + 76, 94, 94, 80, 94, 81, 50, 81, 84, 85, + 107, 96, 94, 89, 90, 91, 107, 93, 66, 107, 68, 107, 107, 71, 107, 107, 74, 75, 76, 107, - 78, 107, 107, 81, 107, 107, 84, 85, 107, 107, - 107, 89, 90, 91, 66, 93, 68, 107, 107, 71, - 107, 107, 74, 75, 76, 107, 107, 107, 107, 81, - 107, 107, 84, 85, 107, 107, 107, 89, 90, 91, - 107, 93, 107, 107, 66, 107, 68, 107, 107, 71, - 107, 107, 74, 75, 76, 107, 107, 107, 107, 81, + 107, 107, 107, 81, 107, 107, 84, 85, 107, 107, + 107, 89, 90, 91, 66, 93, 68, 69, 107, 71, + 72, 107, 74, 75, 76, 103, 104, 107, 11, 81, + 107, 14, 84, 85, 107, 18, 107, 89, 90, 91, + 107, 93, 107, 5, 107, 107, 107, 107, 107, 11, + 12, 13, 14, 107, 16, 107, 107, 107, 20, 21, + 22, 107, 107, 107, 107, 27, 5, 50, 107, 31, + 32, 33, 11, 12, 13, 14, 107, 16, 107, 107, + 107, 20, 21, 22, 107, 107, 107, 107, 27, 107, + 107, 107, 31, 32, 33, 107, 107, 59, 60, 66, + 107, 68, 107, 107, 71, 107, 107, 74, 75, 76, + 107, 107, 107, 107, 81, 73, 107, 84, 85, 77, + 59, 60, 89, 90, 91, 83, 93, 107, 86, 87, + 88, 107, 66, 100, 68, 107, 107, 71, 107, 107, + 74, 75, 76, 101, 107, 107, 107, 81, 107, 107, + 84, 85, 107, 107, 107, 89, 90, 91, 107, 93, + 107, 107, 107, 107, 66, 107, 68, 107, 107, 71, + 104, 107, 74, 75, 76, 107, 78, 107, 107, 81, 107, 107, 84, 85, 107, 107, 107, 89, 90, 91, 66, 93, 68, 107, 107, 71, 107, 107, 74, 75, 76, 107, 107, 107, 107, 81, 107, 107, 84, 85, - 107, 107, 107, 89, 90, 91, 66, 93, 68, 107, - 107, 71, 107, 107, 74, 75, 76, 107, 107, 107, - 107, 81, 107, 107, 84, 85, 107, 107, 107, 89, - 90, 91, 107, 93, 107, 107, 66, 107, 68, 107, - 107, 71, 107, 107, 74, 75, 76, 107, 107, 107, - 107, 81, 107, 107, 84, 85, 107, 107, 107, 89, + 107, 107, 107, 89, 90, 91, 107, 93, 66, 107, + 68, 107, 107, 71, 100, 107, 74, 75, 76, 1, + 2, 3, 107, 81, 107, 107, 84, 85, 107, 107, + 107, 89, 90, 91, 107, 93, 66, 107, 68, 107, + 107, 71, 100, 107, 74, 75, 76, 107, 78, 107, + 107, 81, 107, 107, 84, 85, 107, 39, 40, 89, 90, 91, 66, 93, 68, 107, 107, 71, 107, 107, - 74, 75, 76, 107, 107, 107, 107, 81, 107, 107, - 84, 85, 107, 107, 107, 89, 90, 91, 66, 93, - 68, 107, 107, 71, 107, 107, 74, 75, 76, 107, - 107, 107, 107, 81, 107, 107, 84, 85, 107, 107, - 107, 89, 90, 91, 107, 93, 107, 107, 66, 107, + 74, 75, 76, 55, 56, 57, 58, 81, 107, 107, + 84, 85, 107, 107, 107, 89, 90, 91, 107, 93, + 66, 107, 68, 107, 107, 71, 107, 107, 74, 75, + 76, 1, 107, 3, 107, 81, 107, 107, 84, 85, + 107, 107, 107, 89, 90, 91, 107, 93, 66, 107, 68, 107, 107, 71, 107, 107, 74, 75, 76, 107, - 107, 107, 107, 81, 107, 107, 84, 85, 107, 107, - 107, 89, 90, 91, 66, 93, 68, 107, 107, 71, - 107, 107, 74, 75, 76, 107, 107, 107, 107, 81, - 107, 107, 84, 85, 107, 107, 107, 89, 90, 91, - 66, 93, 68, 107, 107, 71, 107, 107, 74, 75, - 76, 107, 107, 107, 107, 81, 107, 107, 84, 85, - 107, 107, 107, 89, 90, 91, 107, 93, 107, 107, + 107, 107, 107, 81, 107, 107, 84, 85, 107, 39, + 40, 89, 90, 91, 66, 93, 68, 107, 107, 71, + 107, 107, 74, 75, 76, 55, 56, 57, 58, 81, + 60, 107, 84, 85, 107, 107, 107, 89, 90, 91, + 107, 93, 66, 107, 68, 107, 107, 71, 107, 107, + 74, 75, 76, 1, 107, 3, 107, 81, 107, 107, + 84, 85, 107, 107, 107, 89, 90, 91, 107, 93, 66, 107, 68, 107, 107, 71, 107, 107, 74, 75, 76, 107, 107, 107, 107, 81, 107, 107, 84, 85, - 107, 107, 107, 89, 90, 91, 66, 93, 68, 107, - 107, 71, 107, 107, 74, 75, 76, 107, 107, 107, + 38, 39, 40, 89, 90, 91, 66, 93, 68, 107, + 107, 71, 107, 107, 74, 75, 76, 55, 56, 57, + 58, 81, 107, 107, 84, 85, 107, 107, 107, 89, + 90, 91, 107, 93, 66, 107, 68, 107, 107, 71, + 107, 107, 74, 75, 76, 1, 107, 3, 107, 81, + 107, 107, 84, 85, 107, 107, 107, 89, 90, 91, + 107, 93, 66, 107, 68, 107, 107, 71, 107, 107, + 74, 75, 76, 29, 107, 107, 107, 81, 107, 107, + 84, 85, 107, 39, 40, 89, 90, 91, 66, 93, + 68, 107, 107, 71, 107, 107, 74, 75, 76, 55, + 56, 57, 58, 81, 107, 107, 84, 85, 107, 107, + 107, 89, 90, 91, 107, 93, 66, 107, 68, 107, + 107, 71, 107, 107, 74, 75, 76, 1, 107, 3, 107, 81, 107, 107, 84, 85, 107, 107, 107, 89, + 90, 91, 107, 93, 66, 107, 68, 107, 107, 71, + 107, 107, 74, 75, 76, 107, 107, 107, 107, 81, + 107, 107, 84, 85, 38, 39, 40, 89, 90, 91, + 66, 93, 68, 107, 107, 71, 107, 107, 74, 75, + 76, 55, 56, 57, 58, 81, 107, 107, 84, 85, + 107, 107, 107, 89, 90, 91, 107, 93, 66, 107, + 68, 107, 107, 71, 107, 107, 74, 75, 76, 1, + 107, 3, 107, 81, 107, 107, 84, 85, 107, 107, + 107, 89, 90, 91, 107, 93, 66, 107, 68, 107, + 107, 71, 107, 107, 74, 75, 76, 107, 107, 107, + 107, 81, 107, 107, 84, 85, 107, 39, 40, 89, 90, 91, 66, 93, 68, 107, 107, 71, 107, 107, - 74, 75, 76, 107, 107, 107, 107, 81, 107, 107, - 84, 85, 107, 107, 107, 89, 90, 91, 107, 93, - 107, 107, 66, 107, 68, 107, 107, 71, 107, 107, - 74, 75, 76, 107, 107, 107, 107, 81, 107, 107, - 84, 85, 107, 107, 107, 89, 90, 91, 66, 93, + 74, 75, 76, 55, 56, 57, 58, 81, 107, 107, + 84, 85, 107, 1, 107, 89, 90, 91, 107, 93, + 66, 107, 68, 107, 107, 71, 107, 15, 74, 75, + 76, 19, 107, 107, 107, 81, 107, 107, 84, 85, + 28, 107, 107, 89, 90, 91, 34, 93, 66, 37, 68, 107, 107, 71, 107, 107, 74, 75, 76, 107, - 107, 107, 107, 81, 107, 107, 84, 85, 107, 107, + 48, 107, 107, 81, 107, 107, 84, 85, 107, 107, 107, 89, 90, 91, 66, 93, 68, 107, 107, 71, 107, 107, 74, 75, 76, 107, 107, 107, 107, 81, 107, 107, 84, 85, 107, 107, 107, 89, 90, 91, - 107, 93, 107, 107, 66, 107, 68, 107, 107, 71, - 107, 107, 74, 75, 76, 107, 107, 107, 107, 81, - 107, 107, 84, 85, 107, 107, 107, 89, 90, 91, - 66, 93, 68, 107, 107, 71, 107, 107, 74, 75, + 107, 93, 66, 107, 68, 107, 107, 71, 107, 107, + 74, 75, 76, 107, 107, 107, 107, 81, 107, 107, + 84, 85, 107, 107, 107, 89, 90, 91, 107, 93, + 66, 107, 68, 107, 107, 71, 107, 107, 74, 75, 76, 107, 107, 107, 107, 81, 107, 107, 84, 85, 107, 107, 107, 89, 90, 91, 66, 93, 68, 107, 107, 71, 107, 107, 74, 75, 76, 107, 107, 107, 107, 81, 107, 107, 84, 85, 107, 107, 107, 89, - 90, 91, 107, 93, 107, 107, 66, 107, 68, 107, - 107, 71, 107, 107, 74, 75, 76, 107, 107, 107, - 107, 81, 107, 107, 84, 85, 107, 107, 107, 89, - 90, 91, 66, 93, 68, 107, 107, 71, 107, 107, + 90, 91, 107, 93, 66, 107, 68, 107, 107, 71, + 107, 107, 74, 75, 76, 107, 107, 107, 107, 81, + 107, 107, 84, 85, 107, 107, 107, 89, 90, 91, + 107, 93, 66, 107, 68, 107, 107, 71, 107, 107, 74, 75, 76, 107, 107, 107, 107, 81, 107, 107, - 84, 85, 107, 107, 107, 89, 90, 91, 66, 93, + 84, 85, 1, 2, 3, 89, 90, 91, 66, 93, 68, 107, 107, 71, 107, 107, 74, 75, 76, 107, - 107, 107, 107, 81, 107, 107, 84, 85, 107, 107, - 107, 89, 90, 91, 107, 93, 107, 107, 66, 107, - 68, 107, 107, 71, 107, 107, 74, 75, 76, 107, - 107, 107, 107, 81, 107, 107, 84, 85, 107, 107, - 107, 89, 90, 91, 66, 93, 68, 107, 107, 71, - 107, 107, 74, 75, 76, 107, 107, 107, 107, 81, - 107, 107, 84, 85, 1, 2, 3, 89, 90, 91, - 66, 93, 68, 107, 107, 71, 107, 107, 74, 75, - 76, 107, 107, 107, 107, 81, 107, 107, 84, 85, - 107, 107, 107, 89, 90, 91, 107, 93, 107, 107, - 37, 107, 39, 40, 107, 107, 107, 107, 66, 107, - 68, 48, 1, 71, 3, 107, 74, 75, 55, 56, - 57, 58, 3, 81, 107, 107, 107, 85, 107, 107, - 107, 89, 90, 91, 107, 93, 107, 26, 66, 28, - 68, 107, 107, 71, 107, 34, 74, 75, 107, 107, - 39, 40, 1, 81, 3, 107, 107, 85, 39, 40, - 107, 89, 90, 91, 107, 93, 55, 56, 57, 58, - 107, 2, 107, 107, 55, 56, 57, 58, 107, 28, - 11, 107, 107, 14, 107, 34, 2, 18, 19, 107, - 39, 40, 107, 107, 107, 11, 107, 107, 14, 107, - 107, 17, 18, 19, 107, 107, 55, 56, 57, 58, - 107, 1, 107, 3, 45, 107, 107, 48, 66, 50, - 68, 52, 53, 71, 107, 15, 74, 75, 107, 45, - 107, 107, 48, 81, 50, 107, 52, 107, 1, 107, - 3, 89, 90, 91, 107, 93, 66, 107, 68, 39, - 40, 71, 107, 107, 74, 75, 107, 107, 107, 107, - 107, 81, 107, 107, 107, 55, 56, 57, 58, 89, - 90, 91, 2, 93, 107, 107, 39, 40, 107, 107, - 107, 11, 107, 107, 14, 107, 107, 17, 18, 19, - 107, 107, 55, 56, 57, 58, 107, 60, 107, 107, - 107, 66, 107, 68, 107, 107, 71, 107, 107, 74, - 75, 107, 107, 107, 107, 45, 81, 107, 48, 73, - 50, 107, 52, 77, 89, 90, 91, 107, 93, 83, - 107, 107, 86, 87, 88, 107, 107, 66, 107, 68, - 107, 1, 71, 3, 107, 74, 75, 101, 66, 107, - 68, 107, 81, 71, 107, 107, 74, 75, 107, 107, - 89, 90, 91, 81, 93, 107, 1, 107, 3, 107, - 107, 89, 90, 91, 107, 93, 66, 107, 68, 39, - 40, 71, 107, 107, 74, 75, 107, 107, 107, 107, - 107, 81, 107, 53, 29, 55, 56, 57, 58, 89, - 90, 91, 2, 93, 39, 40, 107, 107, 107, 107, - 107, 11, 107, 107, 14, 107, 107, 107, 18, 19, - 55, 56, 57, 58, 1, 107, 3, 107, 1, 107, - 3, 107, 1, 107, 3, 107, 107, 107, 15, 107, - 107, 107, 15, 107, 107, 45, 15, 107, 48, 107, - 50, 107, 52, 107, 107, 107, 107, 11, 107, 107, - 14, 107, 39, 40, 18, 19, 39, 40, 107, 107, - 39, 40, 1, 107, 3, 107, 107, 107, 55, 56, - 57, 58, 55, 56, 57, 58, 55, 56, 57, 58, - 107, 45, 107, 73, 48, 107, 50, 77, 52, 107, - 107, 107, 107, 83, 107, 107, 86, 87, 88, 38, - 39, 40, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 101, 107, 107, 107, 107, 55, 56, 57, 58, - 1, 107, 3, 107, 1, 107, 3, 73, 1, 107, - 3, 77, 107, 107, 15, 107, 107, 83, 107, 107, - 86, 87, 88, 107, 107, 107, 23, 107, 1, 2, - 3, 107, 1, 107, 3, 101, 107, 107, 39, 40, - 107, 107, 39, 40, 107, 38, 39, 40, 107, 107, - 107, 107, 107, 107, 55, 56, 57, 58, 55, 56, - 57, 58, 55, 56, 57, 58, 39, 40, 107, 107, - 39, 40, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 55, 56, 57, 58, 55, 56, 57, 58, - 1, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 15, 107, 107, 107, 19, 107, - 107, 107, 107, 107, 107, 107, 107, 28, 107, 107, - 107, 107, 107, 34, 107, 107, 37, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 48, + 107, 107, 107, 81, 107, 107, 84, 85, 1, 107, + 3, 89, 90, 91, 107, 93, 107, 107, 37, 107, + 39, 40, 107, 107, 107, 66, 107, 68, 107, 48, + 71, 107, 107, 74, 75, 28, 55, 56, 57, 58, + 81, 34, 107, 107, 85, 107, 39, 40, 89, 90, + 91, 66, 93, 68, 107, 1, 71, 3, 107, 74, + 75, 107, 55, 56, 57, 58, 81, 107, 107, 107, + 85, 107, 107, 107, 89, 90, 91, 107, 93, 107, + 26, 107, 28, 2, 107, 107, 107, 107, 34, 107, + 107, 107, 11, 39, 40, 14, 107, 107, 107, 18, + 19, 107, 107, 107, 107, 107, 107, 107, 107, 55, + 56, 57, 58, 107, 107, 66, 107, 68, 107, 107, + 71, 107, 107, 74, 75, 107, 45, 107, 107, 48, + 81, 50, 2, 52, 53, 107, 107, 107, 89, 90, + 91, 11, 93, 2, 14, 107, 107, 17, 18, 19, + 107, 107, 11, 107, 107, 14, 107, 73, 17, 18, + 19, 77, 107, 107, 107, 107, 107, 83, 107, 107, + 86, 87, 88, 107, 107, 45, 107, 107, 48, 66, + 50, 68, 52, 107, 71, 101, 45, 74, 75, 48, + 66, 50, 68, 52, 81, 71, 107, 107, 74, 75, + 107, 107, 89, 90, 91, 81, 93, 107, 107, 107, + 107, 107, 107, 89, 90, 91, 66, 93, 68, 107, + 107, 71, 107, 107, 74, 75, 107, 66, 107, 68, + 107, 81, 71, 107, 107, 74, 75, 107, 107, 89, + 90, 91, 81, 93, 1, 107, 3, 107, 107, 107, + 89, 90, 91, 66, 93, 68, 107, 1, 71, 3, + 107, 74, 75, 107, 107, 107, 23, 107, 81, 107, + 1, 15, 3, 107, 107, 107, 89, 90, 91, 1, + 93, 3, 39, 40, 15, 107, 107, 107, 107, 107, + 107, 107, 107, 15, 107, 39, 40, 107, 55, 56, + 57, 58, 107, 107, 107, 107, 107, 107, 39, 40, + 107, 55, 56, 57, 58, 107, 107, 39, 40, 107, + 107, 107, 107, 107, 55, 56, 57, 58, 2, 1, + 107, 3, 107, 55, 56, 57, 58, 11, 107, 107, + 14, 107, 107, 15, 18, 19, 2, 107, 107, 107, + 107, 107, 107, 107, 107, 11, 107, 107, 14, 107, + 107, 107, 18, 19, 1, 107, 3, 39, 40, 107, + 107, 45, 107, 1, 48, 3, 50, 107, 52, 107, + 107, 107, 107, 55, 56, 57, 58, 15, 107, 45, + 107, 107, 48, 107, 50, 107, 52, 11, 107, 107, + 14, 107, 39, 40, 18, 19, 107, 107, 107, 107, + 107, 39, 40, 107, 107, 107, 53, 107, 55, 56, + 57, 58, 107, 107, 107, 107, 107, 55, 56, 57, + 58, 45, 107, 107, 48, 107, 50, 73, 52, 107, + 107, 77, 107, 107, 107, 107, 107, 83, 107, 107, + 86, 87, 88, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 101, ); - static public $yy_shift_ofst = array( - -23, 399, 399, 349, 99, 449, 449, 99, 349, 99, - 99, -3, 99, 99, 249, 99, 99, 99, 99, 299, - 99, 149, 199, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 299, 99, 99, 49, 49, 499, 499, - 499, 499, 499, 499, 1621, 1661, 1661, 1981, 2067, 2039, - 2047, 2043, 1747, 1850, 1720, 1941, 1937, 1875, 1933, 2071, - 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, - 2071, 2071, 1629, 1629, 522, 695, 2129, 171, 255, 129, - 718, 707, 9, 255, 316, 255, 129, 129, 304, 337, - 583, 1780, 244, 784, 221, 344, 294, 411, 40, 411, - 485, 359, 440, -22, -22, 427, 432, 424, -22, 359, - 437, 589, 227, 227, 227, 589, 227, 227, 227, 227, - -23, -23, -23, -23, 1679, 1694, 561, 1910, 1956, 81, - 674, 212, 461, -22, -22, -22, -14, -14, -22, 360, - -22, -22, -22, -22, -14, 31, 321, -22, -22, 301, - 321, -14, -14, -14, 31, -22, -22, -22, -14, -14, - 589, 589, 227, 508, 589, 288, 227, 227, 288, 227, - 227, -23, -23, -23, -23, -23, -23, 1573, 30, -12, - 94, 144, 775, 342, 194, 103, 179, 258, 211, 141, - 152, 68, 241, 209, 323, 387, 370, 368, 188, -8, - 101, 556, 567, 563, 552, 539, 548, 574, 443, 558, - 566, 582, 581, 584, 541, 543, 512, 519, 506, 476, - 479, 488, 508, 502, 501, 531, 529, 510, + + public static $yy_shift_ofst = array( + -23, 399, 399, 449, 49, 49, 449, 349, 49, 49, + 349, -3, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 149, 199, 299, 49, 149, 49, 49, + 49, 49, 49, 49, 249, 49, 99, 99, 499, 499, + 499, 499, 499, 499, 1664, 1617, 1617, 1144, 1982, 1973, + 1938, 1226, 1853, 1062, 980, 1879, 898, 1866, 1888, 1308, + 1308, 1308, 1308, 1308, 1308, 1308, 1308, 1308, 1308, 1308, + 1308, 1308, 520, 520, 533, 731, 1372, 171, 255, 129, + 708, 595, 9, 154, 129, 255, 308, 129, 255, 537, + 559, 1751, 244, 344, 511, 221, 294, 411, 40, 411, + -22, 438, 438, 436, 387, 427, 319, 355, -22, -22, + 420, 609, 232, 232, 232, 609, 232, 232, 232, 232, + -23, -23, -23, -23, 1740, 1691, 1954, 1936, 1996, 81, + 687, 461, 212, -22, 31, -14, -14, -22, 288, -14, + 288, -14, -22, 31, -22, -14, -14, -22, -22, 351, + -22, -22, -14, -22, -22, -22, -22, -22, -14, 210, + 232, 609, 232, 395, 609, 232, 609, 232, 395, 92, + 232, -23, -23, -23, -23, -23, -23, 1591, 30, -12, + 94, 144, 342, 596, 179, 103, 194, 454, 230, 152, + 269, 301, 318, 127, 282, -8, 205, 361, 378, 421, + 68, 467, 556, 606, 571, 598, 587, 586, 610, 549, + 572, 574, 570, 532, 530, 553, 298, 523, 544, 510, + 92, 534, 529, 519, 517, 496, 442, 481, ); - static public $yy_reduce_ofst = array( - 460, 493, 551, 579, 605, 832, 806, 776, 690, 746, - 716, 1134, 1216, 1242, 1160, 1298, 1022, 1052, 1078, 1104, - 1268, 1488, 1514, 1432, 1462, 1324, 1350, 1406, 1380, 1186, - 888, 996, 970, 940, 914, 858, 1552, 1582, 1745, 1690, - 1781, 1820, 1792, 1662, 1974, 1930, 1756, 37, 37, 37, + + public static $yy_reduce_ofst = array( + 492, 527, 564, 592, 618, 703, 736, 768, 794, 822, + 850, 1068, 1096, 1122, 1150, 1286, 1204, 1232, 1260, 1040, + 1314, 1532, 1478, 1506, 1342, 1450, 1424, 1396, 1368, 1178, + 1014, 986, 932, 904, 876, 958, 1595, 1569, 1771, 1659, + 1760, 1734, 1723, 1797, 712, 1694, 1974, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 114, -33, 6, -67, 56, 226, - 317, 233, 331, 254, 77, 4, 276, 328, 190, 122, - 429, 396, -23, 393, 74, -23, -23, 393, 176, 413, - 176, 407, 381, 366, 364, -23, -23, 243, 372, 426, - 428, 430, -23, -23, 382, 176, -23, -23, -23, -23, - -23, 324, -23, -23, 537, 537, 537, 537, 537, 549, - 542, 537, 537, 538, 538, 538, 533, 533, 538, 540, - 538, 538, 538, 538, 533, 521, 518, 538, 538, 544, - 535, 533, 533, 533, 562, 538, 538, 538, 533, 533, - 550, 550, 113, 545, 550, 197, 113, 113, 197, 113, - 113, 379, 395, -20, 97, -61, 25, + 37, 37, 37, 37, 114, -33, 372, -67, 6, 76, + 71, 233, 241, 190, 226, 4, 307, 276, 326, 172, + 429, 389, -23, -23, 339, 428, -23, 410, 390, 339, + 391, 386, 348, -23, 222, -23, 293, 155, 441, 445, + 390, 459, -23, -23, -23, 390, -23, -23, -23, 439, + -23, -23, 359, -23, 550, 550, 550, 550, 550, 545, + 555, 550, 550, 554, 566, 539, 539, 554, 547, 539, + 548, 539, 554, 546, 554, 539, 539, 554, 554, 563, + 554, 554, 539, 554, 554, 554, 554, 554, 539, 558, + 78, 320, 78, 522, 320, 78, 320, 78, 522, 196, + 78, 51, -61, -20, -4, 109, 132, ); - static public $yyExpectedTokens = array( + + public static $yyExpectedTokens = array( array(), array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), @@ -698,8 +584,9 @@ class Smarty_Internal_Templateparser array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), - array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 53, 54, - 59,), + array( + 3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 53, 54, 59, + ), array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), array(3, 11, 12, 13, 14, 16, 18, 20, 21, 22, 27, 31, 32, 33, 35, 37, 42, 43, 44, 45, 47, 49, 51, 52, 54, 59,), @@ -735,17 +622,17 @@ class Smarty_Internal_Templateparser array(1, 3, 26, 28, 34, 39, 40, 55, 56, 57, 58,), array(1, 3, 28, 34, 39, 40, 55, 56, 57, 58,), array(1, 3, 28, 34, 39, 40, 55, 56, 57, 58,), - array(1, 3, 38, 39, 40, 55, 56, 57, 58,), - array(1, 2, 3, 39, 40, 55, 56, 57, 58,), + array(1, 3, 29, 39, 40, 55, 56, 57, 58,), + array(1, 3, 15, 39, 40, 55, 56, 57, 58,), + array(1, 3, 39, 40, 53, 55, 56, 57, 58,), array(1, 3, 15, 39, 40, 55, 56, 57, 58,), array(1, 3, 38, 39, 40, 55, 56, 57, 58,), array(1, 3, 23, 39, 40, 55, 56, 57, 58,), + array(1, 3, 38, 39, 40, 55, 56, 57, 58,), array(1, 3, 39, 40, 55, 56, 57, 58, 60,), - array(1, 3, 39, 40, 53, 55, 56, 57, 58,), - array(1, 3, 15, 39, 40, 55, 56, 57, 58,), array(1, 3, 15, 39, 40, 55, 56, 57, 58,), + array(1, 2, 3, 39, 40, 55, 56, 57, 58,), array(1, 3, 15, 39, 40, 55, 56, 57, 58,), - array(1, 3, 29, 39, 40, 55, 56, 57, 58,), array(1, 3, 15, 39, 40, 55, 56, 57, 58,), array(1, 3, 39, 40, 55, 56, 57, 58,), array(1, 3, 39, 40, 55, 56, 57, 58,), @@ -771,34 +658,34 @@ class Smarty_Internal_Templateparser array(5, 11, 12, 13, 14, 16, 20, 21, 22, 27, 31, 32, 33, 59, 60,), array(11, 14, 18, 28, 30, 34,), array(11, 14, 18, 28, 34,), + array(19, 45, 52,), + array(16, 37, 54,), array(1, 28, 34,), array(17, 19, 48,), - array(1, 28, 34,), array(16, 37, 54,), - array(16, 37, 54,), - array(19, 45, 52,), + array(1, 28, 34,), array(1, 2,), array(4, 5, 6, 7, 8, 11, 12, 13, 14, 20, 21, 22, 27, 31, 32, 33,), array(2, 11, 14, 17, 18, 19, 45, 48, 50, 52,), array(1, 15, 28, 34,), + array(1, 15, 28, 34,), array(11, 14, 18, 50,), array(14, 16, 18, 54,), array(1, 15, 28, 34,), - array(1, 15, 28, 34,), array(11, 14, 18,), array(17, 19, 48,), array(11, 14, 18,), - array(19, 48,), - array(16, 18,), - array(28, 34,), array(28, 34,), - array(28, 34,), - array(1, 30,), + array(16, 18,), + array(16, 18,), array(1, 53,), + array(1, 19,), + array(1, 30,), array(16, 54,), array(28, 34,), - array(16, 18,), - array(1, 19,), + array(28, 34,), + array(28, 34,), + array(19, 48,), array(19,), array(1,), array(1,), @@ -812,52 +699,52 @@ class Smarty_Internal_Templateparser array(), array(), array(), - array(2, 11, 14, 18, 19, 45, 48, 50, 52, 53,), array(2, 11, 14, 17, 18, 19, 45, 48, 50, 52,), + array(2, 11, 14, 18, 19, 45, 48, 50, 52, 53,), array(2, 11, 14, 18, 19, 45, 48, 50, 52,), array(2, 11, 14, 18, 19, 45, 48, 50, 52,), array(11, 14, 18, 19, 45, 48, 50, 52,), array(14, 16, 18, 35, 54,), array(11, 14, 18, 50,), - array(17, 45, 52,), array(11, 14, 18,), + array(17, 45, 52,), array(28, 34,), - array(28, 34,), - array(28, 34,), + array(16, 54,), array(45, 52,), array(45, 52,), array(28, 34,), - array(14, 37,), - array(28, 34,), - array(28, 34,), + array(45, 52,), + array(45, 52,), + array(45, 52,), + array(45, 52,), array(28, 34,), + array(16, 54,), array(28, 34,), array(45, 52,), - array(16, 54,), array(45, 52,), array(28, 34,), array(28, 34,), array(17, 24,), + array(28, 34,), + array(28, 34,), array(45, 52,), - array(45, 52,), - array(45, 52,), - array(45, 52,), - array(16, 54,), + array(28, 34,), + array(28, 34,), array(28, 34,), array(28, 34,), array(28, 34,), array(45, 52,), - array(45, 52,), - array(19,), - array(19,), + array(14, 37,), array(1,), - array(37,), array(19,), + array(1,), array(2,), + array(19,), array(1,), + array(19,), array(1,), array(2,), - array(1,), + array(37,), array(1,), array(), array(), @@ -870,52 +757,52 @@ class Smarty_Internal_Templateparser array(15, 17, 28, 34, 37, 48,), array(15, 24, 28, 34, 46,), array(15, 24, 28, 34, 46,), - array(11, 14, 18, 50,), array(37, 45, 48, 53,), - array(24, 46, 60,), - array(24, 46, 53,), + array(11, 14, 18, 50,), array(30, 37, 48,), - array(8, 10,), + array(24, 46, 53,), + array(24, 46, 60,), + array(36, 53,), array(36, 38,), - array(23, 36,), array(45, 53,), - array(36, 38,), - array(36, 38,), - array(24, 46,), - array(17, 45,), + array(8, 10,), array(37, 48,), array(37, 48,), array(37, 48,), - array(18, 50,), + array(23, 36,), array(9, 10,), - array(36, 53,), + array(18, 50,), + array(24, 46,), + array(36, 38,), + array(17, 45,), + array(36, 38,), + array(38,), + array(18,), + array(15,), array(51,), + array(17,), array(18,), array(18,), + array(9,), + array(51,), + array(25,), + array(15,), array(18,), + array(53,), + array(53,), + array(16,), + array(41,), + array(45,), array(18,), + array(35,), + array(37,), array(18,), array(18,), - array(45,), - array(35,), - array(35,), array(18,), - array(17,), - array(15,), - array(15,), - array(9,), - array(25,), - array(16,), array(18,), - array(38,), - array(37,), - array(51,), array(37,), - array(53,), - array(53,), - array(18,), + array(35,), array(18,), - array(41,), array(), array(), array(), @@ -1012,77 +899,46 @@ class Smarty_Internal_Templateparser array(), array(), ); - static public $yy_default = array( - 334, 509, 509, 494, 509, 509, 509, 473, 509, 473, - 473, 509, 509, 509, 509, 509, 509, 509, 509, 509, + + public static $yy_default = array( + 334, 509, 509, 494, 509, 473, 509, 509, 473, 473, 509, 509, 509, 509, 509, 509, 509, 509, 509, 509, 509, 509, 509, 509, 509, 509, 509, 509, 509, 509, - 509, 509, 509, 509, 375, 375, 354, 509, 509, 509, - 509, 509, 509, 509, 509, 509, 347, 380, 509, 497, - 386, 495, 496, 471, 347, 359, 380, 472, 377, 397, - 382, 387, 401, 402, 509, 509, 413, 509, 375, 509, - 509, 375, 375, 375, 428, 375, 509, 509, 485, 366, - 323, 427, 389, 438, 509, 389, 389, 438, 428, 438, - 428, 509, 375, 375, 375, 389, 389, 509, 356, 509, - 369, 482, 400, 406, 371, 428, 396, 405, 389, 392, - 480, 332, 404, 393, 427, 427, 427, 427, 427, 509, - 440, 454, 438, 348, 364, 344, 436, 463, 365, 438, - 352, 355, 361, 357, 464, 509, 433, 362, 358, 509, - 431, 434, 435, 466, 509, 363, 350, 351, 465, 432, - 486, 460, 367, 438, 483, 475, 372, 395, 474, 370, - 422, 438, 479, 438, 479, 479, 332, 413, 409, 413, - 403, 403, 439, 413, 403, 403, 413, 330, 509, 509, - 409, 509, 509, 403, 409, 423, 413, 509, 509, 509, - 509, 509, 509, 509, 509, 509, 509, 509, 409, 509, - 411, 509, 509, 509, 509, 509, 383, 509, 509, 509, - 484, 509, 454, 418, 509, 509, 509, 415, 376, 388, - 447, 481, 446, 454, 445, 448, 453, 360, 468, 469, - 384, 459, 444, 450, 415, 490, 476, 477, 407, 368, - 478, 456, 457, 458, 416, 417, 443, 390, 391, 442, - 441, 425, 426, 437, 374, 353, 329, 331, 333, 328, - 327, 324, 325, 326, 335, 336, 341, 343, 373, 340, - 339, 337, 338, 408, 410, 506, 498, 499, 505, 461, - 455, 470, 342, 500, 503, 491, 493, 492, 501, 508, - 502, 504, 507, 462, 430, 398, 399, 421, 420, 419, - 412, 414, 418, 424, 451, 489, 394, 429, 488, 487, - 449, 452, 467, - ); - public static $yyFallback = array(); - public $yyTraceFILE; - public $yyTracePrompt; -public $yyidx; -public $yyerrcnt; -public $yystack = array(); - public $yyTokenName = array( - '$', 'VERT', 'COLON', 'UNIMATH', - 'PHP', 'TEXT', 'STRIPON', 'STRIPOFF', - 'LITERALSTART', 'LITERALEND', 'LITERAL', 'SIMPELOUTPUT', - 'SIMPLETAG', 'SMARTYBLOCKCHILDPARENT', 'LDEL', 'RDEL', - 'DOLLARID', 'EQUAL', 'ID', 'PTR', - 'LDELMAKENOCACHE', 'LDELIF', 'LDELFOR', 'SEMICOLON', - 'INCDEC', 'TO', 'STEP', 'LDELFOREACH', - 'SPACE', 'AS', 'APTR', 'LDELSETFILTER', - 'CLOSETAG', 'LDELSLASH', 'ATTR', 'INTEGER', - 'COMMA', 'OPENP', 'CLOSEP', 'MATH', - 'ISIN', 'QMARK', 'NOT', 'TYPECAST', - 'HEX', 'DOT', 'INSTANCEOF', 'SINGLEQUOTESTRING', - 'DOUBLECOLON', 'NAMESPACE', 'AT', 'HATCH', - 'OPENB', 'CLOSEB', 'DOLLAR', 'LOGOP', - 'SLOGOP', 'TLOGOP', 'SINGLECOND', 'QUOTE', - 'BACKTICK', 'error', 'start', 'template', - 'literal_e2', 'literal_e1', 'smartytag', 'tagbody', - 'tag', 'outattr', 'eqoutattr', 'varindexed', - 'output', 'attributes', 'variable', 'value', - 'expr', 'modifierlist', 'statement', 'statements', - 'foraction', 'varvar', 'modparameters', 'attribute', - 'ternary', 'array', 'tlop', 'lop', - 'scond', 'function', 'ns1', 'doublequoted_with_quotes', - 'static_class_access', 'object', 'arrayindex', 'indexdef', - 'varvarele', 'objectchain', 'objectelement', 'method', - 'params', 'modifier', 'modparameter', 'arrayelements', - 'arrayelement', 'doublequoted', 'doublequotedcontent', + 509, 509, 509, 509, 509, 509, 509, 509, 509, 509, + 509, 509, 509, 509, 375, 354, 375, 380, 509, 509, + 347, 509, 509, 509, 509, 509, 509, 509, 509, 397, + 472, 347, 471, 387, 497, 495, 382, 386, 359, 377, + 380, 496, 402, 401, 509, 509, 413, 509, 375, 509, + 509, 375, 375, 485, 509, 375, 428, 509, 375, 366, + 323, 427, 389, 389, 438, 509, 389, 438, 428, 438, + 375, 509, 509, 389, 369, 389, 509, 375, 375, 356, + 428, 482, 405, 389, 406, 428, 396, 392, 400, 371, + 480, 404, 332, 393, 427, 427, 427, 427, 427, 509, + 440, 438, 454, 355, 509, 436, 434, 365, 433, 432, + 431, 465, 364, 509, 363, 466, 463, 362, 352, 509, + 351, 357, 435, 344, 350, 358, 361, 348, 464, 438, + 422, 460, 367, 474, 486, 372, 483, 395, 475, 438, + 370, 479, 479, 438, 438, 332, 479, 413, 409, 413, + 403, 403, 413, 439, 413, 403, 403, 509, 509, 409, + 330, 423, 509, 413, 509, 509, 509, 403, 509, 409, + 509, 509, 509, 509, 509, 509, 509, 509, 509, 509, + 383, 509, 509, 418, 509, 509, 415, 409, 509, 509, + 454, 509, 509, 509, 509, 484, 411, 509, 324, 426, + 415, 360, 442, 487, 444, 336, 443, 337, 488, 376, + 489, 490, 452, 481, 459, 454, 410, 441, 328, 419, + 325, 326, 437, 420, 477, 327, 476, 398, 399, 414, + 335, 421, 388, 424, 412, 451, 329, 331, 449, 333, + 384, 469, 500, 468, 491, 505, 343, 416, 417, 506, + 374, 391, 492, 493, 498, 341, 373, 418, 425, 353, + 501, 508, 507, 504, 502, 499, 461, 390, 368, 408, + 338, 503, 478, 453, 447, 446, 429, 445, 430, 448, + 450, 342, 462, 339, 340, 455, 470, 458, 457, 407, + 467, 456, 394, ); - public static $yyRuleName = array( + + public static $yyFallback = array(); + + public static $yyRuleName = array( 'start ::= template', 'template ::= template PHP', 'template ::= template TEXT', @@ -1270,7 +1126,8 @@ public $yystack = array(); 'doublequotedcontent ::= smartytag', 'doublequotedcontent ::= TEXT', ); - public static $yyRuleInfo = array( + + public static $yyRuleInfo = array( array(0 => 62, 1 => 1), array(0 => 63, 1 => 2), array(0 => 63, 1 => 2), @@ -1458,7 +1315,8 @@ public $yystack = array(); array(0 => 106, 1 => 1), array(0 => 106, 1 => 1), ); - public static $yyReduceMap = array( + + public static $yyReduceMap = array( 0 => 0, 1 => 1, 2 => 2, @@ -1644,16 +1502,172 @@ public $yystack = array(); 181 => 181, 184 => 184, 185 => 185, - ); /* Index of top element in stack */ - private $_retvalue; /* Shifts left before out of the error */ + ); /** + * result status + * + * @var bool + */ + public $successful = true; + + /** + * return value + * + * @var mixed + */ + public $retvalue = 0; + + /** + * @var + */ + public $yymajor; + + /** + * last index of array variable + * + * @var mixed + */ + public $last_index; + + /** + * last variable name + * + * @var string + */ + public $last_variable; + + /** + * root parse tree buffer + * + * @var Smarty_Internal_ParseTree_Template + */ + public $root_buffer; + + /** + * current parse tree object + * + * @var Smarty_Internal_ParseTree + */ + public $current_buffer; + + /** + * lexer object + * + * @var Smarty_Internal_Templatelexer + */ + public $lex; + + /** + * {strip} status + * + * @var bool + */ + public $strip = false; + + /** + * compiler object + * + * @var Smarty_Internal_TemplateCompilerBase + */ + public $compiler = null; + + /** + * smarty object + * + * @var Smarty + */ + public $smarty = null; + + /** + * template object + * + * @var Smarty_Internal_Template + */ + public $template = null; + + /** + * block nesting level + * + * @var int + */ + public $block_nesting_level = 0; + + /** + * security object + * + * @var Smarty_Security + */ + public $security = null; + + /** + * template prefix array + * + * @var \Smarty_Internal_ParseTree[] + */ + public $template_prefix = array(); + + /** + * template prefix array + * + * @var \Smarty_Internal_ParseTree[] + */ + public $template_postfix = array(); + + public $yyTraceFILE; + + public $yyTracePrompt; + + public $yyidx; + + public $yyerrcnt; + + public $yystack = array(); + + public $yyTokenName = array( + '$', 'VERT', 'COLON', 'UNIMATH', + 'PHP', 'TEXT', 'STRIPON', 'STRIPOFF', + 'LITERALSTART', 'LITERALEND', 'LITERAL', 'SIMPELOUTPUT', + 'SIMPLETAG', 'SMARTYBLOCKCHILDPARENT', 'LDEL', 'RDEL', + 'DOLLARID', 'EQUAL', 'ID', 'PTR', + 'LDELMAKENOCACHE', 'LDELIF', 'LDELFOR', 'SEMICOLON', + 'INCDEC', 'TO', 'STEP', 'LDELFOREACH', + 'SPACE', 'AS', 'APTR', 'LDELSETFILTER', + 'CLOSETAG', 'LDELSLASH', 'ATTR', 'INTEGER', + 'COMMA', 'OPENP', 'CLOSEP', 'MATH', + 'ISIN', 'QMARK', 'NOT', 'TYPECAST', + 'HEX', 'DOT', 'INSTANCEOF', 'SINGLEQUOTESTRING', + 'DOUBLECOLON', 'NAMESPACE', 'AT', 'HATCH', + 'OPENB', 'CLOSEB', 'DOLLAR', 'LOGOP', + 'SLOGOP', 'TLOGOP', 'SINGLECOND', 'QUOTE', + 'BACKTICK', 'error', 'start', 'template', + 'literal_e2', 'literal_e1', 'smartytag', 'tagbody', + 'tag', 'outattr', 'eqoutattr', 'varindexed', + 'output', 'attributes', 'variable', 'value', + 'expr', 'modifierlist', 'statement', 'statements', + 'foraction', 'varvar', 'modparameters', 'attribute', + 'ternary', 'array', 'tlop', 'lop', + 'scond', 'function', 'ns1', 'doublequoted_with_quotes', + 'static_class_access', 'object', 'arrayindex', 'indexdef', + 'varvarele', 'objectchain', 'objectelement', 'method', + 'params', 'modifier', 'modparameter', 'arrayelements', + 'arrayelement', 'doublequoted', 'doublequotedcontent', + ); + + /** + * internal error flag + * + * @var bool + */ + private $internalError = false; /* Index of top element in stack */ + private $_retvalue; /* Shifts left before out of the error */ + /** * constructor * * @param Smarty_Internal_Templatelexer $lex * @param Smarty_Internal_TemplateCompilerBase $compiler */ - function __construct(Smarty_Internal_Templatelexer $lex, Smarty_Internal_TemplateCompilerBase $compiler) + public function __construct(Smarty_Internal_Templatelexer $lex, Smarty_Internal_TemplateCompilerBase $compiler) { $this->lex = $lex; $this->compiler = $compiler; @@ -1662,6 +1676,13 @@ public $yystack = array(); $this->security = isset($this->smarty->security_policy) ? $this->smarty->security_policy : false; $this->current_buffer = $this->root_buffer = new Smarty_Internal_ParseTree_Template(); } /* The parser's stack */ + public static function yy_destructor($yymajor, $yypminor) + { + switch ($yymajor) { + default: + break; /* If no destructor action specified: do nothing */ + } + } /** * insert PHP code in current buffer @@ -1709,7 +1730,7 @@ public $yystack = array(); { if (!$TraceFILE) { $zTracePrompt = 0; - } else if (!$zTracePrompt) { + } elseif (!$zTracePrompt) { $TraceFILE = 0; } $this->yyTraceFILE = $TraceFILE; @@ -1734,14 +1755,6 @@ public $yystack = array(); } } - public static function yy_destructor($yymajor, $yypminor) - { - switch ($yymajor) { - default: - break; /* If no destructor action specified: do nothing */ - } - } - public function yy_pop_parser_stack() { if (empty($this->yystack)) { @@ -1749,9 +1762,11 @@ public $yystack = array(); } $yytos = array_pop($this->yystack); if ($this->yyTraceFILE && $this->yyidx >= 0) { - fwrite($this->yyTraceFILE, - $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . - "\n"); + fwrite( + $this->yyTraceFILE, + $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[ $yytos->major ] . + "\n" + ); } $yymajor = $yytos->major; self::yy_destructor($yymajor, $yytos->minor); @@ -1761,7 +1776,7 @@ public $yystack = array(); public function __destruct() { - while ($this->yystack !== Array()) { + while ($this->yystack !== array()) { $this->yy_pop_parser_stack(); } if (is_resource($this->yyTraceFILE)) { @@ -1803,7 +1818,8 @@ public $yystack = array(); $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ]; $nextstate = $this->yy_find_reduce_action( $this->yystack[ $this->yyidx ]->stateno, - self::$yyRuleInfo[ $yyruleno ][ 0 ]); + self::$yyRuleInfo[ $yyruleno ][ 0 ] + ); if (isset(self::$yyExpectedTokens[ $nextstate ])) { $expected = array_merge($expected, self::$yyExpectedTokens[ $nextstate ]); if (isset($res4[ $nextstate ][ $token ])) { @@ -1829,14 +1845,14 @@ public $yystack = array(); $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ]; $this->yystack[ $this->yyidx ] = $x; continue 2; - } else if ($nextstate === self::YYNSTATE + self::YYNRULE + 1) { + } elseif ($nextstate === self::YYNSTATE + self::YYNRULE + 1) { $this->yyidx = $yyidx; $this->yystack = $stack; // the last token was just ignored, we can't accept // by ignoring input, this is in essence ignoring a // syntax error! return array_unique($expected); - } else if ($nextstate === self::YY_NO_ACTION) { + } elseif ($nextstate === self::YY_NO_ACTION) { $this->yyidx = $yyidx; $this->yystack = $stack; // input accepted, but not shifted (I guess) @@ -1889,7 +1905,8 @@ public $yystack = array(); $this->yyidx -= self::$yyRuleInfo[ $yyruleno ][ 1 ]; $nextstate = $this->yy_find_reduce_action( $this->yystack[ $this->yyidx ]->stateno, - self::$yyRuleInfo[ $yyruleno ][ 0 ]); + self::$yyRuleInfo[ $yyruleno ][ 0 ] + ); if (isset($res2[ $nextstate ][ $token ])) { if ($res2[ $nextstate ][ $token ]) { $this->yyidx = $yyidx; @@ -1897,10 +1914,9 @@ public $yystack = array(); return true; } } else { - if ($res2[ $nextstate ][ $token ] = (isset(self::$yyExpectedTokens[ $nextstate ]) && - in_array($token, - self::$yyExpectedTokens[ $nextstate ], - true))) { + if ($res2[ $nextstate ][ $token ] = + (isset(self::$yyExpectedTokens[ $nextstate ]) && + in_array($token, self::$yyExpectedTokens[ $nextstate ], true))) { $this->yyidx = $yyidx; $this->yystack = $stack; return true; @@ -1914,7 +1930,7 @@ public $yystack = array(); $x->major = self::$yyRuleInfo[ $yyruleno ][ 0 ]; $this->yystack[ $this->yyidx ] = $x; continue 2; - } else if ($nextstate === self::YYNSTATE + self::YYNRULE + 1) { + } elseif ($nextstate === self::YYNSTATE + self::YYNRULE + 1) { $this->yyidx = $yyidx; $this->yystack = $stack; if (!$token) { @@ -1925,7 +1941,7 @@ public $yystack = array(); // by ignoring input, this is in essence ignoring a // syntax error! return false; - } else if ($nextstate === self::YY_NO_ACTION) { + } elseif ($nextstate === self::YY_NO_ACTION) { $this->yyidx = $yyidx; $this->yystack = $stack; // input accepted, but not shifted (I guess) @@ -1963,10 +1979,9 @@ public $yystack = array(); if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback) && ($iFallback = self::$yyFallback[ $iLookAhead ]) != 0) { if ($this->yyTraceFILE) { - fwrite($this->yyTraceFILE, - $this->yyTracePrompt . 'FALLBACK ' . - $this->yyTokenName[ $iLookAhead ] . ' => ' . - $this->yyTokenName[ $iFallback ] . "\n"); + fwrite($this->yyTraceFILE, $this->yyTracePrompt . 'FALLBACK ' . + $this->yyTokenName[ $iLookAhead ] . ' => ' . + $this->yyTokenName[ $iFallback ] . "\n"); } return $this->yy_find_shift_action($iFallback); } @@ -1998,8 +2013,7 @@ public $yystack = array(); } } - #line 234 "../smarty/lexer/smarty_internal_templateparser.y" - + // line 234 "../smarty/lexer/smarty_internal_templateparser.y" public function yy_shift($yyNewState, $yyMajor, $yypMinor) { $this->yyidx++; @@ -2011,7 +2025,7 @@ public $yystack = array(); while ($this->yyidx >= 0) { $this->yy_pop_parser_stack(); } - #line 221 "../smarty/lexer/smarty_internal_templateparser.y" + // line 221 "../smarty/lexer/smarty_internal_templateparser.y" $this->internalError = true; $this->compiler->trigger_template_error('Stack overflow in template parser'); return; @@ -2022,37 +2036,39 @@ public $yystack = array(); $yytos->minor = $yypMinor; $this->yystack[] = $yytos; if ($this->yyTraceFILE && $this->yyidx > 0) { - fprintf($this->yyTraceFILE, - "%sShift %d\n", - $this->yyTracePrompt, - $yyNewState); + fprintf( + $this->yyTraceFILE, + "%sShift %d\n", + $this->yyTracePrompt, + $yyNewState + ); fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt); for ($i = 1; $i <= $this->yyidx; $i++) { - fprintf($this->yyTraceFILE, - " %s", - $this->yyTokenName[ $this->yystack[ $i ]->major ]); + fprintf( + $this->yyTraceFILE, + " %s", + $this->yyTokenName[ $this->yystack[ $i ]->major ] + ); } fwrite($this->yyTraceFILE, "\n"); } } - #line 242 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r0() + // line 242 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r0() { $this->root_buffer->prepend_array($this, $this->template_prefix); $this->root_buffer->append_array($this, $this->template_postfix); $this->_retvalue = $this->root_buffer->to_smarty_php($this); } - #line 251 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r1() + // line 251 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r1() { - $code = $this->compiler->compileTag('private_php', - array(array('code' => $this->yystack[ $this->yyidx + 0 ]->minor), - array('type' => $this->lex->phpType)), - array()); + $code = + $this->compiler->compileTag('private_php', + array(array('code' => $this->yystack[ $this->yyidx + 0 ]->minor), array('type' => $this->lex->phpType)), + array()); if ($this->compiler->has_code && !empty($code)) { $tmp = ''; foreach ($this->compiler->prefix_code as $code) { @@ -2060,114 +2076,94 @@ public $yystack = array(); } $this->compiler->prefix_code = array(); $this->current_buffer->append_subtree($this, - new Smarty_Internal_ParseTree_Tag($this, - $this->compiler->processNocacheCode($tmp . - $code, - true))); + new Smarty_Internal_ParseTree_Tag($this, $this->compiler->processNocacheCode($tmp . $code, true))); } } - #line 255 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r2() + // line 255 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r2() { $this->current_buffer->append_subtree($this, - $this->compiler->processText($this->yystack[ $this->yyidx + 0 ]->minor)); + $this->compiler->processText($this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 259 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r3() + // line 259 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r3() { $this->strip = true; } - #line 264 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r4() + // line 264 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r4() { $this->strip = false; } - #line 269 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r5() + // line 269 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r5() { $this->current_buffer->append_subtree($this, - new Smarty_Internal_ParseTree_Text($this->yystack[ $this->yyidx + - -1 ]->minor)); + new Smarty_Internal_ParseTree_Text($this->yystack[ $this->yyidx + -1 ]->minor)); } - #line 272 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r6() + // line 272 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r6() { $this->_retvalue = $this->yystack[ $this->yyidx + -3 ]->minor . $this->yystack[ $this->yyidx + -1 ]->minor; } - #line 276 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r7() + // line 276 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r7() { $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 281 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r8() + // line 281 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r8() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 285 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r9() + // line 285 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r9() { $this->_retvalue = ''; } - #line 297 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r10() + // line 297 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r10() { if ($this->compiler->has_code) { $this->current_buffer->append_subtree($this, - $this->mergePrefixCode($this->yystack[ $this->yyidx + 0 ]->minor)); + $this->mergePrefixCode($this->yystack[ $this->yyidx + 0 ]->minor)); } $this->compiler->has_variable_string = false; $this->block_nesting_level = count($this->compiler->_tag_stack); } - #line 307 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r12() + // line 307 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r12() { - $var = trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, - $this->compiler->getLdelLength(), - -$this->compiler->getRdelLength()), - ' $'); + $var = + trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, $this->compiler->getLdelLength(), + -$this->compiler->getRdelLength()), ' $'); if (preg_match('/^(.*)(\s+nocache)$/', $var, $match)) { - $this->_retvalue = $this->compiler->compileTag('private_print_expression', - array('nocache'), - array('value' => $this->compiler->compileVariable('\'' . - $match[ 1 ] . - '\''))); + $this->_retvalue = + $this->compiler->compileTag('private_print_expression', array('nocache'), + array('value' => $this->compiler->compileVariable('\'' . $match[ 1 ] . '\''))); } else { - $this->_retvalue = $this->compiler->compileTag('private_print_expression', - array(), - array('value' => $this->compiler->compileVariable('\'' . - $var . - '\''))); + $this->_retvalue = + $this->compiler->compileTag('private_print_expression', array(), + array('value' => $this->compiler->compileVariable('\'' . $var . '\''))); } } - #line 328 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r13() + // line 328 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r13() { - $tag = trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, - $this->compiler->getLdelLength(), - -$this->compiler->getRdelLength())); + $tag = + trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, $this->compiler->getLdelLength(), + -$this->compiler->getRdelLength())); if ($tag == 'strip') { $this->strip = true; $this->_retvalue = null;; @@ -2188,328 +2184,283 @@ public $yystack = array(); } } - #line 339 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r14() + // line 339 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r14() { $j = strrpos($this->yystack[ $this->yyidx + 0 ]->minor, '.'); if ($this->yystack[ $this->yyidx + 0 ]->minor[ $j + 1 ] == 'c') { // {$smarty.block.child} $this->_retvalue = - $this->compiler->compileTag('child', array(), array($this->yystack[ $this->yyidx + 0 ]->minor));; + $this->compiler->compileTag('child', array(), array($this->yystack[ $this->yyidx + 0 ]->minor)); } else { // {$smarty.block.parent} $this->_retvalue = - $this->compiler->compileTag('parent', array(), array($this->yystack[ $this->yyidx + 0 ]->minor));; + $this->compiler->compileTag('parent', array(), array($this->yystack[ $this->yyidx + 0 ]->minor)); } } - #line 343 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r15() + // line 343 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r15() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; } - #line 347 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r16() + // line 347 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r16() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; } - #line 356 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r17() + // line 356 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r17() { - $this->_retvalue = $this->compiler->compileTag('private_print_expression', - $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ], - array('value' => $this->yystack[ $this->yyidx + - 0 ]->minor[ 0 ])); + $this->_retvalue = + $this->compiler->compileTag('private_print_expression', $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ], + array('value' => $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ])); } - #line 360 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r18() + // line 360 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r18() { - $this->_retvalue = $this->compiler->compileTag('assign', - array_merge(array(array('value' => $this->yystack[ $this->yyidx + - 0 ]->minor[ 0 ]), - array('var' => '\'' . - substr($this->yystack[ $this->yyidx + - -1 ]->minor, - 1) . '\'')), - $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ])); + $this->_retvalue = + $this->compiler->compileTag('assign', array_merge(array( + array('value' => $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ]), + array('var' => '\'' . substr($this->yystack[ $this->yyidx + -1 ]->minor, 1) . '\'') + ), $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ])); } - #line 364 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r19() + // line 364 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r19() { - $this->_retvalue = $this->compiler->compileTag('assign', - array_merge(array(array('value' => $this->yystack[ $this->yyidx + - 0 ]->minor[ 0 ]), - array('var' => $this->yystack[ $this->yyidx + - -1 ]->minor[ 'var' ])), - $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ]), - array('smarty_internal_index' => $this->yystack[ $this->yyidx + - -1 ]->minor[ 'smarty_internal_index' ])); + $this->_retvalue = + $this->compiler->compileTag('assign', array_merge(array( + array('value' => $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ]), + array('var' => $this->yystack[ $this->yyidx + -1 ]->minor[ 'var' ]) + ), $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ]), array( + 'smarty_internal_index' => $this->yystack[ $this->yyidx + + -1 ]->minor[ 'smarty_internal_index' ] + )); } - #line 368 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r20() + // line 368 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r20() { $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 383 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r21() + // line 383 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r21() { $this->_retvalue = array($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 393 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r25() + // line 393 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r25() { if (defined($this->yystack[ $this->yyidx + -1 ]->minor)) { if ($this->security) { $this->security->isTrustedConstant($this->yystack[ $this->yyidx + -1 ]->minor, $this->compiler); } - $this->_retvalue = $this->compiler->compileTag('private_print_expression', - $this->yystack[ $this->yyidx + 0 ]->minor, - array('value' => $this->yystack[ $this->yyidx + - -1 ]->minor)); + $this->_retvalue = + $this->compiler->compileTag('private_print_expression', $this->yystack[ $this->yyidx + 0 ]->minor, + array('value' => $this->yystack[ $this->yyidx + -1 ]->minor)); } else { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -1 ]->minor, - $this->yystack[ $this->yyidx + 0 ]->minor); + $this->_retvalue = + $this->compiler->compileTag($this->yystack[ $this->yyidx + -1 ]->minor, + $this->yystack[ $this->yyidx + 0 ]->minor); } } - #line 406 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r26() + // line 406 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r26() { if (defined($this->yystack[ $this->yyidx + 0 ]->minor)) { if ($this->security) { $this->security->isTrustedConstant($this->yystack[ $this->yyidx + 0 ]->minor, $this->compiler); } - $this->_retvalue = $this->compiler->compileTag('private_print_expression', - array(), - array('value' => $this->yystack[ $this->yyidx + 0 ]->minor)); + $this->_retvalue = + $this->compiler->compileTag('private_print_expression', array(), + array('value' => $this->yystack[ $this->yyidx + 0 ]->minor)); } else { $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + 0 ]->minor, array()); } } - #line 418 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r27() + // line 418 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r27() { if (defined($this->yystack[ $this->yyidx + -2 ]->minor)) { if ($this->security) { $this->security->isTrustedConstant($this->yystack[ $this->yyidx + -2 ]->minor, $this->compiler); } - $this->_retvalue = $this->compiler->compileTag('private_print_expression', - $this->yystack[ $this->yyidx + 0 ]->minor, - array('value' => $this->yystack[ $this->yyidx + - -2 ]->minor, - 'modifierlist' => $this->yystack[ $this->yyidx + - -1 ]->minor)); + $this->_retvalue = + $this->compiler->compileTag('private_print_expression', $this->yystack[ $this->yyidx + 0 ]->minor, + array( + 'value' => $this->yystack[ $this->yyidx + -2 ]->minor, + 'modifierlist' => $this->yystack[ $this->yyidx + -1 ]->minor + )); } else { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -2 ]->minor, - $this->yystack[ $this->yyidx + 0 ]->minor, - array('modifierlist' => $this->yystack[ $this->yyidx + - -1 ]->minor)); + $this->_retvalue = + $this->compiler->compileTag($this->yystack[ $this->yyidx + -2 ]->minor, + $this->yystack[ $this->yyidx + 0 ]->minor, + array('modifierlist' => $this->yystack[ $this->yyidx + -1 ]->minor)); } } - #line 423 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r28() + // line 423 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r28() { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -3 ]->minor, - $this->yystack[ $this->yyidx + 0 ]->minor, - array('object_method' => $this->yystack[ $this->yyidx + - -1 ]->minor)); + $this->_retvalue = + $this->compiler->compileTag($this->yystack[ $this->yyidx + -3 ]->minor, + $this->yystack[ $this->yyidx + 0 ]->minor, + array('object_method' => $this->yystack[ $this->yyidx + -1 ]->minor)); } - #line 428 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r29() + // line 428 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r29() { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -4 ]->minor, - $this->yystack[ $this->yyidx + 0 ]->minor, - array('modifierlist' => $this->yystack[ $this->yyidx + - -1 ]->minor, - 'object_method' => $this->yystack[ $this->yyidx + - -2 ]->minor)); + $this->_retvalue = + $this->compiler->compileTag($this->yystack[ $this->yyidx + -4 ]->minor, + $this->yystack[ $this->yyidx + 0 ]->minor, array( + 'modifierlist' => $this->yystack[ $this->yyidx + -1 ]->minor, + 'object_method' => $this->yystack[ $this->yyidx + -2 ]->minor + )); } - #line 433 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r30() + // line 433 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r30() { - $this->_retvalue = $this->compiler->compileTag('make_nocache', - array(array('var' => '\'' . substr($this->yystack[ $this->yyidx + - 0 ]->minor, - 1) . '\''))); + $this->_retvalue = + $this->compiler->compileTag('make_nocache', + array(array('var' => '\'' . substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . '\''))); } - #line 438 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r31() + // line 438 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r31() { $tag = trim(substr($this->yystack[ $this->yyidx + -1 ]->minor, $this->compiler->getLdelLength())); - $this->_retvalue = $this->compiler->compileTag(($tag === 'else if') ? 'elseif' : $tag, - array(), - array('if condition' => $this->yystack[ $this->yyidx + - 0 ]->minor)); + $this->_retvalue = + $this->compiler->compileTag(($tag === 'else if') ? 'elseif' : $tag, array(), + array('if condition' => $this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 443 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r32() + // line 443 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r32() { $tag = trim(substr($this->yystack[ $this->yyidx + -2 ]->minor, $this->compiler->getLdelLength())); - $this->_retvalue = $this->compiler->compileTag(($tag === 'else if') ? 'elseif' : $tag, - $this->yystack[ $this->yyidx + 0 ]->minor, - array('if condition' => $this->yystack[ $this->yyidx + - -1 ]->minor)); + $this->_retvalue = + $this->compiler->compileTag(($tag === 'else if') ? 'elseif' : $tag, + $this->yystack[ $this->yyidx + 0 ]->minor, + array('if condition' => $this->yystack[ $this->yyidx + -1 ]->minor)); } - #line 454 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r33() + // line 454 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r33() { $tag = trim(substr($this->yystack[ $this->yyidx + -1 ]->minor, $this->compiler->getLdelLength())); - $this->_retvalue = $this->compiler->compileTag(($tag === 'else if') ? 'elseif' : $tag, - array(), - array('if condition' => $this->yystack[ $this->yyidx + - 0 ]->minor)); + $this->_retvalue = + $this->compiler->compileTag(($tag === 'else if') ? 'elseif' : $tag, array(), + array('if condition' => $this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 458 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r35() + // line 458 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r35() { - $this->_retvalue = $this->compiler->compileTag('for', - array_merge($this->yystack[ $this->yyidx + 0 ]->minor, - array(array('start' => $this->yystack[ $this->yyidx + - -6 ]->minor), - array('ifexp' => $this->yystack[ $this->yyidx + - -4 ]->minor), - array('var' => $this->yystack[ $this->yyidx + - -2 ]->minor), - array('step' => $this->yystack[ $this->yyidx + - -1 ]->minor))), - 1); + $this->_retvalue = + $this->compiler->compileTag('for', array_merge($this->yystack[ $this->yyidx + 0 ]->minor, array( + array('start' => $this->yystack[ $this->yyidx + -6 ]->minor), + array('ifexp' => $this->yystack[ $this->yyidx + -4 ]->minor), + array('var' => $this->yystack[ $this->yyidx + -2 ]->minor), + array('step' => $this->yystack[ $this->yyidx + -1 ]->minor) + )), 1); } - #line 466 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r36() + // line 466 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r36() { $this->_retvalue = '=' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 470 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r38() + // line 470 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r38() { - $this->_retvalue = $this->compiler->compileTag('for', - array_merge($this->yystack[ $this->yyidx + 0 ]->minor, - array(array('start' => $this->yystack[ $this->yyidx + - -3 ]->minor), - array('to' => $this->yystack[ $this->yyidx + - -1 ]->minor))), - 0); + $this->_retvalue = + $this->compiler->compileTag('for', array_merge($this->yystack[ $this->yyidx + 0 ]->minor, array( + array('start' => $this->yystack[ $this->yyidx + -3 ]->minor), + array('to' => $this->yystack[ $this->yyidx + -1 ]->minor) + )), 0); } - #line 475 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r39() + // line 475 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r39() { - $this->_retvalue = $this->compiler->compileTag('for', - array_merge($this->yystack[ $this->yyidx + 0 ]->minor, - array(array('start' => $this->yystack[ $this->yyidx + - -5 ]->minor), - array('to' => $this->yystack[ $this->yyidx + - -3 ]->minor), - array('step' => $this->yystack[ $this->yyidx + - -1 ]->minor))), - 0); + $this->_retvalue = + $this->compiler->compileTag('for', array_merge($this->yystack[ $this->yyidx + 0 ]->minor, array( + array('start' => $this->yystack[ $this->yyidx + -5 ]->minor), + array('to' => $this->yystack[ $this->yyidx + -3 ]->minor), + array('step' => $this->yystack[ $this->yyidx + -1 ]->minor) + )), 0); } - #line 479 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r40() + // line 479 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r40() { - $this->_retvalue = $this->compiler->compileTag('foreach', - array_merge($this->yystack[ $this->yyidx + 0 ]->minor, - array(array('from' => $this->yystack[ $this->yyidx + - -3 ]->minor), - array('item' => $this->yystack[ $this->yyidx + - -1 ]->minor)))); + $this->_retvalue = + $this->compiler->compileTag('foreach', array_merge($this->yystack[ $this->yyidx + 0 ]->minor, array( + array('from' => $this->yystack[ $this->yyidx + -3 ]->minor), + array('item' => $this->yystack[ $this->yyidx + -1 ]->minor) + ))); } - #line 482 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r41() + // line 482 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r41() { - $this->_retvalue = $this->compiler->compileTag('foreach', - array_merge($this->yystack[ $this->yyidx + 0 ]->minor, - array(array('from' => $this->yystack[ $this->yyidx + - -5 ]->minor), - array('item' => $this->yystack[ $this->yyidx + - -1 ]->minor), - array('key' => $this->yystack[ $this->yyidx + - -3 ]->minor)))); + $this->_retvalue = + $this->compiler->compileTag('foreach', array_merge($this->yystack[ $this->yyidx + 0 ]->minor, array( + array('from' => $this->yystack[ $this->yyidx + -5 ]->minor), + array('item' => $this->yystack[ $this->yyidx + -1 ]->minor), + array('key' => $this->yystack[ $this->yyidx + -3 ]->minor) + ))); } - #line 487 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r42() + // line 487 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r42() { $this->_retvalue = $this->compiler->compileTag('foreach', $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 491 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r43() + // line 491 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r43() { - $this->_retvalue = $this->compiler->compileTag('setfilter', - array(), - array('modifier_list' => array(array_merge(array($this->yystack[ $this->yyidx + - -1 ]->minor), - $this->yystack[ $this->yyidx + - 0 ]->minor)))); - } - - #line 497 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r44() - { - $this->_retvalue = $this->compiler->compileTag('setfilter', - array(), - array('modifier_list' => array_merge(array(array_merge(array($this->yystack[ $this->yyidx + - -2 ]->minor), - $this->yystack[ $this->yyidx + - -1 ]->minor)), - $this->yystack[ $this->yyidx + - 0 ]->minor))); + $this->_retvalue = + $this->compiler->compileTag('setfilter', array(), array( + 'modifier_list' => array( + array_merge(array($this->yystack[ $this->yyidx + -1 ]->minor), + $this->yystack[ $this->yyidx + 0 ]->minor) + ) + )); } - #line 506 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r45() + // line 497 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r44() { - $tag = trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, - $this->compiler->getLdelLength(), - -$this->compiler->getRdelLength()), - ' /'); + $this->_retvalue = + $this->compiler->compileTag('setfilter', array(), array( + 'modifier_list' => array_merge(array( + array_merge(array( + $this->yystack[ $this->yyidx + + -2 ]->minor + ), $this->yystack[ $this->yyidx + -1 ]->minor) + ), $this->yystack[ $this->yyidx + 0 ]->minor) + )); + } + + // line 506 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r45() + { + $tag = + trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, $this->compiler->getLdelLength(), + -$this->compiler->getRdelLength()), ' /'); if ($tag === 'strip') { $this->strip = false; $this->_retvalue = null; @@ -2518,70 +2469,59 @@ public $yystack = array(); } } - #line 510 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r46() + // line 510 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r46() { $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + 0 ]->minor . 'close', array()); } - #line 515 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r47() + // line 515 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r47() { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -1 ]->minor . 'close', - array(), - array('modifier_list' => $this->yystack[ $this->yyidx + - 0 ]->minor)); + $this->_retvalue = + $this->compiler->compileTag($this->yystack[ $this->yyidx + -1 ]->minor . 'close', array(), + array('modifier_list' => $this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 519 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r48() + // line 519 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r48() { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -2 ]->minor . 'close', - array(), - array('object_method' => $this->yystack[ $this->yyidx + - 0 ]->minor)); + $this->_retvalue = + $this->compiler->compileTag($this->yystack[ $this->yyidx + -2 ]->minor . 'close', array(), + array('object_method' => $this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 527 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r49() + // line 527 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r49() { - $this->_retvalue = $this->compiler->compileTag($this->yystack[ $this->yyidx + -3 ]->minor . 'close', - array(), - array('object_method' => $this->yystack[ $this->yyidx + - -1 ]->minor, - 'modifier_list' => $this->yystack[ $this->yyidx + - 0 ]->minor)); + $this->_retvalue = + $this->compiler->compileTag($this->yystack[ $this->yyidx + -3 ]->minor . 'close', array(), array( + 'object_method' => $this->yystack[ $this->yyidx + -1 ]->minor, + 'modifier_list' => $this->yystack[ $this->yyidx + 0 ]->minor + )); } - #line 533 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r50() + // line 533 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r50() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; $this->_retvalue[] = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 538 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r51() + // line 538 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r51() { $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor); } - #line 543 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r52() + // line 543 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r52() { $this->_retvalue = array(); } - #line 554 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r53() + // line 554 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r53() { if (defined($this->yystack[ $this->yyidx + 0 ]->minor)) { if ($this->security) { @@ -2591,196 +2531,202 @@ public $yystack = array(); array($this->yystack[ $this->yyidx + -2 ]->minor => $this->yystack[ $this->yyidx + 0 ]->minor); } else { $this->_retvalue = - array($this->yystack[ $this->yyidx + -2 ]->minor => '\'' . $this->yystack[ $this->yyidx + 0 ]->minor . - '\''); + array( + $this->yystack[ $this->yyidx + -2 ]->minor => '\'' . + $this->yystack[ $this->yyidx + 0 ]->minor . + '\'' + ); } } - #line 562 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r54() + // line 562 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r54() { $this->_retvalue = - array(trim($this->yystack[ $this->yyidx + -1 ]->minor, " =\n\r\t") => $this->yystack[ $this->yyidx + - 0 ]->minor); + array( + trim($this->yystack[ $this->yyidx + -1 ]->minor, " =\n\r\t") => $this->yystack[ $this->yyidx + + 0 ]->minor + ); } - #line 574 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r56() + // line 574 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r56() { $this->_retvalue = '\'' . $this->yystack[ $this->yyidx + 0 ]->minor . '\''; } - #line 587 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r59() + // line 587 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r59() { $this->_retvalue = array($this->yystack[ $this->yyidx + -2 ]->minor => $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 592 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r61() + // line 592 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r61() { $this->yystack[ $this->yyidx + -2 ]->minor[] = $this->yystack[ $this->yyidx + 0 ]->minor; $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor; } - #line 599 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r62() + // line 599 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r62() { - $this->_retvalue = array('var' => '\'' . substr($this->yystack[ $this->yyidx + -2 ]->minor, 1) . '\'', - 'value' => $this->yystack[ $this->yyidx + 0 ]->minor); + $this->_retvalue = + array( + 'var' => '\'' . substr($this->yystack[ $this->yyidx + -2 ]->minor, 1) . '\'', + 'value' => $this->yystack[ $this->yyidx + 0 ]->minor + ); } - #line 603 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r64() + // line 603 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r64() { - $this->_retvalue = array('var' => $this->yystack[ $this->yyidx + -2 ]->minor, - 'value' => $this->yystack[ $this->yyidx + 0 ]->minor); + $this->_retvalue = + array( + 'var' => $this->yystack[ $this->yyidx + -2 ]->minor, + 'value' => $this->yystack[ $this->yyidx + 0 ]->minor + ); } - #line 623 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r65() + // line 623 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r65() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; } - #line 628 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r68() + // line 628 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r68() { $this->_retvalue = - '$_smarty_tpl->getStreamVariable(\'' . substr($this->yystack[ $this->yyidx + -2 ]->minor, 1) . '://' . - $this->yystack[ $this->yyidx + 0 ]->minor . '\')'; + '$_smarty_tpl->getStreamVariable(\'' . + substr($this->yystack[ $this->yyidx + -2 ]->minor, 1) . + '://' . + $this->yystack[ $this->yyidx + 0 ]->minor . + '\')'; } - #line 642 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r69() + // line 642 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r69() { $this->_retvalue = - $this->yystack[ $this->yyidx + -2 ]->minor . trim($this->yystack[ $this->yyidx + -1 ]->minor) . + $this->yystack[ $this->yyidx + -2 ]->minor . + trim($this->yystack[ $this->yyidx + -1 ]->minor) . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 648 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r72() + // line 648 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r72() { - $this->_retvalue = $this->compiler->compileTag('private_modifier', - array(), - array('value' => $this->yystack[ $this->yyidx + - -1 ]->minor, - 'modifierlist' => $this->yystack[ $this->yyidx + - 0 ]->minor)); + $this->_retvalue = + $this->compiler->compileTag('private_modifier', array(), array( + 'value' => $this->yystack[ $this->yyidx + -1 ]->minor, + 'modifierlist' => $this->yystack[ $this->yyidx + 0 ]->minor + )); } - #line 652 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r73() + // line 652 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r73() { $this->_retvalue = - $this->yystack[ $this->yyidx + -1 ]->minor[ 'pre' ] . $this->yystack[ $this->yyidx + -2 ]->minor . - $this->yystack[ $this->yyidx + -1 ]->minor[ 'op' ] . $this->yystack[ $this->yyidx + 0 ]->minor . ')'; + $this->yystack[ $this->yyidx + -1 ]->minor[ 'pre' ] . + $this->yystack[ $this->yyidx + -2 ]->minor . + $this->yystack[ $this->yyidx + -1 ]->minor[ 'op' ] . + $this->yystack[ $this->yyidx + 0 ]->minor . + ')'; } - #line 656 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r74() + // line 656 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r74() { - $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor . $this->yystack[ $this->yyidx + -1 ]->minor . - $this->yystack[ $this->yyidx + 0 ]->minor; + $this->_retvalue = + $this->yystack[ $this->yyidx + -2 ]->minor . + $this->yystack[ $this->yyidx + -1 ]->minor . + $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 660 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r75() + // line 660 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r75() { $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor . $this->yystack[ $this->yyidx + -1 ]->minor . ')'; } - #line 664 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r76() + // line 664 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r76() { $this->_retvalue = - 'in_array(' . $this->yystack[ $this->yyidx + -2 ]->minor . ',' . $this->yystack[ $this->yyidx + 0 ]->minor . + 'in_array(' . + $this->yystack[ $this->yyidx + -2 ]->minor . + ',' . + $this->yystack[ $this->yyidx + 0 ]->minor . ')'; } - #line 672 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r77() + // line 672 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r77() { - $this->_retvalue = 'in_array(' . $this->yystack[ $this->yyidx + -2 ]->minor . ',(array)' . - $this->yystack[ $this->yyidx + 0 ]->minor . ')'; + $this->_retvalue = + 'in_array(' . + $this->yystack[ $this->yyidx + -2 ]->minor . + ',(array)' . + $this->yystack[ $this->yyidx + 0 ]->minor . + ')'; } - #line 676 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r78() + // line 676 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r78() { - $this->_retvalue = $this->yystack[ $this->yyidx + -5 ]->minor . ' ? ' . $this->compiler->compileVariable('\'' . - substr($this->yystack[ $this->yyidx + - -2 ]->minor, - 1) . - '\'') . - ' : ' . $this->yystack[ $this->yyidx + 0 ]->minor; + $this->_retvalue = + $this->yystack[ $this->yyidx + -5 ]->minor . + ' ? ' . + $this->compiler->compileVariable('\'' . substr($this->yystack[ $this->yyidx + -2 ]->minor, 1) . '\'') . + ' : ' . + $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 686 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r79() + // line 686 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r79() { $this->_retvalue = - $this->yystack[ $this->yyidx + -5 ]->minor . ' ? ' . $this->yystack[ $this->yyidx + -2 ]->minor . ' : ' . + $this->yystack[ $this->yyidx + -5 ]->minor . + ' ? ' . + $this->yystack[ $this->yyidx + -2 ]->minor . + ' : ' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 691 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r81() + // line 691 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r81() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 712 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r82() + // line 712 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r82() { $this->_retvalue = '!' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 716 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r87() + // line 716 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r87() { $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor . '.' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 720 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r88() + // line 720 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r88() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . '.'; } - #line 725 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r89() + // line 725 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r89() { $this->_retvalue = '.' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 742 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r90() + // line 742 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r90() { if (defined($this->yystack[ $this->yyidx + 0 ]->minor)) { if ($this->security) { @@ -2792,32 +2738,30 @@ public $yystack = array(); } } - #line 746 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r92() + // line 746 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r92() { $this->_retvalue = '(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')'; } - #line 764 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r93() + // line 764 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r93() { - $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor . $this->yystack[ $this->yyidx + -1 ]->minor . - $this->yystack[ $this->yyidx + 0 ]->minor; + $this->_retvalue = + $this->yystack[ $this->yyidx + -2 ]->minor . + $this->yystack[ $this->yyidx + -1 ]->minor . + $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 775 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r97() + // line 775 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r97() { $prefixVar = $this->compiler->getNewPrefixVariable(); if ($this->yystack[ $this->yyidx + -2 ]->minor[ 'var' ] === '\'smarty\'') { $this->compiler->appendPrefixCode("<?php {$prefixVar} = " . - $this->compiler->compileTag('private_special_variable', - array(), - $this->yystack[ $this->yyidx + - -2 ]->minor[ 'smarty_internal_index' ]) . + $this->compiler->compileTag('private_special_variable', array(), + $this->yystack[ $this->yyidx + + -2 ]->minor[ 'smarty_internal_index' ]) . ';?>'); } else { $this->compiler->appendPrefixCode("<?php {$prefixVar} = " . @@ -2826,13 +2770,15 @@ public $yystack = array(); $this->yystack[ $this->yyidx + -2 ]->minor[ 'smarty_internal_index' ] . ';?>'); } - $this->_retvalue = $prefixVar . '::' . $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ] . - $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ]; + $this->_retvalue = + $prefixVar . + '::' . + $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ] . + $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ]; } - #line 792 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r98() + // line 792 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r98() { $prefixVar = $this->compiler->getNewPrefixVariable(); $tmp = $this->compiler->appendCode('<?php ob_start();?>', $this->yystack[ $this->yyidx + 0 ]->minor); @@ -2840,464 +2786,457 @@ public $yystack = array(); $this->_retvalue = $prefixVar; } - #line 811 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r101() + // line 811 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r101() { if (!in_array(strtolower($this->yystack[ $this->yyidx + -2 ]->minor), array('self', 'parent')) && - (!$this->security || $this->security->isTrustedStaticClassAccess($this->yystack[ $this->yyidx + -2 ]->minor, - $this->yystack[ $this->yyidx + 0 ]->minor, - $this->compiler))) { + (!$this->security || + $this->security->isTrustedStaticClassAccess($this->yystack[ $this->yyidx + -2 ]->minor, + $this->yystack[ $this->yyidx + 0 ]->minor, $this->compiler))) { if (isset($this->smarty->registered_classes[ $this->yystack[ $this->yyidx + -2 ]->minor ])) { $this->_retvalue = - $this->smarty->registered_classes[ $this->yystack[ $this->yyidx + -2 ]->minor ] . '::' . - $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ] . $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ]; + $this->smarty->registered_classes[ $this->yystack[ $this->yyidx + -2 ]->minor ] . + '::' . + $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ] . + $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ]; } else { $this->_retvalue = - $this->yystack[ $this->yyidx + -2 ]->minor . '::' . $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ] . + $this->yystack[ $this->yyidx + -2 ]->minor . + '::' . + $this->yystack[ $this->yyidx + 0 ]->minor[ 0 ] . $this->yystack[ $this->yyidx + 0 ]->minor[ 1 ]; } } else { - $this->compiler->trigger_template_error('static class \'' . $this->yystack[ $this->yyidx + -2 ]->minor . + $this->compiler->trigger_template_error('static class \'' . + $this->yystack[ $this->yyidx + -2 ]->minor . '\' is undefined or not allowed by security setting'); } } - #line 822 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r103() + // line 822 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r103() { $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 825 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r104() + // line 825 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r104() { $this->_retvalue = $this->compiler->compileVariable('\'' . substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . '\''); } - #line 838 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r105() + // line 838 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r105() { if ($this->yystack[ $this->yyidx + 0 ]->minor[ 'var' ] === '\'smarty\'') { - $smarty_var = $this->compiler->compileTag('private_special_variable', - array(), - $this->yystack[ $this->yyidx + - 0 ]->minor[ 'smarty_internal_index' ]); + $smarty_var = + $this->compiler->compileTag('private_special_variable', array(), + $this->yystack[ $this->yyidx + 0 ]->minor[ 'smarty_internal_index' ]); $this->_retvalue = $smarty_var; } else { // used for array reset,next,prev,end,current $this->last_variable = $this->yystack[ $this->yyidx + 0 ]->minor[ 'var' ]; $this->last_index = $this->yystack[ $this->yyidx + 0 ]->minor[ 'smarty_internal_index' ]; - $this->_retvalue = $this->compiler->compileVariable($this->yystack[ $this->yyidx + 0 ]->minor[ 'var' ]) . - $this->yystack[ $this->yyidx + 0 ]->minor[ 'smarty_internal_index' ]; + $this->_retvalue = + $this->compiler->compileVariable($this->yystack[ $this->yyidx + 0 ]->minor[ 'var' ]) . + $this->yystack[ $this->yyidx + 0 ]->minor[ 'smarty_internal_index' ]; } } - #line 848 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r106() + // line 848 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r106() { - $this->_retvalue = '$_smarty_tpl->tpl_vars[' . $this->yystack[ $this->yyidx + -2 ]->minor . ']->' . - $this->yystack[ $this->yyidx + 0 ]->minor; + $this->_retvalue = + '$_smarty_tpl->tpl_vars[' . + $this->yystack[ $this->yyidx + -2 ]->minor . + ']->' . + $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 852 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r108() + // line 852 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r108() { $this->_retvalue = $this->compiler->compileConfigVariable('\'' . $this->yystack[ $this->yyidx + -1 ]->minor . '\''); } - #line 856 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r109() + // line 856 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r109() { - $this->_retvalue = '(is_array($tmp = ' . - $this->compiler->compileConfigVariable('\'' . $this->yystack[ $this->yyidx + -2 ]->minor . - '\'') . ') ? $tmp' . - $this->yystack[ $this->yyidx + 0 ]->minor . ' :null)'; + $this->_retvalue = + '(is_array($tmp = ' . + $this->compiler->compileConfigVariable('\'' . $this->yystack[ $this->yyidx + -2 ]->minor . '\'') . + ') ? $tmp' . + $this->yystack[ $this->yyidx + 0 ]->minor . + ' :null)'; } - #line 860 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r110() + // line 860 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r110() { $this->_retvalue = $this->compiler->compileConfigVariable($this->yystack[ $this->yyidx + -1 ]->minor); } - #line 864 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r111() + // line 864 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r111() { $this->_retvalue = - '(is_array($tmp = ' . $this->compiler->compileConfigVariable($this->yystack[ $this->yyidx + -2 ]->minor) . - ') ? $tmp' . $this->yystack[ $this->yyidx + 0 ]->minor . ' : null)'; + '(is_array($tmp = ' . + $this->compiler->compileConfigVariable($this->yystack[ $this->yyidx + -2 ]->minor) . + ') ? $tmp' . + $this->yystack[ $this->yyidx + 0 ]->minor . + ' : null)'; } - #line 867 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r112() + // line 867 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r112() { - $this->_retvalue = array('var' => '\'' . substr($this->yystack[ $this->yyidx + -1 ]->minor, 1) . '\'', - 'smarty_internal_index' => $this->yystack[ $this->yyidx + 0 ]->minor); + $this->_retvalue = + array( + 'var' => '\'' . substr($this->yystack[ $this->yyidx + -1 ]->minor, 1) . '\'', + 'smarty_internal_index' => $this->yystack[ $this->yyidx + 0 ]->minor + ); } - #line 880 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r113() + // line 880 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r113() { - $this->_retvalue = array('var' => $this->yystack[ $this->yyidx + -1 ]->minor, - 'smarty_internal_index' => $this->yystack[ $this->yyidx + 0 ]->minor); + $this->_retvalue = + array( + 'var' => $this->yystack[ $this->yyidx + -1 ]->minor, + 'smarty_internal_index' => $this->yystack[ $this->yyidx + 0 ]->minor + ); } - #line 886 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r115() + // line 886 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r115() { return; } - #line 889 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r116() + // line 889 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r116() { $this->_retvalue = - '[' . $this->compiler->compileVariable('\'' . substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . '\'') . + '[' . + $this->compiler->compileVariable('\'' . substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . '\'') . ']'; } - #line 893 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r117() + // line 893 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r117() { $this->_retvalue = '[' . $this->compiler->compileVariable($this->yystack[ $this->yyidx + 0 ]->minor) . ']'; } - #line 897 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r118() + // line 897 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r118() { - $this->_retvalue = '[' . $this->compiler->compileVariable($this->yystack[ $this->yyidx + -2 ]->minor) . '->' . - $this->yystack[ $this->yyidx + 0 ]->minor . ']'; + $this->_retvalue = + '[' . + $this->compiler->compileVariable($this->yystack[ $this->yyidx + -2 ]->minor) . + '->' . + $this->yystack[ $this->yyidx + 0 ]->minor . + ']'; } - #line 901 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r119() + // line 901 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r119() { $this->_retvalue = '[\'' . $this->yystack[ $this->yyidx + 0 ]->minor . '\']'; } - #line 906 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r120() + // line 906 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r120() { $this->_retvalue = '[' . $this->yystack[ $this->yyidx + 0 ]->minor . ']'; } - #line 911 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r121() + // line 911 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r121() { $this->_retvalue = '[' . $this->yystack[ $this->yyidx + -1 ]->minor . ']'; } - #line 915 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r122() + // line 915 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r122() { - $this->_retvalue = '[' . $this->compiler->compileTag('private_special_variable', - array(), - '[\'section\'][\'' . - $this->yystack[ $this->yyidx + -1 ]->minor . - '\'][\'index\']') . ']'; + $this->_retvalue = + '[' . + $this->compiler->compileTag('private_special_variable', array(), + '[\'section\'][\'' . $this->yystack[ $this->yyidx + -1 ]->minor . '\'][\'index\']') . + ']'; } - #line 918 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r123() + // line 918 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r123() { - $this->_retvalue = '[' . $this->compiler->compileTag('private_special_variable', - array(), - '[\'section\'][\'' . - $this->yystack[ $this->yyidx + -3 ]->minor . '\'][\'' . - $this->yystack[ $this->yyidx + -1 ]->minor . '\']') . ']'; + $this->_retvalue = + '[' . + $this->compiler->compileTag('private_special_variable', array(), '[\'section\'][\'' . + $this->yystack[ $this->yyidx + + -3 ]->minor . + '\'][\'' . + $this->yystack[ $this->yyidx + + -1 ]->minor . + '\']') . + ']'; } - #line 924 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r124() + // line 924 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r124() { $this->_retvalue = '[' . $this->yystack[ $this->yyidx + -1 ]->minor . ']'; } - #line 940 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r126() + // line 940 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r126() { - $this->_retvalue = '[' . $this->compiler->compileVariable('\'' . - substr($this->yystack[ $this->yyidx + -1 ]->minor, - 1) . '\'') . ']';; + $this->_retvalue = + '[' . + $this->compiler->compileVariable('\'' . substr($this->yystack[ $this->yyidx + -1 ]->minor, 1) . '\'') . + ']'; } - #line 950 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r130() + // line 950 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r130() { $this->_retvalue = '[]'; } - #line 954 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r131() + // line 954 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r131() { $this->_retvalue = '\'' . substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . '\''; } - #line 959 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r132() + // line 959 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r132() { $this->_retvalue = '\'\''; } - #line 967 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r133() + // line 967 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r133() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . '.' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 973 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r135() + // line 973 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r135() { - $var = trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, - $this->compiler->getLdelLength(), - -$this->compiler->getRdelLength()), - ' $'); + $var = + trim(substr($this->yystack[ $this->yyidx + 0 ]->minor, $this->compiler->getLdelLength(), + -$this->compiler->getRdelLength()), ' $'); $this->_retvalue = $this->compiler->compileVariable('\'' . $var . '\''); } - #line 980 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r136() + // line 980 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r136() { $this->_retvalue = '(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')'; } - #line 989 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r137() + // line 989 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r137() { if ($this->yystack[ $this->yyidx + -1 ]->minor[ 'var' ] === '\'smarty\'') { - $this->_retvalue = $this->compiler->compileTag('private_special_variable', - array(), - $this->yystack[ $this->yyidx + - -1 ]->minor[ 'smarty_internal_index' ]) . - $this->yystack[ $this->yyidx + 0 ]->minor; + $this->_retvalue = + $this->compiler->compileTag('private_special_variable', array(), + $this->yystack[ $this->yyidx + -1 ]->minor[ 'smarty_internal_index' ]) . + $this->yystack[ $this->yyidx + 0 ]->minor; } else { - $this->_retvalue = $this->compiler->compileVariable($this->yystack[ $this->yyidx + -1 ]->minor[ 'var' ]) . - $this->yystack[ $this->yyidx + -1 ]->minor[ 'smarty_internal_index' ] . - $this->yystack[ $this->yyidx + 0 ]->minor; + $this->_retvalue = + $this->compiler->compileVariable($this->yystack[ $this->yyidx + -1 ]->minor[ 'var' ]) . + $this->yystack[ $this->yyidx + -1 ]->minor[ 'smarty_internal_index' ] . + $this->yystack[ $this->yyidx + 0 ]->minor; } } - #line 994 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r138() + // line 994 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r138() { $this->_retvalue = $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 999 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r139() + // line 999 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r139() { $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1006 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r140() + // line 1006 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r140() { if ($this->security && substr($this->yystack[ $this->yyidx + -1 ]->minor, 0, 1) === '_') { - $this->compiler->trigger_template_error(self::Err1); + $this->compiler->trigger_template_error(self::ERR1); } $this->_retvalue = '->' . $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1013 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r141() + // line 1013 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r141() { if ($this->security) { - $this->compiler->trigger_template_error(self::Err2); + $this->compiler->trigger_template_error(self::ERR2); } - $this->_retvalue = '->{' . $this->compiler->compileVariable($this->yystack[ $this->yyidx + -1 ]->minor) . - $this->yystack[ $this->yyidx + 0 ]->minor . '}'; + $this->_retvalue = + '->{' . + $this->compiler->compileVariable($this->yystack[ $this->yyidx + -1 ]->minor) . + $this->yystack[ $this->yyidx + 0 ]->minor . + '}'; } - #line 1020 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r142() + // line 1020 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r142() { if ($this->security) { - $this->compiler->trigger_template_error(self::Err2); + $this->compiler->trigger_template_error(self::ERR2); } $this->_retvalue = '->{' . $this->yystack[ $this->yyidx + -2 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor . '}'; } - #line 1028 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r143() + // line 1028 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r143() { if ($this->security) { - $this->compiler->trigger_template_error(self::Err2); + $this->compiler->trigger_template_error(self::ERR2); } $this->_retvalue = - '->{\'' . $this->yystack[ $this->yyidx + -4 ]->minor . '\'.' . $this->yystack[ $this->yyidx + -2 ]->minor . - $this->yystack[ $this->yyidx + 0 ]->minor . '}'; + '->{\'' . + $this->yystack[ $this->yyidx + -4 ]->minor . + '\'.' . + $this->yystack[ $this->yyidx + -2 ]->minor . + $this->yystack[ $this->yyidx + 0 ]->minor . + '}'; } - #line 1036 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r144() + // line 1036 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r144() { $this->_retvalue = '->' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1044 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r145() + // line 1044 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r145() { - $this->_retvalue = $this->compiler->compilePHPFunctionCall($this->yystack[ $this->yyidx + -3 ]->minor, - $this->yystack[ $this->yyidx + -1 ]->minor); + $this->_retvalue = + $this->compiler->compilePHPFunctionCall($this->yystack[ $this->yyidx + -3 ]->minor, + $this->yystack[ $this->yyidx + -1 ]->minor); } - #line 1051 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r146() + // line 1051 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r146() { if ($this->security && substr($this->yystack[ $this->yyidx + -3 ]->minor, 0, 1) === '_') { - $this->compiler->trigger_template_error(self::Err1); + $this->compiler->trigger_template_error(self::ERR1); } - $this->_retvalue = $this->yystack[ $this->yyidx + -3 ]->minor . '(' . - implode(',', $this->yystack[ $this->yyidx + -1 ]->minor) . ')'; + $this->_retvalue = + $this->yystack[ $this->yyidx + -3 ]->minor . + '(' . + implode(',', $this->yystack[ $this->yyidx + -1 ]->minor) . + ')'; } - #line 1062 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r147() + // line 1062 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r147() { if ($this->security) { - $this->compiler->trigger_template_error(self::Err2); + $this->compiler->trigger_template_error(self::ERR2); } $prefixVar = $this->compiler->getNewPrefixVariable(); - $this->compiler->appendPrefixCode("<?php {$prefixVar} = " . $this->compiler->compileVariable('\'' . - substr($this->yystack[ $this->yyidx + - -3 ]->minor, - 1) . '\'') . + $this->compiler->appendPrefixCode("<?php {$prefixVar} = " . + $this->compiler->compileVariable('\'' . + substr($this->yystack[ $this->yyidx + + -3 ]->minor, 1) . + '\'') . ';?>'); $this->_retvalue = $prefixVar . '(' . implode(',', $this->yystack[ $this->yyidx + -1 ]->minor) . ')'; } - #line 1079 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r148() + // line 1079 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r148() { $this->_retvalue = array_merge($this->yystack[ $this->yyidx + -2 ]->minor, array($this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 1083 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r151() + // line 1083 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r151() { - $this->_retvalue = array_merge($this->yystack[ $this->yyidx + -2 ]->minor, - array(array_merge($this->yystack[ $this->yyidx + -1 ]->minor, - $this->yystack[ $this->yyidx + 0 ]->minor))); + $this->_retvalue = + array_merge($this->yystack[ $this->yyidx + -2 ]->minor, array( + array_merge($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor) + )); } - #line 1091 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r152() + // line 1091 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r152() { $this->_retvalue = array(array_merge($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor)); } - #line 1099 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r154() + // line 1099 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r154() { $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor); } - #line 1118 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r155() + // line 1118 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r155() { $this->_retvalue = array_merge($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 1123 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r159() + // line 1123 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r159() { $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor, '', 'method'); } - #line 1128 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r160() + // line 1128 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r160() { $this->_retvalue = array($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor, 'method'); } - #line 1133 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r161() + // line 1133 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r161() { $this->_retvalue = array($this->yystack[ $this->yyidx + 0 ]->minor, ''); } - #line 1138 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r162() + // line 1138 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r162() { $this->_retvalue = array($this->yystack[ $this->yyidx + -1 ]->minor, $this->yystack[ $this->yyidx + 0 ]->minor, 'property'); } - #line 1144 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r163() + // line 1144 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r163() { - $this->_retvalue = array($this->yystack[ $this->yyidx + -2 ]->minor, - $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor, - 'property'); + $this->_retvalue = + array( + $this->yystack[ $this->yyidx + -2 ]->minor, + $this->yystack[ $this->yyidx + -1 ]->minor . $this->yystack[ $this->yyidx + 0 ]->minor, 'property' + ); } - #line 1148 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r164() + // line 1148 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r164() { $this->_retvalue = ' ' . trim($this->yystack[ $this->yyidx + 0 ]->minor) . ' '; } - #line 1167 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r165() + // line 1167 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r165() { static $lops = array( 'eq' => ' == ', @@ -3318,9 +3257,8 @@ public $yystack = array(); $this->_retvalue = $lops[ $op ]; } - #line 1180 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r166() + // line 1180 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r166() { static $tlops = array( 'isdivby' => array('op' => ' % ', 'pre' => '!('), @@ -3334,9 +3272,8 @@ public $yystack = array(); $this->_retvalue = $tlops[ $op ]; } - #line 1194 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r167() + // line 1194 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r167() { static $scond = array( 'iseven' => '!(1 & ', @@ -3348,91 +3285,81 @@ public $yystack = array(); $this->_retvalue = $scond[ $op ]; } - #line 1202 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r168() + // line 1202 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r168() { $this->_retvalue = 'array(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')'; } - #line 1210 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r170() + // line 1210 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r170() { $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor . ',' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1214 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r172() + // line 1214 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r172() { $this->_retvalue = $this->yystack[ $this->yyidx + -2 ]->minor . '=>' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1230 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r173() + // line 1230 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r173() { $this->_retvalue = '\'' . $this->yystack[ $this->yyidx + -2 ]->minor . '\'=>' . $this->yystack[ $this->yyidx + 0 ]->minor; } - #line 1236 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r176() + // line 1236 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r176() { $this->compiler->leaveDoubleQuote(); $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor->to_smarty_php($this); } - #line 1241 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r177() + // line 1241 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r177() { $this->yystack[ $this->yyidx + -1 ]->minor->append_subtree($this, $this->yystack[ $this->yyidx + 0 ]->minor); $this->_retvalue = $this->yystack[ $this->yyidx + -1 ]->minor; } - #line 1245 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r178() + // line 1245 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r178() { $this->_retvalue = new Smarty_Internal_ParseTree_Dq($this, $this->yystack[ $this->yyidx + 0 ]->minor); } - #line 1249 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r179() + // line 1249 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r179() { $this->_retvalue = new Smarty_Internal_ParseTree_Code('(string)' . $this->yystack[ $this->yyidx + -1 ]->minor); } - #line 1253 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r180() + // line 1253 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r180() { $this->_retvalue = new Smarty_Internal_ParseTree_Code('(string)(' . $this->yystack[ $this->yyidx + -1 ]->minor . ')'); } - #line 1265 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r181() + // line 1265 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r181() { - $this->_retvalue = new Smarty_Internal_ParseTree_Code('(string)$_smarty_tpl->tpl_vars[\'' . - substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . - '\']->value'); + $this->_retvalue = + new Smarty_Internal_ParseTree_Code('(string)$_smarty_tpl->tpl_vars[\'' . + substr($this->yystack[ $this->yyidx + 0 ]->minor, 1) . + '\']->value'); } - #line 1269 "../smarty/lexer/smarty_internal_templateparser.y" - - function yy_r184() + // line 1269 "../smarty/lexer/smarty_internal_templateparser.y" + public function yy_r184() { $this->_retvalue = new Smarty_Internal_ParseTree_Tag($this, $this->yystack[ $this->yyidx + 0 ]->minor); } - function yy_r185() + public function yy_r185() { $this->_retvalue = new Smarty_Internal_ParseTree_DqContent($this->yystack[ $this->yyidx + 0 ]->minor); } @@ -3441,11 +3368,13 @@ public $yystack = array(); { if ($this->yyTraceFILE && $yyruleno >= 0 && $yyruleno < count(self::$yyRuleName)) { - fprintf($this->yyTraceFILE, - "%sReduce (%d) [%s].\n", - $this->yyTracePrompt, - $yyruleno, - self::$yyRuleName[ $yyruleno ]); + fprintf( + $this->yyTraceFILE, + "%sReduce (%d) [%s].\n", + $this->yyTracePrompt, + $yyruleno, + self::$yyRuleName[ $yyruleno ] + ); } $this->_retvalue = $yy_lefthand_side = null; if (isset(self::$yyReduceMap[ $yyruleno ])) { @@ -3473,7 +3402,7 @@ public $yystack = array(); } else { $this->yy_shift($yyact, $yygoto, $yy_lefthand_side); } - } else if ($yyact === self::YYNSTATE + self::YYNRULE + 1) { + } elseif ($yyact === self::YYNSTATE + self::YYNRULE + 1) { $this->yy_accept(); } } @@ -3490,7 +3419,7 @@ public $yystack = array(); public function yy_syntax_error($yymajor, $TOKEN) { - #line 214 "../smarty/lexer/smarty_internal_templateparser.y" + // line 214 "../smarty/lexer/smarty_internal_templateparser.y" $this->internalError = true; $this->yymajor = $yymajor; $this->compiler->trigger_template_error(); @@ -3504,7 +3433,7 @@ public $yystack = array(); while ($this->yyidx >= 0) { $this->yy_pop_parser_stack(); } - #line 207 "../smarty/lexer/smarty_internal_templateparser.y" + // line 207 "../smarty/lexer/smarty_internal_templateparser.y" $this->successful = !$this->internalError; $this->internalError = false; $this->retvalue = $this->_retvalue; @@ -3524,10 +3453,12 @@ public $yystack = array(); } $yyendofinput = ($yymajor == 0); if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%sInput %s\n", - $this->yyTracePrompt, - $this->yyTokenName[ $yymajor ]); + fprintf( + $this->yyTraceFILE, + "%sInput %s\n", + $this->yyTracePrompt, + $this->yyTokenName[ $yymajor ] + ); } do { $yyact = $this->yy_find_shift_action($yymajor); @@ -3544,13 +3475,15 @@ public $yystack = array(); } else { $yymajor = self::YYNOCODE; } - } else if ($yyact < self::YYNSTATE + self::YYNRULE) { + } elseif ($yyact < self::YYNSTATE + self::YYNRULE) { $this->yy_reduce($yyact - self::YYNSTATE); - } else if ($yyact === self::YY_ERROR_ACTION) { + } elseif ($yyact === self::YY_ERROR_ACTION) { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%sSyntax Error!\n", - $this->yyTracePrompt); + fprintf( + $this->yyTraceFILE, + "%sSyntax Error!\n", + $this->yyTracePrompt + ); } if (self::YYERRORSYMBOL) { if ($this->yyerrcnt < 0) { @@ -3559,10 +3492,12 @@ public $yystack = array(); $yymx = $this->yystack[ $this->yyidx ]->major; if ($yymx === self::YYERRORSYMBOL || $yyerrorhit) { if ($this->yyTraceFILE) { - fprintf($this->yyTraceFILE, - "%sDiscard input token %s\n", - $this->yyTracePrompt, - $this->yyTokenName[ $yymajor ]); + fprintf( + $this->yyTraceFILE, + "%sDiscard input token %s\n", + $this->yyTracePrompt, + $this->yyTokenName[ $yymajor ] + ); } $this->yy_destructor($yymajor, $yytokenvalue); $yymajor = self::YYNOCODE; @@ -3577,7 +3512,7 @@ public $yystack = array(); $this->yy_destructor($yymajor, $yytokenvalue); $this->yy_parse_failed(); $yymajor = self::YYNOCODE; - } else if ($yymx !== self::YYERRORSYMBOL) { + } elseif ($yymx !== self::YYERRORSYMBOL) { $u2 = 0; $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2); } @@ -3602,4 +3537,3 @@ public $yystack = array(); } while ($yymajor !== self::YYNOCODE && $this->yyidx >= 0); } } - diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_testinstall.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_testinstall.php index bea8b3a80..504a4582c 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_testinstall.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_testinstall.php @@ -21,7 +21,7 @@ class Smarty_Internal_TestInstall * If $errors is secified, the diagnostic report will be appended to the array, rather than being output. * * @param \Smarty $smarty - * @param array $errors array to push results into rather than outputting them + * @param array $errors array to push results into rather than outputting them * * @return bool status, true if everything is fine, false else */ @@ -82,7 +82,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'template_dir' ] = $message; } - } else if (!is_readable($template_dir)) { + } elseif (!is_readable($template_dir)) { $status = false; $message = "FAILED: $template_dir is not readable"; if ($errors === null) { @@ -110,7 +110,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'compile_dir' ] = $message; } - } else if (!is_dir($_compile_dir)) { + } elseif (!is_dir($_compile_dir)) { $status = false; $message = "FAILED: {$_compile_dir} is not a directory"; if ($errors === null) { @@ -118,7 +118,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'compile_dir' ] = $message; } - } else if (!is_readable($_compile_dir)) { + } elseif (!is_readable($_compile_dir)) { $status = false; $message = "FAILED: {$_compile_dir} is not readable"; if ($errors === null) { @@ -126,7 +126,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'compile_dir' ] = $message; } - } else if (!is_writable($_compile_dir)) { + } elseif (!is_writable($_compile_dir)) { $status = false; $message = "FAILED: {$_compile_dir} is not writable"; if ($errors === null) { @@ -192,7 +192,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'plugins_dir' ] = $message; } - } else if (!is_readable($plugin_dir)) { + } elseif (!is_readable($plugin_dir)) { $status = false; $message = "FAILED: $plugin_dir is not readable"; if ($errors === null) { @@ -200,7 +200,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'plugins_dir' ] = $message; } - } else if ($_core_plugins_dir && $_core_plugins_dir == realpath($plugin_dir)) { + } elseif ($_core_plugins_dir && $_core_plugins_dir == realpath($plugin_dir)) { $_core_plugins_available = true; if ($errors === null) { echo "$plugin_dir is OK.\n"; @@ -216,7 +216,7 @@ class Smarty_Internal_TestInstall $message = "WARNING: Smarty's own libs/plugins is not available"; if ($errors === null) { echo $message . ".\n"; - } else if (!isset($errors[ 'plugins_dir' ])) { + } elseif (!isset($errors[ 'plugins_dir' ])) { $errors[ 'plugins_dir' ] = $message; } } @@ -234,7 +234,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'cache_dir' ] = $message; } - } else if (!is_dir($_cache_dir)) { + } elseif (!is_dir($_cache_dir)) { $status = false; $message = "FAILED: {$_cache_dir} is not a directory"; if ($errors === null) { @@ -242,7 +242,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'cache_dir' ] = $message; } - } else if (!is_readable($_cache_dir)) { + } elseif (!is_readable($_cache_dir)) { $status = false; $message = "FAILED: {$_cache_dir} is not readable"; if ($errors === null) { @@ -250,7 +250,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'cache_dir' ] = $message; } - } else if (!is_writable($_cache_dir)) { + } elseif (!is_writable($_cache_dir)) { $status = false; $message = "FAILED: {$_cache_dir} is not writable"; if ($errors === null) { @@ -312,7 +312,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'config_dir' ] = $message; } - } else if (!is_readable($config_dir)) { + } elseif (!is_readable($config_dir)) { $status = false; $message = "FAILED: $config_dir is not readable"; if ($errors === null) { @@ -332,159 +332,161 @@ class Smarty_Internal_TestInstall // test if sysplugins are available $source = SMARTY_SYSPLUGINS_DIR; if (is_dir($source)) { - $expectedSysplugins = array('smartycompilerexception.php' => true, - 'smartyexception.php' => true, - 'smarty_cacheresource.php' => true, - 'smarty_cacheresource_custom.php' => true, - 'smarty_cacheresource_keyvaluestore.php' => true, - 'smarty_data.php' => true, - 'smarty_internal_block.php' => true, - 'smarty_internal_cacheresource_file.php' => true, - 'smarty_internal_compilebase.php' => true, - 'smarty_internal_compile_append.php' => true, - 'smarty_internal_compile_assign.php' => true, - 'smarty_internal_compile_block.php' => true, - 'smarty_internal_compile_block_child.php' => true, - 'smarty_internal_compile_block_parent.php' => true, - 'smarty_internal_compile_child.php' => true, - 'smarty_internal_compile_parent.php' => true, - 'smarty_internal_compile_break.php' => true, - 'smarty_internal_compile_call.php' => true, - 'smarty_internal_compile_capture.php' => true, - 'smarty_internal_compile_config_load.php' => true, - 'smarty_internal_compile_continue.php' => true, - 'smarty_internal_compile_debug.php' => true, - 'smarty_internal_compile_eval.php' => true, - 'smarty_internal_compile_extends.php' => true, - 'smarty_internal_compile_for.php' => true, - 'smarty_internal_compile_foreach.php' => true, - 'smarty_internal_compile_function.php' => true, - 'smarty_internal_compile_if.php' => true, - 'smarty_internal_compile_include.php' => true, - 'smarty_internal_compile_include_php.php' => true, - 'smarty_internal_compile_insert.php' => true, - 'smarty_internal_compile_ldelim.php' => true, - 'smarty_internal_compile_make_nocache.php' => true, - 'smarty_internal_compile_nocache.php' => true, - 'smarty_internal_compile_private_block_plugin.php' => true, - 'smarty_internal_compile_private_foreachsection.php' => true, - 'smarty_internal_compile_private_function_plugin.php' => true, - 'smarty_internal_compile_private_modifier.php' => true, - 'smarty_internal_compile_private_object_block_function.php' => true, - 'smarty_internal_compile_private_object_function.php' => true, - 'smarty_internal_compile_private_php.php' => true, - 'smarty_internal_compile_private_print_expression.php' => true, - 'smarty_internal_compile_private_registered_block.php' => true, - 'smarty_internal_compile_private_registered_function.php' => true, - 'smarty_internal_compile_private_special_variable.php' => true, - 'smarty_internal_compile_rdelim.php' => true, - 'smarty_internal_compile_section.php' => true, - 'smarty_internal_compile_setfilter.php' => true, - 'smarty_internal_compile_shared_inheritance.php' => true, - 'smarty_internal_compile_while.php' => true, - 'smarty_internal_configfilelexer.php' => true, - 'smarty_internal_configfileparser.php' => true, - 'smarty_internal_config_file_compiler.php' => true, - 'smarty_internal_data.php' => true, - 'smarty_internal_debug.php' => true, - 'smarty_internal_errorhandler.php' => true, - 'smarty_internal_extension_handler.php' => true, - 'smarty_internal_method_addautoloadfilters.php' => true, - 'smarty_internal_method_adddefaultmodifiers.php' => true, - 'smarty_internal_method_append.php' => true, - 'smarty_internal_method_appendbyref.php' => true, - 'smarty_internal_method_assignbyref.php' => true, - 'smarty_internal_method_assignglobal.php' => true, - 'smarty_internal_method_clearallassign.php' => true, - 'smarty_internal_method_clearallcache.php' => true, - 'smarty_internal_method_clearassign.php' => true, - 'smarty_internal_method_clearcache.php' => true, - 'smarty_internal_method_clearcompiledtemplate.php' => true, - 'smarty_internal_method_clearconfig.php' => true, - 'smarty_internal_method_compileallconfig.php' => true, - 'smarty_internal_method_compilealltemplates.php' => true, - 'smarty_internal_method_configload.php' => true, - 'smarty_internal_method_createdata.php' => true, - 'smarty_internal_method_getautoloadfilters.php' => true, - 'smarty_internal_method_getconfigvariable.php' => true, - 'smarty_internal_method_getconfigvars.php' => true, - 'smarty_internal_method_getdebugtemplate.php' => true, - 'smarty_internal_method_getdefaultmodifiers.php' => true, - 'smarty_internal_method_getglobal.php' => true, - 'smarty_internal_method_getregisteredobject.php' => true, - 'smarty_internal_method_getstreamvariable.php' => true, - 'smarty_internal_method_gettags.php' => true, - 'smarty_internal_method_gettemplatevars.php' => true, - 'smarty_internal_method_literals.php' => true, - 'smarty_internal_method_loadfilter.php' => true, - 'smarty_internal_method_loadplugin.php' => true, - 'smarty_internal_method_mustcompile.php' => true, - 'smarty_internal_method_registercacheresource.php' => true, - 'smarty_internal_method_registerclass.php' => true, - 'smarty_internal_method_registerdefaultconfighandler.php' => true, - 'smarty_internal_method_registerdefaultpluginhandler.php' => true, - 'smarty_internal_method_registerdefaulttemplatehandler.php' => true, - 'smarty_internal_method_registerfilter.php' => true, - 'smarty_internal_method_registerobject.php' => true, - 'smarty_internal_method_registerplugin.php' => true, - 'smarty_internal_method_registerresource.php' => true, - 'smarty_internal_method_setautoloadfilters.php' => true, - 'smarty_internal_method_setdebugtemplate.php' => true, - 'smarty_internal_method_setdefaultmodifiers.php' => true, - 'smarty_internal_method_unloadfilter.php' => true, - 'smarty_internal_method_unregistercacheresource.php' => true, - 'smarty_internal_method_unregisterfilter.php' => true, - 'smarty_internal_method_unregisterobject.php' => true, - 'smarty_internal_method_unregisterplugin.php' => true, - 'smarty_internal_method_unregisterresource.php' => true, - 'smarty_internal_nocache_insert.php' => true, - 'smarty_internal_parsetree.php' => true, - 'smarty_internal_parsetree_code.php' => true, - 'smarty_internal_parsetree_dq.php' => true, - 'smarty_internal_parsetree_dqcontent.php' => true, - 'smarty_internal_parsetree_tag.php' => true, - 'smarty_internal_parsetree_template.php' => true, - 'smarty_internal_parsetree_text.php' => true, - 'smarty_internal_resource_eval.php' => true, - 'smarty_internal_resource_extends.php' => true, - 'smarty_internal_resource_file.php' => true, - 'smarty_internal_resource_php.php' => true, - 'smarty_internal_resource_registered.php' => true, - 'smarty_internal_resource_stream.php' => true, - 'smarty_internal_resource_string.php' => true, - 'smarty_internal_runtime_cachemodify.php' => true, - 'smarty_internal_runtime_cacheresourcefile.php' => true, - 'smarty_internal_runtime_capture.php' => true, - 'smarty_internal_runtime_codeframe.php' => true, - 'smarty_internal_runtime_filterhandler.php' => true, - 'smarty_internal_runtime_foreach.php' => true, - 'smarty_internal_runtime_getincludepath.php' => true, - 'smarty_internal_runtime_inheritance.php' => true, - 'smarty_internal_runtime_make_nocache.php' => true, - 'smarty_internal_runtime_tplfunction.php' => true, - 'smarty_internal_runtime_updatecache.php' => true, - 'smarty_internal_runtime_updatescope.php' => true, - 'smarty_internal_runtime_writefile.php' => true, - 'smarty_internal_smartytemplatecompiler.php' => true, - 'smarty_internal_template.php' => true, - 'smarty_internal_templatebase.php' => true, - 'smarty_internal_templatecompilerbase.php' => true, - 'smarty_internal_templatelexer.php' => true, - 'smarty_internal_templateparser.php' => true, - 'smarty_internal_testinstall.php' => true, - 'smarty_internal_undefined.php' => true, - 'smarty_resource.php' => true, - 'smarty_resource_custom.php' => true, - 'smarty_resource_recompiled.php' => true, - 'smarty_resource_uncompiled.php' => true, - 'smarty_security.php' => true, - 'smarty_template_cached.php' => true, - 'smarty_template_compiled.php' => true, - 'smarty_template_config.php' => true, - 'smarty_template_resource_base.php' => true, - 'smarty_template_source.php' => true, - 'smarty_undefined_variable.php' => true, - 'smarty_variable.php' => true,); + $expectedSysplugins = array( + 'smartycompilerexception.php' => true, + 'smartyexception.php' => true, + 'smarty_cacheresource.php' => true, + 'smarty_cacheresource_custom.php' => true, + 'smarty_cacheresource_keyvaluestore.php' => true, + 'smarty_data.php' => true, + 'smarty_internal_block.php' => true, + 'smarty_internal_cacheresource_file.php' => true, + 'smarty_internal_compilebase.php' => true, + 'smarty_internal_compile_append.php' => true, + 'smarty_internal_compile_assign.php' => true, + 'smarty_internal_compile_block.php' => true, + 'smarty_internal_compile_block_child.php' => true, + 'smarty_internal_compile_block_parent.php' => true, + 'smarty_internal_compile_child.php' => true, + 'smarty_internal_compile_parent.php' => true, + 'smarty_internal_compile_break.php' => true, + 'smarty_internal_compile_call.php' => true, + 'smarty_internal_compile_capture.php' => true, + 'smarty_internal_compile_config_load.php' => true, + 'smarty_internal_compile_continue.php' => true, + 'smarty_internal_compile_debug.php' => true, + 'smarty_internal_compile_eval.php' => true, + 'smarty_internal_compile_extends.php' => true, + 'smarty_internal_compile_for.php' => true, + 'smarty_internal_compile_foreach.php' => true, + 'smarty_internal_compile_function.php' => true, + 'smarty_internal_compile_if.php' => true, + 'smarty_internal_compile_include.php' => true, + 'smarty_internal_compile_include_php.php' => true, + 'smarty_internal_compile_insert.php' => true, + 'smarty_internal_compile_ldelim.php' => true, + 'smarty_internal_compile_make_nocache.php' => true, + 'smarty_internal_compile_nocache.php' => true, + 'smarty_internal_compile_private_block_plugin.php' => true, + 'smarty_internal_compile_private_foreachsection.php' => true, + 'smarty_internal_compile_private_function_plugin.php' => true, + 'smarty_internal_compile_private_modifier.php' => true, + 'smarty_internal_compile_private_object_block_function.php' => true, + 'smarty_internal_compile_private_object_function.php' => true, + 'smarty_internal_compile_private_php.php' => true, + 'smarty_internal_compile_private_print_expression.php' => true, + 'smarty_internal_compile_private_registered_block.php' => true, + 'smarty_internal_compile_private_registered_function.php' => true, + 'smarty_internal_compile_private_special_variable.php' => true, + 'smarty_internal_compile_rdelim.php' => true, + 'smarty_internal_compile_section.php' => true, + 'smarty_internal_compile_setfilter.php' => true, + 'smarty_internal_compile_shared_inheritance.php' => true, + 'smarty_internal_compile_while.php' => true, + 'smarty_internal_configfilelexer.php' => true, + 'smarty_internal_configfileparser.php' => true, + 'smarty_internal_config_file_compiler.php' => true, + 'smarty_internal_data.php' => true, + 'smarty_internal_debug.php' => true, + 'smarty_internal_errorhandler.php' => true, + 'smarty_internal_extension_handler.php' => true, + 'smarty_internal_method_addautoloadfilters.php' => true, + 'smarty_internal_method_adddefaultmodifiers.php' => true, + 'smarty_internal_method_append.php' => true, + 'smarty_internal_method_appendbyref.php' => true, + 'smarty_internal_method_assignbyref.php' => true, + 'smarty_internal_method_assignglobal.php' => true, + 'smarty_internal_method_clearallassign.php' => true, + 'smarty_internal_method_clearallcache.php' => true, + 'smarty_internal_method_clearassign.php' => true, + 'smarty_internal_method_clearcache.php' => true, + 'smarty_internal_method_clearcompiledtemplate.php' => true, + 'smarty_internal_method_clearconfig.php' => true, + 'smarty_internal_method_compileallconfig.php' => true, + 'smarty_internal_method_compilealltemplates.php' => true, + 'smarty_internal_method_configload.php' => true, + 'smarty_internal_method_createdata.php' => true, + 'smarty_internal_method_getautoloadfilters.php' => true, + 'smarty_internal_method_getconfigvariable.php' => true, + 'smarty_internal_method_getconfigvars.php' => true, + 'smarty_internal_method_getdebugtemplate.php' => true, + 'smarty_internal_method_getdefaultmodifiers.php' => true, + 'smarty_internal_method_getglobal.php' => true, + 'smarty_internal_method_getregisteredobject.php' => true, + 'smarty_internal_method_getstreamvariable.php' => true, + 'smarty_internal_method_gettags.php' => true, + 'smarty_internal_method_gettemplatevars.php' => true, + 'smarty_internal_method_literals.php' => true, + 'smarty_internal_method_loadfilter.php' => true, + 'smarty_internal_method_loadplugin.php' => true, + 'smarty_internal_method_mustcompile.php' => true, + 'smarty_internal_method_registercacheresource.php' => true, + 'smarty_internal_method_registerclass.php' => true, + 'smarty_internal_method_registerdefaultconfighandler.php' => true, + 'smarty_internal_method_registerdefaultpluginhandler.php' => true, + 'smarty_internal_method_registerdefaulttemplatehandler.php' => true, + 'smarty_internal_method_registerfilter.php' => true, + 'smarty_internal_method_registerobject.php' => true, + 'smarty_internal_method_registerplugin.php' => true, + 'smarty_internal_method_registerresource.php' => true, + 'smarty_internal_method_setautoloadfilters.php' => true, + 'smarty_internal_method_setdebugtemplate.php' => true, + 'smarty_internal_method_setdefaultmodifiers.php' => true, + 'smarty_internal_method_unloadfilter.php' => true, + 'smarty_internal_method_unregistercacheresource.php' => true, + 'smarty_internal_method_unregisterfilter.php' => true, + 'smarty_internal_method_unregisterobject.php' => true, + 'smarty_internal_method_unregisterplugin.php' => true, + 'smarty_internal_method_unregisterresource.php' => true, + 'smarty_internal_nocache_insert.php' => true, + 'smarty_internal_parsetree.php' => true, + 'smarty_internal_parsetree_code.php' => true, + 'smarty_internal_parsetree_dq.php' => true, + 'smarty_internal_parsetree_dqcontent.php' => true, + 'smarty_internal_parsetree_tag.php' => true, + 'smarty_internal_parsetree_template.php' => true, + 'smarty_internal_parsetree_text.php' => true, + 'smarty_internal_resource_eval.php' => true, + 'smarty_internal_resource_extends.php' => true, + 'smarty_internal_resource_file.php' => true, + 'smarty_internal_resource_php.php' => true, + 'smarty_internal_resource_registered.php' => true, + 'smarty_internal_resource_stream.php' => true, + 'smarty_internal_resource_string.php' => true, + 'smarty_internal_runtime_cachemodify.php' => true, + 'smarty_internal_runtime_cacheresourcefile.php' => true, + 'smarty_internal_runtime_capture.php' => true, + 'smarty_internal_runtime_codeframe.php' => true, + 'smarty_internal_runtime_filterhandler.php' => true, + 'smarty_internal_runtime_foreach.php' => true, + 'smarty_internal_runtime_getincludepath.php' => true, + 'smarty_internal_runtime_inheritance.php' => true, + 'smarty_internal_runtime_make_nocache.php' => true, + 'smarty_internal_runtime_tplfunction.php' => true, + 'smarty_internal_runtime_updatecache.php' => true, + 'smarty_internal_runtime_updatescope.php' => true, + 'smarty_internal_runtime_writefile.php' => true, + 'smarty_internal_smartytemplatecompiler.php' => true, + 'smarty_internal_template.php' => true, + 'smarty_internal_templatebase.php' => true, + 'smarty_internal_templatecompilerbase.php' => true, + 'smarty_internal_templatelexer.php' => true, + 'smarty_internal_templateparser.php' => true, + 'smarty_internal_testinstall.php' => true, + 'smarty_internal_undefined.php' => true, + 'smarty_resource.php' => true, + 'smarty_resource_custom.php' => true, + 'smarty_resource_recompiled.php' => true, + 'smarty_resource_uncompiled.php' => true, + 'smarty_security.php' => true, + 'smarty_template_cached.php' => true, + 'smarty_template_compiled.php' => true, + 'smarty_template_config.php' => true, + 'smarty_template_resource_base.php' => true, + 'smarty_template_source.php' => true, + 'smarty_undefined_variable.php' => true, + 'smarty_variable.php' => true, + ); $iterator = new DirectoryIterator($source); foreach ($iterator as $file) { if (!$file->isDot()) { @@ -502,7 +504,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'sysplugins' ] = $message; } - } else if ($errors === null) { + } elseif ($errors === null) { echo "... OK\n"; } } else { @@ -586,7 +588,7 @@ class Smarty_Internal_TestInstall } else { $errors[ 'plugins' ] = $message; } - } else if ($errors === null) { + } elseif ($errors === null) { echo "... OK\n"; } } else { diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_undefined.php b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_undefined.php index d6f4bf62e..7df0acc2d 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_internal_undefined.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_internal_undefined.php @@ -11,7 +11,6 @@ */ class Smarty_Internal_Undefined { - /** * Name of undefined extension class * @@ -32,9 +31,9 @@ class Smarty_Internal_Undefined /** * Wrapper for obsolete class Smarty_Internal_Runtime_ValidateCompiled * - * @param \Smarty_Internal_Template $tpl - * @param array $properties special template properties - * @param bool $cache flag if called from cache file + * @param \Smarty_Internal_Template $tpl + * @param array $properties special template properties + * @param bool $cache flag if called from cache file * * @return bool false */ @@ -65,4 +64,4 @@ class Smarty_Internal_Undefined throw new SmartyException(get_class($args[ 0 ]) . "->{$name}() undefined method"); } } -}
\ No newline at end of file +} diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_resource.php b/vendor/smarty/smarty/libs/sysplugins/smarty_resource.php index b76b9c783..aae7e42f7 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_resource.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_resource.php @@ -25,24 +25,29 @@ abstract class Smarty_Resource * * @var array */ - public static $sysplugins = array('file' => 'smarty_internal_resource_file.php', - 'string' => 'smarty_internal_resource_string.php', - 'extends' => 'smarty_internal_resource_extends.php', - 'stream' => 'smarty_internal_resource_stream.php', - 'eval' => 'smarty_internal_resource_eval.php', - 'php' => 'smarty_internal_resource_php.php'); + public static $sysplugins = array( + 'file' => 'smarty_internal_resource_file.php', + 'string' => 'smarty_internal_resource_string.php', + 'extends' => 'smarty_internal_resource_extends.php', + 'stream' => 'smarty_internal_resource_stream.php', + 'eval' => 'smarty_internal_resource_eval.php', + 'php' => 'smarty_internal_resource_php.php' + ); + /** * Source is bypassing compiler * * @var boolean */ public $uncompiled = false; + /** * Source must be recompiled on every occasion * * @var boolean */ public $recompiled = false; + /** * Flag if resource does implement populateCompiledFilepath() method * @@ -53,8 +58,8 @@ abstract class Smarty_Resource /** * Load Resource Handler * - * @param Smarty $smarty smarty object - * @param string $type name of the resource + * @param Smarty $smarty smarty object + * @param string $type name of the resource * * @throws SmartyException * @return Smarty_Resource Resource Handler @@ -82,9 +87,13 @@ abstract class Smarty_Resource if (class_exists($_resource_class, false)) { return $smarty->_cache[ 'resource_handlers' ][ $type ] = new $_resource_class(); } else { - $smarty->registerResource($type, - array("smarty_resource_{$type}_source", "smarty_resource_{$type}_timestamp", - "smarty_resource_{$type}_secure", "smarty_resource_{$type}_trusted")); + $smarty->registerResource( + $type, + array( + "smarty_resource_{$type}_source", "smarty_resource_{$type}_timestamp", + "smarty_resource_{$type}_secure", "smarty_resource_{$type}_trusted" + ) + ); // give it another try, now that the resource is registered properly return self::load($smarty, $type); } @@ -105,10 +114,11 @@ abstract class Smarty_Resource /** * extract resource_type and resource_name from template_resource and config_resource + * * @note "C:/foo.tpl" was forced to file resource up till Smarty 3.1.3 (including). * - * @param string $resource_name template_resource or config_resource to parse - * @param string $default_resource the default resource_type defined in $smarty + * @param string $resource_name template_resource or config_resource to parse + * @param string $default_resource the default resource_type defined in $smarty * * @return array with parsed resource name and type */ @@ -129,8 +139,9 @@ abstract class Smarty_Resource /** * modify template_resource according to resource handlers specifications * - * @param \Smarty_Internal_Template|\Smarty $obj Smarty instance - * @param string $template_resource template_resource to extract resource handler and name of + * @param \Smarty_Internal_Template|\Smarty $obj Smarty instance + * @param string $template_resource template_resource to extract resource handler and + * name of * * @return string unique resource name * @throws \SmartyException @@ -143,8 +154,8 @@ abstract class Smarty_Resource $resource = Smarty_Resource::load($smarty, $type); // go relative to a given template? $_file_is_dotted = $name[ 0 ] === '.' && ($name[ 1 ] === '.' || $name[ 1 ] === '/'); - if ($obj->_isTplObj() && $_file_is_dotted && - ($obj->source->type === 'file' || $obj->parent->source->type === 'extends') + if ($obj->_isTplObj() && $_file_is_dotted + && ($obj->source->type === 'file' || $obj->parent->source->type === 'extends') ) { $name = $smarty->_realpath(dirname($obj->parent->source->filepath) . DIRECTORY_SEPARATOR . $name); } @@ -156,24 +167,25 @@ abstract class Smarty_Resource * wrapper for backward compatibility to versions < 3.1.22 * Either [$_template] or [$smarty, $template_resource] must be specified * - * @param Smarty_Internal_Template $_template template object - * @param Smarty $smarty smarty object - * @param string $template_resource resource identifier + * @param Smarty_Internal_Template $_template template object + * @param Smarty $smarty smarty object + * @param string $template_resource resource identifier * * @return \Smarty_Template_Source Source Object * @throws \SmartyException */ - public static function source(Smarty_Internal_Template $_template = null, - Smarty $smarty = null, - $template_resource = null) - { + public static function source( + Smarty_Internal_Template $_template = null, + Smarty $smarty = null, + $template_resource = null + ) { return Smarty_Template_Source::load($_template, $smarty, $template_resource); } /** * Load template's source into current template object * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string template source * @throws SmartyException if source cannot be loaded @@ -201,9 +213,9 @@ abstract class Smarty_Resource /** * modify resource_name according to resource handlers specifications * - * @param Smarty $smarty Smarty instance - * @param string $resource_name resource_name to make unique - * @param boolean $isConfig flag for config resource + * @param Smarty $smarty Smarty instance + * @param string $resource_name resource_name to make unique + * @param boolean $isConfig flag for config resource * * @return string unique resource name */ @@ -228,11 +240,10 @@ abstract class Smarty_Resource * * @return bool */ - /** * Determine basename for compiled filename * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string resource's basename */ @@ -249,4 +260,3 @@ abstract class Smarty_Resource return true; } } - diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_resource_custom.php b/vendor/smarty/smarty/libs/sysplugins/smarty_resource_custom.php index 77f619eca..8d66be3ae 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_resource_custom.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_resource_custom.php @@ -30,7 +30,7 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource * {@internal implementing this method is optional. * Only implement it if modification times can be accessed faster than loading the complete template source.}} * - * @param string $name template name + * @param string $name template name * * @return integer|boolean timestamp (epoch) the template was modified, or false if not found */ @@ -47,9 +47,8 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource */ public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) { - $source->filepath = $source->type . ':' . substr(preg_replace('/[^A-Za-z0-9.]/','',$source->name),0,25); + $source->filepath = $source->type . ':' . substr(preg_replace('/[^A-Za-z0-9.]/', '', $source->name), 0, 25); $source->uid = sha1($source->type . ':' . $source->name); - $mtime = $this->fetchTimestamp($source->name); if ($mtime !== null) { $source->timestamp = $mtime; @@ -66,7 +65,7 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource /** * Load template's source into current template object * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string template source * @throws SmartyException if source cannot be loaded @@ -77,19 +76,18 @@ abstract class Smarty_Resource_Custom extends Smarty_Resource if (isset($content)) { return $content; } - throw new SmartyException("Unable to read template {$source->type} '{$source->name}'"); } /** * Determine basename for compiled filename * - * @param Smarty_Template_Source $source source object + * @param Smarty_Template_Source $source source object * * @return string resource's basename */ public function getBasename(Smarty_Template_Source $source) { - return basename(substr(preg_replace('/[^A-Za-z0-9.]/','',$source->name),0,25)); + return basename(substr(preg_replace('/[^A-Za-z0-9.]/', '', $source->name), 0, 25)); } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_resource_recompiled.php b/vendor/smarty/smarty/libs/sysplugins/smarty_resource_recompiled.php index 322cdabfa..760c4dd33 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_resource_recompiled.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_resource_recompiled.php @@ -50,8 +50,7 @@ abstract class Smarty_Resource_Recompiled extends Smarty_Resource // call compiler try { eval('?>' . $_smarty_tpl->compiler->compileTemplate($_smarty_tpl)); - } - catch (Exception $e) { + } catch (Exception $e) { unset($_smarty_tpl->compiler); while (ob_get_level() > $level) { ob_end_clean(); @@ -68,8 +67,8 @@ abstract class Smarty_Resource_Recompiled extends Smarty_Resource /** * populate Compiled Object with compiled filepath * - * @param Smarty_Template_Compiled $compiled compiled object - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Template_Compiled $compiled compiled object + * @param Smarty_Internal_Template $_template template object * * @return void */ diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_security.php b/vendor/smarty/smarty/libs/sysplugins/smarty_security.php index 126f6fb46..441a7e284 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_security.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_security.php @@ -6,12 +6,12 @@ * @subpackage Security * @author Uwe Tews */ - -/* +/** * FIXME: Smarty_Security API * - getter and setter instead of public properties would allow cultivating an internal cache properly - * - current implementation of isTrustedResourceDir() assumes that Smarty::$template_dir and Smarty::$config_dir are immutable - * the cache is killed every time either of the variables change. That means that two distinct Smarty objects with differing + * - current implementation of isTrustedResourceDir() assumes that Smarty::$template_dir and Smarty::$config_dir + * are immutable the cache is killed every time either of the variables change. That means that two distinct + * Smarty objects with differing * $template_dir or $config_dir should NOT share the same Smarty_Security instance, * as this would lead to (severe) performance penalty! how should this be handled? */ @@ -258,63 +258,54 @@ class Smarty_Security public function __construct($smarty) { $this->smarty = $smarty; - $this->smarty->_cache[ 'template_dir_new' ] = true; - $this->smarty->_cache[ 'config_dir_new' ] = true; } /** * Check if PHP function is trusted. * - * @param string $function_name - * @param object $compiler compiler object + * @param string $function_name + * @param object $compiler compiler object * * @return boolean true if function is trusted - * @throws SmartyCompilerException if php function is not trusted */ public function isTrustedPhpFunction($function_name, $compiler) { - if (isset($this->php_functions) && - (empty($this->php_functions) || in_array($function_name, $this->php_functions)) + if (isset($this->php_functions) + && (empty($this->php_functions) || in_array($function_name, $this->php_functions)) ) { return true; } - $compiler->trigger_template_error("PHP function '{$function_name}' not allowed by security setting"); - return false; // should not, but who knows what happens to the compiler in the future? } /** * Check if static class is trusted. * - * @param string $class_name - * @param object $compiler compiler object + * @param string $class_name + * @param object $compiler compiler object * * @return boolean true if class is trusted - * @throws SmartyCompilerException if static class is not trusted */ public function isTrustedStaticClass($class_name, $compiler) { - if (isset($this->static_classes) && - (empty($this->static_classes) || in_array($class_name, $this->static_classes)) + if (isset($this->static_classes) + && (empty($this->static_classes) || in_array($class_name, $this->static_classes)) ) { return true; } - $compiler->trigger_template_error("access to static class '{$class_name}' not allowed by security setting"); - return false; // should not, but who knows what happens to the compiler in the future? } /** * Check if static class method/property is trusted. * - * @param string $class_name - * @param string $params - * @param object $compiler compiler object + * @param string $class_name + * @param string $params + * @param object $compiler compiler object * * @return boolean true if class method is trusted - * @throws SmartyCompilerException if static class method is not trusted */ public function isTrustedStaticClassAccess($class_name, $params, $compiler) { @@ -335,8 +326,8 @@ class Smarty_Security // fall back return $this->isTrustedStaticClass($class_name, $compiler); } - if (isset($allowed[ $class_name ]) && - (empty($allowed[ $class_name ]) || in_array($name, $allowed[ $class_name ])) + if (isset($allowed[ $class_name ]) + && (empty($allowed[ $class_name ]) || in_array($name, $allowed[ $class_name ])) ) { return true; } @@ -348,42 +339,43 @@ class Smarty_Security /** * Check if PHP modifier is trusted. * - * @param string $modifier_name - * @param object $compiler compiler object + * @param string $modifier_name + * @param object $compiler compiler object * * @return boolean true if modifier is trusted - * @throws SmartyCompilerException if modifier is not trusted */ public function isTrustedPhpModifier($modifier_name, $compiler) { - if (isset($this->php_modifiers) && - (empty($this->php_modifiers) || in_array($modifier_name, $this->php_modifiers)) + if (isset($this->php_modifiers) + && (empty($this->php_modifiers) || in_array($modifier_name, $this->php_modifiers)) ) { return true; } - $compiler->trigger_template_error("modifier '{$modifier_name}' not allowed by security setting"); - return false; // should not, but who knows what happens to the compiler in the future? } /** * Check if tag is trusted. * - * @param string $tag_name - * @param object $compiler compiler object + * @param string $tag_name + * @param object $compiler compiler object * * @return boolean true if tag is trusted - * @throws SmartyCompilerException if modifier is not trusted */ public function isTrustedTag($tag_name, $compiler) { // check for internal always required tags - if (in_array($tag_name, - array('assign', 'call', 'private_filter', 'private_block_plugin', 'private_function_plugin', - 'private_object_block_function', 'private_object_function', 'private_registered_function', - 'private_registered_block', 'private_special_variable', 'private_print_expression', - 'private_modifier'))) { + if (in_array( + $tag_name, + array( + 'assign', 'call', 'private_filter', 'private_block_plugin', 'private_function_plugin', + 'private_object_block_function', 'private_object_function', 'private_registered_function', + 'private_registered_block', 'private_special_variable', 'private_print_expression', + 'private_modifier' + ) + ) + ) { return true; } // check security settings @@ -398,39 +390,38 @@ class Smarty_Security } else { $compiler->trigger_template_error("tag '{$tag_name}' not allowed by security setting", null, true); } - return false; // should not, but who knows what happens to the compiler in the future? } /** * Check if special $smarty variable is trusted. * - * @param string $var_name - * @param object $compiler compiler object + * @param string $var_name + * @param object $compiler compiler object * * @return boolean true if tag is trusted - * @throws SmartyCompilerException if modifier is not trusted */ public function isTrustedSpecialSmartyVar($var_name, $compiler) { if (!in_array($var_name, $this->disabled_special_smarty_vars)) { return true; } else { - $compiler->trigger_template_error("special variable '\$smarty.{$var_name}' not allowed by security setting", - null, true); + $compiler->trigger_template_error( + "special variable '\$smarty.{$var_name}' not allowed by security setting", + null, + true + ); } - return false; // should not, but who knows what happens to the compiler in the future? } /** * Check if modifier plugin is trusted. * - * @param string $modifier_name - * @param object $compiler compiler object + * @param string $modifier_name + * @param object $compiler compiler object * * @return boolean true if tag is trusted - * @throws SmartyCompilerException if modifier is not trusted */ public function isTrustedModifier($modifier_name, $compiler) { @@ -443,26 +434,31 @@ class Smarty_Security if (empty($this->disabled_modifiers) || !in_array($modifier_name, $this->disabled_modifiers)) { return true; } else { - $compiler->trigger_template_error("modifier '{$modifier_name}' disabled by security setting", null, - true); + $compiler->trigger_template_error( + "modifier '{$modifier_name}' disabled by security setting", + null, + true + ); } - } elseif (in_array($modifier_name, $this->allowed_modifiers) && - !in_array($modifier_name, $this->disabled_modifiers) + } elseif (in_array($modifier_name, $this->allowed_modifiers) + && !in_array($modifier_name, $this->disabled_modifiers) ) { return true; } else { - $compiler->trigger_template_error("modifier '{$modifier_name}' not allowed by security setting", null, - true); + $compiler->trigger_template_error( + "modifier '{$modifier_name}' not allowed by security setting", + null, + true + ); } - return false; // should not, but who knows what happens to the compiler in the future? } /** * Check if constants are enabled or trusted * - * @param string $const constant name - * @param object $compiler compiler object + * @param string $const constant name + * @param object $compiler compiler object * * @return bool */ @@ -488,7 +484,7 @@ class Smarty_Security /** * Check if stream is trusted. * - * @param string $stream_name + * @param string $stream_name * * @return boolean true if stream is trusted * @throws SmartyException if stream is not trusted @@ -498,14 +494,13 @@ class Smarty_Security if (isset($this->streams) && (empty($this->streams) || in_array($stream_name, $this->streams))) { return true; } - throw new SmartyException("stream '{$stream_name}' not allowed by security setting"); } /** * Check if directory of file resource is trusted. * - * @param string $filepath + * @param string $filepath * @param null|bool $isConfig * * @return bool true if directory is trusted @@ -514,38 +509,35 @@ class Smarty_Security public function isTrustedResourceDir($filepath, $isConfig = null) { if ($this->_include_path_status !== $this->smarty->use_include_path) { - $_dir = $this->smarty->use_include_path ? $this->smarty->ext->_getIncludePath->getIncludePathDirs($this->smarty) : array(); + $_dir = + $this->smarty->use_include_path ? $this->smarty->ext->_getIncludePath->getIncludePathDirs($this->smarty) : array(); if ($this->_include_dir !== $_dir) { $this->_updateResourceDir($this->_include_dir, $_dir); $this->_include_dir = $_dir; } $this->_include_path_status = $this->smarty->use_include_path; } - if ($isConfig !== true) { - $_dir = $this->smarty->getTemplateDir(); - if ($this->_template_dir !== $_dir) { - $this->_updateResourceDir($this->_template_dir, $_dir); - $this->_template_dir = $_dir; - } + $_dir = $this->smarty->getTemplateDir(); + if ($this->_template_dir !== $_dir) { + $this->_updateResourceDir($this->_template_dir, $_dir); + $this->_template_dir = $_dir; } - if ($isConfig !== false) { - $_dir = $this->smarty->getConfigDir(); - if ($this->_config_dir !== $_dir) { - $this->_updateResourceDir($this->_config_dir, $_dir); - $this->_config_dir = $_dir; - } + $_dir = $this->smarty->getConfigDir(); + if ($this->_config_dir !== $_dir) { + $this->_updateResourceDir($this->_config_dir, $_dir); + $this->_config_dir = $_dir; } if ($this->_secure_dir !== $this->secure_dir) { $this->secure_dir = (array)$this->secure_dir; - foreach($this->secure_dir as $k => $d) { - $this->secure_dir[$k] = $this->smarty->_realpath($d.DIRECTORY_SEPARATOR,true); + foreach ($this->secure_dir as $k => $d) { + $this->secure_dir[ $k ] = $this->smarty->_realpath($d . DIRECTORY_SEPARATOR, true); } $this->_updateResourceDir($this->_secure_dir, $this->secure_dir); $this->_secure_dir = $this->secure_dir; } - $addPath = $this->_checkDir($filepath, $this->_resource_dir); + $addPath = $this->_checkDir($filepath, $this->_resource_dir); if ($addPath !== false) { - $this->_resource_dir = array_merge($this->_resource_dir, $addPath); + $this->_resource_dir = array_merge($this->_resource_dir, $addPath); } return true; } @@ -556,11 +548,11 @@ class Smarty_Security * So "http://username:password@hello.world.example.org:8080/some-path?some=query-string" * is reduced to "http://hello.world.example.org" prior to applying the patters from {@link $trusted_uri}. * - * @param string $uri + * @param string $uri * * @return boolean true if URI is trusted * @throws SmartyException if URI is not trusted - * @uses $trusted_uri for list of patterns to match against $uri + * @uses $trusted_uri for list of patterns to match against $uri */ public function isTrustedUri($uri) { @@ -573,14 +565,13 @@ class Smarty_Security } } } - throw new SmartyException("URI '{$uri}' not allowed by security setting"); } /** * Check if directory of file resource is trusted. * - * @param string $filepath + * @param string $filepath * * @return boolean true if directory is trusted * @throws SmartyException if PHP directory is not trusted @@ -590,22 +581,20 @@ class Smarty_Security if (empty($this->trusted_dir)) { throw new SmartyException("directory '{$filepath}' not allowed by security setting (no trusted_dir specified)"); } - // check if index is outdated if (!$this->_trusted_dir || $this->_trusted_dir !== $this->trusted_dir) { $this->_php_resource_dir = array(); - $this->_trusted_dir = $this->trusted_dir; - foreach ((array) $this->trusted_dir as $directory) { - $directory = $this->smarty->_realpath($directory . DIRECTORY_SEPARATOR, true); + foreach ((array)$this->trusted_dir as $directory) { + $directory = $this->smarty->_realpath($directory . '/', true); $this->_php_resource_dir[ $directory ] = true; } } - $addPath = $this->_checkDir($filepath, $this->_php_resource_dir); + $addPath = $this->_checkDir($filepath, $this->_php_resource_dir); if ($addPath !== false) { - $this->_php_resource_dir = array_merge($this->_php_resource_dir, $addPath); + $this->_php_resource_dir = array_merge($this->_php_resource_dir, $addPath); } - return true; + return true; } /** @@ -614,21 +603,23 @@ class Smarty_Security * @param array $oldDir * @param array $newDir */ - private function _updateResourceDir($oldDir, $newDir) { + private function _updateResourceDir($oldDir, $newDir) + { foreach ($oldDir as $directory) { - $directory = $this->smarty->_realpath($directory, true); + // $directory = $this->smarty->_realpath($directory, true); $length = strlen($directory); foreach ($this->_resource_dir as $dir) { - if (substr($dir, 0,$length) === $directory) { + if (substr($dir, 0, $length) === $directory) { unset($this->_resource_dir[ $dir ]); } } } foreach ($newDir as $directory) { - $directory = $this->smarty->_realpath($directory, true); + // $directory = $this->smarty->_realpath($directory, true); $this->_resource_dir[ $directory ] = true; } } + /** * Check if file is inside a valid directory * @@ -640,37 +631,34 @@ class Smarty_Security */ private function _checkDir($filepath, $dirs) { - $directory = dirname($filepath) . DIRECTORY_SEPARATOR; - if (isset($dirs[ $directory ])) { - return false; - } - $filepath = $this->smarty->_realpath($filepath, true); - $directory = dirname($filepath) . DIRECTORY_SEPARATOR; + $directory = dirname($this->smarty->_realpath($filepath, true)) . DIRECTORY_SEPARATOR; $_directory = array(); - while (true) { - // test if the directory is trusted - if (isset($dirs[ $directory ])) { - return $_directory; - } - // abort if we've reached root - if (!preg_match('#[\\\/][^\\\/]+[\\\/]$#', $directory)) { - break; + if (!preg_match('#[\\\\/][.][.][\\\\/]#', $directory)) { + while (true) { + // test if the directory is trusted + if (isset($dirs[ $directory ])) { + return $_directory; + } + // abort if we've reached root + if (!preg_match('#[\\\\/][^\\\\/]+[\\\\/]$#', $directory)) { + // give up + break; + } + // remember the directory to add it to _resource_dir in case we're successful + $_directory[ $directory ] = true; + // bubble up one level + $directory = preg_replace('#[\\\\/][^\\\\/]+[\\\\/]$#', DIRECTORY_SEPARATOR, $directory); } - // remember the directory to add it to _resource_dir in case we're successful - $_directory[ $directory ] = true; - // bubble up one level - $directory = preg_replace('#[\\\/][^\\\/]+[\\\/]$#', DIRECTORY_SEPARATOR, $directory); } - // give up - throw new SmartyException("directory '{$filepath}' not allowed by security setting"); + throw new SmartyException(sprintf('Smarty Security: not trusted file path \'%s\' ', $filepath)); } /** * Loads security class and enables security * - * @param \Smarty $smarty - * @param string|Smarty_Security $security_class if a string is used, it must be class-name + * @param \Smarty $smarty + * @param string|Smarty_Security $security_class if a string is used, it must be class-name * * @return \Smarty current Smarty instance for chaining * @throws \SmartyException when an invalid class name is provided @@ -695,6 +683,7 @@ class Smarty_Security } return $smarty; } + /** * Start template processing * @@ -704,19 +693,18 @@ class Smarty_Security */ public function startTemplate($template) { - if ($this->max_template_nesting > 0 && $this->_current_template_nesting ++ >= $this->max_template_nesting) { + if ($this->max_template_nesting > 0 && $this->_current_template_nesting++ >= $this->max_template_nesting) { throw new SmartyException("maximum template nesting level of '{$this->max_template_nesting}' exceeded when calling '{$template->template_resource}'"); } } /** * Exit template processing - * */ public function endTemplate() { if ($this->max_template_nesting > 0) { - $this->_current_template_nesting --; + $this->_current_template_nesting--; } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_template_cached.php b/vendor/smarty/smarty/libs/sysplugins/smarty_template_cached.php index 45c83c895..508d27f36 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_template_cached.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_template_cached.php @@ -92,7 +92,7 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base $this->cache_id = $_template->cache_id; $this->source = $_template->source; if (!class_exists('Smarty_CacheResource', false)) { - require SMARTY_SYSPLUGINS_DIR . 'smarty_cacheresource.php'; + include SMARTY_SYSPLUGINS_DIR . 'smarty_cacheresource.php'; } $this->handler = Smarty_CacheResource::load($_template->smarty); } @@ -102,7 +102,7 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base * * @return Smarty_Template_Cached */ - static function load(Smarty_Internal_Template $_template) + public static function load(Smarty_Internal_Template $_template) { $_template->cached = new Smarty_Template_Cached($_template); $_template->cached->handler->populate($_template->cached, $_template); @@ -118,7 +118,7 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base * Render cache template * * @param \Smarty_Internal_Template $_template - * @param bool $no_output_filter + * @param bool $no_output_filter * * @throws \Exception */ @@ -163,14 +163,14 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base } else { $this->valid = true; } - if ($this->valid && $_template->caching === Smarty::CACHING_LIFETIME_CURRENT && - $_template->cache_lifetime >= 0 && time() > ($this->timestamp + $_template->cache_lifetime) + if ($this->valid && $_template->caching === Smarty::CACHING_LIFETIME_CURRENT + && $_template->cache_lifetime >= 0 && time() > ($this->timestamp + $_template->cache_lifetime) ) { // lifetime expired $this->valid = false; } - if ($this->valid && $_template->compile_check === Smarty::COMPILECHECK_ON && - $_template->source->getTimeStamp() > $this->timestamp + if ($this->valid && $_template->compile_check === Smarty::COMPILECHECK_ON + && $_template->source->getTimeStamp() > $this->timestamp ) { $this->valid = false; } @@ -204,9 +204,9 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base } else { return $this->valid; } - if ($this->valid && $_template->caching === Smarty::CACHING_LIFETIME_SAVED && - $_template->cached->cache_lifetime >= 0 && - (time() > ($_template->cached->timestamp + $_template->cached->cache_lifetime)) + if ($this->valid && $_template->caching === Smarty::CACHING_LIFETIME_SAVED + && $_template->cached->cache_lifetime >= 0 + && (time() > ($_template->cached->timestamp + $_template->cached->cache_lifetime)) ) { $this->valid = false; } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php b/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php index 7ca2ebcb4..37d8f0a9e 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php @@ -7,7 +7,7 @@ * @package Smarty * @subpackage TemplateResources * @author Rodney Rehm - * @property string $content compiled content + * @property string $content compiled content */ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base { @@ -21,11 +21,11 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base /** * get a Compiled Object of this source * - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Internal_Template $_template template object * * @return Smarty_Template_Compiled compiled object */ - static function load($_template) + public static function load($_template) { $compiled = new Smarty_Template_Compiled(); if ($_template->source->handler->hasCompiledHandler) { @@ -134,9 +134,9 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base $smarty = &$_smarty_tpl->smarty; if ($source->handler->recompiled) { $source->handler->process($_smarty_tpl); - } else if (!$source->handler->uncompiled) { - if (!$this->exists || $smarty->force_compile || - ($_smarty_tpl->compile_check && $source->getTimeStamp() > $this->getTimeStamp()) + } elseif (!$source->handler->uncompiled) { + if (!$this->exists || $smarty->force_compile + || ($_smarty_tpl->compile_check && $source->getTimeStamp() > $this->getTimeStamp()) ) { $this->compileTemplateSource($_smarty_tpl); $compileCheck = $_smarty_tpl->compile_check; @@ -145,7 +145,7 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base $_smarty_tpl->compile_check = $compileCheck; } else { $_smarty_tpl->mustCompile = true; - @include($this->filepath); + @include $this->filepath; if ($_smarty_tpl->mustCompile) { $this->compileTemplateSource($_smarty_tpl); $compileCheck = $_smarty_tpl->compile_check; @@ -182,8 +182,7 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base // call compiler $_template->loadCompiler(); $this->write($_template, $_template->compiler->compileTemplate($_template)); - } - catch (Exception $e) { + } catch (Exception $e) { // restore old timestamp in case of error if ($saved_timestamp && is_file($this->filepath)) { touch($this->filepath, $saved_timestamp); @@ -246,13 +245,13 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base && (!function_exists('ini_get') || strlen(ini_get("opcache.restrict_api")) < 1) ) { opcache_invalidate($this->filepath, true); - } else if (function_exists('apc_compile_file')) { + } elseif (function_exists('apc_compile_file')) { apc_compile_file($this->filepath); } if (defined('HHVM_VERSION')) { eval('?>' . file_get_contents($this->filepath)); } else { - include($this->filepath); + include $this->filepath; } } } diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_template_config.php b/vendor/smarty/smarty/libs/sysplugins/smarty_template_config.php index 44cdba6fd..850ae32e7 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_template_config.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_template_config.php @@ -14,7 +14,6 @@ * @package Smarty * @subpackage TemplateResources * @author Uwe Tews - * */ class Smarty_Template_Config extends Smarty_Template_Source { @@ -64,16 +63,18 @@ class Smarty_Template_Config extends Smarty_Template_Source * initialize Source Object for given resource * Either [$_template] or [$smarty, $template_resource] must be specified * - * @param Smarty_Internal_Template $_template template object - * @param Smarty $smarty smarty object - * @param string $template_resource resource identifier + * @param Smarty_Internal_Template $_template template object + * @param Smarty $smarty smarty object + * @param string $template_resource resource identifier * * @return Smarty_Template_Config Source Object * @throws SmartyException */ - public static function load(Smarty_Internal_Template $_template = null, Smarty $smarty = null, - $template_resource = null) - { + public static function load( + Smarty_Internal_Template $_template = null, + Smarty $smarty = null, + $template_resource = null + ) { static $_incompatible_resources = array('extends' => true, 'php' => true); if ($_template) { $smarty = $_template->smarty; @@ -82,11 +83,11 @@ class Smarty_Template_Config extends Smarty_Template_Source if (empty($template_resource)) { throw new SmartyException('Source: Missing name'); } - // parse resource_name, load resource handler + // parse resource_name, load resource handler list($name, $type) = Smarty_Resource::parseResourceName($template_resource, $smarty->default_config_type); // make sure configs are not loaded via anything smarty can't handle if (isset($_incompatible_resources[ $type ])) { - throw new SmartyException ("Unable to use resource '{$type}' for config"); + throw new SmartyException("Unable to use resource '{$type}' for config"); } $source = new Smarty_Template_Config($smarty, $template_resource, $type, $name); $source->handler->populate($source, $_template); diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php b/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php index 951e02af3..52bfba252 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php @@ -125,8 +125,7 @@ abstract class Smarty_Template_Resource_Base call_user_func($callback, $_template); } $_template->isRenderingCache = false; - } - catch (Exception $e) { + } catch (Exception $e) { $_template->isRenderingCache = false; while (ob_get_level() > $level) { ob_end_clean(); diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_template_source.php b/vendor/smarty/smarty/libs/sysplugins/smarty_template_source.php index 4868706c8..16b47f23c 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_template_source.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_template_source.php @@ -7,7 +7,6 @@ * @package Smarty * @subpackage TemplateResources * @author Rodney Rehm - * */ class Smarty_Template_Source { @@ -131,7 +130,7 @@ class Smarty_Template_Source * @param string $type type of resource * @param string $name resource name * - * @throws \SmartyException + * @throws \SmartyException * @internal param \Smarty_Resource $handler Resource Handler this source object communicates with */ public function __construct(Smarty $smarty, $resource, $type, $name) @@ -149,16 +148,18 @@ class Smarty_Template_Source * initialize Source Object for given resource * Either [$_template] or [$smarty, $template_resource] must be specified * - * @param Smarty_Internal_Template $_template template object - * @param Smarty $smarty smarty object - * @param string $template_resource resource identifier + * @param Smarty_Internal_Template $_template template object + * @param Smarty $smarty smarty object + * @param string $template_resource resource identifier * * @return Smarty_Template_Source Source Object * @throws SmartyException */ - public static function load(Smarty_Internal_Template $_template = null, Smarty $smarty = null, - $template_resource = null) - { + public static function load( + Smarty_Internal_Template $_template = null, + Smarty $smarty = null, + $template_resource = null + ) { if ($_template) { $smarty = $_template->smarty; $template_resource = $_template->template_resource; diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_undefined_variable.php b/vendor/smarty/smarty/libs/sysplugins/smarty_undefined_variable.php index e064f6551..6d31a8a05 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_undefined_variable.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_undefined_variable.php @@ -12,13 +12,13 @@ class Smarty_Undefined_Variable extends Smarty_Variable /** * Returns null for not existing properties * - * @param string $name + * @param string $name * * @return null */ public function __get($name) { - return null; + return null; } /** diff --git a/vendor/smarty/smarty/libs/sysplugins/smarty_variable.php b/vendor/smarty/smarty/libs/sysplugins/smarty_variable.php index 0b17bc7cf..914d99bd7 100644 --- a/vendor/smarty/smarty/libs/sysplugins/smarty_variable.php +++ b/vendor/smarty/smarty/libs/sysplugins/smarty_variable.php @@ -42,7 +42,6 @@ class Smarty_Variable */ public function __toString() { - return (string) $this->value; + return (string)$this->value; } } - |