Version Description
- {{ user.avatar }} property is now available (thanks @connorjburton) d21eb85
- #947: Fix to pagination base (thanks @matsrietdijk) 270d7c2
- Fix to some namespacing issues (thanks @connorjburton) 0a8346a
- #958: Call the_post action to help other plugins (thanks @felthy) 4442703
- #976: Fixed problem with static declaration (@jarednova) c888606
- #978: Bug with arrays for post types (thanks @connorjburton) 571f6f8
Download this release
Release Info
Developer | jarednova |
Plugin | Timber |
Version | 1.0.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.0.1
- README.md +1 -1
- lib/Admin.php +14 -14
- lib/Post.php +3 -0
- lib/PostGetter.php +5 -5
- lib/Timber.php +2 -2
- lib/User.php +7 -0
- readme.txt +30 -2
- timber-starter-theme/single.php +1 -1
- timber.php +1 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +5 -5
README.md
CHANGED
@@ -5,7 +5,7 @@ By Jared Novack (<a href="https://twitter.com/jarednova">@JaredNova</a>) and <a
|
|
5 |
</div>
|
6 |
|
7 |
[![Build Status](https://img.shields.io/travis/timber/timber/master.svg?style=flat-square)](https://travis-ci.org/timber/timber)
|
8 |
-
[![Coverage Status](https://img.shields.io/coveralls/
|
9 |
[![Dependency Status](https://img.shields.io/versioneye/d/ruby/rails.svg?style=flat-square)](https://www.versioneye.com/user/projects/54e3c717d1ec5734f4000099)
|
10 |
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/timber/timber.svg?style=flat-square)](https://scrutinizer-ci.com/g/timber/timber/?branch=master)
|
11 |
[![Latest Stable Version](https://img.shields.io/packagist/v/timber/timber.svg?style=flat-square)](https://packagist.org/packages/timber/timber)
|
5 |
</div>
|
6 |
|
7 |
[![Build Status](https://img.shields.io/travis/timber/timber/master.svg?style=flat-square)](https://travis-ci.org/timber/timber)
|
8 |
+
[![Coverage Status](https://img.shields.io/coveralls/timber/timber.svg?style=flat-square)](https://coveralls.io/r/timber/timber?branch=master)
|
9 |
[![Dependency Status](https://img.shields.io/versioneye/d/ruby/rails.svg?style=flat-square)](https://www.versioneye.com/user/projects/54e3c717d1ec5734f4000099)
|
10 |
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/timber/timber.svg?style=flat-square)](https://scrutinizer-ci.com/g/timber/timber/?branch=master)
|
11 |
[![Latest Stable Version](https://img.shields.io/packagist/v/timber/timber.svg?style=flat-square)](https://packagist.org/packages/timber/timber)
|
lib/Admin.php
CHANGED
@@ -6,8 +6,8 @@ class Admin {
|
|
6 |
|
7 |
public static function init() {
|
8 |
$filter = add_filter('plugin_row_meta', array( __CLASS__, 'meta_links' ), 10, 2);
|
9 |
-
$action = add_action('in_plugin_update_message-timber-library/timber.php', array(
|
10 |
-
$action = add_action('in_plugin_update_message-timber/timber.php', array(
|
11 |
if ($filter && $action) {
|
12 |
return true;
|
13 |
}
|
@@ -25,6 +25,7 @@ class Admin {
|
|
25 |
$links[] = '<a href="http://upstatement.com/timber" target="_blank">Homepage</a>';
|
26 |
$links[] = '<a href="https://github.com/timber/timber/wiki" target="_blank">Documentation</a>';
|
27 |
$links[] = '<a href="https://github.com/timber/timber/wiki/getting-started" target="_blank">Starter Guide</a>';
|
|
|
28 |
return $links;
|
29 |
}
|
30 |
return $links;
|
@@ -42,28 +43,27 @@ class Admin {
|
|
42 |
* @param {array} $plugin_data
|
43 |
* @param {object} $r
|
44 |
*/
|
45 |
-
function in_plugin_update_message( $plugin_data, $r ) {
|
|
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
if ( version_compare("1.0", $plugin_data->Version) > 0 ) {
|
51 |
-
$m = '<p><b>Warning:</b> Timber 1.0 removed a number of features and methods. Before upgrading please test your theme on a local or staging site to ensure that your theme will work with the newest version.</p>
|
52 |
|
53 |
<p><strong>Is your theme in active development?</strong> That is, is someone actively in PHP files writing new code? If you answered "no", then <i>do not upgrade</i>. You will not benefit from Timber 1.0</p>';
|
54 |
|
55 |
$m .= '<p>Read the <strong><a href="https://github.com/timber/timber/wiki/1.0-Upgrade-Guide">Upgrade Guide</a></strong> for more information</p>';
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
}
|
60 |
}
|
61 |
|
62 |
-
|
63 |
-
|
|
|
64 |
|
65 |
// show message
|
66 |
-
echo '<br />'.sprintf($m
|
67 |
|
68 |
}
|
69 |
|
6 |
|
7 |
public static function init() {
|
8 |
$filter = add_filter('plugin_row_meta', array( __CLASS__, 'meta_links' ), 10, 2);
|
9 |
+
$action = add_action('in_plugin_update_message-timber-library/timber.php', array( __CLASS__, 'in_plugin_update_message'), 10, 2);
|
10 |
+
$action = add_action('in_plugin_update_message-timber/timber.php', array( __CLASS__, 'in_plugin_update_message'), 10, 2);
|
11 |
if ($filter && $action) {
|
12 |
return true;
|
13 |
}
|
25 |
$links[] = '<a href="http://upstatement.com/timber" target="_blank">Homepage</a>';
|
26 |
$links[] = '<a href="https://github.com/timber/timber/wiki" target="_blank">Documentation</a>';
|
27 |
$links[] = '<a href="https://github.com/timber/timber/wiki/getting-started" target="_blank">Starter Guide</a>';
|
28 |
+
$links[] = '<p><a href="https://downloads.wordpress.org/plugin/timber-library.0.22.6.zip">Site not working on 1.0? Downgrade to version 0.22.6</a></p>';
|
29 |
return $links;
|
30 |
}
|
31 |
return $links;
|
43 |
* @param {array} $plugin_data
|
44 |
* @param {object} $r
|
45 |
*/
|
46 |
+
public static function in_plugin_update_message( $plugin_data, $r ) {
|
47 |
+
$m = '';
|
48 |
|
49 |
+
if ( version_compare("1.0.0", $plugin_data->new_version) <= 0 ) {
|
50 |
+
//a version of 1.0.0 or greater is availalbe
|
51 |
+
$m .= '<p><b>Warning:</b> Timber 1.0 removed a number of features and methods. Before upgrading please test your theme on a local or staging site to ensure that your theme will work with the newest version.</p>
|
|
|
|
|
52 |
|
53 |
<p><strong>Is your theme in active development?</strong> That is, is someone actively in PHP files writing new code? If you answered "no", then <i>do not upgrade</i>. You will not benefit from Timber 1.0</p>';
|
54 |
|
55 |
$m .= '<p>Read the <strong><a href="https://github.com/timber/timber/wiki/1.0-Upgrade-Guide">Upgrade Guide</a></strong> for more information</p>';
|
56 |
|
57 |
+
$m .= "<p>You can also <b><a href='https://downloads.wordpress.org/plugin/timber-library.0.22.6.zip'>upgrade to version 0.22.6</a></b> if you want to upgrade, but are unsure if you're ready for 1.0";
|
58 |
+
|
|
|
59 |
}
|
60 |
|
61 |
+
if ( version_compare("1.0.0", $plugin_data->Version) <= 0 ) {
|
62 |
+
$m .= "<p>Are you seeing errors since upgrading to 1.0? Download <b><a href='https://downloads.wordpress.org/plugin/timber-library.0.22.6.zip'>Version 0.22.6</a></b> to bring things back to stability.";
|
63 |
+
}
|
64 |
|
65 |
// show message
|
66 |
+
echo '<br />'.sprintf($m);
|
67 |
|
68 |
}
|
69 |
|
lib/Post.php
CHANGED
@@ -494,6 +494,9 @@ class Post extends Core implements CoreInterface {
|
|
494 |
if ( !isset($post->post_status) ) {
|
495 |
return null;
|
496 |
}
|
|
|
|
|
|
|
497 |
$post->status = $post->post_status;
|
498 |
$post->id = $post->ID;
|
499 |
$post->slug = $post->post_name;
|
494 |
if ( !isset($post->post_status) ) {
|
495 |
return null;
|
496 |
}
|
497 |
+
|
498 |
+
do_action_ref_array( 'the_post', array( &$post, &$GLOBALS['wp_query'] ) );
|
499 |
+
|
500 |
$post->status = $post->post_status;
|
501 |
$post->id = $post->ID;
|
502 |
$post->slug = $post->post_name;
|
lib/PostGetter.php
CHANGED
@@ -12,19 +12,19 @@ class PostGetter {
|
|
12 |
* @param string $PostClass
|
13 |
* @return array|bool|null
|
14 |
*/
|
15 |
-
static function get_post( $query = false, $PostClass = '
|
16 |
$posts = self::get_posts($query, $PostClass);
|
17 |
if ( $post = reset($posts) ) {
|
18 |
return $post;
|
19 |
}
|
20 |
}
|
21 |
|
22 |
-
static function get_posts( $query = false, $PostClass = '
|
23 |
$posts = self::query_posts($query, $PostClass);
|
24 |
return apply_filters('timber_post_getter_get_posts', $posts->get_posts($return_collection));
|
25 |
}
|
26 |
|
27 |
-
static function query_post( $query = false, $PostClass = '
|
28 |
$posts = self::query_posts($query, $PostClass);
|
29 |
if ( method_exists($posts, 'current') && $post = $posts->current() ) {
|
30 |
return $post;
|
@@ -36,7 +36,7 @@ class PostGetter {
|
|
36 |
* @param string $PostClass
|
37 |
* @return array|bool|null
|
38 |
*/
|
39 |
-
static function query_posts( $query = false, $PostClass = '
|
40 |
if ( $type = self::get_class_for_use_as_timber_post($query) ) {
|
41 |
$PostClass = $type;
|
42 |
if ( self::is_post_class_or_class_map($query) ) {
|
@@ -124,7 +124,7 @@ class PostGetter {
|
|
124 |
return false;
|
125 |
}
|
126 |
|
127 |
-
if ( class_exists($type) && is_subclass_of($type, '
|
128 |
return $type;
|
129 |
}
|
130 |
}
|
12 |
* @param string $PostClass
|
13 |
* @return array|bool|null
|
14 |
*/
|
15 |
+
static function get_post( $query = false, $PostClass = '\Timber\Post' ) {
|
16 |
$posts = self::get_posts($query, $PostClass);
|
17 |
if ( $post = reset($posts) ) {
|
18 |
return $post;
|
19 |
}
|
20 |
}
|
21 |
|
22 |
+
static function get_posts( $query = false, $PostClass = '\Timber\Post', $return_collection = false ) {
|
23 |
$posts = self::query_posts($query, $PostClass);
|
24 |
return apply_filters('timber_post_getter_get_posts', $posts->get_posts($return_collection));
|
25 |
}
|
26 |
|
27 |
+
static function query_post( $query = false, $PostClass = '\Timber\Post' ) {
|
28 |
$posts = self::query_posts($query, $PostClass);
|
29 |
if ( method_exists($posts, 'current') && $post = $posts->current() ) {
|
30 |
return $post;
|
36 |
* @param string $PostClass
|
37 |
* @return array|bool|null
|
38 |
*/
|
39 |
+
static function query_posts( $query = false, $PostClass = '\Timber\Post' ) {
|
40 |
if ( $type = self::get_class_for_use_as_timber_post($query) ) {
|
41 |
$PostClass = $type;
|
42 |
if ( self::is_post_class_or_class_map($query) ) {
|
124 |
return false;
|
125 |
}
|
126 |
|
127 |
+
if ( !is_array($type) && class_exists($type) && is_subclass_of($type, '\Timber\Post') ) {
|
128 |
return $type;
|
129 |
}
|
130 |
}
|
lib/Timber.php
CHANGED
@@ -394,7 +394,7 @@ class Timber {
|
|
394 |
parse_str($url[1], $query);
|
395 |
$args['add_args'] = $query;
|
396 |
}
|
397 |
-
$args['format'] = '
|
398 |
$args['base'] = trailingslashit($url[0]).'%_%';
|
399 |
} else {
|
400 |
$big = 999999999;
|
@@ -457,7 +457,7 @@ class Timber {
|
|
457 |
*/
|
458 |
public static function add_route( $route, $callback, $args = array() ) {
|
459 |
Helper::warn('Timber::add_route (and accompanying methods for load_view, etc. Have been deprecated and will soon be removed. Please update your theme with Route::map. You can read more in the 1.0 Upgrade Guide: https://github.com/timber/timber/wiki/1.0-Upgrade-Guide');
|
460 |
-
Routes::map($route, $callback, $args);
|
461 |
}
|
462 |
|
463 |
/**
|
394 |
parse_str($url[1], $query);
|
395 |
$args['add_args'] = $query;
|
396 |
}
|
397 |
+
$args['format'] = $wp_rewrite->pagination_base . '/%#%';
|
398 |
$args['base'] = trailingslashit($url[0]).'%_%';
|
399 |
} else {
|
400 |
$big = 999999999;
|
457 |
*/
|
458 |
public static function add_route( $route, $callback, $args = array() ) {
|
459 |
Helper::warn('Timber::add_route (and accompanying methods for load_view, etc. Have been deprecated and will soon be removed. Please update your theme with Route::map. You can read more in the 1.0 Upgrade Guide: https://github.com/timber/timber/wiki/1.0-Upgrade-Guide');
|
460 |
+
\Routes::map($route, $callback, $args);
|
461 |
}
|
462 |
|
463 |
/**
|
lib/User.php
CHANGED
@@ -38,6 +38,12 @@ class User extends Core implements CoreInterface {
|
|
38 |
public $description;
|
39 |
public $display_name;
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
/**
|
42 |
* @api
|
43 |
* @var string The first name of the user
|
@@ -136,6 +142,7 @@ class User extends Core implements CoreInterface {
|
|
136 |
}
|
137 |
$this->id = $this->ID;
|
138 |
$this->name = $this->name();
|
|
|
139 |
$custom = $this->get_custom();
|
140 |
$this->import($custom);
|
141 |
}
|
38 |
public $description;
|
39 |
public $display_name;
|
40 |
|
41 |
+
/**
|
42 |
+
* @api
|
43 |
+
* @var string The URL of the author's avatar
|
44 |
+
*/
|
45 |
+
public $avatar;
|
46 |
+
|
47 |
/**
|
48 |
* @api
|
49 |
* @var string The first name of the user
|
142 |
}
|
143 |
$this->id = $this->ID;
|
144 |
$this->name = $this->name();
|
145 |
+
$this->avatar = get_avatar_url($this->id);
|
146 |
$custom = $this->get_custom();
|
147 |
$this->import($custom);
|
148 |
}
|
readme.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
=== Timber ===
|
2 |
-
Contributors: jarednova, lggorman
|
3 |
Tags: template engine, templates, twig
|
4 |
Requires at least: 3.7
|
5 |
-
Stable tag: 1.0.
|
6 |
Tested up to: 4.5.1
|
7 |
PHP version: 5.3.0 or greater
|
8 |
License: GPLv2 or later
|
@@ -41,6 +41,34 @@ Timber is great for any WordPress developer who cares about writing good, mainta
|
|
41 |
|
42 |
== Changelog ==
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
= 0.22.5 =
|
45 |
* Fixed errors in tests (thanks @lggorman)
|
46 |
* Fixed error in comments_link (thanks @tehlivi)
|
1 |
=== Timber ===
|
2 |
+
Contributors: jarednova, connorjburton, lggorman
|
3 |
Tags: template engine, templates, twig
|
4 |
Requires at least: 3.7
|
5 |
+
Stable tag: 1.0.1
|
6 |
Tested up to: 4.5.1
|
7 |
PHP version: 5.3.0 or greater
|
8 |
License: GPLv2 or later
|
41 |
|
42 |
== Changelog ==
|
43 |
|
44 |
+
= 1.0.1 =
|
45 |
+
* {{ user.avatar }} property is now available (thanks @connorjburton) d21eb85
|
46 |
+
* #947: Fix to pagination base (thanks @matsrietdijk) 270d7c2
|
47 |
+
* Fix to some namespacing issues (thanks @connorjburton) 0a8346a
|
48 |
+
* #958: Call the_post action to help other plugins (thanks @felthy) 4442703
|
49 |
+
* #976: Fixed problem with static declaration (@jarednova) c888606
|
50 |
+
* #978: Bug with arrays for post types (thanks @connorjburton) 571f6f8
|
51 |
+
|
52 |
+
= 1.0.0 =
|
53 |
+
* Added `{{ user }}` object to context
|
54 |
+
* Exposed translation functions
|
55 |
+
* Added better error reporting/warnings
|
56 |
+
* Fixed some things with function wrapper
|
57 |
+
* Timber is now namespaced, big big thanks to @connorjburton
|
58 |
+
* Cleanup of spacing
|
59 |
+
* Removed deprecated functions, added warning for key functions
|
60 |
+
* Updated version numbers and build script (@jarednova) 81a281e
|
61 |
+
* Corrected Routes -> /Routes which threw a fatal error (@jarednova) 26b6585
|
62 |
+
|
63 |
+
= 0.22.6 =
|
64 |
+
* New {{request}} object for post/get variables (thanks @connorjburton) #856
|
65 |
+
* New crop positions (thanks @salaros) #861
|
66 |
+
* Bug Fixes
|
67 |
+
|
68 |
+
* Fix to "next" in pagination (thanks @connorjburton) #900
|
69 |
+
* Fix to issue with tojpg filter's images not being deleted (thanks @connorjburton) #897
|
70 |
+
* `{{post.parent.children}}` used to return unpublished posts due to underlying behavior in WordPress, it now only returns published posts (thanks @connorjburton) #883
|
71 |
+
|
72 |
= 0.22.5 =
|
73 |
* Fixed errors in tests (thanks @lggorman)
|
74 |
* Fixed error in comments_link (thanks @tehlivi)
|
timber-starter-theme/single.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
$context = Timber::get_context();
|
13 |
$post = Timber::query_post();
|
14 |
$context['post'] = $post;
|
15 |
-
$context['comment_form'] =
|
16 |
|
17 |
if ( post_password_required( $post->ID ) ) {
|
18 |
Timber::render( 'single-password.twig', $context );
|
12 |
$context = Timber::get_context();
|
13 |
$post = Timber::query_post();
|
14 |
$context['post'] = $post;
|
15 |
+
$context['comment_form'] = comment_form();
|
16 |
|
17 |
if ( post_password_required( $post->ID ) ) {
|
18 |
Timber::render( 'single-password.twig', $context );
|
timber.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Timber
|
|
4 |
Description: The WordPress Timber Library allows you to write themes using the power Twig templates.
|
5 |
Plugin URI: http://timber.upstatement.com
|
6 |
Author: Jared Novack + Upstatement
|
7 |
-
Version: 1.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 Twig templates.
|
5 |
Plugin URI: http://timber.upstatement.com
|
6 |
Author: Jared Novack + Upstatement
|
7 |
+
Version: 1.0.1
|
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 ComposerAutoloaderInit327165da8fdb503dc7c8e78bb047573c::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 ComposerAutoloaderInit977d5902edc1085fc45cbf70be497654
|
|
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) {
|
@@ -42,14 +42,14 @@ class ComposerAutoloaderInit977d5902edc1085fc45cbf70be497654
|
|
42 |
|
43 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
44 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
45 |
-
|
46 |
}
|
47 |
|
48 |
return $loader;
|
49 |
}
|
50 |
}
|
51 |
|
52 |
-
function
|
53 |
{
|
54 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
55 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit327165da8fdb503dc7c8e78bb047573c
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit327165da8fdb503dc7c8e78bb047573c', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit327165da8fdb503dc7c8e78bb047573c', 'loadClassLoader'));
|
25 |
|
26 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
27 |
foreach ($map as $namespace => $path) {
|
42 |
|
43 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
44 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
45 |
+
composerRequire327165da8fdb503dc7c8e78bb047573c($fileIdentifier, $file);
|
46 |
}
|
47 |
|
48 |
return $loader;
|
49 |
}
|
50 |
}
|
51 |
|
52 |
+
function composerRequire327165da8fdb503dc7c8e78bb047573c($fileIdentifier, $file)
|
53 |
{
|
54 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
55 |
require $file;
|