Timber - Version 0.21.6

Version Description

  • Fix for TimberMenu visiblility
  • Fix for TimberComment visibility
Download this release

Release Info

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

Code changes from version 0.21.5 to 0.21.6

README.md CHANGED
@@ -7,6 +7,7 @@ By Jared Novack (<a href="http://twitter.com/jarednova">@JaredNova</a>) and <a h
7
  [![Build Status](https://travis-ci.org/jarednova/timber.png?branch=master)](https://travis-ci.org/jarednova/timber)
8
  [![Coverage Status](https://coveralls.io/repos/jarednova/timber/badge.svg?branch=master)](https://coveralls.io/r/jarednova/timber?branch=master)
9
  [![Dependency Status](https://www.versioneye.com/user/projects/54e3c717d1ec5734f4000099/badge.svg?style=flat)](https://www.versioneye.com/user/projects/54e3c717d1ec5734f4000099)
 
10
 
11
  ### Because WordPress is awesome, but the_loop isn't
12
  Timber helps you create fully-customized WordPress themes faster with more sustainable code. With Timber, you write your HTML using the [Twig Template Engine](http://twig.sensiolabs.org/) separate from your PHP files.
@@ -15,7 +16,7 @@ This cleans-up your theme code so, for example, your php file can focus on being
15
 
16
  This is what Timber's `.twig` files look like:
17
 
18
- ```html+django
19
  {% extends "base.twig" %}
20
  {% block content %}
21
  <h1 class="big-title">{{foo}}</h1>
7
  [![Build Status](https://travis-ci.org/jarednova/timber.png?branch=master)](https://travis-ci.org/jarednova/timber)
8
  [![Coverage Status](https://coveralls.io/repos/jarednova/timber/badge.svg?branch=master)](https://coveralls.io/r/jarednova/timber?branch=master)
9
  [![Dependency Status](https://www.versioneye.com/user/projects/54e3c717d1ec5734f4000099/badge.svg?style=flat)](https://www.versioneye.com/user/projects/54e3c717d1ec5734f4000099)
10
+ [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/jarednova/timber/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/jarednova/timber/?branch=master)
11
 
12
  ### Because WordPress is awesome, but the_loop isn't
13
  Timber helps you create fully-customized WordPress themes faster with more sustainable code. With Timber, you write your HTML using the [Twig Template Engine](http://twig.sensiolabs.org/) separate from your PHP files.
16
 
17
  This is what Timber's `.twig` files look like:
18
 
19
+ ```twig
20
  {% extends "base.twig" %}
21
  {% block content %}
22
  <h1 class="big-title">{{foo}}</h1>
lib/image/timber-image-operation-retina.php CHANGED
@@ -1,22 +1,29 @@
1
  <?php
 
 
 
2
 
3
  /**
4
  * Increases image size by a given factor
5
  * Arguments:
6
  * - factor by which to multiply image dimensions
 
7
  */
8
  class TimberImageOperationRetina extends TimberImageOperation {
9
 
10
  private $factor;
11
 
12
  /**
13
- * @param int $factor to multiply original dimensions by
 
14
  */
15
  function __construct($factor) {
16
  $this->factor = $factor;
17
  }
18
 
19
  /**
 
 
20
  * @param string $src_filename the basename of the file (ex: my-awesome-pic)
21
  * @param string $src_extension the extension (ex: .jpg)
22
  * @return string the final filename to be used (ex: my-awesome-pic@2x.jpg)
1
  <?php
2
+ /**
3
+ * Contains the class for running image retina-izing operations
4
+ */
5
 
6
  /**
7
  * Increases image size by a given factor
8
  * Arguments:
9
  * - factor by which to multiply image dimensions
10
+ * @property float $factor the factor (ex: 2, 1.5, 1.75) to multiply dimension by
11
  */
12
  class TimberImageOperationRetina extends TimberImageOperation {
13
 
14
  private $factor;
15
 
16
  /**
17
+ * Construct our operation
18
+ * @param float $factor to multiply original dimensions by
19
  */
20
  function __construct($factor) {
21
  $this->factor = $factor;
22
  }
23
 
24
  /**
25
+ * Generates the final filename based on the source's name and extension
26
+ *
27
  * @param string $src_filename the basename of the file (ex: my-awesome-pic)
28
  * @param string $src_extension the extension (ex: .jpg)
29
  * @return string the final filename to be used (ex: my-awesome-pic@2x.jpg)
lib/timber-comment.php CHANGED
@@ -133,7 +133,7 @@ class TimberComment extends TimberCore implements TimberCoreInterface {
133
  * @param int $comment_id
134
  * @return mixed
135
  */
136
- private function get_meta_fields($comment_id = null) {
137
  if ($comment_id === null) {
138
  $comment_id = $this->ID;
139
  }
@@ -153,7 +153,7 @@ class TimberComment extends TimberCore implements TimberCoreInterface {
153
  * @param string $field_name
154
  * @return mixed
155
  */
156
- private function get_meta_field($field_name) {
157
  $value = apply_filters('timber_comment_get_meta_field_pre', null, $this->ID, $field_name, $this);
158
  if ($value === null) {
159
  $value = get_comment_meta($this->ID, $field_name, true);
@@ -168,7 +168,7 @@ class TimberComment extends TimberCore implements TimberCoreInterface {
168
  /**
169
  * @return string
170
  */
171
- private function avatar_email() {
172
  $id = (int)$this->user_id;
173
  $user = get_userdata($id);
174
  if ($user) {
@@ -183,7 +183,7 @@ class TimberComment extends TimberCore implements TimberCoreInterface {
183
  * @param string $email_hash
184
  * @return string
185
  */
186
- private function avatar_host($email_hash) {
187
  if (is_ssl()) {
188
  $host = 'https://secure.gravatar.com';
189
  } else {
@@ -203,7 +203,7 @@ class TimberComment extends TimberCore implements TimberCoreInterface {
203
  * @param string $host
204
  * @return string
205
  */
206
- private function avatar_default($default, $email, $size, $host) {
207
  # what if its relative.
208
  if (substr($default, 0, 1) == '/') {
209
  $default = home_url() . $default;
@@ -243,7 +243,7 @@ class TimberComment extends TimberCore implements TimberCoreInterface {
243
  * @param string $size
244
  * @return mixed
245
  */
246
- private function avatar_out($email, $default, $host, $email_hash, $size) {
247
  $out = $host . '/avatar/' . $email_hash . '?s=' . $size . '&amp;d=' . urlencode($default);
248
  $rating = get_option('avatar_rating');
249
  if (!empty($rating)) {
133
  * @param int $comment_id
134
  * @return mixed
135
  */
136
+ protected function get_meta_fields($comment_id = null) {
137
  if ($comment_id === null) {
138
  $comment_id = $this->ID;
139
  }
153
  * @param string $field_name
154
  * @return mixed
155
  */
156
+ protected function get_meta_field($field_name) {
157
  $value = apply_filters('timber_comment_get_meta_field_pre', null, $this->ID, $field_name, $this);
158
  if ($value === null) {
159
  $value = get_comment_meta($this->ID, $field_name, true);
168
  /**
169
  * @return string
170
  */
171
+ protected function avatar_email() {
172
  $id = (int)$this->user_id;
173
  $user = get_userdata($id);
174
  if ($user) {
183
  * @param string $email_hash
184
  * @return string
185
  */
186
+ protected function avatar_host($email_hash) {
187
  if (is_ssl()) {
188
  $host = 'https://secure.gravatar.com';
189
  } else {
203
  * @param string $host
204
  * @return string
205
  */
206
+ protected function avatar_default($default, $email, $size, $host) {
207
  # what if its relative.
208
  if (substr($default, 0, 1) == '/') {
209
  $default = home_url() . $default;
243
  * @param string $size
244
  * @return mixed
245
  */
246
+ protected function avatar_out($email, $default, $host, $email_hash, $size) {
247
  $out = $host . '/avatar/' . $email_hash . '?s=' . $size . '&amp;d=' . urlencode($default);
248
  $rating = get_option('avatar_rating');
249
  if (!empty($rating)) {
lib/timber-menu.php CHANGED
@@ -37,7 +37,7 @@ class TimberMenu extends TimberCore {
37
  /**
38
  * @param int $menu_id
39
  */
40
- private function init($menu_id) {
41
  $menu = wp_get_nav_menu_items($menu_id);
42
  if ($menu) {
43
  _wp_menu_item_classes_by_context($menu);
@@ -53,7 +53,7 @@ class TimberMenu extends TimberCore {
53
  }
54
  }
55
 
56
- private function init_as_page_menu() {
57
  $menu = get_pages();
58
  if ($menu) {
59
  foreach($menu as $mi) {
@@ -72,7 +72,7 @@ class TimberMenu extends TimberCore {
72
  * @param array $locations
73
  * @return integer
74
  */
75
- private function get_menu_id_from_locations($slug, $locations) {
76
  if ($slug === 0) {
77
  $slug = $this->get_menu_id_from_terms($slug);
78
  }
@@ -88,7 +88,7 @@ class TimberMenu extends TimberCore {
88
  * @param int $slug
89
  * @return int
90
  */
91
- private function get_menu_id_from_terms($slug = 0) {
92
  if (!is_numeric($slug) && is_string($slug)) {
93
  //we have a string so lets search for that
94
  $menu_id = get_term_by('slug', $slug, 'nav_menu');
37
  /**
38
  * @param int $menu_id
39
  */
40
+ protected function init($menu_id) {
41
  $menu = wp_get_nav_menu_items($menu_id);
42
  if ($menu) {
43
  _wp_menu_item_classes_by_context($menu);
53
  }
54
  }
55
 
56
+ protected function init_as_page_menu() {
57
  $menu = get_pages();
58
  if ($menu) {
59
  foreach($menu as $mi) {
72
  * @param array $locations
73
  * @return integer
74
  */
75
+ protected function get_menu_id_from_locations($slug, $locations) {
76
  if ($slug === 0) {
77
  $slug = $this->get_menu_id_from_terms($slug);
78
  }
88
  * @param int $slug
89
  * @return int
90
  */
91
+ protected function get_menu_id_from_terms($slug = 0) {
92
  if (!is_numeric($slug) && is_string($slug)) {
93
  //we have a string so lets search for that
94
  $menu_id = get_term_by('slug', $slug, 'nav_menu');
lib/timber-post.php CHANGED
@@ -1,5 +1,11 @@
1
  <?php
2
 
 
 
 
 
 
 
3
  class TimberPost extends TimberCore implements TimberCoreInterface {
4
 
5
  public $ImageClass = 'TimberImage';
@@ -41,7 +47,6 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
41
  * @param mixed a value to test against
42
  * @return int the numberic id we should be using for this post object
43
  */
44
-
45
  protected function determine_id($pid) {
46
  global $wp_query;
47
  if ($pid === null &&
@@ -78,6 +83,7 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
78
  }
79
 
80
  /**
 
81
  * @return string
82
  */
83
  function __toString() {
@@ -86,6 +92,7 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
86
 
87
 
88
  /**
 
89
  * @param int|bool $pid
90
  */
91
  function init($pid = false) {
@@ -135,7 +142,7 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
135
  * @param mixed $pid
136
  * @return WP_Post on success
137
  */
138
- private function prepare_post_info($pid = 0) {
139
  if (is_string($pid) || is_numeric($pid) || (is_object($pid) && !isset($pid->post_title)) || $pid === 0) {
140
  $pid = self::check_post_id($pid);
141
  $post = get_post($pid);
@@ -179,7 +186,7 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
179
  * @param string $post_name
180
  * @return int
181
  */
182
- public static function get_post_id_by_name($post_name) {
183
  global $wpdb;
184
  $query = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name = %s LIMIT 1", $post_name);
185
  $result = $wpdb->get_row($query);
@@ -189,15 +196,11 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
189
  return $result->ID;
190
  }
191
 
192
-
193
- /**
194
- * ## get a preview of your post, if you have an excerpt it will use that,
195
- * ## otherwise it will pull from the post_content.
196
- * ## If there's a <!-- more --> tag it will use that to mark where to pull through.
197
- * <p>{{post.get_preview(50)}}</p>
198
- */
199
-
200
  /**
 
 
 
 
201
  * @param int $len
202
  * @param bool $force
203
  * @param string $readmore
@@ -260,7 +263,7 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
260
  }
261
 
262
  /**
263
- * gets the post custom and attaches it to the current object
264
  * @param bool|int $pid a post ID number
265
  * @nodoc
266
  */
@@ -273,10 +276,12 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
273
  }
274
 
275
  /**
 
 
276
  * @param int $pid
277
  * @return array
278
  */
279
- function get_post_custom($pid) {
280
  apply_filters('timber_post_get_meta_pre', array(), $pid, $this);
281
  $customs = get_post_custom($pid);
282
  if (!is_array($customs) || empty($customs)) {
@@ -293,11 +298,9 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
293
  }
294
 
295
  /**
296
- * ## get the featured image as a TimberImage
297
- * <img src="{{post.get_thumbnail.get_src}}" />
298
- */
299
-
300
- /**
301
  * @return null|TimberImage
302
  */
303
  function get_thumbnail() {
@@ -310,6 +313,9 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
310
  }
311
 
312
  /**
 
 
 
313
  * @return string
314
  */
315
  function get_permalink() {
@@ -321,6 +327,9 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
321
  }
322
 
323
  /**
 
 
 
324
  * @return string
325
  */
326
  function get_link() {
@@ -328,8 +337,9 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
328
  }
329
 
330
  /**
 
331
  * @param bool $taxonomy
332
- * @return mixed
333
  */
334
  function get_next($taxonomy = false) {
335
  if (!isset($this->_next) || !isset($this->_next[$taxonomy])) {
@@ -354,6 +364,7 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
354
  }
355
 
356
  /**
 
357
  * @return array
358
  */
359
  public function get_pagination() {
@@ -387,7 +398,7 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
387
  * @param int $i
388
  * @return string
389
  */
390
- private static function get_wp_link_page($i) {
391
  $link = _wp_link_page($i);
392
  $link = new SimpleXMLElement($link . '</a>');
393
  if (isset($link['href'])) {
@@ -397,6 +408,9 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
397
  }
398
 
399
  /**
 
 
 
400
  * @return string
401
  */
402
  function get_path() {
@@ -404,8 +418,9 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
404
  }
405
 
406
  /**
 
407
  * @param bool $taxonomy
408
- * @return mixed
409
  */
410
  function get_prev($taxonomy = false) {
411
  if (isset($this->_prev) && isset($this->_prev[$taxonomy])) {
@@ -427,6 +442,7 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
427
  }
428
 
429
  /**
 
430
  * @return bool|TimberPost
431
  */
432
  function get_parent() {
@@ -437,11 +453,8 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
437
  }
438
 
439
  /**
440
- * ## Gets a User object from the author of the post
441
- * <p class="byline">{{post.get_author.name}}</p>
442
- */
443
-
444
- /**
445
  * @return bool|TimberUser
446
  */
447
  function get_author() {
@@ -451,6 +464,7 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
451
  }
452
 
453
  /**
 
454
  * @return bool|TimberUser
455
  */
456
  function get_modified_author() {
@@ -459,10 +473,11 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
459
  }
460
 
461
  /**
 
462
  * @param int $pid
463
  * @return null|object|WP_Post
464
  */
465
- function get_info($pid) {
466
  $post = $this->prepare_post_info($pid);
467
  if (!isset($post->post_status)) {
468
  return null;
@@ -478,6 +493,7 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
478
 
479
  /**
480
  * This is deprecated!
 
481
  * @param string $use
482
  * @return string
483
  */
@@ -536,18 +552,16 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
536
  }
537
 
538
  /**
 
539
  * {% for comment in post.get_comments %}
540
  * <p>{{comment.content}}</p>
541
  * {% endfor %}
542
- */
543
-
544
- /**
545
  * @param int $ct
546
  * @param string $order
547
  * @param string $type
548
  * @param string $status
549
  * @param string $CommentClass
550
- * @return mixed
551
  */
552
  function get_comments($ct = 0, $order = 'wp', $type = 'comment', $status = 'approve', $CommentClass = 'TimberComment') {
553
  $args = array('post_id' => $this->ID, 'status' => $status, 'order' => $order);
@@ -581,15 +595,13 @@ class TimberPost extends TimberCore implements TimberCoreInterface {
581
  }
582
 
583
  /**
 
584
  * <ul class="categories">
585
  * {% for category in post.get_categories %}
586
  * <li>{{category.name}}</li>
587
  * {% endfor %}
588
  * </ul>
589
- */
590
-
591
- /**
592
- * @return array
593
  */
594
  function get_categories() {
595
  return $this->get_terms('category');
1
  <?php
2
 
3
+ /**
4
+ * This is the object you use to access or extend WordPress posts,
5
+ * Think of it as Timber's (more accessible) version of WP_Post
6
+ * @package timber
7
+ */
8
+
9
  class TimberPost extends TimberCore implements TimberCoreInterface {
10
 
11
  public $ImageClass = 'TimberImage';
47
  * @param mixed a value to test against
48
  * @return int the numberic id we should be using for this post object
49
  */
 
50
  protected function determine_id($pid) {
51
  global $wp_query;
52
  if ($pid === null &&
83
  }
84
 
85
  /**
86
+ * Outputs the title of the post if you do something like `<h1>{{post}}</h1>`
87
  * @return string
88
  */
89
  function __toString() {
92
 
93
 
94
  /**
95
+ * Initializes a TimberPost
96
  * @param int|bool $pid
97
  */
98
  function init($pid = false) {
142
  * @param mixed $pid
143
  * @return WP_Post on success
144
  */
145
+ protected function prepare_post_info($pid = 0) {
146
  if (is_string($pid) || is_numeric($pid) || (is_object($pid) && !isset($pid->post_title)) || $pid === 0) {
147
  $pid = self::check_post_id($pid);
148
  $post = get_post($pid);
186
  * @param string $post_name
187
  * @return int
188
  */
189
+ static function get_post_id_by_name($post_name) {
190
  global $wpdb;
191
  $query = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name = %s LIMIT 1", $post_name);
192
  $result = $wpdb->get_row($query);
196
  return $result->ID;
197
  }
198
 
 
 
 
 
 
 
 
 
199
  /**
200
+ * get a preview of your post, if you have an excerpt it will use that,
201
+ * otherwise it will pull from the post_content.
202
+ * If there's a <!-- more --> tag it will use that to mark where to pull through.
203
+ * <p>{{post.get_preview(50)}}</p>
204
  * @param int $len
205
  * @param bool $force
206
  * @param string $readmore
263
  }
264
 
265
  /**
266
+ * gets the post custom and attaches it to the current object
267
  * @param bool|int $pid a post ID number
268
  * @nodoc
269
  */
276
  }
277
 
278
  /**
279
+ * Used internally to fetch the metadata fields (wp_postmeta table)
280
+ * and attach them to our TimberPost object
281
  * @param int $pid
282
  * @return array
283
  */
284
+ protected function get_post_custom($pid) {
285
  apply_filters('timber_post_get_meta_pre', array(), $pid, $this);
286
  $customs = get_post_custom($pid);
287
  if (!is_array($customs) || empty($customs)) {
298
  }
299
 
300
  /**
301
+ * get the featured image as a TimberImage
302
+ * In your templates you should just use thumbnail though:
303
+ * <img src="{{post.thumbnail.get_src}}" />
 
 
304
  * @return null|TimberImage
305
  */
306
  function get_thumbnail() {
313
  }
314
 
315
  /**
316
+ * get the permalink for a post object
317
+ * In your templates you should use link:
318
+ * <a href="{{post.link}}">Read my post</a>
319
  * @return string
320
  */
321
  function get_permalink() {
327
  }
328
 
329
  /**
330
+ * get the permalink for a post object
331
+ * In your templates you should use link:
332
+ * <a href="{{post.link}}">Read my post</a>
333
  * @return string
334
  */
335
  function get_link() {
337
  }
338
 
339
  /**
340
+ * Get the next post in WordPress's ordering
341
  * @param bool $taxonomy
342
+ * @return TimberPost|boolean
343
  */
344
  function get_next($taxonomy = false) {
345
  if (!isset($this->_next) || !isset($this->_next[$taxonomy])) {
364
  }
365
 
366
  /**
367
+ * Get a data array of pagination so you can navigate to the previous/next for a paginated post
368
  * @return array
369
  */
370
  public function get_pagination() {
398
  * @param int $i
399
  * @return string
400
  */
401
+ protected static function get_wp_link_page($i) {
402
  $link = _wp_link_page($i);
403
  $link = new SimpleXMLElement($link . '</a>');
404
  if (isset($link['href'])) {
408
  }
409
 
410
  /**
411
+ * Get the permalink for a post, but as a relative path
412
+ * For example, where {{post.link}} would return "http://example.org/2015/07/04/my-cool-post"
413
+ * this will return the relative version: "/2015/07/04/my-cool-post"
414
  * @return string
415
  */
416
  function get_path() {
418
  }
419
 
420
  /**
421
+ * Get the next post in WordPress's ordering
422
  * @param bool $taxonomy
423
+ * @return TimberPost|boolean
424
  */
425
  function get_prev($taxonomy = false) {
426
  if (isset($this->_prev) && isset($this->_prev[$taxonomy])) {
442
  }
443
 
444
  /**
445
+ * Get the parent post of the post
446
  * @return bool|TimberPost
447
  */
448
  function get_parent() {
453
  }
454
 
455
  /**
456
+ * Gets a User object from the author of the post
457
+ * <p class="byline">{{post.get_author.name}}</p>
 
 
 
458
  * @return bool|TimberUser
459
  */
460
  function get_author() {
464
  }
465
 
466
  /**
467
+ * Get the author (WordPress user) who last modified the post
468
  * @return bool|TimberUser
469
  */
470
  function get_modified_author() {
473
  }
474
 
475
  /**
476
+ * Used internally by init, etc. to build TimberPost object
477
  * @param int $pid
478
  * @return null|object|WP_Post
479
  */
480
+ protected function get_info($pid) {
481
  $post = $this->prepare_post_info($pid);
482
  if (!isset($post->post_status)) {
483
  return null;
493
 
494
  /**
495
  * This is deprecated!
496
+ * But it would get the human-friendly date that should actually display in a .twig template
497
  * @param string $use
498
  * @return string
499
  */
552
  }
553
 
554
  /**
555
+ * Get the comments for a post
556
  * {% for comment in post.get_comments %}
557
  * <p>{{comment.content}}</p>
558
  * {% endfor %}
 
 
 
559
  * @param int $ct
560
  * @param string $order
561
  * @param string $type
562
  * @param string $status
563
  * @param string $CommentClass
564
+ * @return array|mixed
565
  */
566
  function get_comments($ct = 0, $order = 'wp', $type = 'comment', $status = 'approve', $CommentClass = 'TimberComment') {
567
  $args = array('post_id' => $this->ID, 'status' => $status, 'order' => $order);
595
  }
596
 
597
  /**
598
+ * Get the categories for a post
599
  * <ul class="categories">
600
  * {% for category in post.get_categories %}
601
  * <li>{{category.name}}</li>
602
  * {% endfor %}
603
  * </ul>
604
+ * @return array of TimberTerms
 
 
 
605
  */
606
  function get_categories() {
607
  return $this->get_terms('category');
lib/timber-term.php CHANGED
@@ -41,7 +41,7 @@ class TimberTerm extends TimberCore implements TimberCoreInterface {
41
  /**
42
  * @return integer
43
  */
44
- private function get_term_from_query() {
45
  global $wp_query;
46
  if (isset($wp_query->queried_object)) {
47
  $qo = $wp_query->queried_object;
@@ -55,7 +55,7 @@ class TimberTerm extends TimberCore implements TimberCoreInterface {
55
  /**
56
  * @param int $tid
57
  */
58
- private function init($tid) {
59
  $term = $this->get_term($tid);
60
  if (isset($term->id)) {
61
  $term->ID = $term->id;
@@ -79,7 +79,7 @@ class TimberTerm extends TimberCore implements TimberCoreInterface {
79
  * @param int $tid
80
  * @return array
81
  */
82
- private function get_term_meta($tid) {
83
  $customs = array();
84
  $customs = apply_filters('timber_term_get_meta', $customs, $tid, $this);
85
  return $customs;
@@ -89,7 +89,7 @@ class TimberTerm extends TimberCore implements TimberCoreInterface {
89
  * @param int $tid
90
  * @return mixed
91
  */
92
- private function get_term($tid) {
93
  if (is_object($tid) || is_array($tid)) {
94
  return $tid;
95
  }
@@ -112,7 +112,7 @@ class TimberTerm extends TimberCore implements TimberCoreInterface {
112
  * @param int $tid
113
  * @return int
114
  */
115
- private function get_tid($tid) {
116
  global $wpdb;
117
  if (is_numeric($tid)) {
118
  return $tid;
41
  /**
42
  * @return integer
43
  */
44
+ protected function get_term_from_query() {
45
  global $wp_query;
46
  if (isset($wp_query->queried_object)) {
47
  $qo = $wp_query->queried_object;
55
  /**
56
  * @param int $tid
57
  */
58
+ protected function init($tid) {
59
  $term = $this->get_term($tid);
60
  if (isset($term->id)) {
61
  $term->ID = $term->id;
79
  * @param int $tid
80
  * @return array
81
  */
82
+ protected function get_term_meta($tid) {
83
  $customs = array();
84
  $customs = apply_filters('timber_term_get_meta', $customs, $tid, $this);
85
  return $customs;
89
  * @param int $tid
90
  * @return mixed
91
  */
92
+ protected function get_term($tid) {
93
  if (is_object($tid) || is_array($tid)) {
94
  return $tid;
95
  }
112
  * @param int $tid
113
  * @return int
114
  */
115
+ protected function get_tid($tid) {
116
  global $wpdb;
117
  if (is_numeric($tid)) {
118
  return $tid;
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: jarednova
3
  Tags: template engine, templates, twig
4
  Requires at least: 3.7
5
  Stable tag: 0.21.5
6
- Tested up to: 4.1
7
  PHP version: 5.3.0 or greater
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -41,6 +41,10 @@ Timber is great for any WordPress developer who cares about writing good, mainta
41
 
42
  == Changelog ==
43
 
 
 
 
 
44
  = 0.21.5 =
45
  * Patch for method property visibility in TimberPost
46
 
3
  Tags: template engine, templates, twig
4
  Requires at least: 3.7
5
  Stable tag: 0.21.5
6
+ Tested up to: 4.2.2
7
  PHP version: 5.3.0 or greater
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
41
 
42
  == Changelog ==
43
 
44
+ = 0.21.6 =
45
+ * Fix for TimberMenu visiblility
46
+ * Fix for TimberComment visibility
47
+
48
  = 0.21.5 =
49
  * Patch for method property visibility in TimberPost
50
 
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.21.5
8
  Author URI: http://upstatement.com/
9
  */
10
 
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.21.6
8
  Author URI: http://upstatement.com/
9
  */
10
 
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit1a7bf9a555e4135502f9ecbaf92aba4a::getLoader();
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitda967d47ec325ce56e659cd9fd82bee1::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit1a7bf9a555e4135502f9ecbaf92aba4a
6
  {
7
  private static $loader;
8
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit1a7bf9a555e4135502f9ecbaf92aba4a
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit1a7bf9a555e4135502f9ecbaf92aba4a', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit1a7bf9a555e4135502f9ecbaf92aba4a', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
@@ -44,7 +44,7 @@ class ComposerAutoloaderInit1a7bf9a555e4135502f9ecbaf92aba4a
44
  }
45
  }
46
 
47
- function composerRequire1a7bf9a555e4135502f9ecbaf92aba4a($file)
48
  {
49
  require $file;
50
  }
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitda967d47ec325ce56e659cd9fd82bee1
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInitda967d47ec325ce56e659cd9fd82bee1', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInitda967d47ec325ce56e659cd9fd82bee1', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
44
  }
45
  }
46
 
47
+ function composerRequireda967d47ec325ce56e659cd9fd82bee1($file)
48
  {
49
  require $file;
50
  }