Timber - Version 1.18.2

Version Description

Fixes and improvements

  • Fixes an issue where images loaded from another domain/site weren't properly deleted from the tmp directory #2216 (thanks @oxyc)
Download this release

Release Info

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

Code changes from version 1.18.1 to 1.18.2

Files changed (45) hide show
  1. lib/Image.php +1 -1
  2. lib/ImageHelper.php +3 -2
  3. lib/Timber.php +1 -1
  4. readme.txt +9 -2
  5. timber-starter-theme/{theme/404.php → 404.php} +0 -0
  6. timber-starter-theme/LICENSE +0 -0
  7. timber-starter-theme/README.md +3 -4
  8. timber-starter-theme/{theme/archive.php → archive.php} +0 -0
  9. timber-starter-theme/{theme/author.php → author.php} +0 -0
  10. timber-starter-theme/{theme/footer.php → footer.php} +0 -0
  11. timber-starter-theme/{theme/functions.php → functions.php} +3 -3
  12. timber-starter-theme/{theme/header.php → header.php} +0 -0
  13. timber-starter-theme/{theme/index.php → index.php} +0 -0
  14. timber-starter-theme/{theme/page.php → page.php} +0 -0
  15. timber-starter-theme/{theme/screenshot.png → screenshot.png} +0 -0
  16. timber-starter-theme/{theme/search.php → search.php} +0 -0
  17. timber-starter-theme/{theme/sidebar.php → sidebar.php} +0 -0
  18. timber-starter-theme/{theme/single.php → single.php} +1 -1
  19. timber-starter-theme/static/site.js +0 -0
  20. timber-starter-theme/{theme/style.css → style.css} +0 -0
  21. timber-starter-theme/{views → templates}/404.twig +0 -0
  22. timber-starter-theme/{views → templates}/archive.twig +0 -0
  23. timber-starter-theme/{views → templates}/author.twig +0 -0
  24. timber-starter-theme/{views → templates}/base.twig +0 -0
  25. timber-starter-theme/{views → templates}/comment-form.twig +0 -0
  26. timber-starter-theme/{views → templates}/comment.twig +0 -0
  27. timber-starter-theme/{views → templates}/footer.twig +0 -0
  28. timber-starter-theme/{views → templates}/html-header.twig +0 -0
  29. timber-starter-theme/{views → templates}/index.twig +0 -0
  30. timber-starter-theme/{views → templates}/menu.twig +0 -0
  31. timber-starter-theme/{views → templates}/page-plugin.twig +0 -0
  32. timber-starter-theme/{views → templates}/page.twig +0 -0
  33. timber-starter-theme/{views → templates}/partial/pagination.twig +0 -0
  34. timber-starter-theme/{views → templates}/search.twig +0 -0
  35. timber-starter-theme/{views → templates}/sidebar.twig +0 -0
  36. timber-starter-theme/{views → templates}/single-password.twig +0 -0
  37. timber-starter-theme/{views → templates}/single.twig +0 -0
  38. timber-starter-theme/{views → templates}/tease-post.twig +0 -0
  39. timber-starter-theme/{views → templates}/tease.twig +0 -0
  40. timber-starter-theme/tests/test-timber-starter-theme.php +1 -1
  41. timber.php +1 -1
  42. vendor/autoload.php +1 -1
  43. vendor/composer/autoload_real.php +7 -7
  44. vendor/composer/autoload_static.php +6 -6
  45. vendor/composer/installed.json +2 -1
lib/Image.php CHANGED
@@ -497,7 +497,7 @@ class Image extends Post implements CoreInterface {
497
  */
498
  protected function is_image() {
499
  $src = wp_get_attachment_url($this->ID);
500
- $image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );
501
  $check = wp_check_filetype(PathHelper::basename($src), null);
502
  return in_array($check['ext'], $image_exts);
503
  }
497
  */
