Timber - Version 0.16.7

Version Description

  • Fixed issue with image heights on external images (thanks @AndrewDuthie)
  • Added new filter for timber_compile_result (thanks @parisholley)
  • Other minor fixes (@jarednova)
Download this release

Release Info

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

Code changes from version 0.16.6 to 0.16.7

functions/timber-image.php CHANGED
@@ -29,7 +29,7 @@ class TimberImage extends TimberCore {
29
  if (isset($this->_dimensions)){
30
  return $this->get_dimensions_loaded($dim);
31
  }
32
- list($width, $height) = getimagesize($this->fileloc);
33
  $this->_dimensions = array();
34
  $this->_dimensions[0] = $width;
35
  $this->_dimensions[1] = $height;
@@ -126,10 +126,10 @@ class TimberImage extends TimberCore {
126
  $basedir = wp_upload_dir();
127
  $basedir = $basedir['basedir'];
128
  if (isset($this->file)){
129
- $this->file_loc = $basedir . $this->file;
130
  } else if (isset($this->_wp_attached_file)){
131
  $this->file = reset($this->_wp_attached_file);
132
- $this->file_loc = $basedir . $this->file;
133
  }
134
  if (isset($image_info['id'])) {
135
  $this->ID = $image_info['id'];
@@ -153,6 +153,7 @@ class TimberImage extends TimberCore {
153
 
154
  function init_with_url($url) {
155
  $this->abs_url = $url;
 
156
  if (TimberHelper::is_local($url)){
157
  $this->file = ABSPATH . TimberHelper::get_rel_url($url);
158
  }
29
  if (isset($this->_dimensions)){
30
  return $this->get_dimensions_loaded($dim);
31
  }
32
+ list($width, $height) = getimagesize($this->file_loc);
33
  $this->_dimensions = array();
34
  $this->_dimensions[0] = $width;
35
  $this->_dimensions[1] = $height;
126
  $basedir = wp_upload_dir();
127
  $basedir = $basedir['basedir'];
128
  if (isset($this->file)){
129
+ $this->file_loc = $basedir . DIRECTORY_SEPARATOR . $this->file;
130
  } else if (isset($this->_wp_attached_file)){
131
  $this->file = reset($this->_wp_attached_file);
132
+ $this->file_loc = $basedir . DIRECTORY_SEPARATOR . $this->file;
133
  }
134
  if (isset($image_info['id'])) {
135
  $this->ID = $image_info['id'];
153
 
154
  function init_with_url($url) {
155
  $this->abs_url = $url;
156
+ $this->file_loc = $url;
157
  if (TimberHelper::is_local($url)){
158
  $this->file = ABSPATH . TimberHelper::get_rel_url($url);
159
  }
functions/timber-post.php CHANGED
@@ -6,6 +6,7 @@ class TimberPost extends TimberCore {
6
  var $PostClass = 'TimberPost';
7
  var $_can_edit;
8
  var $_get_terms;
 
9
  var $object_type = 'post';
10
 
11
  var $_custom_imported = false;
@@ -497,6 +498,9 @@ class TimberPost extends TimberCore {
497
  */
498
 
499
  function get_content($len = 0, $page = 0) {
 
 
 
500
  $content = $this->post_content;
501
  if ($len) {
502
  $content = wp_trim_words($content, $len);
@@ -508,7 +512,11 @@ class TimberPost extends TimberCore {
508
  $content = $contents[$page];
509
  }
510
  }
511
- return apply_filters('the_content', ($content));
 
 
 
 
512
  }
513
 
514
  public function get_post_type() {
6
  var $PostClass = 'TimberPost';
7
  var $_can_edit;
8
  var $_get_terms;
9
+ var $_content;
10
  var $object_type = 'post';
11
 
12
  var $_custom_imported = false;
498
  */
499
 
500
  function get_content($len = 0, $page = 0) {
501
+ if ($len == 0 && $page == 0 && $this->_content){
502
+ return $this->_content;
503
+ }
504
  $content = $this->post_content;
505
  if ($len) {
506
  $content = wp_trim_words($content, $len);
512
  $content = $contents[$page];
513
  }
514
  }
515
+ $content = apply_filters('the_content', ($content));
516
+ if ($len == 0 && $page == 0){
517
+ $this->_content = $content;
518
+ }
519
+ return $content;
520
  }
521
 
522
  public function get_post_type() {
functions/timber-term.php CHANGED
@@ -102,6 +102,10 @@ class TimberTerm extends TimberCore {
102
  /* Public methods
103
  ===================== */
104
 
 
 
 
 
105
  public function get_meta_field($field_name){
106
  if (!isset($this->$field_name)){
107
  $field = '';
@@ -183,6 +187,10 @@ class TimberTerm extends TimberCore {
183
  return $this->get_children();
184
  }
185
 
 
 
 
 
186
  public function get_url() {
187
  return $this->get_link();
188
  }
102
  /* Public methods
103
  ===================== */
104
 
105
+ public function get_edit_url(){
106
+ return get_edit_term_link($this->ID, $this->taxonomy);
107
+ }
108
+
109
  public function get_meta_field($field_name){
110
  if (!isset($this->$field_name)){
111
  $field = '';
187
  return $this->get_children();
188
  }
189
 
190
+ public function edit_link(){
191
+ return $this->get_edit_url();
192
+ }
193
+
194
  public function get_url() {
195
  return $this->get_link();
196
  }
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: jarednova
3
  Tags: template engine, templates, twig
4
  Requires at least: 3.5
5
- Stable tag: 0.16.6
6
  Tested up to: 3.8.0
7
  PHP version: 5.3.0 or greater
8
  License: GPLv2 or later
@@ -41,6 +41,11 @@ Timber is great for any WordPress developer who cares about writing good, mainta
41
 
42
  == Changelog ==
43
 
 
 
 
 
 
44
  = 0.16.6 =
45
  * Router plays nice with installs in subdirectories (thanks @TerminalPixel)
46
  * ACF Timber now initializes on Init (thanks @Zerek)
2
  Contributors: jarednova
3
  Tags: template engine, templates, twig
4
  Requires at least: 3.5
5
+ Stable tag: 0.16.7
6
  Tested up to: 3.8.0
7
  PHP version: 5.3.0 or greater
8
  License: GPLv2 or later
41
 
42
  == Changelog ==
43
 
44
+ = 0.16.7 =
45
+ * Fixed issue with image heights on external images (thanks @AndrewDuthie)
46
+ * Added new filter for timber_compile_result (thanks @parisholley)
47
+ * Other minor fixes (@jarednova)
48
+
49
  = 0.16.6 =
50
  * Router plays nice with installs in subdirectories (thanks @TerminalPixel)
51
  * ACF Timber now initializes on Init (thanks @Zerek)
timber.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Timber
4
  Plugin URI: http://timber.upstatement.com
5
  Description: The WordPress Timber Library allows you to write themes using the power Twig templates
6
  Author: Jared Novack + Upstatement
7
- Version: 0.16.6
8
  Author URI: http://upstatement.com/
9
  */
10
 
@@ -375,6 +375,7 @@ class Timber {
375
  $cache_mode = TimberLoader::CACHE_USE_DEFAULT;
376
  }
377
  $output = self::compile($filenames, $data, $expires, $cache_mode, true);
 
378
  echo $output;
379
  return $output;
380
  }
4
  Plugin URI: http://timber.upstatement.com
5
  Description: The WordPress Timber Library allows you to write themes using the power Twig templates
6
  Author: Jared Novack + Upstatement
7
+ Version: 0.16.7
8
  Author URI: http://upstatement.com/
9
  */
10
 
375
  $cache_mode = TimberLoader::CACHE_USE_DEFAULT;
376
  }
377
  $output = self::compile($filenames, $data, $expires, $cache_mode, true);
378
+ $output = apply_filters('timber_compile_result', $output);
379
  echo $output;
380
  return $output;
381
  }