Version Description
- Update Mustache package to support PHP 8.
Download this release
Release Info
Developer | stiofansisland |
Plugin | Posts 2 Posts |
Version | 1.7 |
Comparing to | |
See all releases |
Code changes from version 1.6.6 to 1.7
- composer.json +11 -2
- posts-to-posts.php +2 -2
- readme.txt +10 -7
- vendor/mustache/mustache/.gitattributes +8 -0
- vendor/mustache/mustache/.php_cs +0 -26
- vendor/mustache/mustache/.styleci.yml +0 -13
- vendor/mustache/mustache/.travis.yml +0 -19
- vendor/mustache/mustache/CONTRIBUTING.md +0 -35
- vendor/mustache/mustache/README.md +6 -4
- vendor/mustache/mustache/bin/build_bootstrap.php +178 -0
- vendor/mustache/mustache/composer.json +2 -2
- vendor/mustache/mustache/phpunit.xml.dist +0 -17
- vendor/mustache/mustache/src/Mustache/Autoloader.php +16 -2
- vendor/mustache/mustache/src/Mustache/Cache.php +8 -1
- vendor/mustache/mustache/src/Mustache/Cache/AbstractCache.php +2 -2
- vendor/mustache/mustache/src/Mustache/Cache/FilesystemCache.php +9 -3
- vendor/mustache/mustache/src/Mustache/Cache/NoopCache.php +1 -1
- vendor/mustache/mustache/src/Mustache/Compiler.php +45 -37
- vendor/mustache/mustache/src/Mustache/Context.php +3 -3
- vendor/mustache/mustache/src/Mustache/Engine.php +63 -21
- vendor/mustache/mustache/src/Mustache/Exception.php +1 -1
- vendor/mustache/mustache/src/Mustache/Exception/InvalidArgumentException.php +1 -1
- vendor/mustache/mustache/src/Mustache/Exception/LogicException.php +1 -1
- vendor/mustache/mustache/src/Mustache/Exception/RuntimeException.php +1 -1
- vendor/mustache/mustache/src/Mustache/Exception/SyntaxException.php +10 -5
- vendor/mustache/mustache/src/Mustache/Exception/UnknownFilterException.php +10 -4
- vendor/mustache/mustache/src/Mustache/Exception/UnknownHelperException.php +10 -4
- vendor/mustache/mustache/src/Mustache/Exception/UnknownTemplateException.php +10 -4
- vendor/mustache/mustache/src/Mustache/HelperCollection.php +3 -3
- vendor/mustache/mustache/src/Mustache/LambdaHelper.php +33 -6
- vendor/mustache/mustache/src/Mustache/Loader.php +3 -3
- vendor/mustache/mustache/src/Mustache/Loader/ArrayLoader.php +2 -2
- vendor/mustache/mustache/src/Mustache/Loader/CascadingLoader.php +2 -2
- vendor/mustache/mustache/src/Mustache/Loader/FilesystemLoader.php +17 -6
- vendor/mustache/mustache/src/Mustache/Loader/InlineLoader.php +3 -3
- vendor/mustache/mustache/src/Mustache/Loader/MutableLoader.php +1 -1
- vendor/mustache/mustache/src/Mustache/Loader/ProductionFilesystemLoader.php +86 -0
- vendor/mustache/mustache/src/Mustache/Loader/StringLoader.php +1 -1
- vendor/mustache/mustache/src/Mustache/Logger.php +1 -1
- vendor/mustache/mustache/src/Mustache/Logger/AbstractLogger.php +1 -1
- vendor/mustache/mustache/src/Mustache/Logger/StreamLogger.php +7 -7
- vendor/mustache/mustache/src/Mustache/Parser.php +8 -8
- vendor/mustache/mustache/src/Mustache/Source.php +40 -0
- vendor/mustache/mustache/src/Mustache/Source/FilesystemSource.php +77 -0
- vendor/mustache/mustache/src/Mustache/Template.php +3 -4
- vendor/mustache/mustache/src/Mustache/Tokenizer.php +71 -46
- vendor/scribu/lib-posts-to-posts/.gitignore +2 -0
- vendor/scribu/lib-posts-to-posts/composer.json +7 -1
- vendor/scribu/lib-posts-to-posts/side-post.php +1 -1
- vendor/scribu/scb-framework/.gitignore +1 -0
- vendor/scribu/scb-framework/AdminPage.php +3 -3
- vendor/scribu/scb-framework/Forms.php +4 -0
- vendor/scribu/scb-framework/load.php +1 -1
composer.json
CHANGED
@@ -4,13 +4,22 @@
|
|
4 |
"homepage": "http://wordpress.org/plugins/posts-to-posts",
|
5 |
"license": "GPL-2.0+",
|
6 |
"minimum-stability": "dev",
|
|
|
|
|
|
|
7 |
"require": {
|
8 |
"composer/installers": "~1.0",
|
|
|
|
|
9 |
},
|
10 |
"repositories": [
|
11 |
{
|
12 |
"type": "vcs",
|
13 |
-
"url": "https://github.com/
|
|
|
|
|
|
|
|
|
14 |
}
|
15 |
]
|
16 |
-
}
|
4 |
"homepage": "http://wordpress.org/plugins/posts-to-posts",
|
5 |
"license": "GPL-2.0+",
|
6 |
"minimum-stability": "dev",
|
7 |
+
"scripts": {
|
8 |
+
"zip": "git archive --format zip --output \"../../posts-to-posts.zip\" master"
|
9 |
+
},
|
10 |
"require": {
|
11 |
"composer/installers": "~1.0",
|
12 |
+
"scribu/lib-posts-to-posts": "dev-master",
|
13 |
+
"mustache/mustache": "~2.6"
|
14 |
},
|
15 |
"repositories": [
|
16 |
{
|
17 |
"type": "vcs",
|
18 |
+
"url": "https://github.com/jeffreyvr/wp-lib-posts-to-posts"
|
19 |
+
},
|
20 |
+
{
|
21 |
+
"type": "vcs",
|
22 |
+
"url": "https://github.com/jeffreyvr/wp-scb-framework"
|
23 |
}
|
24 |
]
|
25 |
+
}
|
posts-to-posts.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Posts 2 Posts
|
4 |
Description: Create many-to-many relationships between all types of posts.
|
5 |
-
Version: 1.
|
6 |
Author: scribu
|
7 |
Author URI: http://scribu.net/
|
8 |
Plugin URI: http://scribu.net/wordpress/posts-to-posts
|
@@ -10,7 +10,7 @@ Text Domain: posts-to-posts
|
|
10 |
Domain Path: /lang
|
11 |
*/
|
12 |
|
13 |
-
define( 'P2P_PLUGIN_VERSION', '1.
|
14 |
|
15 |
define( 'P2P_TEXTDOMAIN', 'posts-to-posts' );
|
16 |
|
2 |
/*
|
3 |
Plugin Name: Posts 2 Posts
|
4 |
Description: Create many-to-many relationships between all types of posts.
|
5 |
+
Version: 1.7
|
6 |
Author: scribu
|
7 |
Author URI: http://scribu.net/
|
8 |
Plugin URI: http://scribu.net/wordpress/posts-to-posts
|
10 |
Domain Path: /lang
|
11 |
*/
|
12 |
|
13 |
+
define( 'P2P_PLUGIN_VERSION', '1.7' );
|
14 |
|
15 |
define( 'P2P_TEXTDOMAIN', 'posts-to-posts' );
|
16 |
|
readme.txt
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
=== Posts 2 Posts ===
|
2 |
|
3 |
Contributors: scribu, ciobi, ayecode, stiofansisland
|
4 |
-
Tags: connections, custom post types, relationships, many-to-many, users
|
5 |
-
Requires at least:
|
6 |
Requires PHP: 5.6
|
7 |
-
Tested up to: 5.
|
8 |
-
Stable tag: 1.
|
9 |
|
10 |
-
License: GPLv2 or later
|
11 |
-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
13 |
Efficient many-to-many connections between posts, pages, custom post types, users.
|
14 |
|
@@ -42,7 +42,7 @@ Links: [**Documentation**](http://github.com/scribu/wp-posts-to-posts/wiki) | [P
|
|
42 |
See [Installing Plugins](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins).
|
43 |
|
44 |
After activating it, refer to the [Basic usage](https://github.com/scribu/wp-posts-to-posts/wiki/Basic-usage) tutorial.
|
45 |
-
|
46 |
Additional info can be found on the [wiki](http://github.com/scribu/wp-posts-to-posts/wiki).
|
47 |
|
48 |
== Frequently Asked Questions ==
|
@@ -61,6 +61,9 @@ Additional info can be found on the [wiki](http://github.com/scribu/wp-posts-to-
|
|
61 |
|
62 |
== Changelog ==
|
63 |
|
|
|
|
|
|
|
64 |
= 1.6.6 =
|
65 |
* AyeCode Ltd have committed to security and maintenance updates - INFO
|
66 |
* Deprecated PHP notices showing with latest WordPress - FIXED
|
1 |
=== Posts 2 Posts ===
|
2 |
|
3 |
Contributors: scribu, ciobi, ayecode, stiofansisland
|
4 |
+
Tags: connections, custom post types, relationships, many-to-many, users
|
5 |
+
Requires at least: 4.5
|
6 |
Requires PHP: 5.6
|
7 |
+
Tested up to: 5.9
|
8 |
+
Stable tag: 1.7
|
9 |
|
10 |
+
License: GPLv2 or later
|
11 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
13 |
Efficient many-to-many connections between posts, pages, custom post types, users.
|
14 |
|
42 |
See [Installing Plugins](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins).
|
43 |
|
44 |
After activating it, refer to the [Basic usage](https://github.com/scribu/wp-posts-to-posts/wiki/Basic-usage) tutorial.
|
45 |
+
|
46 |
Additional info can be found on the [wiki](http://github.com/scribu/wp-posts-to-posts/wiki).
|
47 |
|
48 |
== Frequently Asked Questions ==
|
61 |
|
62 |
== Changelog ==
|
63 |
|
64 |
+
= 1.7 =
|
65 |
+
* Update Mustache package to support PHP 8.
|
66 |
+
|
67 |
= 1.6.6 =
|
68 |
* AyeCode Ltd have committed to security and maintenance updates - INFO
|
69 |
* Deprecated PHP notices showing with latest WordPress - FIXED
|
vendor/mustache/mustache/.gitattributes
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/test export-ignore
|
2 |
+
/CONTRIBUTING.md export-ignore
|
3 |
+
/.php_cs export-ignore
|
4 |
+
/phpunit.xml.dist export-ignore
|
5 |
+
/.travis.yml export-ignore
|
6 |
+
/.styleci.yml export-ignore
|
7 |
+
/.gitmodules export-ignore
|
8 |
+
/.gitignore export-ignore
|
vendor/mustache/mustache/.php_cs
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
use Symfony\CS\Config\Config;
|
4 |
-
use Symfony\CS\FixerInterface;
|
5 |
-
|
6 |
-
$config = Config::create()
|
7 |
-
// use symfony level and extra fixers:
|
8 |
-
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
|
9 |
-
->fixers(array(
|
10 |
-
'-concat_without_spaces',
|
11 |
-
'-pre_increment',
|
12 |
-
'-unalign_double_arrow',
|
13 |
-
'-unalign_equals',
|
14 |
-
'align_double_arrow',
|
15 |
-
'concat_with_spaces',
|
16 |
-
'ordered_use',
|
17 |
-
'strict',
|
18 |
-
))
|
19 |
-
->setUsingLinter(false);
|
20 |
-
|
21 |
-
$finder = $config->getFinder()
|
22 |
-
->in('bin')
|
23 |
-
->in('src')
|
24 |
-
->in('test');
|
25 |
-
|
26 |
-
return $config;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/mustache/mustache/.styleci.yml
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
preset: symfony
|
2 |
-
|
3 |
-
enabled:
|
4 |
-
- align_double_arrow
|
5 |
-
- concat_with_spaces
|
6 |
-
- ordered_use
|
7 |
-
- strict
|
8 |
-
|
9 |
-
disabled:
|
10 |
-
- concat_without_spaces
|
11 |
-
- pre_increment
|
12 |
-
- unalign_double_arrow
|
13 |
-
- unalign_equals
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/mustache/mustache/.travis.yml
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
language: php
|
2 |
-
|
3 |
-
install:
|
4 |
-
- curl http://get.sensiolabs.org/php-cs-fixer.phar -o php-cs-fixer.phar
|
5 |
-
|
6 |
-
script:
|
7 |
-
- phpunit
|
8 |
-
- if [[ `php -r "echo version_compare(PHP_VERSION, '5.3.6', '>=') && !defined('HHVM_VERSION');"` ]]; then php php-cs-fixer.phar --diff --dry-run -vv fix; fi
|
9 |
-
|
10 |
-
php:
|
11 |
-
- 5.2
|
12 |
-
- 5.3
|
13 |
-
- 5.4
|
14 |
-
- 5.5
|
15 |
-
- 5.6
|
16 |
-
- 7.0
|
17 |
-
- hhvm
|
18 |
-
|
19 |
-
sudo: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/mustache/mustache/CONTRIBUTING.md
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
# Contributions welcome!
|
2 |
-
|
3 |
-
|
4 |
-
### Here's a quick guide:
|
5 |
-
|
6 |
-
1. [Fork the repo on GitHub](https://github.com/bobthecow/mustache.php).
|
7 |
-
|
8 |
-
2. Update submodules: `git submodule update --init`
|
9 |
-
|
10 |
-
3. Run the test suite. We only take pull requests with passing tests, and it's great to know that you have a clean slate. Make sure you have PHPUnit 3.5+, then run `phpunit` from the project directory.
|
11 |
-
|
12 |
-
4. Add tests for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, add a test!
|
13 |
-
|
14 |
-
5. Make the tests pass.
|
15 |
-
|
16 |
-
6. Push your fork to GitHub and submit a pull request against the `dev` branch.
|
17 |
-
|
18 |
-
|
19 |
-
### You can do some things to increase the chance that your pull request is accepted the first time:
|
20 |
-
|
21 |
-
* Submit one pull request per fix or feature.
|
22 |
-
* To help with that, do all your work in a feature branch (e.g. `feature/my-alsome-feature`).
|
23 |
-
* Follow the conventions you see used in the project.
|
24 |
-
* Use `phpcs --standard=PSR2` to check your changes against the coding standard.
|
25 |
-
* Write tests that fail without your code, and pass with it.
|
26 |
-
* Don't bump version numbers. Those will be updated — per [semver](http://semver.org) — once your change is merged into `master`.
|
27 |
-
* Update any documentation: docblocks, README, examples, etc.
|
28 |
-
* ... Don't update the wiki until your change is merged and released, but make a note in your pull request so we don't forget.
|
29 |
-
|
30 |
-
|
31 |
-
### Mustache.php follows the PSR-* coding standards:
|
32 |
-
|
33 |
-
* [PSR-0: Class and file naming conventions](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md)
|
34 |
-
* [PSR-1: Basic coding standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md)
|
35 |
-
* [PSR-2: Coding style guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/mustache/mustache/README.md
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
Mustache.php
|
2 |
============
|
3 |
|
4 |
-
A [Mustache](
|
5 |
|
6 |
[![Package version](http://img.shields.io/packagist/v/mustache/mustache.svg?style=flat-square)](https://packagist.org/packages/mustache/mustache)
|
7 |
[![Build status](http://img.shields.io/travis/bobthecow/mustache.php/dev.svg?style=flat-square)](http://travis-ci.org/bobthecow/mustache.php)
|
|
|
8 |
[![Monthly downloads](http://img.shields.io/packagist/dm/mustache/mustache.svg?style=flat-square)](https://packagist.org/packages/mustache/mustache)
|
9 |
|
10 |
|
@@ -15,7 +16,7 @@ A quick example:
|
|
15 |
|
16 |
```php
|
17 |
<?php
|
18 |
-
$m = new Mustache_Engine;
|
19 |
echo $m->render('Hello {{planet}}', array('planet' => 'World!')); // "Hello World!"
|
20 |
```
|
21 |
|
@@ -52,11 +53,12 @@ And render it:
|
|
52 |
|
53 |
```php
|
54 |
<?php
|
55 |
-
$m = new Mustache_Engine;
|
56 |
$chris = new Chris;
|
57 |
echo $m->render($template, $chris);
|
58 |
```
|
59 |
|
|
|
60 |
|
61 |
And That's Not All!
|
62 |
-------------------
|
@@ -67,5 +69,5 @@ Read [the Mustache.php documentation](https://github.com/bobthecow/mustache.php/
|
|
67 |
See Also
|
68 |
--------
|
69 |
|
|
|
70 |
* [Readme for the Ruby Mustache implementation](http://github.com/defunkt/mustache/blob/master/README.md).
|
71 |
-
* [mustache(5)](http://mustache.github.com/mustache.5.html) man page.
|
1 |
Mustache.php
|
2 |
============
|
3 |
|
4 |
+
A [Mustache](https://mustache.github.io/) implementation in PHP.
|
5 |
|
6 |
[![Package version](http://img.shields.io/packagist/v/mustache/mustache.svg?style=flat-square)](https://packagist.org/packages/mustache/mustache)
|
7 |
[![Build status](http://img.shields.io/travis/bobthecow/mustache.php/dev.svg?style=flat-square)](http://travis-ci.org/bobthecow/mustache.php)
|
8 |
+
[![StyleCI](https://styleci.io/repos/569670/shield)](https://styleci.io/repos/569670)
|
9 |
[![Monthly downloads](http://img.shields.io/packagist/dm/mustache/mustache.svg?style=flat-square)](https://packagist.org/packages/mustache/mustache)
|
10 |
|
11 |
|
16 |
|
17 |
```php
|
18 |
<?php
|
19 |
+
$m = new Mustache_Engine(array('entity_flags' => ENT_QUOTES));
|
20 |
echo $m->render('Hello {{planet}}', array('planet' => 'World!')); // "Hello World!"
|
21 |
```
|
22 |
|
53 |
|
54 |
```php
|
55 |
<?php
|
56 |
+
$m = new Mustache_Engine(array('entity_flags' => ENT_QUOTES));
|
57 |
$chris = new Chris;
|
58 |
echo $m->render($template, $chris);
|
59 |
```
|
60 |
|
61 |
+
*Note:* we recommend using `ENT_QUOTES` as a default of [entity_flags](https://github.com/bobthecow/mustache.php/wiki#entity_flags) to decrease the chance of Cross-site scripting vulnerability.
|
62 |
|
63 |
And That's Not All!
|
64 |
-------------------
|
69 |
See Also
|
70 |
--------
|
71 |
|
72 |
+
* [mustache(5)](http://mustache.github.io/mustache.5.html) man page.
|
73 |
* [Readme for the Ruby Mustache implementation](http://github.com/defunkt/mustache/blob/master/README.md).
|
|
vendor/mustache/mustache/bin/build_bootstrap.php
ADDED
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env php
|
2 |
+
<?php
|
3 |
+
|
4 |
+
/*
|
5 |
+
* This file is part of Mustache.php.
|
6 |
+
*
|
7 |
+
* (c) 2010-2015 Justin Hileman
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* A shell script to create a single-file class cache of the entire Mustache
|
15 |
+
* library.
|
16 |
+
*
|
17 |
+
* $ bin/build_bootstrap.php
|
18 |
+
*
|
19 |
+
* ... will create a `mustache.php` bootstrap file in the project directory,
|
20 |
+
* containing all Mustache library classes. This file can then be included in
|
21 |
+
* your project, rather than requiring the Mustache Autoloader.
|
22 |
+
*/
|
23 |
+
$baseDir = realpath(dirname(__FILE__) . '/..');
|
24 |
+
|
25 |
+
require $baseDir . '/src/Mustache/Autoloader.php';
|
26 |
+
Mustache_Autoloader::register();
|
27 |
+
|
28 |
+
// delete the old file
|
29 |
+
$file = $baseDir . '/mustache.php';
|
30 |
+
if (file_exists($file)) {
|
31 |
+
unlink($file);
|
32 |
+
}
|
33 |
+
|
34 |
+
// and load the new one
|
35 |
+
SymfonyClassCollectionLoader::load(array(
|
36 |
+
'Mustache_Engine',
|
37 |
+
'Mustache_Cache',
|
38 |
+
'Mustache_Cache_AbstractCache',
|
39 |
+
'Mustache_Cache_FilesystemCache',
|
40 |
+
'Mustache_Cache_NoopCache',
|
41 |
+
'Mustache_Compiler',
|
42 |
+
'Mustache_Context',
|
43 |
+
'Mustache_Exception',
|
44 |
+
'Mustache_Exception_InvalidArgumentException',
|
45 |
+
'Mustache_Exception_LogicException',
|
46 |
+
'Mustache_Exception_RuntimeException',
|
47 |
+
'Mustache_Exception_SyntaxException',
|
48 |
+
'Mustache_Exception_UnknownFilterException',
|
49 |
+
'Mustache_Exception_UnknownHelperException',
|
50 |
+
'Mustache_Exception_UnknownTemplateException',
|
51 |
+
'Mustache_HelperCollection',
|
52 |
+
'Mustache_LambdaHelper',
|
53 |
+
'Mustache_Loader',
|
54 |
+
'Mustache_Loader_ArrayLoader',
|
55 |
+
'Mustache_Loader_CascadingLoader',
|
56 |
+
'Mustache_Loader_FilesystemLoader',
|
57 |
+
'Mustache_Loader_InlineLoader',
|
58 |
+
'Mustache_Loader_MutableLoader',
|
59 |
+
'Mustache_Loader_StringLoader',
|
60 |
+
'Mustache_Logger',
|
61 |
+
'Mustache_Logger_AbstractLogger',
|
62 |
+
'Mustache_Logger_StreamLogger',
|
63 |
+
'Mustache_Parser',
|
64 |
+
'Mustache_Template',
|
65 |
+
'Mustache_Tokenizer',
|
66 |
+
), dirname($file), basename($file, '.php'));
|
67 |
+
|
68 |
+
/**
|
69 |
+
* SymfonyClassCollectionLoader.
|
70 |
+
*
|
71 |
+
* Based heavily on the Symfony ClassCollectionLoader component, with all
|
72 |
+
* the unnecessary bits removed.
|
73 |
+
*
|
74 |
+
* @license http://www.opensource.org/licenses/MIT
|
75 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
76 |
+
*/
|
77 |
+
class SymfonyClassCollectionLoader
|
78 |
+
{
|
79 |
+
private static $loaded;
|
80 |
+
|
81 |
+
const HEADER = <<<'EOS'
|
82 |
+
<?php
|
83 |
+
|
84 |
+
/*
|
85 |
+
* This file is part of Mustache.php.
|
86 |
+
*
|
87 |
+
* (c) 2010-%d Justin Hileman
|
88 |
+
*
|
89 |
+
* For the full copyright and license information, please view the LICENSE
|
90 |
+
* file that was distributed with this source code.
|
91 |
+
*/
|
92 |
+
EOS;
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Loads a list of classes and caches them in one big file.
|
96 |
+
*
|
97 |
+
* @param array $classes An array of classes to load
|
98 |
+
* @param string $cacheDir A cache directory
|
99 |
+
* @param string $name The cache name prefix
|
100 |
+
* @param string $extension File extension of the resulting file
|
101 |
+
*
|
102 |
+
* @throws InvalidArgumentException When class can't be loaded
|
103 |
+
*/
|
104 |
+
public static function load(array $classes, $cacheDir, $name, $extension = '.php')
|
105 |
+
{
|
106 |
+
// each $name can only be loaded once per PHP process
|
107 |
+
if (isset(self::$loaded[$name])) {
|
108 |
+
return;
|
109 |
+
}
|
110 |
+
|
111 |
+
self::$loaded[$name] = true;
|
112 |
+
|
113 |
+
$content = '';
|
114 |
+
foreach ($classes as $class) {
|
115 |
+
if (!class_exists($class) && !interface_exists($class) && (!function_exists('trait_exists') || !trait_exists($class))) {
|
116 |
+
throw new InvalidArgumentException(sprintf('Unable to load class "%s"', $class));
|
117 |
+
}
|
118 |
+
|
119 |
+
$r = new ReflectionClass($class);
|
120 |
+
$content .= preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', file_get_contents($r->getFileName()));
|
121 |
+
}
|
122 |
+
|
123 |
+
$cache = $cacheDir . '/' . $name . $extension;
|
124 |
+
$header = sprintf(self::HEADER, strftime('%Y'));
|
125 |
+
self::writeCacheFile($cache, $header . substr(self::stripComments('<?php ' . $content), 5));
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Writes a cache file.
|
130 |
+
*
|
131 |
+
* @param string $file Filename
|
132 |
+
* @param string $content Temporary file content
|
133 |
+
*
|
134 |
+
* @throws RuntimeException when a cache file cannot be written
|
135 |
+
*/
|
136 |
+
private static function writeCacheFile($file, $content)
|
137 |
+
{
|
138 |
+
$tmpFile = tempnam(dirname($file), basename($file));
|
139 |
+
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
|
140 |
+
chmod($file, 0666 & ~umask());
|
141 |
+
|
142 |
+
return;
|
143 |
+
}
|
144 |
+
|
145 |
+
throw new RuntimeException(sprintf('Failed to write cache file "%s".', $file));
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Removes comments from a PHP source string.
|
150 |
+
*
|
151 |
+
* We don't use the PHP php_strip_whitespace() function
|
152 |
+
* as we want the content to be readable and well-formatted.
|
153 |
+
*
|
154 |
+
* @param string $source A PHP string
|
155 |
+
*
|
156 |
+
* @return string The PHP string with the comments removed
|
157 |
+
*/
|
158 |
+
private static function stripComments($source)
|
159 |
+
{
|
160 |
+
if (!function_exists('token_get_all')) {
|
161 |
+
return $source;
|
162 |
+
}
|
163 |
+
|
164 |
+
$output = '';
|
165 |
+
foreach (token_get_all($source) as $token) {
|
166 |
+
if (is_string($token)) {
|
167 |
+
$output .= $token;
|
168 |
+
} elseif (!in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {
|
169 |
+
$output .= $token[1];
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
// replace multiple new lines with a single newline
|
174 |
+
$output = preg_replace(array('/\s+$/Sm', '/\n+/S'), "\n", $output);
|
175 |
+
|
176 |
+
return $output;
|
177 |
+
}
|
178 |
+
}
|
vendor/mustache/mustache/composer.json
CHANGED
@@ -16,8 +16,8 @@
|
|
16 |
"php": ">=5.2.4"
|
17 |
},
|
18 |
"require-dev": {
|
19 |
-
"phpunit/phpunit": "~3.7|~4.0",
|
20 |
-
"
|
21 |
},
|
22 |
"autoload": {
|
23 |
"psr-0": { "Mustache": "src/" }
|
16 |
"php": ">=5.2.4"
|
17 |
},
|
18 |
"require-dev": {
|
19 |
+
"phpunit/phpunit": "~3.7|~4.0|~5.0",
|
20 |
+
"friendsofphp/php-cs-fixer": "~1.11"
|
21 |
},
|
22 |
"autoload": {
|
23 |
"psr-0": { "Mustache": "src/" }
|
vendor/mustache/mustache/phpunit.xml.dist
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<phpunit backupGlobals="false" colors="true" bootstrap="./test/bootstrap.php">
|
3 |
-
<testsuite name="Mustache">
|
4 |
-
<directory suffix="Test.php">./test</directory>
|
5 |
-
<exclude>./test/Mustache/Test/FiveThree</exclude>
|
6 |
-
</testsuite>
|
7 |
-
|
8 |
-
<testsuite name="Mustache FiveThree">
|
9 |
-
<directory suffix="Test.php" phpVersion="5.3.0" phpVersionOperator=">=">./test/Mustache/Test/FiveThree</directory>
|
10 |
-
</testsuite>
|
11 |
-
|
12 |
-
<filter>
|
13 |
-
<whitelist>
|
14 |
-
<directory suffix=".php">./src/Mustache</directory>
|
15 |
-
</whitelist>
|
16 |
-
</filter>
|
17 |
-
</phpunit>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/mustache/mustache/src/Mustache/Autoloader.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -16,6 +16,14 @@ class Mustache_Autoloader
|
|
16 |
{
|
17 |
private $baseDir;
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
/**
|
20 |
* Autoloader constructor.
|
21 |
*
|
@@ -45,7 +53,13 @@ class Mustache_Autoloader
|
|
45 |
*/
|
46 |
public static function register($baseDir = null)
|
47 |
{
|
48 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
spl_autoload_register(array($loader, 'autoload'));
|
50 |
|
51 |
return $loader;
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
16 |
{
|
17 |
private $baseDir;
|
18 |
|
19 |
+
/**
|
20 |
+
* An array where the key is the baseDir and the key is an instance of this
|
21 |
+
* class.
|
22 |
+
*
|
23 |
+
* @var array
|
24 |
+
*/
|
25 |
+
private static $instances;
|
26 |
+
|
27 |
/**
|
28 |
* Autoloader constructor.
|
29 |
*
|
53 |
*/
|
54 |
public static function register($baseDir = null)
|
55 |
{
|
56 |
+
$key = $baseDir ? $baseDir : 0;
|
57 |
+
|
58 |
+
if (!isset(self::$instances[$key])) {
|
59 |
+
self::$instances[$key] = new self($baseDir);
|
60 |
+
}
|
61 |
+
|
62 |
+
$loader = self::$instances[$key];
|
63 |
spl_autoload_register(array($loader, 'autoload'));
|
64 |
|
65 |
return $loader;
|
vendor/mustache/mustache/src/Mustache/Cache.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -33,4 +33,11 @@ interface Mustache_Cache
|
|
33 |
* @param string $value
|
34 |
*/
|
35 |
public function cache($key, $value);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
33 |
* @param string $value
|
34 |
*/
|
35 |
public function cache($key, $value);
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Set a logger instance.
|
39 |
+
*
|
40 |
+
* @param Mustache_Logger|Psr\Log\LoggerInterface $logger
|
41 |
+
*/
|
42 |
+
public function setLogger($logger = null);
|
43 |
}
|
vendor/mustache/mustache/src/Mustache/Cache/AbstractCache.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -47,7 +47,7 @@ abstract class Mustache_Cache_AbstractCache implements Mustache_Cache
|
|
47 |
/**
|
48 |
* Add a log record if logging is enabled.
|
49 |
*
|
50 |
-
* @param
|
51 |
* @param string $message The log message
|
52 |
* @param array $context The log context
|
53 |
*/
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
47 |
/**
|
48 |
* Add a log record if logging is enabled.
|
49 |
*
|
50 |
+
* @param string $level The logging level
|
51 |
* @param string $message The log message
|
52 |
* @param array $context The log context
|
53 |
*/
|
vendor/mustache/mustache/src/Mustache/Cache/FilesystemCache.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -27,8 +27,8 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
|
|
27 |
/**
|
28 |
* Filesystem cache constructor.
|
29 |
*
|
30 |
-
* @param string $baseDir Directory for compiled templates
|
31 |
-
* @param int $fileMode Override default permissions for cache files. Defaults to using the system-defined umask
|
32 |
*/
|
33 |
public function __construct($baseDir, $fileMode = null)
|
34 |
{
|
@@ -108,9 +108,11 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
|
|
108 |
);
|
109 |
|
110 |
@mkdir($dirName, 0777, true);
|
|
|
111 |
if (!is_dir($dirName)) {
|
112 |
throw new Mustache_Exception_RuntimeException(sprintf('Failed to create cache directory "%s".', $dirName));
|
113 |
}
|
|
|
114 |
}
|
115 |
|
116 |
return $dirName;
|
@@ -143,13 +145,17 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
|
|
143 |
return;
|
144 |
}
|
145 |
|
|
|
146 |
$this->log(
|
147 |
Mustache_Logger::ERROR,
|
148 |
'Unable to rename Mustache temp cache file: "{tempName}" -> "{fileName}"',
|
149 |
array('tempName' => $tempFile, 'fileName' => $fileName)
|
150 |
);
|
|
|
151 |
}
|
152 |
|
|
|
153 |
throw new Mustache_Exception_RuntimeException(sprintf('Failed to write cache file "%s".', $fileName));
|
|
|
154 |
}
|
155 |
}
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
27 |
/**
|
28 |
* Filesystem cache constructor.
|
29 |
*
|
30 |
+
* @param string $baseDir Directory for compiled templates
|
31 |
+
* @param int $fileMode Override default permissions for cache files. Defaults to using the system-defined umask
|
32 |
*/
|
33 |
public function __construct($baseDir, $fileMode = null)
|
34 |
{
|
108 |
);
|
109 |
|
110 |
@mkdir($dirName, 0777, true);
|
111 |
+
// @codeCoverageIgnoreStart
|
112 |
if (!is_dir($dirName)) {
|
113 |
throw new Mustache_Exception_RuntimeException(sprintf('Failed to create cache directory "%s".', $dirName));
|
114 |
}
|
115 |
+
// @codeCoverageIgnoreEnd
|
116 |
}
|
117 |
|
118 |
return $dirName;
|
145 |
return;
|
146 |
}
|
147 |
|
148 |
+
// @codeCoverageIgnoreStart
|
149 |
$this->log(
|
150 |
Mustache_Logger::ERROR,
|
151 |
'Unable to rename Mustache temp cache file: "{tempName}" -> "{fileName}"',
|
152 |
array('tempName' => $tempFile, 'fileName' => $fileName)
|
153 |
);
|
154 |
+
// @codeCoverageIgnoreEnd
|
155 |
}
|
156 |
|
157 |
+
// @codeCoverageIgnoreStart
|
158 |
throw new Mustache_Exception_RuntimeException(sprintf('Failed to write cache file "%s".', $fileName));
|
159 |
+
// @codeCoverageIgnoreEnd
|
160 |
}
|
161 |
}
|
vendor/mustache/mustache/src/Mustache/Cache/NoopCache.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
vendor/mustache/mustache/src/Mustache/Compiler.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -75,7 +75,7 @@ class Mustache_Compiler
|
|
75 |
/**
|
76 |
* Helper function for walking the Mustache token parse tree.
|
77 |
*
|
78 |
-
* @throws Mustache_Exception_SyntaxException upon encountering unknown token types
|
79 |
*
|
80 |
* @param array $tree Parse tree of Mustache tokens
|
81 |
* @param int $level (default: 0)
|
@@ -191,7 +191,6 @@ class Mustache_Compiler
|
|
191 |
{
|
192 |
$this->lambdaHelper = new Mustache_LambdaHelper($this->mustache, $context);
|
193 |
$buffer = \'\';
|
194 |
-
$newContext = array();
|
195 |
%s
|
196 |
|
197 |
return $buffer;
|
@@ -207,7 +206,6 @@ class Mustache_Compiler
|
|
207 |
public function renderInternal(Mustache_Context $context, $indent = \'\')
|
208 |
{
|
209 |
$buffer = \'\';
|
210 |
-
$newContext = array();
|
211 |
%s
|
212 |
|
213 |
return $buffer;
|
@@ -240,10 +238,11 @@ class Mustache_Compiler
|
|
240 |
$blockFunction = $context->findInBlock(%s);
|
241 |
if (is_callable($blockFunction)) {
|
242 |
$buffer .= call_user_func($blockFunction, $context);
|
243 |
-
|
244 |
-
}
|
245 |
';
|
246 |
|
|
|
|
|
247 |
/**
|
248 |
* Generate Mustache Template inheritance block variable PHP source.
|
249 |
*
|
@@ -261,10 +260,15 @@ class Mustache_Compiler
|
|
261 |
{
|
262 |
$id = var_export($id, true);
|
263 |
|
264 |
-
|
|
|
|
|
|
|
|
|
|
|
265 |
}
|
266 |
|
267 |
-
const BLOCK_ARG = '
|
268 |
|
269 |
/**
|
270 |
* Generate Mustache Template inheritance block argument PHP source.
|
@@ -282,10 +286,9 @@ class Mustache_Compiler
|
|
282 |
private function blockArg($nodes, $id, $start, $end, $otag, $ctag, $level)
|
283 |
{
|
284 |
$key = $this->block($nodes);
|
285 |
-
$keystr = var_export($key, true);
|
286 |
$id = var_export($id, true);
|
287 |
|
288 |
-
return sprintf($this->prepare(self::BLOCK_ARG,
|
289 |
}
|
290 |
|
291 |
const BLOCK_FUNCTION = '
|
@@ -317,7 +320,6 @@ class Mustache_Compiler
|
|
317 |
}
|
318 |
|
319 |
const SECTION_CALL = '
|
320 |
-
// %s section
|
321 |
$value = $context->%s(%s);%s
|
322 |
$buffer .= $this->section%s($context, $indent, $value);
|
323 |
';
|
@@ -326,14 +328,15 @@ class Mustache_Compiler
|
|
326 |
private function section%s(Mustache_Context $context, $indent, $value)
|
327 |
{
|
328 |
$buffer = \'\';
|
|
|
329 |
if (%s) {
|
330 |
$source = %s;
|
331 |
-
$result = call_user_func($value, $source,
|
332 |
if (strpos($result, \'{{\') === false) {
|
333 |
$buffer .= $result;
|
334 |
} else {
|
335 |
$buffer .= $this->mustache
|
336 |
-
->loadLambda(
|
337 |
->renderInternal($context);
|
338 |
}
|
339 |
} elseif (!empty($value)) {
|
@@ -360,40 +363,37 @@ class Mustache_Compiler
|
|
360 |
* @param string $otag Current Mustache opening tag
|
361 |
* @param string $ctag Current Mustache closing tag
|
362 |
* @param int $level
|
363 |
-
* @param bool $arg (default: false)
|
364 |
*
|
365 |
* @return string Generated section PHP source code
|
366 |
*/
|
367 |
-
private function section($nodes, $id, $filters, $start, $end, $otag, $ctag, $level
|
368 |
{
|
369 |
$source = var_export(substr($this->source, $start, $end - $start), true);
|
370 |
$callable = $this->getCallable();
|
371 |
|
372 |
if ($otag !== '{{' || $ctag !== '}}') {
|
373 |
-
$
|
|
|
|
|
374 |
} else {
|
|
|
375 |
$delims = '';
|
376 |
}
|
377 |
|
378 |
$key = ucfirst(md5($delims . "\n" . $source));
|
379 |
|
380 |
if (!isset($this->sections[$key])) {
|
381 |
-
$this->sections[$key] = sprintf($this->prepare(self::SECTION), $key, $callable, $source, $delims, $this->walk($nodes, 2));
|
382 |
}
|
383 |
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
$method = $this->getFindMethod($id);
|
388 |
-
$id = var_export($id, true);
|
389 |
-
$filters = $this->getFilters($filters, $level);
|
390 |
|
391 |
-
|
392 |
-
}
|
393 |
}
|
394 |
|
395 |
const INVERTED_SECTION = '
|
396 |
-
// %s inverted section
|
397 |
$value = $context->%s(%s);%s
|
398 |
if (empty($value)) {
|
399 |
%s
|
@@ -416,7 +416,7 @@ class Mustache_Compiler
|
|
416 |
$id = var_export($id, true);
|
417 |
$filters = $this->getFilters($filters, $level);
|
418 |
|
419 |
-
return sprintf($this->prepare(self::INVERTED_SECTION, $level), $
|
420 |
}
|
421 |
|
422 |
const PARTIAL_INDENT = ', $indent . %s';
|
@@ -451,15 +451,20 @@ class Mustache_Compiler
|
|
451 |
}
|
452 |
|
453 |
const PARENT = '
|
454 |
-
%s
|
455 |
-
|
456 |
-
|
457 |
-
$context->pushBlockContext($newContext);
|
458 |
$buffer .= $parent->renderInternal($context, $indent);
|
459 |
$context->popBlockContext();
|
460 |
}
|
461 |
';
|
462 |
|
|
|
|
|
|
|
|
|
|
|
|
|
463 |
/**
|
464 |
* Generate Mustache Template inheritance parent call PHP source.
|
465 |
*
|
@@ -474,11 +479,14 @@ class Mustache_Compiler
|
|
474 |
{
|
475 |
$realChildren = array_filter($children, array(__CLASS__, 'onlyBlockArgs'));
|
476 |
|
|
|
|
|
|
|
|
|
477 |
return sprintf(
|
478 |
$this->prepare(self::PARENT, $level),
|
479 |
-
$this->walk($realChildren, $level),
|
480 |
var_export($id, true),
|
481 |
-
|
482 |
);
|
483 |
}
|
484 |
|
@@ -487,7 +495,7 @@ class Mustache_Compiler
|
|
487 |
*
|
488 |
* @param array $node
|
489 |
*
|
490 |
-
* @return bool True if $node is a block arg token
|
491 |
*/
|
492 |
private static function onlyBlockArgs(array $node)
|
493 |
{
|
@@ -495,8 +503,8 @@ class Mustache_Compiler
|
|
495 |
}
|
496 |
|
497 |
const VARIABLE = '
|
498 |
-
$value = $this->resolveValue($context->%s(%s), $context
|
499 |
-
$buffer .= %s%s;
|
500 |
';
|
501 |
|
502 |
/**
|
@@ -615,7 +623,7 @@ class Mustache_Compiler
|
|
615 |
/**
|
616 |
* Select the appropriate Context `find` method for a given $id.
|
617 |
*
|
618 |
-
* The return value will be one of `find`, `findDot` or `last`.
|
619 |
*
|
620 |
* @see Mustache_Context::find
|
621 |
* @see Mustache_Context::findDot
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
75 |
/**
|
76 |
* Helper function for walking the Mustache token parse tree.
|
77 |
*
|
78 |
+
* @throws Mustache_Exception_SyntaxException upon encountering unknown token types
|
79 |
*
|
80 |
* @param array $tree Parse tree of Mustache tokens
|
81 |
* @param int $level (default: 0)
|
191 |
{
|
192 |
$this->lambdaHelper = new Mustache_LambdaHelper($this->mustache, $context);
|
193 |
$buffer = \'\';
|
|
|
194 |
%s
|
195 |
|
196 |
return $buffer;
|
206 |
public function renderInternal(Mustache_Context $context, $indent = \'\')
|
207 |
{
|
208 |
$buffer = \'\';
|
|
|
209 |
%s
|
210 |
|
211 |
return $buffer;
|
238 |
$blockFunction = $context->findInBlock(%s);
|
239 |
if (is_callable($blockFunction)) {
|
240 |
$buffer .= call_user_func($blockFunction, $context);
|
241 |
+
%s}
|
|
|
242 |
';
|
243 |
|
244 |
+
const BLOCK_VAR_ELSE = '} else {%s';
|
245 |
+
|
246 |
/**
|
247 |
* Generate Mustache Template inheritance block variable PHP source.
|
248 |
*
|
260 |
{
|
261 |
$id = var_export($id, true);
|
262 |
|
263 |
+
$else = $this->walk($nodes, $level);
|
264 |
+
if ($else !== '') {
|
265 |
+
$else = sprintf($this->prepare(self::BLOCK_VAR_ELSE, $level + 1, false, true), $else);
|
266 |
+
}
|
267 |
+
|
268 |
+
return sprintf($this->prepare(self::BLOCK_VAR, $level), $id, $else);
|
269 |
}
|
270 |
|
271 |
+
const BLOCK_ARG = '%s => array($this, \'block%s\'),';
|
272 |
|
273 |
/**
|
274 |
* Generate Mustache Template inheritance block argument PHP source.
|
286 |
private function blockArg($nodes, $id, $start, $end, $otag, $ctag, $level)
|
287 |
{
|
288 |
$key = $this->block($nodes);
|
|
|
289 |
$id = var_export($id, true);
|
290 |
|
291 |
+
return sprintf($this->prepare(self::BLOCK_ARG, $level), $id, $key);
|
292 |
}
|
293 |
|
294 |
const BLOCK_FUNCTION = '
|
320 |
}
|
321 |
|
322 |
const SECTION_CALL = '
|
|
|
323 |
$value = $context->%s(%s);%s
|
324 |
$buffer .= $this->section%s($context, $indent, $value);
|
325 |
';
|
328 |
private function section%s(Mustache_Context $context, $indent, $value)
|
329 |
{
|
330 |
$buffer = \'\';
|
331 |
+
|
332 |
if (%s) {
|
333 |
$source = %s;
|
334 |
+
$result = (string) call_user_func($value, $source, %s);
|
335 |
if (strpos($result, \'{{\') === false) {
|
336 |
$buffer .= $result;
|
337 |
} else {
|
338 |
$buffer .= $this->mustache
|
339 |
+
->loadLambda($result%s)
|
340 |
->renderInternal($context);
|
341 |
}
|
342 |
} elseif (!empty($value)) {
|
363 |
* @param string $otag Current Mustache opening tag
|
364 |
* @param string $ctag Current Mustache closing tag
|
365 |
* @param int $level
|
|
|
366 |
*
|
367 |
* @return string Generated section PHP source code
|
368 |
*/
|
369 |
+
private function section($nodes, $id, $filters, $start, $end, $otag, $ctag, $level)
|
370 |
{
|
371 |
$source = var_export(substr($this->source, $start, $end - $start), true);
|
372 |
$callable = $this->getCallable();
|
373 |
|
374 |
if ($otag !== '{{' || $ctag !== '}}') {
|
375 |
+
$delimTag = var_export(sprintf('{{= %s %s =}}', $otag, $ctag), true);
|
376 |
+
$helper = sprintf('$this->lambdaHelper->withDelimiters(%s)', $delimTag);
|
377 |
+
$delims = ', ' . $delimTag;
|
378 |
} else {
|
379 |
+
$helper = '$this->lambdaHelper';
|
380 |
$delims = '';
|
381 |
}
|
382 |
|
383 |
$key = ucfirst(md5($delims . "\n" . $source));
|
384 |
|
385 |
if (!isset($this->sections[$key])) {
|
386 |
+
$this->sections[$key] = sprintf($this->prepare(self::SECTION), $key, $callable, $source, $helper, $delims, $this->walk($nodes, 2));
|
387 |
}
|
388 |
|
389 |
+
$method = $this->getFindMethod($id);
|
390 |
+
$id = var_export($id, true);
|
391 |
+
$filters = $this->getFilters($filters, $level);
|
|
|
|
|
|
|
392 |
|
393 |
+
return sprintf($this->prepare(self::SECTION_CALL, $level), $method, $id, $filters, $key);
|
|
|
394 |
}
|
395 |
|
396 |
const INVERTED_SECTION = '
|
|
|
397 |
$value = $context->%s(%s);%s
|
398 |
if (empty($value)) {
|
399 |
%s
|
416 |
$id = var_export($id, true);
|
417 |
$filters = $this->getFilters($filters, $level);
|
418 |
|
419 |
+
return sprintf($this->prepare(self::INVERTED_SECTION, $level), $method, $id, $filters, $this->walk($nodes, $level));
|
420 |
}
|
421 |
|
422 |
const PARTIAL_INDENT = ', $indent . %s';
|
451 |
}
|
452 |
|
453 |
const PARENT = '
|
454 |
+
if ($parent = $this->mustache->loadPartial(%s)) {
|
455 |
+
$context->pushBlockContext(array(%s
|
456 |
+
));
|
|
|
457 |
$buffer .= $parent->renderInternal($context, $indent);
|
458 |
$context->popBlockContext();
|
459 |
}
|
460 |
';
|
461 |
|
462 |
+
const PARENT_NO_CONTEXT = '
|
463 |
+
if ($parent = $this->mustache->loadPartial(%s)) {
|
464 |
+
$buffer .= $parent->renderInternal($context, $indent);
|
465 |
+
}
|
466 |
+
';
|
467 |
+
|
468 |
/**
|
469 |
* Generate Mustache Template inheritance parent call PHP source.
|
470 |
*
|
479 |
{
|
480 |
$realChildren = array_filter($children, array(__CLASS__, 'onlyBlockArgs'));
|
481 |
|
482 |
+
if (empty($realChildren)) {
|
483 |
+
return sprintf($this->prepare(self::PARENT_NO_CONTEXT, $level), var_export($id, true));
|
484 |
+
}
|
485 |
+
|
486 |
return sprintf(
|
487 |
$this->prepare(self::PARENT, $level),
|
|
|
488 |
var_export($id, true),
|
489 |
+
$this->walk($realChildren, $level + 1)
|
490 |
);
|
491 |
}
|
492 |
|
495 |
*
|
496 |
* @param array $node
|
497 |
*
|
498 |
+
* @return bool True if $node is a block arg token
|
499 |
*/
|
500 |
private static function onlyBlockArgs(array $node)
|
501 |
{
|
503 |
}
|
504 |
|
505 |
const VARIABLE = '
|
506 |
+
$value = $this->resolveValue($context->%s(%s), $context);%s
|
507 |
+
$buffer .= %s($value === null ? \'\' : %s);
|
508 |
';
|
509 |
|
510 |
/**
|
623 |
/**
|
624 |
* Select the appropriate Context `find` method for a given $id.
|
625 |
*
|
626 |
+
* The return value will be one of `find`, `findDot`, `findAnchoredDot` or `last`.
|
627 |
*
|
628 |
* @see Mustache_Context::find
|
629 |
* @see Mustache_Context::findDot
|
vendor/mustache/mustache/src/Mustache/Context.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -150,7 +150,7 @@ class Mustache_Context
|
|
150 |
*
|
151 |
* @see Mustache_Context::findDot
|
152 |
*
|
153 |
-
* @throws Mustache_Exception_InvalidArgumentException if given an invalid anchored dot $id
|
154 |
*
|
155 |
* @param string $id Dotted variable selector
|
156 |
*
|
@@ -182,7 +182,7 @@ class Mustache_Context
|
|
182 |
*
|
183 |
* @param string $id
|
184 |
*
|
185 |
-
* @return mixed Variable value, or '' if not found
|
186 |
*/
|
187 |
public function findInBlock($id)
|
188 |
{
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
150 |
*
|
151 |
* @see Mustache_Context::findDot
|
152 |
*
|
153 |
+
* @throws Mustache_Exception_InvalidArgumentException if given an invalid anchored dot $id
|
154 |
*
|
155 |
* @param string $id Dotted variable selector
|
156 |
*
|
182 |
*
|
183 |
* @param string $id
|
184 |
*
|
185 |
+
* @return mixed Variable value, or '' if not found
|
186 |
*/
|
187 |
public function findInBlock($id)
|
188 |
{
|
vendor/mustache/mustache/src/Mustache/Engine.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -23,8 +23,8 @@
|
|
23 |
*/
|
24 |
class Mustache_Engine
|
25 |
{
|
26 |
-
const VERSION = '2.
|
27 |
-
const SPEC_VERSION = '1.
|
28 |
|
29 |
const PRAGMA_FILTERS = 'FILTERS';
|
30 |
const PRAGMA_BLOCKS = 'BLOCKS';
|
@@ -54,6 +54,7 @@ class Mustache_Engine
|
|
54 |
private $logger;
|
55 |
private $strictCallables = false;
|
56 |
private $pragmas = array();
|
|
|
57 |
|
58 |
// Services
|
59 |
private $tokenizer;
|
@@ -81,6 +82,14 @@ class Mustache_Engine
|
|
81 |
* // sections are often too dynamic to benefit from caching.
|
82 |
* 'cache_lambda_templates' => true,
|
83 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
* // A Mustache template loader instance. Uses a StringLoader if not specified.
|
85 |
* 'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'),
|
86 |
*
|
@@ -126,13 +135,17 @@ class Mustache_Engine
|
|
126 |
* 'pragmas' => [Mustache_Engine::PRAGMA_FILTERS],
|
127 |
* );
|
128 |
*
|
129 |
-
* @throws Mustache_Exception_InvalidArgumentException If `escape` option is not callable
|
130 |
*
|
131 |
* @param array $options (default: array())
|
132 |
*/
|
133 |
public function __construct(array $options = array())
|
134 |
{
|
135 |
if (isset($options['template_class_prefix'])) {
|
|
|
|
|
|
|
|
|
136 |
$this->templateClassPrefix = $options['template_class_prefix'];
|
137 |
}
|
138 |
|
@@ -191,6 +204,10 @@ class Mustache_Engine
|
|
191 |
$this->strictCallables = $options['strict_callables'];
|
192 |
}
|
193 |
|
|
|
|
|
|
|
|
|
194 |
if (isset($options['pragmas'])) {
|
195 |
foreach ($options['pragmas'] as $pragma) {
|
196 |
if (!isset(self::$knownPragmas[$pragma])) {
|
@@ -429,7 +446,7 @@ class Mustache_Engine
|
|
429 |
/**
|
430 |
* Set the Mustache Logger instance.
|
431 |
*
|
432 |
-
* @throws Mustache_Exception_InvalidArgumentException If logger is not an instance of Mustache_Logger or Psr\Log\LoggerInterface
|
433 |
*
|
434 |
* @param Mustache_Logger|Psr\Log\LoggerInterface $logger
|
435 |
*/
|
@@ -589,22 +606,43 @@ class Mustache_Engine
|
|
589 |
/**
|
590 |
* Helper method to generate a Mustache template class.
|
591 |
*
|
592 |
-
*
|
|
|
|
|
|
|
593 |
*
|
594 |
* @return string Mustache Template class name
|
595 |
*/
|
596 |
public function getTemplateClassName($source)
|
597 |
{
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
608 |
}
|
609 |
|
610 |
/**
|
@@ -681,8 +719,8 @@ class Mustache_Engine
|
|
681 |
* @see Mustache_Engine::loadPartial
|
682 |
* @see Mustache_Engine::loadLambda
|
683 |
*
|
684 |
-
* @param string
|
685 |
-
* @param Mustache_Cache
|
686 |
*
|
687 |
* @return Mustache_Template
|
688 |
*/
|
@@ -725,7 +763,7 @@ class Mustache_Engine
|
|
725 |
*/
|
726 |
private function tokenize($source)
|
727 |
{
|
728 |
-
return $this->getTokenizer()->scan($source);
|
729 |
}
|
730 |
|
731 |
/**
|
@@ -750,13 +788,12 @@ class Mustache_Engine
|
|
750 |
*
|
751 |
* @see Mustache_Compiler::compile
|
752 |
*
|
753 |
-
* @param string $source
|
754 |
*
|
755 |
* @return string generated Mustache template class code
|
756 |
*/
|
757 |
private function compile($source)
|
758 |
{
|
759 |
-
$tree = $this->parse($source);
|
760 |
$name = $this->getTemplateClassName($source);
|
761 |
|
762 |
$this->log(
|
@@ -765,6 +802,11 @@ class Mustache_Engine
|
|
765 |
array('className' => $name)
|
766 |
);
|
767 |
|
|
|
|
|
|
|
|
|
|
|
768 |
$compiler = $this->getCompiler();
|
769 |
$compiler->setPragmas($this->getPragmas());
|
770 |
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
23 |
*/
|
24 |
class Mustache_Engine
|
25 |
{
|
26 |
+
const VERSION = '2.14.0';
|
27 |
+
const SPEC_VERSION = '1.2.2';
|
28 |
|
29 |
const PRAGMA_FILTERS = 'FILTERS';
|
30 |
const PRAGMA_BLOCKS = 'BLOCKS';
|
54 |
private $logger;
|
55 |
private $strictCallables = false;
|
56 |
private $pragmas = array();
|
57 |
+
private $delimiters;
|
58 |
|
59 |
// Services
|
60 |
private $tokenizer;
|
82 |
* // sections are often too dynamic to benefit from caching.
|
83 |
* 'cache_lambda_templates' => true,
|
84 |
*
|
85 |
+
* // Customize the tag delimiters used by this engine instance. Note that overriding here changes the
|
86 |
+
* // delimiters used to parse all templates and partials loaded by this instance. To override just for a
|
87 |
+
* // single template, use an inline "change delimiters" tag at the start of the template file:
|
88 |
+
* //
|
89 |
+
* // {{=<% %>=}}
|
90 |
+
* //
|
91 |
+
* 'delimiters' => '<% %>',
|
92 |
+
*
|
93 |
* // A Mustache template loader instance. Uses a StringLoader if not specified.
|
94 |
* 'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'),
|
95 |
*
|
135 |
* 'pragmas' => [Mustache_Engine::PRAGMA_FILTERS],
|
136 |
* );
|
137 |
*
|
138 |
+
* @throws Mustache_Exception_InvalidArgumentException If `escape` option is not callable
|
139 |
*
|
140 |
* @param array $options (default: array())
|
141 |
*/
|
142 |
public function __construct(array $options = array())
|
143 |
{
|
144 |
if (isset($options['template_class_prefix'])) {
|
145 |
+
if ((string) $options['template_class_prefix'] === '') {
|
146 |
+
throw new Mustache_Exception_InvalidArgumentException('Mustache Constructor "template_class_prefix" must not be empty');
|
147 |
+
}
|
148 |
+
|
149 |
$this->templateClassPrefix = $options['template_class_prefix'];
|
150 |
}
|
151 |
|
204 |
$this->strictCallables = $options['strict_callables'];
|
205 |
}
|
206 |
|
207 |
+
if (isset($options['delimiters'])) {
|
208 |
+
$this->delimiters = $options['delimiters'];
|
209 |
+
}
|
210 |
+
|
211 |
if (isset($options['pragmas'])) {
|
212 |
foreach ($options['pragmas'] as $pragma) {
|
213 |
if (!isset(self::$knownPragmas[$pragma])) {
|
446 |
/**
|
447 |
* Set the Mustache Logger instance.
|
448 |
*
|
449 |
+
* @throws Mustache_Exception_InvalidArgumentException If logger is not an instance of Mustache_Logger or Psr\Log\LoggerInterface
|
450 |
*
|
451 |
* @param Mustache_Logger|Psr\Log\LoggerInterface $logger
|
452 |
*/
|
606 |
/**
|
607 |
* Helper method to generate a Mustache template class.
|
608 |
*
|
609 |
+
* This method must be updated any time options are added which make it so
|
610 |
+
* the same template could be parsed and compiled multiple different ways.
|
611 |
+
*
|
612 |
+
* @param string|Mustache_Source $source
|
613 |
*
|
614 |
* @return string Mustache Template class name
|
615 |
*/
|
616 |
public function getTemplateClassName($source)
|
617 |
{
|
618 |
+
// For the most part, adding a new option here should do the trick.
|
619 |
+
//
|
620 |
+
// Pick a value here which is unique for each possible way the template
|
621 |
+
// could be compiled... but not necessarily unique per option value. See
|
622 |
+
// escape below, which only needs to differentiate between 'custom' and
|
623 |
+
// 'default' escapes.
|
624 |
+
//
|
625 |
+
// Keep this list in alphabetical order :)
|
626 |
+
$chunks = array(
|
627 |
+
'charset' => $this->charset,
|
628 |
+
'delimiters' => $this->delimiters ? $this->delimiters : '{{ }}',
|
629 |
+
'entityFlags' => $this->entityFlags,
|
630 |
+
'escape' => isset($this->escape) ? 'custom' : 'default',
|
631 |
+
'key' => ($source instanceof Mustache_Source) ? $source->getKey() : 'source',
|
632 |
+
'pragmas' => $this->getPragmas(),
|
633 |
+
'strictCallables' => $this->strictCallables,
|
634 |
+
'version' => self::VERSION,
|
635 |
+
);
|
636 |
+
|
637 |
+
$key = json_encode($chunks);
|
638 |
+
|
639 |
+
// Template Source instances have already provided their own source key. For strings, just include the whole
|
640 |
+
// source string in the md5 hash.
|
641 |
+
if (!$source instanceof Mustache_Source) {
|
642 |
+
$key .= "\n" . $source;
|
643 |
+
}
|
644 |
+
|
645 |
+
return $this->templateClassPrefix . md5($key);
|
646 |
}
|
647 |
|
648 |
/**
|
719 |
* @see Mustache_Engine::loadPartial
|
720 |
* @see Mustache_Engine::loadLambda
|
721 |
*
|
722 |
+
* @param string|Mustache_Source $source
|
723 |
+
* @param Mustache_Cache $cache (default: null)
|
724 |
*
|
725 |
* @return Mustache_Template
|
726 |
*/
|
763 |
*/
|
764 |
private function tokenize($source)
|
765 |
{
|
766 |
+
return $this->getTokenizer()->scan($source, $this->delimiters);
|
767 |
}
|
768 |
|
769 |
/**
|
788 |
*
|
789 |
* @see Mustache_Compiler::compile
|
790 |
*
|
791 |
+
* @param string|Mustache_Source $source
|
792 |
*
|
793 |
* @return string generated Mustache template class code
|
794 |
*/
|
795 |
private function compile($source)
|
796 |
{
|
|
|
797 |
$name = $this->getTemplateClassName($source);
|
798 |
|
799 |
$this->log(
|
802 |
array('className' => $name)
|
803 |
);
|
804 |
|
805 |
+
if ($source instanceof Mustache_Source) {
|
806 |
+
$source = $source->getSource();
|
807 |
+
}
|
808 |
+
$tree = $this->parse($source);
|
809 |
+
|
810 |
$compiler = $this->getCompiler();
|
811 |
$compiler->setPragmas($this->getPragmas());
|
812 |
|
vendor/mustache/mustache/src/Mustache/Exception.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
vendor/mustache/mustache/src/Mustache/Exception/InvalidArgumentException.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
vendor/mustache/mustache/src/Mustache/Exception/LogicException.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
vendor/mustache/mustache/src/Mustache/Exception/RuntimeException.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
vendor/mustache/mustache/src/Mustache/Exception/SyntaxException.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -17,13 +17,18 @@ class Mustache_Exception_SyntaxException extends LogicException implements Musta
|
|
17 |
protected $token;
|
18 |
|
19 |
/**
|
20 |
-
* @param string
|
21 |
-
* @param array
|
|
|
22 |
*/
|
23 |
-
public function __construct($msg, array $token)
|
24 |
{
|
25 |
$this->token = $token;
|
26 |
-
|
|
|
|
|
|
|
|
|
27 |
}
|
28 |
|
29 |
/**
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
17 |
protected $token;
|
18 |
|
19 |
/**
|
20 |
+
* @param string $msg
|
21 |
+
* @param array $token
|
22 |
+
* @param Exception $previous
|
23 |
*/
|
24 |
+
public function __construct($msg, array $token, Exception $previous = null)
|
25 |
{
|
26 |
$this->token = $token;
|
27 |
+
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
28 |
+
parent::__construct($msg, 0, $previous);
|
29 |
+
} else {
|
30 |
+
parent::__construct($msg); // @codeCoverageIgnore
|
31 |
+
}
|
32 |
}
|
33 |
|
34 |
/**
|
vendor/mustache/mustache/src/Mustache/Exception/UnknownFilterException.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -17,12 +17,18 @@ class Mustache_Exception_UnknownFilterException extends UnexpectedValueException
|
|
17 |
protected $filterName;
|
18 |
|
19 |
/**
|
20 |
-
* @param string
|
|
|
21 |
*/
|
22 |
-
public function __construct($filterName)
|
23 |
{
|
24 |
$this->filterName = $filterName;
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
public function getFilterName()
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
17 |
protected $filterName;
|
18 |
|
19 |
/**
|
20 |
+
* @param string $filterName
|
21 |
+
* @param Exception $previous
|
22 |
*/
|
23 |
+
public function __construct($filterName, Exception $previous = null)
|
24 |
{
|
25 |
$this->filterName = $filterName;
|
26 |
+
$message = sprintf('Unknown filter: %s', $filterName);
|
27 |
+
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
28 |
+
parent::__construct($message, 0, $previous);
|
29 |
+
} else {
|
30 |
+
parent::__construct($message); // @codeCoverageIgnore
|
31 |
+
}
|
32 |
}
|
33 |
|
34 |
public function getFilterName()
|
vendor/mustache/mustache/src/Mustache/Exception/UnknownHelperException.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -17,12 +17,18 @@ class Mustache_Exception_UnknownHelperException extends InvalidArgumentException
|
|
17 |
protected $helperName;
|
18 |
|
19 |
/**
|
20 |
-
* @param string
|
|
|
21 |
*/
|
22 |
-
public function __construct($helperName)
|
23 |
{
|
24 |
$this->helperName = $helperName;
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
public function getHelperName()
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
17 |
protected $helperName;
|
18 |
|
19 |
/**
|
20 |
+
* @param string $helperName
|
21 |
+
* @param Exception $previous
|
22 |
*/
|
23 |
+
public function __construct($helperName, Exception $previous = null)
|
24 |
{
|
25 |
$this->helperName = $helperName;
|
26 |
+
$message = sprintf('Unknown helper: %s', $helperName);
|
27 |
+
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
28 |
+
parent::__construct($message, 0, $previous);
|
29 |
+
} else {
|
30 |
+
parent::__construct($message); // @codeCoverageIgnore
|
31 |
+
}
|
32 |
}
|
33 |
|
34 |
public function getHelperName()
|
vendor/mustache/mustache/src/Mustache/Exception/UnknownTemplateException.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -17,12 +17,18 @@ class Mustache_Exception_UnknownTemplateException extends InvalidArgumentExcepti
|
|
17 |
protected $templateName;
|
18 |
|
19 |
/**
|
20 |
-
* @param string
|
|
|
21 |
*/
|
22 |
-
public function __construct($templateName)
|
23 |
{
|
24 |
$this->templateName = $templateName;
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
public function getTemplateName()
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
17 |
protected $templateName;
|
18 |
|
19 |
/**
|
20 |
+
* @param string $templateName
|
21 |
+
* @param Exception $previous
|
22 |
*/
|
23 |
+
public function __construct($templateName, Exception $previous = null)
|
24 |
{
|
25 |
$this->templateName = $templateName;
|
26 |
+
$message = sprintf('Unknown template: %s', $templateName);
|
27 |
+
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
|
28 |
+
parent::__construct($message, 0, $previous);
|
29 |
+
} else {
|
30 |
+
parent::__construct($message); // @codeCoverageIgnore
|
31 |
+
}
|
32 |
}
|
33 |
|
34 |
public function getTemplateName()
|
vendor/mustache/mustache/src/Mustache/HelperCollection.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -81,7 +81,7 @@ class Mustache_HelperCollection
|
|
81 |
/**
|
82 |
* Get a helper by name.
|
83 |
*
|
84 |
-
* @throws Mustache_Exception_UnknownHelperException If helper does not exist
|
85 |
*
|
86 |
* @param string $name
|
87 |
*
|
@@ -137,7 +137,7 @@ class Mustache_HelperCollection
|
|
137 |
/**
|
138 |
* Check whether a given helper is present in the collection.
|
139 |
*
|
140 |
-
* @throws Mustache_Exception_UnknownHelperException if the requested helper is not present
|
141 |
*
|
142 |
* @param string $name
|
143 |
*/
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
81 |
/**
|
82 |
* Get a helper by name.
|
83 |
*
|
84 |
+
* @throws Mustache_Exception_UnknownHelperException If helper does not exist
|
85 |
*
|
86 |
* @param string $name
|
87 |
*
|
137 |
/**
|
138 |
* Check whether a given helper is present in the collection.
|
139 |
*
|
140 |
+
* @throws Mustache_Exception_UnknownHelperException if the requested helper is not present
|
141 |
*
|
142 |
* @param string $name
|
143 |
*/
|
vendor/mustache/mustache/src/Mustache/LambdaHelper.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -20,17 +20,20 @@ class Mustache_LambdaHelper
|
|
20 |
{
|
21 |
private $mustache;
|
22 |
private $context;
|
|
|
23 |
|
24 |
/**
|
25 |
* Mustache Lambda Helper constructor.
|
26 |
*
|
27 |
-
* @param Mustache_Engine $mustache Mustache engine instance
|
28 |
-
* @param Mustache_Context $context Rendering context
|
|
|
29 |
*/
|
30 |
-
public function __construct(Mustache_Engine $mustache, Mustache_Context $context)
|
31 |
{
|
32 |
$this->mustache = $mustache;
|
33 |
$this->context = $context;
|
|
|
34 |
}
|
35 |
|
36 |
/**
|
@@ -38,12 +41,36 @@ class Mustache_LambdaHelper
|
|
38 |
*
|
39 |
* @param string $string
|
40 |
*
|
41 |
-
* @return string Rendered template
|
42 |
*/
|
43 |
public function render($string)
|
44 |
{
|
45 |
return $this->mustache
|
46 |
-
->loadLambda((string) $string)
|
47 |
->renderInternal($this->context);
|
48 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
20 |
{
|
21 |
private $mustache;
|
22 |
private $context;
|
23 |
+
private $delims;
|
24 |
|
25 |
/**
|
26 |
* Mustache Lambda Helper constructor.
|
27 |
*
|
28 |
+
* @param Mustache_Engine $mustache Mustache engine instance
|
29 |
+
* @param Mustache_Context $context Rendering context
|
30 |
+
* @param string $delims Optional custom delimiters, in the format `{{= <% %> =}}`. (default: null)
|
31 |
*/
|
32 |
+
public function __construct(Mustache_Engine $mustache, Mustache_Context $context, $delims = null)
|
33 |
{
|
34 |
$this->mustache = $mustache;
|
35 |
$this->context = $context;
|
36 |
+
$this->delims = $delims;
|
37 |
}
|
38 |
|
39 |
/**
|
41 |
*
|
42 |
* @param string $string
|
43 |
*
|
44 |
+
* @return string Rendered template
|
45 |
*/
|
46 |
public function render($string)
|
47 |
{
|
48 |
return $this->mustache
|
49 |
+
->loadLambda((string) $string, $this->delims)
|
50 |
->renderInternal($this->context);
|
51 |
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Render a string as a Mustache template with the current rendering context.
|
55 |
+
*
|
56 |
+
* @param string $string
|
57 |
+
*
|
58 |
+
* @return string Rendered template
|
59 |
+
*/
|
60 |
+
public function __invoke($string)
|
61 |
+
{
|
62 |
+
return $this->render($string);
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Get a Lambda Helper with custom delimiters.
|
67 |
+
*
|
68 |
+
* @param string $delims Custom delimiters, in the format `{{= <% %> =}}`
|
69 |
+
*
|
70 |
+
* @return Mustache_LambdaHelper
|
71 |
+
*/
|
72 |
+
public function withDelimiters($delims)
|
73 |
+
{
|
74 |
+
return new self($this->mustache, $this->context, $delims);
|
75 |
+
}
|
76 |
}
|
vendor/mustache/mustache/src/Mustache/Loader.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -17,11 +17,11 @@ interface Mustache_Loader
|
|
17 |
/**
|
18 |
* Load a Template by name.
|
19 |
*
|
20 |
-
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
21 |
*
|
22 |
* @param string $name
|
23 |
*
|
24 |
-
* @return string Mustache Template source
|
25 |
*/
|
26 |
public function load($name);
|
27 |
}
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
17 |
/**
|
18 |
* Load a Template by name.
|
19 |
*
|
20 |
+
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
21 |
*
|
22 |
* @param string $name
|
23 |
*
|
24 |
+
* @return string|Mustache_Source Mustache Template source
|
25 |
*/
|
26 |
public function load($name);
|
27 |
}
|
vendor/mustache/mustache/src/Mustache/Loader/ArrayLoader.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -41,7 +41,7 @@ class Mustache_Loader_ArrayLoader implements Mustache_Loader, Mustache_Loader_Mu
|
|
41 |
/**
|
42 |
* Load a Template.
|
43 |
*
|
44 |
-
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
45 |
*
|
46 |
* @param string $name
|
47 |
*
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
41 |
/**
|
42 |
* Load a Template.
|
43 |
*
|
44 |
+
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
45 |
*
|
46 |
* @param string $name
|
47 |
*
|
vendor/mustache/mustache/src/Mustache/Loader/CascadingLoader.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -48,7 +48,7 @@ class Mustache_Loader_CascadingLoader implements Mustache_Loader
|
|
48 |
/**
|
49 |
* Load a Template by name.
|
50 |
*
|
51 |
-
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
52 |
*
|
53 |
* @param string $name
|
54 |
*
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
48 |
/**
|
49 |
* Load a Template by name.
|
50 |
*
|
51 |
+
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
52 |
*
|
53 |
* @param string $name
|
54 |
*
|
vendor/mustache/mustache/src/Mustache/Loader/FilesystemLoader.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -40,9 +40,9 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader
|
|
40 |
* 'extension' => '.ms',
|
41 |
* );
|
42 |
*
|
43 |
-
* @throws Mustache_Exception_RuntimeException if $baseDir does not exist
|
44 |
*
|
45 |
-
* @param string $baseDir Base directory containing Mustache template files
|
46 |
* @param array $options Array of Loader options (default: array())
|
47 |
*/
|
48 |
public function __construct($baseDir, array $options = array())
|
@@ -53,7 +53,7 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader
|
|
53 |
$this->baseDir = realpath($this->baseDir);
|
54 |
}
|
55 |
|
56 |
-
if (!is_dir($this->baseDir)) {
|
57 |
throw new Mustache_Exception_RuntimeException(sprintf('FilesystemLoader baseDir must be a directory: %s', $baseDir));
|
58 |
}
|
59 |
|
@@ -88,7 +88,7 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader
|
|
88 |
/**
|
89 |
* Helper function for loading a Mustache file by name.
|
90 |
*
|
91 |
-
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
92 |
*
|
93 |
* @param string $name
|
94 |
*
|
@@ -98,7 +98,7 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader
|
|
98 |
{
|
99 |
$fileName = $this->getFileName($name);
|
100 |
|
101 |
-
if (!file_exists($fileName)) {
|
102 |
throw new Mustache_Exception_UnknownTemplateException($name);
|
103 |
}
|
104 |
|
@@ -121,4 +121,15 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader
|
|
121 |
|
122 |
return $fileName;
|
123 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
}
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
40 |
* 'extension' => '.ms',
|
41 |
* );
|
42 |
*
|
43 |
+
* @throws Mustache_Exception_RuntimeException if $baseDir does not exist
|
44 |
*
|
45 |
+
* @param string $baseDir Base directory containing Mustache template files
|
46 |
* @param array $options Array of Loader options (default: array())
|
47 |
*/
|
48 |
public function __construct($baseDir, array $options = array())
|
53 |
$this->baseDir = realpath($this->baseDir);
|
54 |
}
|
55 |
|
56 |
+
if ($this->shouldCheckPath() && !is_dir($this->baseDir)) {
|
57 |
throw new Mustache_Exception_RuntimeException(sprintf('FilesystemLoader baseDir must be a directory: %s', $baseDir));
|
58 |
}
|
59 |
|
88 |
/**
|
89 |
* Helper function for loading a Mustache file by name.
|
90 |
*
|
91 |
+
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
92 |
*
|
93 |
* @param string $name
|
94 |
*
|
98 |
{
|
99 |
$fileName = $this->getFileName($name);
|
100 |
|
101 |
+
if ($this->shouldCheckPath() && !file_exists($fileName)) {
|
102 |
throw new Mustache_Exception_UnknownTemplateException($name);
|
103 |
}
|
104 |
|
121 |
|
122 |
return $fileName;
|
123 |
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Only check if baseDir is a directory and requested templates are files if
|
127 |
+
* baseDir is using the filesystem stream wrapper.
|
128 |
+
*
|
129 |
+
* @return bool Whether to check `is_dir` and `file_exists`
|
130 |
+
*/
|
131 |
+
protected function shouldCheckPath()
|
132 |
+
{
|
133 |
+
return strpos($this->baseDir, '://') === false || strpos($this->baseDir, 'file://') === 0;
|
134 |
+
}
|
135 |
}
|
vendor/mustache/mustache/src/Mustache/Loader/InlineLoader.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -68,7 +68,7 @@ class Mustache_Loader_InlineLoader implements Mustache_Loader
|
|
68 |
* @param string $fileName The file to parse for inline templates
|
69 |
* @param int $offset A string offset for the start of the templates.
|
70 |
* This usually coincides with the `__halt_compiler`
|
71 |
-
* call, and the `__COMPILER_HALT_OFFSET__
|
72 |
*/
|
73 |
public function __construct($fileName, $offset)
|
74 |
{
|
@@ -87,7 +87,7 @@ class Mustache_Loader_InlineLoader implements Mustache_Loader
|
|
87 |
/**
|
88 |
* Load a Template by name.
|
89 |
*
|
90 |
-
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
91 |
*
|
92 |
* @param string $name
|
93 |
*
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
68 |
* @param string $fileName The file to parse for inline templates
|
69 |
* @param int $offset A string offset for the start of the templates.
|
70 |
* This usually coincides with the `__halt_compiler`
|
71 |
+
* call, and the `__COMPILER_HALT_OFFSET__`
|
72 |
*/
|
73 |
public function __construct($fileName, $offset)
|
74 |
{
|
87 |
/**
|
88 |
* Load a Template by name.
|
89 |
*
|
90 |
+
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found
|
91 |
*
|
92 |
* @param string $name
|
93 |
*
|
vendor/mustache/mustache/src/Mustache/Loader/MutableLoader.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
vendor/mustache/mustache/src/Mustache/Loader/ProductionFilesystemLoader.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Mustache Template production filesystem Loader implementation.
|
14 |
+
*
|
15 |
+
* A production-ready FilesystemLoader, which doesn't require reading a file if it already exists in the template cache.
|
16 |
+
*
|
17 |
+
* {@inheritdoc}
|
18 |
+
*/
|
19 |
+
class Mustache_Loader_ProductionFilesystemLoader extends Mustache_Loader_FilesystemLoader
|
20 |
+
{
|
21 |
+
private $statProps;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Mustache production filesystem Loader constructor.
|
25 |
+
*
|
26 |
+
* Passing an $options array allows overriding certain Loader options during instantiation:
|
27 |
+
*
|
28 |
+
* $options = array(
|
29 |
+
* // The filename extension used for Mustache templates. Defaults to '.mustache'
|
30 |
+
* 'extension' => '.ms',
|
31 |
+
* 'stat_props' => array('size', 'mtime'),
|
32 |
+
* );
|
33 |
+
*
|
34 |
+
* Specifying 'stat_props' overrides the stat properties used to invalidate the template cache. By default, this
|
35 |
+
* uses 'mtime' and 'size', but this can be set to any of the properties supported by stat():
|
36 |
+
*
|
37 |
+
* http://php.net/manual/en/function.stat.php
|
38 |
+
*
|
39 |
+
* You can also disable filesystem stat entirely:
|
40 |
+
*
|
41 |
+
* $options = array('stat_props' => null);
|
42 |
+
*
|
43 |
+
* But with great power comes great responsibility. Namely, if you disable stat-based cache invalidation,
|
44 |
+
* YOU MUST CLEAR THE TEMPLATE CACHE YOURSELF when your templates change. Make it part of your build or deploy
|
45 |
+
* process so you don't forget!
|
46 |
+
*
|
47 |
+
* @throws Mustache_Exception_RuntimeException if $baseDir does not exist.
|
48 |
+
*
|
49 |
+
* @param string $baseDir Base directory containing Mustache template files.
|
50 |
+
* @param array $options Array of Loader options (default: array())
|
51 |
+
*/
|
52 |
+
public function __construct($baseDir, array $options = array())
|
53 |
+
{
|
54 |
+
parent::__construct($baseDir, $options);
|
55 |
+
|
56 |
+
if (array_key_exists('stat_props', $options)) {
|
57 |
+
if (empty($options['stat_props'])) {
|
58 |
+
$this->statProps = array();
|
59 |
+
} else {
|
60 |
+
$this->statProps = $options['stat_props'];
|
61 |
+
}
|
62 |
+
} else {
|
63 |
+
$this->statProps = array('size', 'mtime');
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Helper function for loading a Mustache file by name.
|
69 |
+
*
|
70 |
+
* @throws Mustache_Exception_UnknownTemplateException If a template file is not found.
|
71 |
+
*
|
72 |
+
* @param string $name
|
73 |
+
*
|
74 |
+
* @return Mustache_Source Mustache Template source
|
75 |
+
*/
|
76 |
+
protected function loadFile($name)
|
77 |
+
{
|
78 |
+
$fileName = $this->getFileName($name);
|
79 |
+
|
80 |
+
if (!file_exists($fileName)) {
|
81 |
+
throw new Mustache_Exception_UnknownTemplateException($name);
|
82 |
+
}
|
83 |
+
|
84 |
+
return new Mustache_Source_FilesystemSource($fileName, $this->statProps);
|
85 |
+
}
|
86 |
+
}
|
vendor/mustache/mustache/src/Mustache/Loader/StringLoader.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
vendor/mustache/mustache/src/Mustache/Logger.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
vendor/mustache/mustache/src/Mustache/Logger/AbstractLogger.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
vendor/mustache/mustache/src/Mustache/Logger/StreamLogger.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -36,7 +36,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
|
|
36 |
protected $url = null;
|
37 |
|
38 |
/**
|
39 |
-
* @throws InvalidArgumentException if the logging level is unknown
|
40 |
*
|
41 |
* @param resource|string $stream Resource instance or URL
|
42 |
* @param int $level The minimum logging level at which this handler will be triggered
|
@@ -65,7 +65,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
|
|
65 |
/**
|
66 |
* Set the minimum logging level.
|
67 |
*
|
68 |
-
* @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown
|
69 |
*
|
70 |
* @param int $level The minimum logging level which will be written
|
71 |
*/
|
@@ -91,7 +91,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
|
|
91 |
/**
|
92 |
* Logs with an arbitrary level.
|
93 |
*
|
94 |
-
* @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown
|
95 |
*
|
96 |
* @param mixed $level
|
97 |
* @param string $message
|
@@ -111,8 +111,8 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
|
|
111 |
/**
|
112 |
* Write a record to the log.
|
113 |
*
|
114 |
-
* @throws Mustache_Exception_LogicException If neither a stream resource nor url is present
|
115 |
-
* @throws Mustache_Exception_RuntimeException If the stream url cannot be opened
|
116 |
*
|
117 |
* @param int $level The logging level
|
118 |
* @param string $message The log message
|
@@ -139,7 +139,7 @@ class Mustache_Logger_StreamLogger extends Mustache_Logger_AbstractLogger
|
|
139 |
/**
|
140 |
* Gets the name of the logging level.
|
141 |
*
|
142 |
-
* @throws InvalidArgumentException if the logging level is unknown
|
143 |
*
|
144 |
* @param int $level
|
145 |
*
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
36 |
protected $url = null;
|
37 |
|
38 |
/**
|
39 |
+
* @throws InvalidArgumentException if the logging level is unknown
|
40 |
*
|
41 |
* @param resource|string $stream Resource instance or URL
|
42 |
* @param int $level The minimum logging level at which this handler will be triggered
|
65 |
/**
|
66 |
* Set the minimum logging level.
|
67 |
*
|
68 |
+
* @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown
|
69 |
*
|
70 |
* @param int $level The minimum logging level which will be written
|
71 |
*/
|
91 |
/**
|
92 |
* Logs with an arbitrary level.
|
93 |
*
|
94 |
+
* @throws Mustache_Exception_InvalidArgumentException if the logging level is unknown
|
95 |
*
|
96 |
* @param mixed $level
|
97 |
* @param string $message
|
111 |
/**
|
112 |
* Write a record to the log.
|
113 |
*
|
114 |
+
* @throws Mustache_Exception_LogicException If neither a stream resource nor url is present
|
115 |
+
* @throws Mustache_Exception_RuntimeException If the stream url cannot be opened
|
116 |
*
|
117 |
* @param int $level The logging level
|
118 |
* @param string $message The log message
|
139 |
/**
|
140 |
* Gets the name of the logging level.
|
141 |
*
|
142 |
+
* @throws InvalidArgumentException if the logging level is unknown
|
143 |
*
|
144 |
* @param int $level
|
145 |
*
|
vendor/mustache/mustache/src/Mustache/Parser.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -63,7 +63,7 @@ class Mustache_Parser
|
|
63 |
/**
|
64 |
* Helper method for recursively building a parse tree.
|
65 |
*
|
66 |
-
* @throws Mustache_Exception_SyntaxException when nesting errors or mismatched section tags are encountered
|
67 |
*
|
68 |
* @param array &$tokens Set of Mustache tokens
|
69 |
* @param array $parent Parent token (default: null)
|
@@ -149,7 +149,7 @@ class Mustache_Parser
|
|
149 |
case Mustache_Tokenizer::T_BLOCK_VAR:
|
150 |
if ($this->pragmaBlocks) {
|
151 |
// BLOCKS pragma is enabled, let's do this!
|
152 |
-
if ($parent[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_PARENT) {
|
153 |
$token[Mustache_Tokenizer::TYPE] = Mustache_Tokenizer::T_BLOCK_ARG;
|
154 |
}
|
155 |
$this->clearStandaloneLines($nodes, $tokens);
|
@@ -195,10 +195,10 @@ class Mustache_Parser
|
|
195 |
*
|
196 |
* Returns a whitespace token for indenting partials, if applicable.
|
197 |
*
|
198 |
-
* @param array $nodes Parsed nodes
|
199 |
-
* @param array $tokens Tokens to be parsed
|
200 |
*
|
201 |
-
* @return array|null Resulting indent token, if any
|
202 |
*/
|
203 |
private function clearStandaloneLines(array &$nodes, array &$tokens)
|
204 |
{
|
@@ -268,14 +268,14 @@ class Mustache_Parser
|
|
268 |
/**
|
269 |
* Check whether a token is allowed inside a parent tag.
|
270 |
*
|
271 |
-
* @throws Mustache_Exception_SyntaxException if an invalid token is found inside a parent tag
|
272 |
*
|
273 |
* @param array|null $parent
|
274 |
* @param array $token
|
275 |
*/
|
276 |
private function checkIfTokenIsAllowedInParent($parent, array $token)
|
277 |
{
|
278 |
-
if ($parent[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_PARENT) {
|
279 |
throw new Mustache_Exception_SyntaxException('Illegal content in < parent tag', $token);
|
280 |
}
|
281 |
}
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
63 |
/**
|
64 |
* Helper method for recursively building a parse tree.
|
65 |
*
|
66 |
+
* @throws Mustache_Exception_SyntaxException when nesting errors or mismatched section tags are encountered
|
67 |
*
|
68 |
* @param array &$tokens Set of Mustache tokens
|
69 |
* @param array $parent Parent token (default: null)
|
149 |
case Mustache_Tokenizer::T_BLOCK_VAR:
|
150 |
if ($this->pragmaBlocks) {
|
151 |
// BLOCKS pragma is enabled, let's do this!
|
152 |
+
if (isset($parent) && $parent[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_PARENT) {
|
153 |
$token[Mustache_Tokenizer::TYPE] = Mustache_Tokenizer::T_BLOCK_ARG;
|
154 |
}
|
155 |
$this->clearStandaloneLines($nodes, $tokens);
|
195 |
*
|
196 |
* Returns a whitespace token for indenting partials, if applicable.
|
197 |
*
|
198 |
+
* @param array $nodes Parsed nodes
|
199 |
+
* @param array $tokens Tokens to be parsed
|
200 |
*
|
201 |
+
* @return array|null Resulting indent token, if any
|
202 |
*/
|
203 |
private function clearStandaloneLines(array &$nodes, array &$tokens)
|
204 |
{
|
268 |
/**
|
269 |
* Check whether a token is allowed inside a parent tag.
|
270 |
*
|
271 |
+
* @throws Mustache_Exception_SyntaxException if an invalid token is found inside a parent tag
|
272 |
*
|
273 |
* @param array|null $parent
|
274 |
* @param array $token
|
275 |
*/
|
276 |
private function checkIfTokenIsAllowedInParent($parent, array $token)
|
277 |
{
|
278 |
+
if (isset($parent) && $parent[Mustache_Tokenizer::TYPE] === Mustache_Tokenizer::T_PARENT) {
|
279 |
throw new Mustache_Exception_SyntaxException('Illegal content in < parent tag', $token);
|
280 |
}
|
281 |
}
|
vendor/mustache/mustache/src/Mustache/Source.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Mustache template Source interface.
|
14 |
+
*/
|
15 |
+
interface Mustache_Source
|
16 |
+
{
|
17 |
+
/**
|
18 |
+
* Get the Source key (used to generate the compiled class name).
|
19 |
+
*
|
20 |
+
* This must return a distinct key for each template source. For example, an
|
21 |
+
* MD5 hash of the template contents would probably do the trick. The
|
22 |
+
* ProductionFilesystemLoader uses mtime and file path. If your production
|
23 |
+
* source directory is under version control, you could use the current Git
|
24 |
+
* rev and the file path...
|
25 |
+
*
|
26 |
+
* @throws RuntimeException when a source file cannot be read
|
27 |
+
*
|
28 |
+
* @return string
|
29 |
+
*/
|
30 |
+
public function getKey();
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Get the template Source.
|
34 |
+
*
|
35 |
+
* @throws RuntimeException when a source file cannot be read
|
36 |
+
*
|
37 |
+
* @return string
|
38 |
+
*/
|
39 |
+
public function getSource();
|
40 |
+
}
|
vendor/mustache/mustache/src/Mustache/Source/FilesystemSource.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Mustache.php.
|
5 |
+
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
+
*
|
8 |
+
* For the full copyright and license information, please view the LICENSE
|
9 |
+
* file that was distributed with this source code.
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Mustache template Filesystem Source.
|
14 |
+
*
|
15 |
+
* This template Source uses stat() to generate the Source key, so that using
|
16 |
+
* pre-compiled templates doesn't require hitting the disk to read the source.
|
17 |
+
* It is more suitable for production use, and is used by default in the
|
18 |
+
* ProductionFilesystemLoader.
|
19 |
+
*/
|
20 |
+
class Mustache_Source_FilesystemSource implements Mustache_Source
|
21 |
+
{
|
22 |
+
private $fileName;
|
23 |
+
private $statProps;
|
24 |
+
private $stat;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Filesystem Source constructor.
|
28 |
+
*
|
29 |
+
* @param string $fileName
|
30 |
+
* @param array $statProps
|
31 |
+
*/
|
32 |
+
public function __construct($fileName, array $statProps)
|
33 |
+
{
|
34 |
+
$this->fileName = $fileName;
|
35 |
+
$this->statProps = $statProps;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Get the Source key (used to generate the compiled class name).
|
40 |
+
*
|
41 |
+
* @throws Mustache_Exception_RuntimeException when a source file cannot be read
|
42 |
+
*
|
43 |
+
* @return string
|
44 |
+
*/
|
45 |
+
public function getKey()
|
46 |
+
{
|
47 |
+
$chunks = array(
|
48 |
+
'fileName' => $this->fileName,
|
49 |
+
);
|
50 |
+
|
51 |
+
if (!empty($this->statProps)) {
|
52 |
+
if (!isset($this->stat)) {
|
53 |
+
$this->stat = @stat($this->fileName);
|
54 |
+
}
|
55 |
+
|
56 |
+
if ($this->stat === false) {
|
57 |
+
throw new Mustache_Exception_RuntimeException(sprintf('Failed to read source file "%s".', $this->fileName));
|
58 |
+
}
|
59 |
+
|
60 |
+
foreach ($this->statProps as $prop) {
|
61 |
+
$chunks[$prop] = $this->stat[$prop];
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
return json_encode($chunks);
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Get the template Source.
|
70 |
+
*
|
71 |
+
* @return string
|
72 |
+
*/
|
73 |
+
public function getSource()
|
74 |
+
{
|
75 |
+
return file_get_contents($this->fileName);
|
76 |
+
}
|
77 |
+
}
|
vendor/mustache/mustache/src/Mustache/Template.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -164,16 +164,15 @@ abstract class Mustache_Template
|
|
164 |
*
|
165 |
* @param mixed $value
|
166 |
* @param Mustache_Context $context
|
167 |
-
* @param string $indent
|
168 |
*
|
169 |
* @return string
|
170 |
*/
|
171 |
-
protected function resolveValue($value, Mustache_Context $context
|
172 |
{
|
173 |
if (($this->strictCallables ? is_object($value) : !is_string($value)) && is_callable($value)) {
|
174 |
return $this->mustache
|
175 |
->loadLambda((string) call_user_func($value))
|
176 |
-
->renderInternal($context
|
177 |
}
|
178 |
|
179 |
return $value;
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
164 |
*
|
165 |
* @param mixed $value
|
166 |
* @param Mustache_Context $context
|
|
|
167 |
*
|
168 |
* @return string
|
169 |
*/
|
170 |
+
protected function resolveValue($value, Mustache_Context $context)
|
171 |
{
|
172 |
if (($this->strictCallables ? is_object($value) : !is_string($value)) && is_callable($value)) {
|
173 |
return $this->mustache
|
174 |
->loadLambda((string) call_user_func($value))
|
175 |
+
->renderInternal($context);
|
176 |
}
|
177 |
|
178 |
return $value;
|
vendor/mustache/mustache/src/Mustache/Tokenizer.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
-
* (c) 2010-
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
@@ -72,34 +72,47 @@ class Mustache_Tokenizer
|
|
72 |
private $tokens;
|
73 |
private $seenTag;
|
74 |
private $line;
|
|
|
75 |
private $otag;
|
76 |
-
private $
|
77 |
private $otagLen;
|
|
|
|
|
|
|
78 |
private $ctagLen;
|
79 |
|
80 |
/**
|
81 |
* Scan and tokenize template source.
|
82 |
*
|
83 |
-
* @throws Mustache_Exception_SyntaxException when mismatched section tags are encountered
|
|
|
84 |
*
|
85 |
* @param string $text Mustache template source to tokenize
|
86 |
-
* @param string $delimiters Optionally, pass initial opening and closing delimiters (default:
|
87 |
*
|
88 |
* @return array Set of Mustache tokens
|
89 |
*/
|
90 |
-
public function scan($text, $delimiters =
|
91 |
{
|
92 |
// Setting mbstring.func_overload makes things *really* slow.
|
93 |
// Let's do everyone a favor and scan this string as ASCII instead.
|
|
|
|
|
|
|
|
|
|
|
94 |
$encoding = null;
|
95 |
-
if (
|
96 |
-
|
97 |
-
|
|
|
|
|
98 |
}
|
|
|
99 |
|
100 |
$this->reset();
|
101 |
|
102 |
-
if ($delimiters = trim($delimiters)) {
|
103 |
$this->setDelimiters($delimiters);
|
104 |
}
|
105 |
|
@@ -107,12 +120,13 @@ class Mustache_Tokenizer
|
|
107 |
for ($i = 0; $i < $len; $i++) {
|
108 |
switch ($this->state) {
|
109 |
case self::IN_TEXT:
|
110 |
-
|
|
|
|
|
111 |
$i--;
|
112 |
$this->flushBuffer();
|
113 |
$this->state = self::IN_TAG_TYPE;
|
114 |
} else {
|
115 |
-
$char = $text[$i];
|
116 |
$this->buffer .= $char;
|
117 |
if ($char === "\n") {
|
118 |
$this->flushBuffer();
|
@@ -148,7 +162,9 @@ class Mustache_Tokenizer
|
|
148 |
break;
|
149 |
|
150 |
default:
|
151 |
-
|
|
|
|
|
152 |
$token = array(
|
153 |
self::TYPE => $this->tagType,
|
154 |
self::NAME => trim($this->buffer),
|
@@ -193,7 +209,7 @@ class Mustache_Tokenizer
|
|
193 |
$this->state = self::IN_TEXT;
|
194 |
$this->tokens[] = $token;
|
195 |
} else {
|
196 |
-
$this->buffer .= $
|
197 |
}
|
198 |
break;
|
199 |
}
|
@@ -202,9 +218,11 @@ class Mustache_Tokenizer
|
|
202 |
$this->flushBuffer();
|
203 |
|
204 |
// Restore the user's encoding...
|
|
|
205 |
if ($encoding) {
|
206 |
mb_internal_encoding($encoding);
|
207 |
}
|
|
|
208 |
|
209 |
return $this->tokens;
|
210 |
}
|
@@ -214,16 +232,20 @@ class Mustache_Tokenizer
|
|
214 |
*/
|
215 |
private function reset()
|
216 |
{
|
217 |
-
$this->state
|
218 |
-
$this->tagType
|
219 |
-
$this->buffer
|
220 |
-
$this->tokens
|
221 |
-
$this->seenTag
|
222 |
-
$this->line
|
223 |
-
|
224 |
-
$this->
|
225 |
-
$this->
|
226 |
-
$this->
|
|
|
|
|
|
|
|
|
227 |
}
|
228 |
|
229 |
/**
|
@@ -244,6 +266,8 @@ class Mustache_Tokenizer
|
|
244 |
/**
|
245 |
* Change the current Mustache delimiters. Set new `otag` and `ctag` values.
|
246 |
*
|
|
|
|
|
247 |
* @param string $text Mustache template source
|
248 |
* @param int $index Current tokenizer index
|
249 |
*
|
@@ -255,28 +279,44 @@ class Mustache_Tokenizer
|
|
255 |
$close = '=' . $this->ctag;
|
256 |
$closeIndex = strpos($text, $close, $index);
|
257 |
|
258 |
-
$
|
259 |
-
|
260 |
-
$this->tokens[] = array(
|
261 |
self::TYPE => self::T_DELIM_CHANGE,
|
262 |
self::LINE => $this->line,
|
263 |
);
|
264 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
return $closeIndex + strlen($close) - 1;
|
266 |
}
|
267 |
|
268 |
/**
|
269 |
* Set the current Mustache `otag` and `ctag` delimiters.
|
270 |
*
|
|
|
|
|
271 |
* @param string $delimiters
|
272 |
*/
|
273 |
private function setDelimiters($delimiters)
|
274 |
{
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
}
|
281 |
|
282 |
/**
|
@@ -304,19 +344,4 @@ class Mustache_Tokenizer
|
|
304 |
|
305 |
return $end + $this->ctagLen - 1;
|
306 |
}
|
307 |
-
|
308 |
-
/**
|
309 |
-
* Test whether it's time to change tags.
|
310 |
-
*
|
311 |
-
* @param string $tag Current tag name
|
312 |
-
* @param int $tagLen Current tag name length
|
313 |
-
* @param string $text Mustache template source
|
314 |
-
* @param int $index Current tokenizer index
|
315 |
-
*
|
316 |
-
* @return bool True if this is a closing section tag
|
317 |
-
*/
|
318 |
-
private function tagChange($tag, $tagLen, $text, $index)
|
319 |
-
{
|
320 |
-
return substr($text, $index, $tagLen) === $tag;
|
321 |
-
}
|
322 |
}
|
3 |
/*
|
4 |
* This file is part of Mustache.php.
|
5 |
*
|
6 |
+
* (c) 2010-2017 Justin Hileman
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
72 |
private $tokens;
|
73 |
private $seenTag;
|
74 |
private $line;
|
75 |
+
|
76 |
private $otag;
|
77 |
+
private $otagChar;
|
78 |
private $otagLen;
|
79 |
+
|
80 |
+
private $ctag;
|
81 |
+
private $ctagChar;
|
82 |
private $ctagLen;
|
83 |
|
84 |
/**
|
85 |
* Scan and tokenize template source.
|
86 |
*
|
87 |
+
* @throws Mustache_Exception_SyntaxException when mismatched section tags are encountered
|
88 |
+
* @throws Mustache_Exception_InvalidArgumentException when $delimiters string is invalid
|
89 |
*
|
90 |
* @param string $text Mustache template source to tokenize
|
91 |
+
* @param string $delimiters Optionally, pass initial opening and closing delimiters (default: empty string)
|
92 |
*
|
93 |
* @return array Set of Mustache tokens
|
94 |
*/
|
95 |
+
public function scan($text, $delimiters = '')
|
96 |
{
|
97 |
// Setting mbstring.func_overload makes things *really* slow.
|
98 |
// Let's do everyone a favor and scan this string as ASCII instead.
|
99 |
+
//
|
100 |
+
// The INI directive was removed in PHP 8.0 so we don't need to check there (and can drop it
|
101 |
+
// when we remove support for older versions of PHP).
|
102 |
+
//
|
103 |
+
// @codeCoverageIgnoreStart
|
104 |
$encoding = null;
|
105 |
+
if (version_compare(PHP_VERSION, '8.0.0', '<')) {
|
106 |
+
if (function_exists('mb_internal_encoding') && ini_get('mbstring.func_overload') & 2) {
|
107 |
+
$encoding = mb_internal_encoding();
|
108 |
+
mb_internal_encoding('ASCII');
|
109 |
+
}
|
110 |
}
|
111 |
+
// @codeCoverageIgnoreEnd
|
112 |
|
113 |
$this->reset();
|
114 |
|
115 |
+
if (is_string($delimiters) && $delimiters = trim($delimiters)) {
|
116 |
$this->setDelimiters($delimiters);
|
117 |
}
|
118 |
|
120 |
for ($i = 0; $i < $len; $i++) {
|
121 |
switch ($this->state) {
|
122 |
case self::IN_TEXT:
|
123 |
+
$char = $text[$i];
|
124 |
+
// Test whether it's time to change tags.
|
125 |
+
if ($char === $this->otagChar && substr($text, $i, $this->otagLen) === $this->otag) {
|
126 |
$i--;
|
127 |
$this->flushBuffer();
|
128 |
$this->state = self::IN_TAG_TYPE;
|
129 |
} else {
|
|
|
130 |
$this->buffer .= $char;
|
131 |
if ($char === "\n") {
|
132 |
$this->flushBuffer();
|
162 |
break;
|
163 |
|
164 |
default:
|
165 |
+
$char = $text[$i];
|
166 |
+
// Test whether it's time to change tags.
|
167 |
+
if ($char === $this->ctagChar && substr($text, $i, $this->ctagLen) === $this->ctag) {
|
168 |
$token = array(
|
169 |
self::TYPE => $this->tagType,
|
170 |
self::NAME => trim($this->buffer),
|
209 |
$this->state = self::IN_TEXT;
|
210 |
$this->tokens[] = $token;
|
211 |
} else {
|
212 |
+
$this->buffer .= $char;
|
213 |
}
|
214 |
break;
|
215 |
}
|
218 |
$this->flushBuffer();
|
219 |
|
220 |
// Restore the user's encoding...
|
221 |
+
// @codeCoverageIgnoreStart
|
222 |
if ($encoding) {
|
223 |
mb_internal_encoding($encoding);
|
224 |
}
|
225 |
+
// @codeCoverageIgnoreEnd
|
226 |
|
227 |
return $this->tokens;
|
228 |
}
|
232 |
*/
|
233 |
private function reset()
|
234 |
{
|
235 |
+
$this->state = self::IN_TEXT;
|
236 |
+
$this->tagType = null;
|
237 |
+
$this->buffer = '';
|
238 |
+
$this->tokens = array();
|
239 |
+
$this->seenTag = false;
|
240 |
+
$this->line = 0;
|
241 |
+
|
242 |
+
$this->otag = '{{';
|
243 |
+
$this->otagChar = '{';
|
244 |
+
$this->otagLen = 2;
|
245 |
+
|
246 |
+
$this->ctag = '}}';
|
247 |
+
$this->ctagChar = '}';
|
248 |
+
$this->ctagLen = 2;
|
249 |
}
|
250 |
|
251 |
/**
|
266 |
/**
|
267 |
* Change the current Mustache delimiters. Set new `otag` and `ctag` values.
|
268 |
*
|
269 |
+
* @throws Mustache_Exception_SyntaxException when delimiter string is invalid
|
270 |
+
*
|
271 |
* @param string $text Mustache template source
|
272 |
* @param int $index Current tokenizer index
|
273 |
*
|
279 |
$close = '=' . $this->ctag;
|
280 |
$closeIndex = strpos($text, $close, $index);
|
281 |
|
282 |
+
$token = array(
|
|
|
|
|
283 |
self::TYPE => self::T_DELIM_CHANGE,
|
284 |
self::LINE => $this->line,
|
285 |
);
|
286 |
|
287 |
+
try {
|
288 |
+
$this->setDelimiters(trim(substr($text, $startIndex, $closeIndex - $startIndex)));
|
289 |
+
} catch (Mustache_Exception_InvalidArgumentException $e) {
|
290 |
+
throw new Mustache_Exception_SyntaxException($e->getMessage(), $token);
|
291 |
+
}
|
292 |
+
|
293 |
+
$this->tokens[] = $token;
|
294 |
+
|
295 |
return $closeIndex + strlen($close) - 1;
|
296 |
}
|
297 |
|
298 |
/**
|
299 |
* Set the current Mustache `otag` and `ctag` delimiters.
|
300 |
*
|
301 |
+
* @throws Mustache_Exception_InvalidArgumentException when delimiter string is invalid
|
302 |
+
*
|
303 |
* @param string $delimiters
|
304 |
*/
|
305 |
private function setDelimiters($delimiters)
|
306 |
{
|
307 |
+
if (!preg_match('/^\s*(\S+)\s+(\S+)\s*$/', $delimiters, $matches)) {
|
308 |
+
throw new Mustache_Exception_InvalidArgumentException(sprintf('Invalid delimiters: %s', $delimiters));
|
309 |
+
}
|
310 |
+
|
311 |
+
list($_, $otag, $ctag) = $matches;
|
312 |
+
|
313 |
+
$this->otag = $otag;
|
314 |
+
$this->otagChar = $otag[0];
|
315 |
+
$this->otagLen = strlen($otag);
|
316 |
+
|
317 |
+
$this->ctag = $ctag;
|
318 |
+
$this->ctagChar = $ctag[0];
|
319 |
+
$this->ctagLen = strlen($ctag);
|
320 |
}
|
321 |
|
322 |
/**
|
344 |
|
345 |
return $end + $this->ctagLen - 1;
|
346 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
347 |
}
|
vendor/scribu/lib-posts-to-posts/.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
vendor/
|
2 |
+
composer.lock
|
vendor/scribu/lib-posts-to-posts/composer.json
CHANGED
@@ -9,5 +9,11 @@
|
|
9 |
},
|
10 |
"autoload": {
|
11 |
"files": ["autoload.php"]
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
9 |
},
|
10 |
"autoload": {
|
11 |
"files": ["autoload.php"]
|
12 |
+
},
|
13 |
+
"repositories": [
|
14 |
+
{
|
15 |
+
"type": "vcs",
|
16 |
+
"url": "https://github.com/jeffreyvr/wp-scb-framework/"
|
17 |
+
}
|
18 |
+
]
|
19 |
}
|
vendor/scribu/lib-posts-to-posts/side-post.php
CHANGED
@@ -22,7 +22,7 @@ class P2P_Side_Post extends P2P_Side {
|
|
22 |
$ptype_object = get_post_type_object( $ptype );
|
23 |
|
24 |
if ( !$ptype_object ) {
|
25 |
-
throw new P2P_Exception( "Can't find $ptype." );
|
26 |
}
|
27 |
|
28 |
return $ptype_object;
|
22 |
$ptype_object = get_post_type_object( $ptype );
|
23 |
|
24 |
if ( !$ptype_object ) {
|
25 |
+
throw new P2P_Exception( "Can't find post type $ptype." );
|
26 |
}
|
27 |
|
28 |
return $ptype_object;
|
vendor/scribu/scb-framework/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.svn
|
vendor/scribu/scb-framework/AdminPage.php
CHANGED
@@ -136,6 +136,9 @@ abstract class scbAdminPage {
|
|
136 |
|
137 |
add_action( 'admin_menu', array( $this, 'page_init' ), $this->args['admin_action_priority'] );
|
138 |
|
|
|
|
|
|
|
139 |
if ( $file ) {
|
140 |
$this->file = $file;
|
141 |
$this->plugin_url = plugin_dir_url( $file );
|
@@ -508,7 +511,6 @@ abstract class scbAdminPage {
|
|
508 |
'toplevel' => '',
|
509 |
'position' => null,
|
510 |
'icon_url' => '',
|
511 |
-
'screen_icon' => '',
|
512 |
'parent' => 'options-general.php',
|
513 |
'capability' => 'manage_options',
|
514 |
'menu_title' => $this->args['page_title'],
|
@@ -538,7 +540,6 @@ abstract class scbAdminPage {
|
|
538 |
* @param string|object $screen
|
539 |
*
|
540 |
* @return string
|
541 |
-
* @deprecated 1.6.6 Not used
|
542 |
*/
|
543 |
public function _contextual_help( $help, $screen ) {
|
544 |
if ( is_object( $screen ) ) {
|
@@ -580,4 +581,3 @@ abstract class scbAdminPage {
|
|
580 |
return $links;
|
581 |
}
|
582 |
}
|
583 |
-
|
136 |
|
137 |
add_action( 'admin_menu', array( $this, 'page_init' ), $this->args['admin_action_priority'] );
|
138 |
|
139 |
+
// Commented out due to deprecated notice.
|
140 |
+
// add_filter( 'contextual_help', array( $this, '_contextual_help' ), 10, 2 );
|
141 |
+
|
142 |
if ( $file ) {
|
143 |
$this->file = $file;
|
144 |
$this->plugin_url = plugin_dir_url( $file );
|
511 |
'toplevel' => '',
|
512 |
'position' => null,
|
513 |
'icon_url' => '',
|
|
|
514 |
'parent' => 'options-general.php',
|
515 |
'capability' => 'manage_options',
|
516 |
'menu_title' => $this->args['page_title'],
|
540 |
* @param string|object $screen
|
541 |
*
|
542 |
* @return string
|
|
|
543 |
*/
|
544 |
public function _contextual_help( $help, $screen ) {
|
545 |
if ( is_object( $screen ) ) {
|
581 |
return $links;
|
582 |
}
|
583 |
}
|
|
vendor/scribu/scb-framework/Forms.php
CHANGED
@@ -606,6 +606,10 @@ abstract class scbFormField implements scbFormField_I {
|
|
606 |
* @return string
|
607 |
*/
|
608 |
protected static function add_label( $input, $desc, $desc_pos ) {
|
|
|
|
|
|
|
|
|
609 |
return html( 'label', self::add_desc( $input, $desc, $desc_pos ) ) . "\n";
|
610 |
}
|
611 |
|
606 |
* @return string
|
607 |
*/
|
608 |
protected static function add_label( $input, $desc, $desc_pos ) {
|
609 |
+
if ( empty( $desc ) ) {
|
610 |
+
return $input;
|
611 |
+
}
|
612 |
+
|
613 |
return html( 'label', self::add_desc( $input, $desc, $desc_pos ) ) . "\n";
|
614 |
}
|
615 |
|
vendor/scribu/scb-framework/load.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
$GLOBALS['_scb_data'] = array(
|
4 |
'scbUtil',
|
5 |
'scbOptions',
|
6 |
'scbForms',
|
1 |
<?php
|
2 |
|
3 |
+
$GLOBALS['_scb_data'] = array( 61, __FILE__, array(
|
4 |
'scbUtil',
|
5 |
'scbOptions',
|
6 |
'scbForms',
|