498
  protected function is_image() {
499
  $src = wp_get_attachment_url($this->ID);
500
+ $image_exts = array( 'gif', 'jpg', 'jpeg', 'jpe', 'png', 'webp' );
501
  $check = wp_check_filetype(PathHelper::basename($src), null);
502
  return in_array($check['ext'], $image_exts);
503
  }
lib/ImageHelper.php CHANGED
@@ -378,14 +378,15 @@ class ImageHelper {
378
  $file_array = array();
379
  $file_array['name'] = PathHelper::basename($matches[0]);
380
  $file_array['tmp_name'] = $tmp;
381
- // If error storing temporarily, unlink
382
  if ( is_wp_error($tmp) ) {
383
- @unlink($file_array['tmp_name']);
384
  $file_array['tmp_name'] = '';
385
  }
386
  // do the validation and storage stuff
387
  $locinfo = PathHelper::pathinfo($loc);
388
  $file = wp_upload_bits($locinfo['basename'], null, file_get_contents($file_array['tmp_name']));
 
 
389
  return $file['url'];
390
  }
391
 
378
  $file_array = array();
379
  $file_array['name'] = PathHelper::basename($matches[0]);
380
  $file_array['tmp_name'] = $tmp;
381
+ // If error storing temporarily, do not use
382
  if ( is_wp_error($tmp) ) {
 
383
  $file_array['tmp_name'] = '';
384
  }
385
  // do the validation and storage stuff
386
  $locinfo = PathHelper::pathinfo($loc);
387
  $file = wp_upload_bits($locinfo['basename'], null, file_get_contents($file_array['tmp_name']));
388
+ // delete tmp file
389
+ @unlink($file_array['tmp_name']);
390
  return $file['url'];
391
  }
392
 
lib/Timber.php CHANGED
@@ -35,7 +35,7 @@ use Timber\Loader;
35
  */
