Version Description
Fixes and improvements * Resolve potential pagination issue #1642 (thanks @gchtr)
Download this release
Release Info
Developer | jarednova |
Plugin | Timber |
Version | 1.8.4 |
Comparing to | |
See all releases |
Code changes from version 1.8.3 to 1.8.4
- README.md +18 -11
- lib/Image/Operation/ToWebp.php +12 -2
- lib/ImageHelper.php +8 -3
- lib/Pagination.php +1 -1
- lib/TextHelper.php +11 -0
- lib/Timber.php +1 -1
- readme.txt +5 -2
- timber.php +1 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +3 -3
README.md
CHANGED
@@ -2,12 +2,15 @@
|
|
2 |
<a href="https://upstatement.com/timber/"><img src="http://i.imgur.com/PbEwvZ9.png" style="display:block; margin:auto; width:100%; max-width:100%"/></a>
|
3 |
</div>
|
4 |
|
5 |
-
By
|
6 |
-
|
|
|
|
|
|
|
|
|
7 |
|
8 |
[![Build Status](https://img.shields.io/travis/timber/timber/master.svg?style=flat-square)](https://travis-ci.org/timber/timber)
|
9 |
[![Coverage Status](https://img.shields.io/coveralls/timber/timber.svg?style=flat-square)](https://codecov.io/gh/timber/timber)
|
10 |
-
[![Dependency Status](https://www.versioneye.com/user/projects/574e40e6e298f30048059b9f/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/574e40e6e298f30048059b9f)
|
11 |
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/timber/timber.svg?style=flat-square)](https://scrutinizer-ci.com/g/timber/timber/?branch=master)
|
12 |
[![Latest Stable Version](https://img.shields.io/packagist/v/timber/timber.svg?style=flat-square)](https://packagist.org/packages/timber/timber)
|
13 |
[![WordPress Download Count](https://img.shields.io/wordpress/plugin/dt/timber-library.svg?style=flat-square)](https://wordpress.org/plugins/timber-library/)
|
@@ -83,16 +86,20 @@ Nothing. Timber is meant for you to build a theme on. Like [_s](https://github.c
|
|
83 |
#### Who is it good for?
|
84 |
Timber is great for any WordPress developer who cares about writing good, maintainable code. It helps teams of designers and developers working together. At [Upstatement](http://upstatement.com) we made Timber because while our entire team needs to participate in building WordPress sites, not everyone knows the ins-and-outs of the_loop(), codex and PHP (nor should they). With Timber your best WordPress engineer can focus on building the `.php` files with requests from WordPress and pass the data into `.twig` files. Once there, designers can easily mark-up data and build out a site's look-and-feel.
|
85 |
|
86 |
-
#### Related Projects
|
|
|
87 |
* [**Timber Starter Theme**](https://github.com/timber/starter-theme) The "_s" of Timber to give you an easy start to the most basic theme you can build upon and customize.
|
88 |
* [**Timber Debug Bar**](https://github.com/timber/debug-bar-timber) Adds a debug bar panel that will show you which template is in-use and the data sent to your twig file.
|
89 |
-
|
90 |
-
|
91 |
-
* [**
|
92 |
-
* [**Timber
|
93 |
-
* [**
|
94 |
-
* [**
|
95 |
-
* [**
|
|
|
|
|
|
|
96 |
|
97 |
#### Projects that use Timber
|
98 |
* [**Gantry5**](https://wordpress.org/plugins/gantry5/) a framework for theme development
|
2 |
<a href="https://upstatement.com/timber/"><img src="http://i.imgur.com/PbEwvZ9.png" style="display:block; margin:auto; width:100%; max-width:100%"/></a>
|
3 |
</div>
|
4 |
|
5 |
+
By
|
6 |
+
[Jared Novack](https://github.com/jarednova) ([@jarednova](https://twitter.com/jarednova)),
|
7 |
+
[Lukas Gächter](https://github.com/gchtr) ([@lgaechter](https://twitter.com/lgaechter)),
|
8 |
+
[Pascal Knecht](https://github.com/pascalknecht) ([@pascalknecht](https://twitter.com/revenwo)),
|
9 |
+
[Maciej Palmowski](https://github.com/palmiak) ([@palmiak_fp](https://twitter.com/palmiak_fp)),
|
10 |
+
[Upstatement](https://twitter.com/upstatement) and [hundreds of other GitHub contributors](https://github.com/timber/timber/graphs/contributors)
|
11 |
|
12 |
[![Build Status](https://img.shields.io/travis/timber/timber/master.svg?style=flat-square)](https://travis-ci.org/timber/timber)
|
13 |
[![Coverage Status](https://img.shields.io/coveralls/timber/timber.svg?style=flat-square)](https://codecov.io/gh/timber/timber)
|
|
|
14 |
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/timber/timber.svg?style=flat-square)](https://scrutinizer-ci.com/g/timber/timber/?branch=master)
|
15 |
[![Latest Stable Version](https://img.shields.io/packagist/v/timber/timber.svg?style=flat-square)](https://packagist.org/packages/timber/timber)
|
16 |
[![WordPress Download Count](https://img.shields.io/wordpress/plugin/dt/timber-library.svg?style=flat-square)](https://wordpress.org/plugins/timber-library/)
|
86 |
#### Who is it good for?
|
87 |
Timber is great for any WordPress developer who cares about writing good, maintainable code. It helps teams of designers and developers working together. At [Upstatement](http://upstatement.com) we made Timber because while our entire team needs to participate in building WordPress sites, not everyone knows the ins-and-outs of the_loop(), codex and PHP (nor should they). With Timber your best WordPress engineer can focus on building the `.php` files with requests from WordPress and pass the data into `.twig` files. Once there, designers can easily mark-up data and build out a site's look-and-feel.
|
88 |
|
89 |
+
#### Related & Official Projects
|
90 |
+
* [**Twig**](https://github.com/twigphp/Twig) The template language used by Timber.
|
91 |
* [**Timber Starter Theme**](https://github.com/timber/starter-theme) The "_s" of Timber to give you an easy start to the most basic theme you can build upon and customize.
|
92 |
* [**Timber Debug Bar**](https://github.com/timber/debug-bar-timber) Adds a debug bar panel that will show you which template is in-use and the data sent to your twig file.
|
93 |
+
|
94 |
+
#### Related Timber Projects
|
95 |
+
* [**Pine**](https://github.com/azeemhassni/pine) A CLI _installer_ for Timber
|
96 |
+
* [**Timber CLI**](https://github.com/nclud/wp-timber-cli) A CLI for Timber
|
97 |
+
* [**Timber Commented Include**](https://github.com/djboris88/timber-commented-include) Debug output via HTML comments before and after each include statement in Twig
|
98 |
+
* [**Timber Dump Extension**](https://github.com/nlemoine/timber-dump-extension) Debug output with nice formatting
|
99 |
+
* [**Timber Photon**](https://github.com/slimndap/TimberPhoton) Plug-in to use JetPack's free Photon image manipulation and CDN with Timber
|
100 |
+
* [**Timber Sugar**](https://github.com/timber/sugar) A catch-all for goodies to use w Timber
|
101 |
+
* [**Timber WebLink Extension**](https://github.com/nlemoine/timber-weblink-extension) Provides Twig functions to manage the Link HTTP header needed for Web Linking when using HTTP/2 Server Push as well as Resource Hints
|
102 |
+
* [**Timmy**](https://github.com/MINDKomm/Timmy) Advanced image manipulation for Timber
|
103 |
|
104 |
#### Projects that use Timber
|
105 |
* [**Gantry5**](https://wordpress.org/plugins/gantry5/) a framework for theme development
|
lib/Image/Operation/ToWebp.php
CHANGED
@@ -2,9 +2,13 @@
|
|
2 |
|
3 |
namespace Timber\Image\Operation;
|
4 |
|
|
|
5 |
use Timber\Image\Operation as ImageOperation;
|
|
|
6 |
|
7 |
/**
|
|
|
|
|
8 |
* @codeCoverageIgnore
|
9 |
*/
|
10 |
class ToWebp extends ImageOperation {
|
@@ -21,7 +25,7 @@ class ToWebp extends ImageOperation {
|
|
21 |
/**
|
22 |
* @param string $src_filename the basename of the file (ex: my-awesome-pic)
|
23 |
* @param string $src_extension ignored
|
24 |
-
* @return string the final filename to be used (ex: my-awesome-pic.
|
25 |
*/
|
26 |
public function filename( $src_filename, $src_extension = 'webp' ) {
|
27 |
$new_name = $src_filename . '.webp';
|
@@ -32,7 +36,7 @@ class ToWebp extends ImageOperation {
|
|
32 |
* Performs the actual image manipulation,
|
33 |
* including saving the target file.
|
34 |
*
|
35 |
-
* @param string $load_filename filepath (not URL) to source file (ex: /src/var/www/wp-content/uploads/my-pic.
|
36 |
* @param string $save_filename filepath (not URL) where result file should be saved
|
37 |
* (ex: /src/var/www/wp-content/uploads/my-pic.webp)
|
38 |
* @return bool true if everything went fine, false otherwise
|
@@ -42,6 +46,11 @@ class ToWebp extends ImageOperation {
|
|
42 |
return false;
|
43 |
}
|
44 |
|
|
|
|
|
|
|
|
|
|
|
45 |
$ext = wp_check_filetype($load_filename);
|
46 |
if ( isset($ext['ext']) ) {
|
47 |
$ext = $ext['ext'];
|
@@ -61,6 +70,7 @@ class ToWebp extends ImageOperation {
|
|
61 |
}
|
62 |
|
63 |
if (!function_exists('imagewebp')) {
|
|
|
64 |
return false;
|
65 |
}
|
66 |
|
2 |
|
3 |
namespace Timber\Image\Operation;
|
4 |
|
5 |
+
use Timber\Helper as Helper;
|
6 |
use Timber\Image\Operation as ImageOperation;
|
7 |
+
use Timber\ImageHelper;
|
8 |
|
9 |
/**
|
10 |
+
* This class is used to process webp images. Not all server configurations support webp.
|
11 |
+
* If webp is not enabled, Timber will generate webp images instead
|
12 |
* @codeCoverageIgnore
|
13 |
*/
|
14 |
class ToWebp extends ImageOperation {
|
25 |
/**
|
26 |
* @param string $src_filename the basename of the file (ex: my-awesome-pic)
|
27 |
* @param string $src_extension ignored
|
28 |
+
* @return string the final filename to be used (ex: my-awesome-pic.webp)
|
29 |
*/
|
30 |
public function filename( $src_filename, $src_extension = 'webp' ) {
|
31 |
$new_name = $src_filename . '.webp';
|
36 |
* Performs the actual image manipulation,
|
37 |
* including saving the target file.
|
38 |
*
|
39 |
+
* @param string $load_filename filepath (not URL) to source file (ex: /src/var/www/wp-content/uploads/my-pic.webp)
|
40 |
* @param string $save_filename filepath (not URL) where result file should be saved
|
41 |
* (ex: /src/var/www/wp-content/uploads/my-pic.webp)
|
42 |
* @return bool true if everything went fine, false otherwise
|
46 |
return false;
|
47 |
}
|
48 |
|
49 |
+
// Attempt to check if SVG.
|
50 |
+
if ( ImageHelper::is_svg($load_filename) ) {
|
51 |
+
return false;
|
52 |
+
}
|
53 |
+
|
54 |
$ext = wp_check_filetype($load_filename);
|
55 |
if ( isset($ext['ext']) ) {
|
56 |
$ext = $ext['ext'];
|
70 |
}
|
71 |
|
72 |
if (!function_exists('imagewebp')) {
|
73 |
+
Helper::error_log('The function imagewebp does not exist on this server to convert image to '.$save_filename.'.');
|
74 |
return false;
|
75 |
}
|
76 |
|
lib/ImageHelper.php
CHANGED
@@ -153,6 +153,10 @@ class ImageHelper {
|
|
153 |
return false;
|
154 |
}
|
155 |
|
|
|
|
|
|
|
|
|
156 |
/**
|
157 |
* Try reading mime type.
|
158 |
*
|
@@ -200,10 +204,11 @@ class ImageHelper {
|
|
200 |
}
|
201 |
|
202 |
/**
|
203 |
-
* Generates a new image by converting the source into WEBP
|
204 |
*
|
205 |
-
* @param string $src a url or path to the image (http://example.org/wp-content/uploads/2014/image.
|
206 |
-
*
|
|
|
207 |
* @param int $quality ranges from 0 (worst quality, smaller file) to 100 (best quality, biggest file)
|
208 |
* @param bool $force
|
209 |
*/
|
153 |
return false;
|
154 |
}
|
155 |
|
156 |
+
if ( TextHelper::ends_with( strtolower($file_path), '.svg' ) ) {
|
157 |
+
return true;
|
158 |
+
}
|
159 |
+
|
160 |
/**
|
161 |
* Try reading mime type.
|
162 |
*
|
204 |
}
|
205 |
|
206 |
/**
|
207 |
+
* Generates a new image by converting the source into WEBP if supported by the server
|
208 |
*
|
209 |
+
* @param string $src a url or path to the image (http://example.org/wp-content/uploads/2014/image.webp)
|
210 |
+
* or (/wp-content/uploads/2014/image.jpg)
|
211 |
+
* If webp is not supported, a jpeg image will be generated
|
212 |
* @param int $quality ranges from 0 (worst quality, smaller file) to 100 (best quality, biggest file)
|
213 |
* @param bool $force
|
214 |
*/
|
lib/Pagination.php
CHANGED
@@ -167,7 +167,7 @@ class Pagination {
|
|
167 |
|
168 |
$page_links[] = array(
|
169 |
'class' => 'page-number page-numbers',
|
170 |
-
'link' => $link,
|
171 |
'title' => $n_display,
|
172 |
'name' => $n_display,
|
173 |
'current' => $args['current'] == $n
|
167 |
|
168 |
$page_links[] = array(
|
169 |
'class' => 'page-number page-numbers',
|
170 |
+
'link' => esc_url( $link ),
|
171 |
'title' => $n_display,
|
172 |
'name' => $n_display,
|
173 |
'current' => $args['current'] == $n
|
lib/TextHelper.php
CHANGED
@@ -86,6 +86,17 @@ class TextHelper {
|
|
86 |
return false;
|
87 |
}
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
/**
|
90 |
*
|
91 |
*
|
86 |
return false;
|
87 |
}
|
88 |
|
89 |
+
/**
|
90 |
+
* Does the string in question (haystack)
|
91 |
+
* end with the substring in question (needle)?
|
92 |
+
* @param string $haystack
|
93 |
+
* @param string $needle
|
94 |
+
* @return boolean
|
95 |
+
*/
|
96 |
+
public static function ends_with( $haystack, $needle ) {
|
97 |
+
return ( substr( $haystack, strlen( $haystack ) - strlen( $needle ) ) == $needle );
|
98 |
+
}
|
99 |
+
|
100 |
/**
|
101 |
*
|
102 |
*
|
lib/Timber.php
CHANGED
@@ -35,7 +35,7 @@ use Timber\Loader;
|
|
35 |
*/
|
36 |
class Timber {
|
37 |
|
38 |
-
public static $version = '1.8.
|
39 |
public static $locations;
|
40 |
public static $dirname = 'views';
|
41 |
public static $twig_cache = false;
|
35 |
*/
|
36 |
class Timber {
|
37 |
|
38 |
+
public static $version = '1.8.4';
|
39 |
public static $locations;
|
40 |
public static $dirname = 'views';
|
41 |
public static $twig_cache = false;
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: jarednova, connorjburton, lggorman
|
3 |
Tags: template engine, templates, twig
|
4 |
Requires at least: 4.7.9
|
5 |
-
Tested up to:
|
6 |
-
Stable tag: 1.8.
|
7 |
Requires PHP: 5.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -36,6 +36,9 @@ _Twig is the template language powering Timber; if you need a little background
|
|
36 |
**Changes for Theme Developers**
|
37 |
- Please add bullet points here with your PR. The heading for this section will get the correct version number once released.
|
38 |
|
|
|
|
|
|
|
39 |
|
40 |
= 1.8.3 =
|
41 |
**Fixes and improvements**
|
2 |
Contributors: jarednova, connorjburton, lggorman
|
3 |
Tags: template engine, templates, twig
|
4 |
Requires at least: 4.7.9
|
5 |
+
Tested up to: 5.0.2
|
6 |
+
Stable tag: 1.8.4
|
7 |
Requires PHP: 5.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
36 |
**Changes for Theme Developers**
|
37 |
- Please add bullet points here with your PR. The heading for this section will get the correct version number once released.
|
38 |
|
39 |
+
= 1.8.4 =
|
40 |
+
**Fixes and improvements**
|
41 |
+
* Resolve potential pagination issue #1642 (thanks @gchtr)
|
42 |
|
43 |
= 1.8.3 =
|
44 |
**Fixes and improvements**
|
timber.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Timber
|
|
4 |
Description: The WordPress Timber Library allows you to write themes using the power of Twig templates.
|
5 |
Plugin URI: http://timber.upstatement.com
|
6 |
Author: Jared Novack + Upstatement
|
7 |
-
Version: 1.8.
|
8 |
Author URI: http://upstatement.com/
|
9 |
*/
|
10 |
// we look for Composer files first in the plugins dir.
|
4 |
Description: The WordPress Timber Library allows you to write themes using the power of Twig templates.
|
5 |
Plugin URI: http://timber.upstatement.com
|
6 |
Author: Jared Novack + Upstatement
|
7 |
+
Version: 1.8.4
|
8 |
Author URI: http://upstatement.com/
|
9 |
*/
|
10 |
// we look for Composer files first in the plugins dir.
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer' . '/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit2d3b2487a3de8d7edb3d42365706054f::getLoader();
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit1a9acfa75255d78c93ec9ed3be4ba492
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
27 |
foreach ($map as $namespace => $path) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit2d3b2487a3de8d7edb3d42365706054f
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit2d3b2487a3de8d7edb3d42365706054f', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit2d3b2487a3de8d7edb3d42365706054f', 'loadClassLoader'));
|
25 |
|
26 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
27 |
foreach ($map as $namespace => $path) {
|