Timber - Version 1.17.0

Version Description

Changes for Theme Developers

  • Adds new filter: timber/allow_fs_write to ensure compatibility with WordPress VIP and other hosts with filewrite restrictions. #2250 (thanks @mjangda)

Fixes and improvements

  • Add a catch so that {{ dump() }} when WP_DEBUG
Download this release

Release Info

Developer jarednova
Plugin Icon 128x128 Timber
Version 1.17.0
Comparing to
See all releases

Code changes from version 1.16.0 to 1.17.0

lib/ImageHelper.php CHANGED
@@ -572,6 +572,13 @@ class ImageHelper {
572
  if ( empty($src) ) {
573
  return '';
574
  }
 
 
 
 
 
 
 
575
  $external = false;
576
  // if external image, load it first
577
  if ( URLHelper::is_external_content($src) ) {
572
  if ( empty($src) ) {
573
  return '';
574
  }
575
+
576
+ $allow_fs_write = apply_filters('timber/allow_fs_write', true);
577
+
578
+ if ( $allow_fs_write === false ) {
579
+ return $src;
580
+ }
581
+
582
  $external = false;
583
  // if external image, load it first
584
  if ( URLHelper::is_external_content($src) ) {
lib/Loader.php CHANGED
@@ -174,6 +174,10 @@ class Loader {
174
  $twig = new \Twig\Environment($loader, $params);
175
  if ( WP_DEBUG ) {
176
  $twig->addExtension(new \Twig\Extension\DebugExtension());
 
 
 
 
177
  }
178
  $twig->addExtension($this->_get_cache_extension());
179
 
@@ -210,7 +214,10 @@ class Loader {
210
 
211
  protected static function clear_cache_timber_database() {
212
  global $wpdb;
213
- $query = $wpdb->prepare("DELETE FROM $wpdb->options WHERE option_name LIKE '%s'", '_transient_timberloader_%');
 
 
 
214
  return $wpdb->query($query);
215
  }
216
 
174
  $twig = new \Twig\Environment($loader, $params);
175
  if ( WP_DEBUG ) {
176
  $twig->addExtension(new \Twig\Extension\DebugExtension());
177
+ } else {
178
+ $twig->addFunction(new Twig_Function('dump', function() {
179
+ return null;
180
+ }));
181
  }
182
  $twig->addExtension($this->_get_cache_extension());
183
 
214
 
215
  protected static function clear_cache_timber_database() {
216
  global $wpdb;
217
+ $query = $wpdb->prepare(
218
+ "DELETE FROM $wpdb->options WHERE option_name LIKE '%s'",
219
+ '_transient%timberloader_%'
220
+ );
221
  return $wpdb->query($query);
222
  }
223
 
lib/Post.php CHANGED
@@ -1224,6 +1224,7 @@ class Post extends Core implements CoreInterface {
1224
  $content = $contents[$page];
1225
  }
1226
  }
 
1227
  $content = apply_filters('the_content', ($content));
1228
  if ( $len == -1 && $page == 0 ) {
1229
  $this->___content = $content;
@@ -1231,6 +1232,22 @@ class Post extends Core implements CoreInterface {
1231
  return $content;
1232
  }
1233
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1234
  /**
1235
  * @return string
1236
  */
1224
  $content = $contents[$page];
1225
  }
1226
  }
1227
+ $content = $this->content_handle_no_teaser_block( $content );
1228
  $content = apply_filters('the_content', ($content));
1229
  if ( $len == -1 && $page == 0 ) {
1230
  $this->___content = $content;
1232
  return $content;
1233
  }
1234
 
1235
+ /**
1236
+ * Handles for an circumstance with the Block editor where a "more" block has an option to
1237
+ * "Hide the excerpt on the full content page" which hides everything prior to the inserted
1238
+ * "more" block
1239
+ * @ticket #2218
1240
+ * @param string $content
1241
+ * @return string
1242
+ */
1243
+ protected function content_handle_no_teaser_block( $content ) {
1244
+ if ( strpos($content, 'noTeaser:true') !== false ) {
1245
+ $arr = explode('<!--noteaser-->', $content);
1246
+ return $arr[1];
1247
+ }
1248
+ return $content;
1249
+ }
1250
+
1251
  /**
1252
  * @return string
1253
  */
lib/Timber.php CHANGED
@@ -35,7 +35,7 @@ use Timber\Loader;
35
  */
36
  class Timber {
37
 
38
- public static $version = '1.16.0';
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.17.0';
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
3
  Tags: template engine, templates, twig
4
  Requires at least: 4.9.8
5
- Tested up to: 5.4.1
6
- Stable tag: 1.16.0
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -30,10 +30,22 @@ _Twig is the template language powering Timber; if you need a little background
30
 
31
  = Develop (next release) =
32
 
 
 
33
  **Fixes and improvements**
34
 
 
 
35
  **Changes for Theme Developers**
36
 
 
 
 
 
 
 
 
 
37
  = 1.16.0 =
38
  **Changes for Theme Developers**
39
  * Allows for translation of time_ago Twig filter #2214 #2215 (thanks @gchtr)
2
  Contributors: jarednova
3
  Tags: template engine, templates, twig
4
  Requires at least: 4.9.8
5
+ Tested up to: 5.4.2
6
+ Stable tag: 1.17.0
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
30
 
31
  = Develop (next release) =
32
 
33
+ **Changes for Theme Developers**
34
+
35
  **Fixes and improvements**
36
 
37
+ = 1.17.0 =
38
+
39
  **Changes for Theme Developers**
40
 
41
+ * Adds new filter: `timber/allow_fs_write` to ensure compatibility with WordPress VIP and other hosts with filewrite restrictions. #2250 (thanks @mjangda)
42
+
43
+ **Fixes and improvements**
44
+
45
+ * Add a catch so that `{{ dump() }}` when WP_DEBUG = FALSE doesn't cause a fatal error #2217, #2282
46
+ * Performance improvement for the deletion of transients #2281 (thanks @opengeekv2)
47
+ * Fix for "More" block issue with Gutenberg #2256
48
+
49
  = 1.16.0 =
50
  **Changes for Theme Developers**
51
  * Allows for translation of time_ago Twig filter #2214 #2215 (thanks @gchtr)
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: https://upstatement.com/timber
6
  Author: Jared Novack + Upstatement
7
- Version: 1.16.0
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: https://upstatement.com/timber
6
  Author: Jared Novack + Upstatement
7
+ Version: 1.17.0
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 ComposerAutoloaderInitf110f5a1c019086cf9b17e8d5e12df63::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit09c71e928ca77624cf6af04a8ad5b593::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitf110f5a1c019086cf9b17e8d5e12df63
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInitf110f5a1c019086cf9b17e8d5e12df63
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInitf110f5a1c019086cf9b17e8d5e12df63', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInitf110f5a1c019086cf9b17e8d5e12df63', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInitf110f5a1c019086cf9b17e8d5e12df63::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
@@ -51,19 +51,19 @@ class ComposerAutoloaderInitf110f5a1c019086cf9b17e8d5e12df63
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
- $includeFiles = Composer\Autoload\ComposerStaticInitf110f5a1c019086cf9b17e8d5e12df63::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
- composerRequiref110f5a1c019086cf9b17e8d5e12df63($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
- function composerRequiref110f5a1c019086cf9b17e8d5e12df63($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit09c71e928ca77624cf6af04a8ad5b593
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit09c71e928ca77624cf6af04a8ad5b593', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit09c71e928ca77624cf6af04a8ad5b593', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInit09c71e928ca77624cf6af04a8ad5b593::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
+ $includeFiles = Composer\Autoload\ComposerStaticInit09c71e928ca77624cf6af04a8ad5b593::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
+ composerRequire09c71e928ca77624cf6af04a8ad5b593($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
+ function composerRequire09c71e928ca77624cf6af04a8ad5b593($fileIdentifier, $file)
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitf110f5a1c019086cf9b17e8d5e12df63
8
  {
9
  public static $files = array (
10
  '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
@@ -618,11 +618,11 @@ class ComposerStaticInitf110f5a1c019086cf9b17e8d5e12df63
618
  public static function getInitializer(ClassLoader $loader)
619
  {
620
  return \Closure::bind(function () use ($loader) {
621
- $loader->prefixLengthsPsr4 = ComposerStaticInitf110f5a1c019086cf9b17e8d5e12df63::$prefixLengthsPsr4;
622
- $loader->prefixDirsPsr4 = ComposerStaticInitf110f5a1c019086cf9b17e8d5e12df63::$prefixDirsPsr4;
623
- $loader->fallbackDirsPsr4 = ComposerStaticInitf110f5a1c019086cf9b17e8d5e12df63::$fallbackDirsPsr4;
624
- $loader->prefixesPsr0 = ComposerStaticInitf110f5a1c019086cf9b17e8d5e12df63::$prefixesPsr0;
625
- $loader->classMap = ComposerStaticInitf110f5a1c019086cf9b17e8d5e12df63::$classMap;
626
 
627
  }, null, ClassLoader::class);
628
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit09c71e928ca77624cf6af04a8ad5b593
8
  {
9
  public static $files = array (
10
  '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
618
  public static function getInitializer(ClassLoader $loader)
619
  {
620
  return \Closure::bind(function () use ($loader) {
621
+ $loader->prefixLengthsPsr4 = ComposerStaticInit09c71e928ca77624cf6af04a8ad5b593::$prefixLengthsPsr4;
622
+ $loader->prefixDirsPsr4 = ComposerStaticInit09c71e928ca77624cf6af04a8ad5b593::$prefixDirsPsr4;
623
+ $loader->fallbackDirsPsr4 = ComposerStaticInit09c71e928ca77624cf6af04a8ad5b593::$fallbackDirsPsr4;
624
+ $loader->prefixesPsr0 = ComposerStaticInit09c71e928ca77624cf6af04a8ad5b593::$prefixesPsr0;
625
+ $loader->classMap = ComposerStaticInit09c71e928ca77624cf6af04a8ad5b593::$classMap;
626
 
627
  }, null, ClassLoader::class);
628
  }
vendor/composer/installed.json CHANGED
@@ -254,17 +254,17 @@
254
  },
255
  {
256
  "name": "symfony/polyfill-ctype",
257
- "version": "v1.17.0",
258
- "version_normalized": "1.17.0.0",
259
  "source": {
260
  "type": "git",
261
  "url": "https://github.com/symfony/polyfill-ctype.git",
262
- "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9"
263
  },
264
  "dist": {
265
  "type": "zip",
266
- "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e94c8b1bbe2bc77507a1056cdb06451c75b427f9",
267
- "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9",
268
  "shasum": ""
269
  },
270
  "require": {
@@ -273,11 +273,15 @@
273
  "suggest": {
274
  "ext-ctype": "For best performance"
275
  },
276
- "time": "2020-05-12T16:14:59+00:00",
277
  "type": "library",
278
  "extra": {
279
  "branch-alias": {
280
- "dev-master": "1.17-dev"
 
 
 
 
281
  }
282
  },
283
  "installation-source": "dist",
254
  },
255
  {
256
  "name": "symfony/polyfill-ctype",
257
+ "version": "v1.18.0",
258
+ "version_normalized": "1.18.0.0",
259
  "source": {
260
  "type": "git",
261
  "url": "https://github.com/symfony/polyfill-ctype.git",
262
+ "reference": "1c302646f6efc070cd46856e600e5e0684d6b454"
263
  },
264
  "dist": {
265
  "type": "zip",
266
+ "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454",
267
+ "reference": "1c302646f6efc070cd46856e600e5e0684d6b454",
268
  "shasum": ""
269
  },
270
  "require": {
273
  "suggest": {
274
  "ext-ctype": "For best performance"
275
  },
276
+ "time": "2020-07-14T12:35:20+00:00",
277
  "type": "library",
278
  "extra": {
279
  "branch-alias": {
280
+ "dev-master": "1.18-dev"
281
+ },
282
+ "thanks": {
283
+ "name": "symfony/polyfill",
284
+ "url": "https://github.com/symfony/polyfill"
285
  }
286
  },
287
  "installation-source": "dist",
vendor/symfony/polyfill-ctype/composer.json CHANGED
@@ -28,7 +28,11 @@
28
  "minimum-stability": "dev",
29
  "extra": {
30
  "branch-alias": {
31
- "dev-master": "1.17-dev"
 
 
 
 
32
  }
33
  }
34
  }
28
  "minimum-stability": "dev",
29
  "extra": {
30
  "branch-alias": {
31
+ "dev-master": "1.18-dev"
32
+ },
33
+ "thanks": {
34
+ "name": "symfony/polyfill",
35
+ "url": "https://github.com/symfony/polyfill"
36
  }
37
  }
38
  }