Version Description
Fixes and improvements - Fix for WPML URLs in some situations #1513 (thanks @ChrisManganaro) - Fix for PHP 5.5 issue with some URLs #1518 (thanks @danFWD)
Download this release
Release Info
Developer | jarednova |
Plugin | Timber |
Version | 1.4.1 |
Comparing to | |
See all releases |
Code changes from version 1.4.0 to 1.4.1
- README.md +8 -8
- lib/Admin.php +3 -3
- lib/Helper.php +1 -1
- lib/Image.php +2 -2
- lib/ImageHelper.php +1 -1
- lib/Integrations/WPML.php +1 -1
- lib/Timber.php +2 -2
- lib/URLHelper.php +2 -1
- readme.txt +33 -45
- timber.php +1 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +3 -3
README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<div style="text-align:center">
|
2 |
-
<a href="
|
3 |
</div>
|
4 |
|
5 |
By [Jared Novack](https://github.com/jarednova) ([@jarednova](https://twitter.com/jarednova)), [Lukas Gächter](https://github.com/gchtr) ([@lgaechter](https://twitter.com/lgaechter)), [Linda Gorman](https://github.com/lggorman) ([@lggorman](https://twitter.com/lggorman)) and [Upstatement](https://twitter.com/upstatement)
|
@@ -18,7 +18,7 @@ By [Jared Novack](https://github.com/jarednova) ([@jarednova](https://twitter.co
|
|
18 |
### Because WordPress is awesome, but the_loop isn't
|
19 |
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.
|
20 |
|
21 |
-
This cleans
|
22 |
|
23 |
This is what Timber's `.twig` files look like:
|
24 |
|
@@ -38,8 +38,8 @@ Once Timber is installed and activated in your plugin directory, it gives any Wo
|
|
38 |
### Looking for docs?
|
39 |
* [Timber Documentation](https://timber.github.io/docs/)
|
40 |
* [Twig Reference](http://twig.sensiolabs.org/doc/templates.html)
|
41 |
-
* [
|
42 |
-
* [
|
43 |
|
44 |
* * *
|
45 |
|
@@ -68,14 +68,14 @@ $timber = new \Timber\Timber();
|
|
68 |
### Mission Statement
|
69 |
Timber is a tool for developers who want to translate their HTML into high-quality WordPress themes through an intuitive, consistent and fully-accessible interface.
|
70 |
* **Intuitive**: The API is written to be user-centric around a programmer's expectations.
|
71 |
-
* **Consistent**:
|
72 |
* **Accessible**: No black boxes. Every effort is made so the developer has access to 100% of their HTML.
|
73 |
|
74 |
#### What does it look like?
|
75 |
Nothing. Timber is meant for you to build a theme on. Like the [Starkers](https://github.com/viewportindustries/starkers) or [Boilerplate theme](https://github.com/zencoder/html5-boilerplate-for-wordpress) it comes style-free, because you're the style expert. Instead, Timber handles the logic you need to make a kick-ass looking site.
|
76 |
|
77 |
#### Who is it good for?
|
78 |
-
Timber is great for any WordPress developer who cares about writing good, maintainable code. It helps teams of designers and developers working together. At [Upstatement](http://upstatement.com) we made Timber because while our entire team needs to participate in building WordPress sites, not everyone knows the ins-and-outs of the_loop(), codex and PHP (nor should they). With Timber your best WordPress
|
79 |
|
80 |
#### Related Projects
|
81 |
* [**Timber Starter Theme**](https://github.com/timber/starter-theme) The "_s" of Timber to give you an easy start to the most basic theme you can build upon and customize.
|
@@ -100,14 +100,14 @@ Timber is great for any WordPress developer who cares about writing good, mainta
|
|
100 |
Please post on [StackOverflow under the "Timber" tag](http://stackoverflow.com/questions/tagged/timber). Please use GitHub issues only for specific bugs, feature requests and other types of issues.
|
101 |
|
102 |
#### Should I use it?
|
103 |
-
It's MIT-licensed, so please use in personal or commercial work. Just don't re-sell it. Timber is used on [
|
104 |
|
105 |
#### Contributing
|
106 |
Read the [Contributor Guidelines](https://github.com/timber/timber/blob/master/CONTRIBUTING.md).
|
107 |
|
108 |
## Documentation
|
109 |
|
110 |
-
The [Documentation for Timber](https://timber.github.io/docs/) is generated from the contents of this repository:
|
111 |
|
112 |
* Documentation for classes and functions is [auto generated](https://github.com/timber/docs). Any changes to the [Reference section](https://timber.github.io/docs/reference/) of the docs should be made by editing the function’s DocBlock. For inline documentation, we follow the [WordPress PHP Documentation Standards](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/).
|
113 |
* To make a change to one of the guides, edit the relevant file in the [`docs` directory](https://github.com/timber/timber/tree/master/docs).
|
1 |
<div style="text-align:center">
|
2 |
+
<a href="https://upstatement.com/timber/"><img src="http://i.imgur.com/PbEwvZ9.png" style="display:block; margin:auto; width:100%; max-width:100%"/></a>
|
3 |
</div>
|
4 |
|
5 |
By [Jared Novack](https://github.com/jarednova) ([@jarednova](https://twitter.com/jarednova)), [Lukas Gächter](https://github.com/gchtr) ([@lgaechter](https://twitter.com/lgaechter)), [Linda Gorman](https://github.com/lggorman) ([@lggorman](https://twitter.com/lggorman)) and [Upstatement](https://twitter.com/upstatement)
|
18 |
### Because WordPress is awesome, but the_loop isn't
|
19 |
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.
|
20 |
|
21 |
+
This cleans up your theme code so, for example, your PHP file can focus on being the data/logic, while your Twig file can focus 100% on the HTML and display.
|
22 |
|
23 |
This is what Timber's `.twig` files look like:
|
24 |
|
38 |
### Looking for docs?
|
39 |
* [Timber Documentation](https://timber.github.io/docs/)
|
40 |
* [Twig Reference](http://twig.sensiolabs.org/doc/templates.html)
|
41 |
+
* [Overview / Getting Started Guide](https://timber.github.io/docs/getting-started/)
|
42 |
+
* [Video Tutorials](https://timber.github.io/docs/getting-started/video-tutorials/)
|
43 |
|
44 |
* * *
|
45 |
|
68 |
### Mission Statement
|
69 |
Timber is a tool for developers who want to translate their HTML into high-quality WordPress themes through an intuitive, consistent and fully-accessible interface.
|
70 |
* **Intuitive**: The API is written to be user-centric around a programmer's expectations.
|
71 |
+
* **Consistent**: WordPress objects can be accessed through common polymorphic properties like slug, ID and name.
|
72 |
* **Accessible**: No black boxes. Every effort is made so the developer has access to 100% of their HTML.
|
73 |
|
74 |
#### What does it look like?
|
75 |
Nothing. Timber is meant for you to build a theme on. Like the [Starkers](https://github.com/viewportindustries/starkers) or [Boilerplate theme](https://github.com/zencoder/html5-boilerplate-for-wordpress) it comes style-free, because you're the style expert. Instead, Timber handles the logic you need to make a kick-ass looking site.
|
76 |
|
77 |
#### Who is it good for?
|
78 |
+
Timber is great for any WordPress developer who cares about writing good, maintainable code. It helps teams of designers and developers working together. At [Upstatement](http://upstatement.com) we made Timber because while our entire team needs to participate in building WordPress sites, not everyone knows the ins-and-outs of the_loop(), codex and PHP (nor should they). With Timber your best WordPress engineer can focus on building the `.php` files with requests from WordPress and pass the data into `.twig` files. Once there, designers can easily mark-up data and build out a site's look-and-feel.
|
79 |
|
80 |
#### Related Projects
|
81 |
* [**Timber Starter Theme**](https://github.com/timber/starter-theme) The "_s" of Timber to give you an easy start to the most basic theme you can build upon and customize.
|
100 |
Please post on [StackOverflow under the "Timber" tag](http://stackoverflow.com/questions/tagged/timber). Please use GitHub issues only for specific bugs, feature requests and other types of issues.
|
101 |
|
102 |
#### Should I use it?
|
103 |
+
It's MIT-licensed, so please use in personal or commercial work. Just don't re-sell it. Timber is used on [thousands of sites](https://www.upstatement.com/timber/#showcase) (and tons more we don't know about)
|
104 |
|
105 |
#### Contributing
|
106 |
Read the [Contributor Guidelines](https://github.com/timber/timber/blob/master/CONTRIBUTING.md).
|
107 |
|
108 |
## Documentation
|
109 |
|
110 |
+
The Official [Documentation for Timber](https://timber.github.io/docs/) is generated from the contents of this repository:
|
111 |
|
112 |
* Documentation for classes and functions is [auto generated](https://github.com/timber/docs). Any changes to the [Reference section](https://timber.github.io/docs/reference/) of the docs should be made by editing the function’s DocBlock. For inline documentation, we follow the [WordPress PHP Documentation Standards](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/).
|
113 |
* To make a change to one of the guides, edit the relevant file in the [`docs` directory](https://github.com/timber/timber/tree/master/docs).
|
lib/Admin.php
CHANGED
@@ -23,8 +23,8 @@ class Admin {
|
|
23 |
unset($links[2]);
|
24 |
$links[] = '<a href="/wp-admin/plugin-install.php?tab=plugin-information&plugin=timber-library&TB_iframe=true&width=600&height=550" class="thickbox" aria-label="More information about Timber" data-title="Timber">View details</a>';
|
25 |
$links[] = '<a href="http://upstatement.com/timber" target="_blank">Homepage</a>';
|
26 |
-
$links[] = '<a href="https://github.
|
27 |
-
$links[] = '<a href="https://github.
|
28 |
return $links;
|
29 |
}
|
30 |
return $links;
|
@@ -49,7 +49,7 @@ class Admin {
|
|
49 |
|
50 |
<br><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<br>';
|
51 |
|
52 |
-
$m .= '<br>Read the <strong><a href="https://github.
|
53 |
|
54 |
$m .= "<br>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<br>";
|
55 |
$m .= self::disable_update();
|
23 |
unset($links[2]);
|
24 |
$links[] = '<a href="/wp-admin/plugin-install.php?tab=plugin-information&plugin=timber-library&TB_iframe=true&width=600&height=550" class="thickbox" aria-label="More information about Timber" data-title="Timber">View details</a>';
|
25 |
$links[] = '<a href="http://upstatement.com/timber" target="_blank">Homepage</a>';
|
26 |
+
$links[] = '<a href="https://timber.github.io/docs/" target="_blank">Documentation</a>';
|
27 |
+
$links[] = '<a href="https://timber.github.io/docs/getting-started/setup/" target="_blank">Starter Guide</a>';
|
28 |
return $links;
|
29 |
}
|
30 |
return $links;
|
49 |
|
50 |
<br><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<br>';
|
51 |
|
52 |
+
$m .= '<br>Read the <strong><a href="https://timber.github.io/docs/upgrade-guides/1.0/">Upgrade Guide</a></strong> for more information<br>';
|
53 |
|
54 |
$m .= "<br>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<br>";
|
55 |
$m .= self::disable_update();
|
lib/Helper.php
CHANGED
@@ -180,7 +180,7 @@ class Helper {
|
|
180 |
* @return FunctionWrapper|mixed
|
181 |
*/
|
182 |
public static function function_wrapper( $function_name, $defaults = array(), $return_output_buffer = false ) {
|
183 |
-
Helper::warn( 'function_wrapper is deprecated and will be removed in 1.4. Use {{ function( \'function_to_call\' ) }} instead or use FunctionWrapper directly. For more information refer to
|
184 |
|
185 |
return new FunctionWrapper( $function_name, $defaults, $return_output_buffer );
|
186 |
}
|
180 |
* @return FunctionWrapper|mixed
|
181 |
*/
|
182 |
public static function function_wrapper( $function_name, $defaults = array(), $return_output_buffer = false ) {
|
183 |
+
Helper::warn( 'function_wrapper is deprecated and will be removed in 1.4. Use {{ function( \'function_to_call\' ) }} instead or use FunctionWrapper directly. For more information refer to https://timber.github.io/docs/guides/functions/' );
|
184 |
|
185 |
return new FunctionWrapper( $function_name, $defaults, $return_output_buffer );
|
186 |
}
|
lib/Image.php
CHANGED
@@ -219,7 +219,7 @@ class Image extends Post implements CoreInterface {
|
|
219 |
public function init( $iid = false ) {
|
220 |
//Make sure we actually have something to work with
|
221 |
if ( !$iid ) { Helper::error_log('Initalized TimberImage without providing first parameter.'); return; }
|
222 |
-
|
223 |
//If passed TimberImage, grab the ID and continue
|
224 |
if ( $iid instanceof self ) {
|
225 |
$iid = (int) $iid->ID;
|
@@ -258,7 +258,7 @@ class Image extends Post implements CoreInterface {
|
|
258 |
/**
|
259 |
* This will catch TimberPost and any post classes that extend TimberPost,
|
260 |
* see http://php.net/manual/en/internals2.opcodes.instanceof.php#109108
|
261 |
-
* and https://github.
|
262 |
*/
|
263 |
$iid = (int) $iid->_thumbnail_id;
|
264 |
}
|
219 |
public function init( $iid = false ) {
|
220 |
//Make sure we actually have something to work with
|
221 |
if ( !$iid ) { Helper::error_log('Initalized TimberImage without providing first parameter.'); return; }
|
222 |
+
|
223 |
//If passed TimberImage, grab the ID and continue
|
224 |
if ( $iid instanceof self ) {
|
225 |
$iid = (int) $iid->ID;
|
258 |
/**
|
259 |
* This will catch TimberPost and any post classes that extend TimberPost,
|
260 |
* see http://php.net/manual/en/internals2.opcodes.instanceof.php#109108
|
261 |
+
* and https://timber.github.io/docs/guides/extending-timber/
|
262 |
*/
|
263 |
$iid = (int) $iid->_thumbnail_id;
|
264 |
}
|
lib/ImageHelper.php
CHANGED
@@ -12,7 +12,7 @@ use Timber\URLHelper;
|
|
12 |
|
13 |
/**
|
14 |
* Implements the Twig image filters:
|
15 |
-
* https://github.
|
16 |
* - resize
|
17 |
* - retina
|
18 |
* - letterbox
|
12 |
|
13 |
/**
|
14 |
* Implements the Twig image filters:
|
15 |
+
* https://timber.github.io/docs/guides/cookbook-images/#arbitrary-resizing-of-images
|
16 |
* - resize
|
17 |
* - retina
|
18 |
* - letterbox
|
lib/Integrations/WPML.php
CHANGED
@@ -13,7 +13,7 @@ class WPML {
|
|
13 |
|
14 |
public function file_system_to_url($url) {
|
15 |
if ( defined('ICL_LANGUAGE_CODE') ) {
|
16 |
-
$url = preg_replace('
|
17 |
}
|
18 |
return $url;
|
19 |
}
|
13 |
|
14 |
public function file_system_to_url($url) {
|
15 |
if ( defined('ICL_LANGUAGE_CODE') ) {
|
16 |
+
$url = preg_replace('/(?<!:\/)\/' . ICL_LANGUAGE_CODE . '/', '', $url);
|
17 |
}
|
18 |
return $url;
|
19 |
}
|
lib/Timber.php
CHANGED
@@ -317,7 +317,7 @@ class Timber {
|
|
317 |
|
318 |
$output = $loader->render($file, $data, $expires, $cache_mode);
|
319 |
}
|
320 |
-
|
321 |
do_action('timber_compile_done');
|
322 |
return $output;
|
323 |
}
|
@@ -498,7 +498,7 @@ class Timber {
|
|
498 |
* @codeCoverageIgnore
|
499 |
*/
|
500 |
public static function add_route( $route, $callback, $args = array() ) {
|
501 |
-
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.
|
502 |
\Routes::map($route, $callback, $args);
|
503 |
}
|
504 |
|
317 |
|
318 |
$output = $loader->render($file, $data, $expires, $cache_mode);
|
319 |
}
|
320 |
+
|
321 |
do_action('timber_compile_done');
|
322 |
return $output;
|
323 |
}
|
498 |
* @codeCoverageIgnore
|
499 |
*/
|
500 |
public static function add_route( $route, $callback, $args = array() ) {
|
501 |
+
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://timber.github.io/docs/upgrade-guides/1.0/');
|
502 |
\Routes::map($route, $callback, $args);
|
503 |
}
|
504 |
|
lib/URLHelper.php
CHANGED
@@ -127,7 +127,8 @@ class URLHelper {
|
|
127 |
* @return bool
|
128 |
*/
|
129 |
public static function is_local( $url ) {
|
130 |
-
|
|
|
131 |
return true;
|
132 |
}
|
133 |
return false;
|
127 |
* @return bool
|
128 |
*/
|
129 |
public static function is_local( $url ) {
|
130 |
+
$host = self::get_host();
|
131 |
+
if ( !empty($host) && strstr($url, $host) ) {
|
132 |
return true;
|
133 |
}
|
134 |
return false;
|
readme.txt
CHANGED
@@ -2,54 +2,45 @@
|
|
2 |
Contributors: jarednova, connorjburton, lggorman
|
3 |
Tags: template engine, templates, twig
|
4 |
Requires at least: 3.7
|
5 |
-
Stable tag: 1.4.
|
6 |
Tested up to: 4.8.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
|
10 |
|
11 |
-
Helps you create themes faster with sustainable code. With Timber, you write HTML using
|
12 |
|
13 |
== Description ==
|
14 |
-
Timber cleans
|
15 |
|
16 |
Once Timber is installed and activated in your plugin directory, it gives any WordPress theme the ability to take advantage of the power of Twig and other Timber features.
|
17 |
|
18 |
-
###
|
19 |
* **[Project Page](http://upstatement.com/timber)**
|
20 |
-
* [Timber Documentation](https://github.com/timber/docs)
|
21 |
-
* [Twig Reference (from SensioLabs)](http://twig.sensiolabs.org/doc/templates.html)
|
22 |
-
_Twig is the template language powering Timber; if you need a little background on what a template language is, [Twig's homepage has an overview](http://twig.sensiolabs.org/)_
|
23 |
-
* **[Video Tutorials](https://github.com/timber/timber/wiki/Video-Tutorials)**
|
24 |
-
* [Overview / Getting Started Guide](https://github.com/timber/timber/wiki/getting-started)
|
25 |
-
|
26 |
-
#### Related Projects
|
27 |
-
* [**Timber Debug Bar**](http://wordpress.org/plugins/debug-bar-timber/) Adds a debug bar panel that will show you want template is in-use and the data sent to your twig file.
|
28 |
-
|
29 |
-
#### What does it look like?
|
30 |
-
Nothing. Timber is meant for you to build a theme on. Like the [Starkers](https://github.com/viewportindustries/starkers) or [_s theme](https://github.com/Automattic/_s) it comes style-free, because you're the style expert. Instead, Timber handles the logic you need to make a kick-ass looking site.
|
31 |
-
|
32 |
-
#### Who is it good for?
|
33 |
-
Timber is great for any WordPress developer who cares about writing good, maintainable code. It helps teams of designers and developers working together. At [Upstatement](http://upstatement.com) we made Timber because not everyone knows the ins-and-outs of the_loop(), WordPress codex and PHP (nor should they). With Timber your best WordPress dev can focus on building the .php files with requests from WordPress and pass the data into .twig files. Once there, designers can easily mark-up data and build out a site's look-and-feel.
|
34 |
-
|
35 |
-
#### Want to read more?
|
36 |
* [Timber on GitHub](http://github.com/timber/timber/)
|
37 |
-
* [Timber Overview on Tidy Repo](http://tidyrepo.com/timber/)
|
38 |
-
* ["Timber and Twig Reignited My Love for WordPress" on CSS-Tricks](https://css-tricks.com/timber-and-twig-reignited-my-love-for-wordpress/)
|
39 |
-
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
== Changelog ==
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
= 1.4.0 =
|
45 |
|
46 |
**Fixes and Improvements**
|
47 |
-
|
48 |
- Improve GIF resize performance #1495 (thanks @ahallais)
|
49 |
- Fix for get_host which could generate an unncessary warning #1490 (thanks @ahallais)
|
50 |
|
51 |
**Changes for Theme Developers**
|
52 |
-
|
53 |
- Improve loader performance and logic #1476 #1489 #1491 (thanks @heino). This introduces potential changes if you were loading templates in a non-standard way and with multiple sources (ex: from a theme and plugin directory). Non-existing templates are no longer passed all the way to Twig’s `render()`, which currently generates an exception.
|
54 |
|
55 |
= 1.3.4 =
|
@@ -609,7 +600,7 @@ Misc fixes to documentation
|
|
609 |
|
610 |
== Screenshots ==
|
611 |
|
612 |
-
1. This what a normal
|
613 |
2. With Timber, you write Twig files that are super-clear and HTML-centric.
|
614 |
|
615 |
== Installation ==
|
@@ -617,21 +608,21 @@ Misc fixes to documentation
|
|
617 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
618 |
2. For an example, try modifying your home.php or index.php with something like this:
|
619 |
|
620 |
-
|
621 |
$context = array();
|
622 |
$context['message'] = 'Hello Timber!';
|
623 |
-
Timber::render('welcome.twig', $context);
|
624 |
-
|
|
|
|
|
625 |
|
626 |
-
|
627 |
-
`
|
628 |
-
{# welcome.twig #}
|
629 |
<div class="welcome">
|
630 |
-
|
631 |
</div>
|
632 |
-
|
633 |
|
634 |
-
That
|
635 |
|
636 |
== Support ==
|
637 |
|
@@ -640,19 +631,16 @@ Please post on [StackOverflow under the "Timber" tag](http://stackoverflow.com/q
|
|
640 |
== Frequently Asked Questions ==
|
641 |
|
642 |
= Can it be used in an existing theme? =
|
643 |
-
You bet! Watch these **[
|
644 |
|
645 |
= Is it used in production? =
|
646 |
-
|
647 |
|
648 |
-
= Doesn't this all make WordPress harder since there
|
649 |
-
Does jQuery make JavaScript harder? Yes, it
|
650 |
|
651 |
-
= Oh, Timber is simple code so it
|
652 |
-
Whatever. It simplifies the silly stuff so that you can focus on building more complicated sites and apps. jQuery simplifies Javascript, but you can still use the full range of
|
653 |
|
654 |
= Will you support it? =
|
655 |
-
|
656 |
-
|
657 |
-
= Support? =
|
658 |
-
Leave a [GitHub issue](https://github.com/timber/timber/issues?state=open) and I'll holler back.
|
2 |
Contributors: jarednova, connorjburton, lggorman
|
3 |
Tags: template engine, templates, twig
|
4 |
Requires at least: 3.7
|
5 |
+
Stable tag: 1.4.1
|
6 |
Tested up to: 4.8.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
|
10 |
|
11 |
+
Helps you create themes faster with sustainable code. With Timber, you write HTML using Twig Templates http://www.upstatement.com/timber/
|
12 |
|
13 |
== Description ==
|
14 |
+
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. This cleans up your theme code so, for example, your PHP file can focus on being the data/logic, while your Twig file can focus 100% on the HTML and display.
|
15 |
|
16 |
Once Timber is installed and activated in your plugin directory, it gives any WordPress theme the ability to take advantage of the power of Twig and other Timber features.
|
17 |
|
18 |
+
### Want to learn more?
|
19 |
* **[Project Page](http://upstatement.com/timber)**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
* [Timber on GitHub](http://github.com/timber/timber/)
|
|
|
|
|
|
|
21 |
|
22 |
+
### Looking for Documentation?
|
23 |
+
* [Timber Documentation](https://timber.github.io/docs/)
|
24 |
+
* [Twig Reference (from SensioLabs)](http://twig.sensiolabs.org/doc/templates.html)
|
25 |
+
_Twig is the template language powering Timber; if you need a little background on what a template language is, [Twig’s homepage has an overview](http://twig.sensiolabs.org/)_
|
26 |
+
* **[Video Tutorials](https://timber.github.io/docs/getting-started/video-tutorials/)**
|
27 |
+
* [Overview / Getting Started Guide](https://timber.github.io/docs/getting-started/)
|
28 |
|
29 |
== Changelog ==
|
30 |
|
31 |
+
= 1.4.1 =
|
32 |
+
|
33 |
+
**Fixes and improvements**
|
34 |
+
- Fix for WPML URLs in some situations #1513 (thanks @ChrisManganaro)
|
35 |
+
- Fix for PHP 5.5 issue with some URLs #1518 (thanks @danFWD)
|
36 |
+
|
37 |
= 1.4.0 =
|
38 |
|
39 |
**Fixes and Improvements**
|
|
|
40 |
- Improve GIF resize performance #1495 (thanks @ahallais)
|
41 |
- Fix for get_host which could generate an unncessary warning #1490 (thanks @ahallais)
|
42 |
|
43 |
**Changes for Theme Developers**
|
|
|
44 |
- Improve loader performance and logic #1476 #1489 #1491 (thanks @heino). This introduces potential changes if you were loading templates in a non-standard way and with multiple sources (ex: from a theme and plugin directory). Non-existing templates are no longer passed all the way to Twig’s `render()`, which currently generates an exception.
|
45 |
|
46 |
= 1.3.4 =
|
600 |
|
601 |
== Screenshots ==
|
602 |
|
603 |
+
1. This what a normal WordPress PHP file looks like
|
604 |
2. With Timber, you write Twig files that are super-clear and HTML-centric.
|
605 |
|
606 |
== Installation ==
|
608 |
1. Activate the plugin through the 'Plugins' menu in WordPress
|
609 |
2. For an example, try modifying your home.php or index.php with something like this:
|
610 |
|
611 |
+
```
|
612 |
$context = array();
|
613 |
$context['message'] = 'Hello Timber!';
|
614 |
+
Timber::render( 'welcome.twig', $context );
|
615 |
+
```
|
616 |
+
|
617 |
+
Then create a subdirectory called `views` in your theme folder. Then create a file `views/welcome.twig` with these contents:
|
618 |
|
619 |
+
```
|
|
|
|
|
620 |
<div class="welcome">
|
621 |
+
<h3>{{ message }}</h3>
|
622 |
</div>
|
623 |
+
```
|
624 |
|
625 |
+
That’s Timber!
|
626 |
|
627 |
== Support ==
|
628 |
|
631 |
== Frequently Asked Questions ==
|
632 |
|
633 |
= Can it be used in an existing theme? =
|
634 |
+
You bet! Watch these **[Video Tutorials](https://timber.github.io/docs/getting-started/video-tutorials/)** to see how.
|
635 |
|
636 |
= Is it used in production? =
|
637 |
+
Tens of thousands of sites now use Timber. You can check some of them out in the **[Showcase](http://upstatement.com/timber/#showcase)**.
|
638 |
|
639 |
+
= Doesn't this all make WordPress harder since there’s more to learn? =
|
640 |
+
Does jQuery make JavaScript harder? Yes, it’s an extra piece to learn — but it super-charges your ability to write unencumbered JavaScript (and prevents you from having to learn lots of the messy internals). If your answer is "jQuery sucks and everyone should learn how to write vanilla JavaScript or they’re rotten stupid people," this tool isn’t for you.
|
641 |
|
642 |
+
= Oh, Timber is simple code so it’s for making simple themes =
|
643 |
+
Whatever. It simplifies the silly stuff so that you can focus on building more complicated sites and apps. jQuery simplifies Javascript, but you can still use the full range of JavaScript’s abilities.
|
644 |
|
645 |
= Will you support it? =
|
646 |
+
At [Upstatement](https://upstatement.com) we’re using it in dozens of sites (and many more planned) -- thousands of other developers are using it too. This isn’t going anywhere. Twig is the chosen language for other PHP platforms like Symfony, Drupal 8 and Craft.
|
|
|
|
|
|
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: http://timber.upstatement.com
|
6 |
Author: Jared Novack + Upstatement
|
7 |
-
Version: 1.4.
|
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: http://timber.upstatement.com
|
6 |
Author: Jared Novack + Upstatement
|
7 |
+
Version: 1.4.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 ComposerAutoloaderInitdf0038319ddcc4e70ed54620c71e6bea::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 ComposerAutoloaderInit862731a8f7673738491a1b7cef45d134
|
|
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) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInitdf0038319ddcc4e70ed54620c71e6bea
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInitdf0038319ddcc4e70ed54620c71e6bea', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitdf0038319ddcc4e70ed54620c71e6bea', 'loadClassLoader'));
|
25 |
|
26 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
27 |
foreach ($map as $namespace => $path) {
|