36
  class Timber {
37
 
38
- public static $version = '1.18.1';
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.18.2';
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.2
6
- Stable tag: 1.18.0
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -38,6 +38,13 @@ _Twig is the template language powering Timber; if you need a little background
38
 
39
  **Fixes and improvements**
40
 
 
 
 
 
 
 
 
41
  = 1.18.1 =
42
 
43
  **Fixes and improvements**
2
  Contributors: jarednova
3
  Tags: template engine, templates, twig
4
  Requires at least: 4.9.8
5
+ Tested up to: 5.8.1
6
+ Stable tag: 1.18.2
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
38
 
39
  **Fixes and improvements**
40
 
41
+ = 1.18.2 =
42
+
43
+ **Fixes and improvements**
44
+
45
+ * Fixes an issue where images loaded from another domain/site weren't properly deleted from the tmp directory #2216 (thanks @oxyc)
46
+
47
+
48
  = 1.18.1 =
49
 
50
  **Fixes and improvements**
timber-starter-theme/{theme/404.php → 404.php} RENAMED
File without changes
timber-starter-theme/LICENSE CHANGED
File without changes
timber-starter-theme/README.md CHANGED
@@ -1,8 +1,9 @@
 
1
  # The Timber Starter Theme
2
 
3
  The "_s" for Timber: a dead-simple theme that you can build from. The primary purpose of this theme is to provide a file structure rather than a framework for markup or styles. Configure your Sass, scripts, and task runners however you would like!
4
 
5
- [![Build Status](https://travis-ci.com/timber/starter-theme.svg?branch=master)](https://travis-ci.com/github/timber/starter-theme)
6
 
7
  ## Installing the Theme
8
 
@@ -12,7 +13,7 @@ Install this theme as you would any other, and be sure the Timber plugin is acti
12
  2. Download the zip for this theme (or clone it) and move it to `wp-content/themes` in your WordPress installation.
13
  3. Rename the folder to something that makes sense for your website (generally no spaces and all lowercase). You could keep the name `timber-starter-theme` but the point of a starter theme is to make it your own!
14
  4. Activate the theme in Appearance > Themes.
15
- 5. Do your thing! And read [the docs](https://github.com/jarednova/timber/wiki).
16
 
17
  ## What's here?
18
 
@@ -24,8 +25,6 @@ Install this theme as you would any other, and be sure the Timber plugin is acti
24
 
25
  ## Other Resources
26
 
27
- The [main Timber Wiki](https://github.com/jarednova/timber/wiki) is super great, so reference those often. Also, check out these articles and projects for more info:
28
-
29
  * [This branch](https://github.com/laras126/timber-starter-theme/tree/tackle-box) of the starter theme has some more example code with ACF and a slightly different set up.
30
  * [Twig for Timber Cheatsheet](http://notlaura.com/the-twig-for-timber-cheatsheet/)
31
  * [Timber and Twig Reignited My Love for WordPress](https://css-tricks.com/timber-and-twig-reignited-my-love-for-wordpress/) on CSS-Tricks
1
+
2
  # The Timber Starter Theme
3
 
4
  The "_s" for Timber: a dead-simple theme that you can build from. The primary purpose of this theme is to provide a file structure rather than a framework for markup or styles. Configure your Sass, scripts, and task runners however you would like!
5
 
6
+ [![Build Status](https://travis-ci.com/timber/starter-theme.svg?branch=master)](https://travis-ci.come/github/timber/starter-theme)
7
 
8
  ## Installing the Theme
9
 
13
  2. Download the zip for this theme (or clone it) and move it to `wp-content/themes` in your WordPress installation.
14
  3. Rename the folder to something that makes sense for your website (generally no spaces and all lowercase). You could keep the name `timber-starter-theme` but the point of a starter theme is to make it your own!
15
  4. Activate the theme in Appearance > Themes.
16
+ 5. Do your thing! And read [the docs](https://timber.github.io/docs/).
17
 
18
  ## What's here?
19
 
25
 
26
  ## Other Resources
27
 
 
 
28
  * [This branch](https://github.com/laras126/timber-starter-theme/tree/tackle-box) of the starter theme has some more example code with ACF and a slightly different set up.
29
  * [Twig for Timber Cheatsheet](http://notlaura.com/the-twig-for-timber-cheatsheet/)
30
  * [Timber and Twig Reignited My Love for WordPress](https://css-tricks.com/timber-and-twig-reignited-my-love-for-wordpress/) on CSS-Tricks
timber-starter-theme/{theme/archive.php → archive.php} RENAMED
File without changes
timber-starter-theme/{theme/author.php → author.php} RENAMED
File without changes
timber-starter-theme/{theme/footer.php → footer.php} RENAMED
File without changes
timber-starter-theme/{theme/functions.php → functions.php} RENAMED
@@ -13,7 +13,7 @@
13
  * to load your dependencies and initialize Timber. If you are using Timber via the WordPress.org
14
  * plug-in, you can safely delete this block.
15
  */
16
- $composer_autoload = dirname( __DIR__ ) . '/vendor/autoload.php';
17
  if ( file_exists( $composer_autoload ) ) {
18
  require_once $composer_autoload;
19
  $timber = new Timber\Timber();
@@ -35,7 +35,7 @@ if ( ! class_exists( 'Timber' ) ) {
35
  add_filter(
36
  'template_include',
37
  function( $template ) {
38
- return dirname( get_stylesheet_directory() ) . '/static/no-timber.html';
39
  }
40
  );
41
  return;
@@ -44,7 +44,7 @@ if ( ! class_exists( 'Timber' ) ) {
44
  /**
45
  * Sets the directories (inside your theme) to find .twig files
46
  */
47
- Timber::$dirname = array( '../views' );
48
 
49
  /**
50
  * By default, Timber does NOT autoescape values. Want to enable Twig's autoescape?
13
  * to load your dependencies and initialize Timber. If you are using Timber via the WordPress.org
14
  * plug-in, you can safely delete this block.
15
  */
16
+ $composer_autoload = __DIR__ . '/vendor/autoload.php';
17
  if ( file_exists( $composer_autoload ) ) {
18
  require_once $composer_autoload;
19
  $timber = new Timber\Timber();
35
  add_filter(
36
  'template_include',
37
  function( $template ) {
38
+ return get_stylesheet_directory() . '/static/no-timber.html';
39
  }
40
  );
41
  return;
44
  /**
45
  * Sets the directories (inside your theme) to find .twig files
46
  */
47
+ Timber::$dirname = array( 'templates', 'views' );
48
 
49
  /**
50
  * By default, Timber does NOT autoescape values. Want to enable Twig's autoescape?
timber-starter-theme/{theme/header.php → header.php} RENAMED
File without changes
timber-starter-theme/{theme/index.php → index.php} RENAMED
File without changes
timber-starter-theme/{theme/page.php → page.php} RENAMED
File without changes
timber-starter-theme/{theme/screenshot.png → screenshot.png} RENAMED
File without changes
timber-starter-theme/{theme/search.php → search.php} RENAMED
File without changes
timber-starter-theme/{theme/sidebar.php → sidebar.php} RENAMED
File without changes
timber-starter-theme/{theme/single.php → single.php} RENAMED
@@ -10,7 +10,7 @@
10
  */
11
 
12
  $context = Timber::context();
13
- $timber_post = Timber::query_post();
14
  $context['post'] = $timber_post;
15
 
16
  if ( post_password_required( $timber_post->ID ) ) {
10
  */
11
 
12
  $context = Timber::context();
13
+ $timber_post = Timber::get_post();
14
  $context['post'] = $timber_post;
15
 
16
  if ( post_password_required( $timber_post->ID ) ) {
timber-starter-theme/static/site.js CHANGED
File without changes
timber-starter-theme/{theme/style.css → style.css} RENAMED
File without changes
timber-starter-theme/{views → templates}/404.twig RENAMED
File without changes
timber-starter-theme/{views → templates}/archive.twig RENAMED
File without changes
timber-starter-theme/{views → templates}/author.twig RENAMED
File without changes
timber-starter-theme/{views → templates}/base.twig RENAMED
File without changes
timber-starter-theme/{views → templates}/comment-form.twig RENAMED
File without changes
timber-starter-theme/{views → templates}/comment.twig RENAMED
File without changes
timber-starter-theme/{views → templates}/footer.twig RENAMED
File without changes
timber-starter-theme/{views → templates}/html-header.twig RENAMED
File without changes
timber-starter-theme/{views → templates}/index.twig RENAMED
File without changes
timber-starter-theme/{views → templates}/menu.twig RENAMED
File without changes
timber-starter-theme/{views → templates}/page-plugin.twig RENAMED
File without changes
timber-starter-theme/{views → templates}/page.twig RENAMED
File without changes
timber-starter-theme/{views → templates}/partial/pagination.twig RENAMED
File without changes
timber-starter-theme/{views → templates}/search.twig RENAMED
File without changes
timber-starter-theme/{views → templates}/sidebar.twig RENAMED
File without changes
timber-starter-theme/{views → templates}/single-password.twig RENAMED
File without changes
timber-starter-theme/{views → templates}/single.twig RENAMED
File without changes
timber-starter-theme/{views → templates}/tease-post.twig RENAMED
File without changes
timber-starter-theme/{views → templates}/tease.twig RENAMED
File without changes
timber-starter-theme/tests/test-timber-starter-theme.php CHANGED
@@ -5,7 +5,7 @@
5
  function setUp() {
6
  self::_setupStarterTheme();
7
  switch_theme( basename( dirname( dirname( __FILE__ ) ) ) );
8
- require_once(__DIR__.'/../theme/functions.php');
9
  }
10
 
11
  function tearDown() {
5
  function setUp() {
6
  self::_setupStarterTheme();
7
  switch_theme( basename( dirname( dirname( __FILE__ ) ) ) );
8
+ require_once(__DIR__.'/../functions.php');
9
  }
10
 
11
  function tearDown() {
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.18.1
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.18.2
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 ComposerAutoloaderInit7c91bbb73b7b38d67cc012492962d7a4::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit98e2addbab75aec03cd32e9c811af941::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit7c91bbb73b7b38d67cc012492962d7a4
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit7c91bbb73b7b38d67cc012492962d7a4
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInit7c91bbb73b7b38d67cc012492962d7a4', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInit7c91bbb73b7b38d67cc012492962d7a4', '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\ComposerStaticInit7c91bbb73b7b38d67cc012492962d7a4::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
@@ -51,19 +51,19 @@ class ComposerAutoloaderInit7c91bbb73b7b38d67cc012492962d7a4
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
- $includeFiles = Composer\Autoload\ComposerStaticInit7c91bbb73b7b38d67cc012492962d7a4::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
- composerRequire7c91bbb73b7b38d67cc012492962d7a4($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
- function composerRequire7c91bbb73b7b38d67cc012492962d7a4($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 ComposerAutoloaderInit98e2addbab75aec03cd32e9c811af941
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInit98e2addbab75aec03cd32e9c811af941', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInit98e2addbab75aec03cd32e9c811af941', '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\ComposerStaticInit98e2addbab75aec03cd32e9c811af941::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\ComposerStaticInit98e2addbab75aec03cd32e9c811af941::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
+ composerRequire98e2addbab75aec03cd32e9c811af941($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
+ function composerRequire98e2addbab75aec03cd32e9c811af941($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 ComposerStaticInit7c91bbb73b7b38d67cc012492962d7a4
8
  {
9
  public static $files = array (
10
  '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
@@ -618,11 +618,11 @@ class ComposerStaticInit7c91bbb73b7b38d67cc012492962d7a4
618
  public static function getInitializer(ClassLoader $loader)
619
  {
620
  return \Closure::bind(function () use ($loader) {
621
- $loader->prefixLengthsPsr4 = ComposerStaticInit7c91bbb73b7b38d67cc012492962d7a4::$prefixLengthsPsr4;
622
- $loader->prefixDirsPsr4 = ComposerStaticInit7c91bbb73b7b38d67cc012492962d7a4::$prefixDirsPsr4;
623
- $loader->fallbackDirsPsr4 = ComposerStaticInit7c91bbb73b7b38d67cc012492962d7a4::$fallbackDirsPsr4;
624
- $loader->prefixesPsr0 = ComposerStaticInit7c91bbb73b7b38d67cc012492962d7a4::$prefixesPsr0;
625
- $loader->classMap = ComposerStaticInit7c91bbb73b7b38d67cc012492962d7a4::$classMap;
626
 
627
  }, null, ClassLoader::class);
628
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit98e2addbab75aec03cd32e9c811af941
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 = ComposerStaticInit98e2addbab75aec03cd32e9c811af941::$prefixLengthsPsr4;
622
+ $loader->prefixDirsPsr4 = ComposerStaticInit98e2addbab75aec03cd32e9c811af941::$prefixDirsPsr4;
623
+ $loader->fallbackDirsPsr4 = ComposerStaticInit98e2addbab75aec03cd32e9c811af941::$fallbackDirsPsr4;
624
+ $loader->prefixesPsr0 = ComposerStaticInit98e2addbab75aec03cd32e9c811af941::$prefixesPsr0;
625
+ $loader->classMap = ComposerStaticInit98e2addbab75aec03cd32e9c811af941::$classMap;
626
 
627
  }, null, ClassLoader::class);
628
  }
vendor/composer/installed.json CHANGED
@@ -111,7 +111,8 @@
111
  "cache",
112
  "extension",
113
  "twig"
114
- ]
 
115
  },
116
  {
117
  "name": "composer/installers",
111
  "cache",
112
  "extension",
113
  "twig"
114
+ ],
115
+ "abandoned": "twig/cache-extension"
116
  },
117
  {
118
  "name": "composer/installers",