Version Description
- Fix to how categories work in Timber::get_posts 49f6007db3f829097f82ed41d389dd39053fb84a
- Fix to usage of class maps in Timber::get_posts (thanks @vilpersson) b1387e443850aa021a0a70203bc20d238d4b21cb
- Added Post::password_required method (thanks @marclarr) 2e685ce3d05c50e879817e51256202e032e77122
- You can filter the link markup for Post::get_preview (thanks @LiljebergXYZ) b8100d7f2601b4da40bcc0a873c071b6ecf267f1
Download this release
Release Info
Developer | jarednova |
Plugin | Timber |
Version | 1.1.3 |
Comparing to | |
See all releases |
Code changes from version 1.1.4 to 1.1.3
- README.md +1 -1
- lib/Admin.php +5 -5
- lib/Core.php +0 -8
- lib/Helper.php +0 -19
- lib/Integrations.php +6 -14
- lib/Integrations/CoAuthorsPlus.php +0 -30
- lib/Loader.php +9 -13
- lib/Post.php +5 -26
- lib/QueryIterator.php +1 -18
- lib/TermGetter.php +2 -2
- lib/Timber.php +8 -8
- lib/Twig.php +0 -2
- lib/URLHelper.php +4 -12
- lib/User.php +1 -1
- readme.txt +2 -10
- 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="http://timber.github.io/timber"><img src="http://i.imgur.com/
|
3 |
<div>
|
4 |
By Jared Novack (<a href="https://twitter.com/jarednova">@JaredNova</a>) and <a href="http://upstatement.com">Upstatement</a> (<a href="https://twitter.com/upstatement">@Upstatement</a>)</div>
|
5 |
</div>
|
1 |
<div style="text-align:center">
|
2 |
+
<a href="http://timber.github.io/timber"><img src="http://i.imgur.com/oM1AHrz.jpg" style="display:block; margin:auto; width:100%; max-width:100%"/></a>
|
3 |
<div>
|
4 |
By Jared Novack (<a href="https://twitter.com/jarednova">@JaredNova</a>) and <a href="http://upstatement.com">Upstatement</a> (<a href="https://twitter.com/upstatement">@Upstatement</a>)</div>
|
5 |
</div>
|
lib/Admin.php
CHANGED
@@ -48,18 +48,18 @@ class Admin {
|
|
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 .= '<
|
52 |
|
53 |
-
<
|
54 |
|
55 |
-
$m .= '<
|
56 |
|
57 |
-
$m .= "<
|
58 |
|
59 |
}
|
60 |
|
61 |
if ( version_compare("1.0.0", $plugin_data['Version']) <= 0 ) {
|
62 |
-
$m .= "<
|
63 |
}
|
64 |
|
65 |
// show message
|
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
|
lib/Core.php
CHANGED
@@ -117,12 +117,4 @@ abstract class Core {
|
|
117 |
$ret['can_edit'] = $this->can_edit();
|
118 |
return $ret;
|
119 |
}
|
120 |
-
|
121 |
-
/**
|
122 |
-
* @param string $field_name
|
123 |
-
* @return mixed
|
124 |
-
*/
|
125 |
-
public function get_field( $field_name ) {
|
126 |
-
return $this->get_meta_field($field_name);
|
127 |
-
}
|
128 |
}
|
117 |
$ret['can_edit'] = $this->can_edit();
|
118 |
return $ret;
|
119 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
}
|
lib/Helper.php
CHANGED
@@ -444,25 +444,6 @@ class Helper {
|
|
444 |
return ($i % 2) != 0;
|
445 |
}
|
446 |
|
447 |
-
/**
|
448 |
-
* Plucks the values of a certain key from an array of objects
|
449 |
-
* @param array $array
|
450 |
-
* @param string $key
|
451 |
-
*/
|
452 |
-
public static function pluck( $array, $key ) {
|
453 |
-
$return = array();
|
454 |
-
foreach ( $array as $obj ) {
|
455 |
-
if ( is_object($obj) && method_exists($obj, $key) ) {
|
456 |
-
$return[] = $obj->$key();
|
457 |
-
} elseif ( is_object($obj) && property_exists($obj, $key) ) {
|
458 |
-
$return[] = $obj->$key;
|
459 |
-
} elseif ( isset($obj[$key]) ) {
|
460 |
-
$return[] = $obj[$key];
|
461 |
-
}
|
462 |
-
}
|
463 |
-
return $return;
|
464 |
-
}
|
465 |
-
|
466 |
/* Links, Forms, Etc. Utilities
|
467 |
======================== */
|
468 |
|
444 |
return ($i % 2) != 0;
|
445 |
}
|
446 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
447 |
/* Links, Forms, Etc. Utilities
|
448 |
======================== */
|
449 |
|
lib/Integrations.php
CHANGED
@@ -2,33 +2,25 @@
|
|
2 |
|
3 |
namespace Timber;
|
4 |
|
|
|
|
|
5 |
/**
|
6 |
* This is for integrating external plugins into timber
|
7 |
* @package timber
|
8 |
*/
|
9 |
class Integrations {
|
10 |
-
|
11 |
-
var $acf;
|
12 |
-
var $coauthors_plus;
|
13 |
-
|
14 |
-
public function __construct() {
|
15 |
-
$this->init();
|
16 |
-
}
|
17 |
|
18 |
-
public function init() {
|
19 |
-
add_action('init', array(
|
20 |
|
21 |
if ( class_exists('WP_CLI_Command') ) {
|
22 |
\WP_CLI::add_command('timber', 'Timber\Integrations\Timber_WP_CLI_Command');
|
23 |
}
|
24 |
}
|
25 |
|
26 |
-
public function
|
27 |
if ( class_exists('ACF') ) {
|
28 |
-
|
29 |
-
}
|
30 |
-
if ( class_exists('CoAuthors_Plus') ) {
|
31 |
-
$this->coauthors_plus = new Integrations\CoAuthorsPlus();
|
32 |
}
|
33 |
}
|
34 |
}
|
2 |
|
3 |
namespace Timber;
|
4 |
|
5 |
+
use Timber\Integrations\ACF;
|
6 |
+
|
7 |
/**
|
8 |
* This is for integrating external plugins into timber
|
9 |
* @package timber
|
10 |
*/
|
11 |
class Integrations {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
public static function init() {
|
14 |
+
add_action('init', array(__CLASS__, 'maybe_init_acf'));
|
15 |
|
16 |
if ( class_exists('WP_CLI_Command') ) {
|
17 |
\WP_CLI::add_command('timber', 'Timber\Integrations\Timber_WP_CLI_Command');
|
18 |
}
|
19 |
}
|
20 |
|
21 |
+
public static function maybe_init_acf() {
|
22 |
if ( class_exists('ACF') ) {
|
23 |
+
new ACF();
|
|
|
|
|
|
|
24 |
}
|
25 |
}
|
26 |
}
|
lib/Integrations/CoAuthorsPlus.php
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace Timber\Integrations;
|
4 |
-
|
5 |
-
class CoAuthorsPlus {
|
6 |
-
|
7 |
-
/**
|
8 |
-
* @codeCoverageIgnore
|
9 |
-
*/
|
10 |
-
public function __construct() {
|
11 |
-
add_filter('timber/post/authors', array($this, 'authors'), 10, 2);
|
12 |
-
}
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Filters {{ post.authors }} to return authors stored from Co-Authors Plus
|
16 |
-
* @since 1.1.4
|
17 |
-
* @param array $author
|
18 |
-
* @param Post $post
|
19 |
-
* @return array of User objects
|
20 |
-
*/
|
21 |
-
public function authors( $author, $post ) {
|
22 |
-
$authors = array();
|
23 |
-
$cauthors = get_coauthors($post->ID);
|
24 |
-
foreach ( $cauthors as $author ) {
|
25 |
-
$authors[] = new \Timber\User($author);
|
26 |
-
}
|
27 |
-
return $authors;
|
28 |
-
}
|
29 |
-
|
30 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/Loader.php
CHANGED
@@ -35,10 +35,10 @@ class Loader {
|
|
35 |
}
|
36 |
|
37 |
/**
|
38 |
-
* @param string
|
39 |
-
* @param array
|
40 |
-
* @param array|
|
41 |
-
* @param string
|
42 |
* @return bool|string
|
43 |
*/
|
44 |
public function render( $file, $data = null, $expires = false, $cache_mode = self::CACHE_USE_DEFAULT ) {
|
@@ -112,18 +112,14 @@ class Loader {
|
|
112 |
|
113 |
|
114 |
/**
|
115 |
-
* @return \
|
116 |
*/
|
117 |
public function get_loader() {
|
118 |
-
$
|
119 |
-
$
|
120 |
-
|
121 |
-
$custom_loaders = apply_filters('timber/loader/custom', array());
|
122 |
-
$all_loaders = array_merge($custom_loaders, $filesystem_loader);
|
123 |
-
return new \Twig_Loader_Chain($all_loaders);
|
124 |
}
|
125 |
|
126 |
-
|
127 |
/**
|
128 |
* @return \Twig_Environment
|
129 |
*/
|
@@ -261,7 +257,7 @@ class Loader {
|
|
261 |
* @param string $key
|
262 |
* @param string|boolean $value
|
263 |
* @param string $group
|
264 |
-
* @param
|
265 |
* @param string $cache_mode
|
266 |
* @return string|boolean
|
267 |
*/
|
35 |
}
|
36 |
|
37 |
/**
|
38 |
+
* @param string $file
|
39 |
+
* @param array $data
|
40 |
+
* @param array|bool $expires
|
41 |
+
* @param string $cache_mode
|
42 |
* @return bool|string
|
43 |
*/
|
44 |
public function render( $file, $data = null, $expires = false, $cache_mode = self::CACHE_USE_DEFAULT ) {
|
112 |
|
113 |
|
114 |
/**
|
115 |
+
* @return \Twig_Loader_Filesystem
|
116 |
*/
|
117 |
public function get_loader() {
|
118 |
+
$paths = array_merge($this->locations, array(ini_get('open_basedir') ? ABSPATH : '/'));
|
119 |
+
$paths = apply_filters('timber/loader/paths', $paths);
|
120 |
+
return new \Twig_Loader_Filesystem($paths);
|
|
|
|
|
|
|
121 |
}
|
122 |
|
|
|
123 |
/**
|
124 |
* @return \Twig_Environment
|
125 |
*/
|
257 |
* @param string $key
|
258 |
* @param string|boolean $value
|
259 |
* @param string $group
|
260 |
+
* @param int $expires
|
261 |
* @param string $cache_mode
|
262 |
* @return string|boolean
|
263 |
*/
|
lib/Post.php
CHANGED
@@ -755,13 +755,7 @@ class Post extends Core implements CoreInterface {
|
|
755 |
* @return User|null A User object if found, false if not
|
756 |
*/
|
757 |
public function author() {
|
758 |
-
|
759 |
-
return new User($this->post_author);
|
760 |
-
}
|
761 |
-
}
|
762 |
-
|
763 |
-
public function authors() {
|
764 |
-
return apply_filters('timber/post/authors', array($this->author()), $this);
|
765 |
}
|
766 |
|
767 |
/**
|
@@ -777,7 +771,7 @@ class Post extends Core implements CoreInterface {
|
|
777 |
*/
|
778 |
public function modified_author() {
|
779 |
$user_id = get_post_meta($this->ID, '_edit_last', true);
|
780 |
-
return ($user_id ? new User($user_id) : $this->
|
781 |
}
|
782 |
|
783 |
/**
|
@@ -914,20 +908,6 @@ class Post extends Core implements CoreInterface {
|
|
914 |
return $timber_comments;
|
915 |
}
|
916 |
|
917 |
-
/**
|
918 |
-
* If the Password form is to be shown, show it!
|
919 |
-
* @return string|void
|
920 |
-
*/
|
921 |
-
protected function maybe_show_password_form(){
|
922 |
-
if ( $this->password_required() ) {
|
923 |
-
$show_pw = false;
|
924 |
-
$show_pw = apply_filters('timber/post/content/show_password_form_for_protected', $show_pw);
|
925 |
-
if ($show_pw) {
|
926 |
-
return apply_filters('timber/post/content/password_form', get_the_password_form($this->ID), $this);
|
927 |
-
}
|
928 |
-
}
|
929 |
-
}
|
930 |
-
|
931 |
/**
|
932 |
* Gets the actual content of a WP Post, as opposed to post_content this will run the hooks/filters attached to the_content. \This guy will return your posts content with WordPress filters run on it (like for shortcodes and wpautop).
|
933 |
* @api
|
@@ -942,9 +922,6 @@ class Post extends Core implements CoreInterface {
|
|
942 |
* @return string
|
943 |
*/
|
944 |
public function content( $page = 0, $len = -1 ) {
|
945 |
-
if ( $form = $this->maybe_show_password_form() ) {
|
946 |
-
return $form;
|
947 |
-
}
|
948 |
if ( $len == -1 && $page == 0 && $this->_content ) {
|
949 |
return $this->_content;
|
950 |
}
|
@@ -1538,7 +1515,9 @@ class Post extends Core implements CoreInterface {
|
|
1538 |
* @return User|null
|
1539 |
*/
|
1540 |
public function get_author() {
|
1541 |
-
|
|
|
|
|
1542 |
}
|
1543 |
|
1544 |
/**
|
755 |
* @return User|null A User object if found, false if not
|
756 |
*/
|
757 |
public function author() {
|
758 |
+
return $this->get_author();
|
|
|
|
|
|
|
|
|
|
|
|
|
759 |
}
|
760 |
|
761 |
/**
|
771 |
*/
|
772 |
public function modified_author() {
|
773 |
$user_id = get_post_meta($this->ID, '_edit_last', true);
|
774 |
+
return ($user_id ? new User($user_id) : $this->get_author());
|
775 |
}
|
776 |
|
777 |
/**
|
908 |
return $timber_comments;
|
909 |
}
|
910 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
911 |
/**
|
912 |
* Gets the actual content of a WP Post, as opposed to post_content this will run the hooks/filters attached to the_content. \This guy will return your posts content with WordPress filters run on it (like for shortcodes and wpautop).
|
913 |
* @api
|
922 |
* @return string
|
923 |
*/
|
924 |
public function content( $page = 0, $len = -1 ) {
|
|
|
|
|
|
|
925 |
if ( $len == -1 && $page == 0 && $this->_content ) {
|
926 |
return $this->_content;
|
927 |
}
|
1515 |
* @return User|null
|
1516 |
*/
|
1517 |
public function get_author() {
|
1518 |
+
if ( isset($this->post_author) ) {
|
1519 |
+
return new User($this->post_author);
|
1520 |
+
}
|
1521 |
}
|
1522 |
|
1523 |
/**
|
lib/QueryIterator.php
CHANGED
@@ -10,7 +10,7 @@ if ( !defined('ABSPATH') ) {
|
|
10 |
exit;
|
11 |
}
|
12 |
|
13 |
-
class QueryIterator implements \Iterator
|
14 |
|
15 |
/**
|
16 |
*
|
@@ -173,21 +173,4 @@ class QueryIterator implements \Iterator, \Countable {
|
|
173 |
return $query;
|
174 |
}
|
175 |
|
176 |
-
/**
|
177 |
-
* Count elements of an object.
|
178 |
-
*
|
179 |
-
* Necessary for some Twig `loop` variable properties.
|
180 |
-
* @see http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable
|
181 |
-
*
|
182 |
-
* @link http://php.net/manual/en/countable.count.php
|
183 |
-
* @return int The custom count as an integer.
|
184 |
-
* </p>
|
185 |
-
* <p>
|
186 |
-
* The return value is cast to an integer.
|
187 |
-
* @since 5.1.0
|
188 |
-
*/
|
189 |
-
public function count()
|
190 |
-
{
|
191 |
-
return $this->post_count();
|
192 |
-
}
|
193 |
}
|
10 |
exit;
|
11 |
}
|
12 |
|
13 |
+
class QueryIterator implements \Iterator {
|
14 |
|
15 |
/**
|
16 |
*
|
173 |
return $query;
|
174 |
}
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
}
|
lib/TermGetter.php
CHANGED
@@ -11,7 +11,7 @@ class TermGetter {
|
|
11 |
* @param string $taxonomy
|
12 |
* @return Timber\Term|WP_Error|null
|
13 |
*/
|
14 |
-
public static function get_term( $term, $taxonomy, $TermClass = '
|
15 |
$term = get_term($term, $taxonomy);
|
16 |
return new $TermClass($term->term_id, $term->taxonomy);
|
17 |
}
|
@@ -22,7 +22,7 @@ class TermGetter {
|
|
22 |
* @param string $TermClass
|
23 |
* @return mixed
|
24 |
*/
|
25 |
-
public static function get_terms( $args = null, $maybe_args = array(), $TermClass = '
|
26 |
if ( is_string($maybe_args) && !strstr($maybe_args, '=') ) {
|
27 |
//the user is sending the $TermClass in the second argument
|
28 |
$TermClass = $maybe_args;
|
11 |
* @param string $taxonomy
|
12 |
* @return Timber\Term|WP_Error|null
|
13 |
*/
|
14 |
+
public static function get_term( $term, $taxonomy, $TermClass = 'Term' ) {
|
15 |
$term = get_term($term, $taxonomy);
|
16 |
return new $TermClass($term->term_id, $term->taxonomy);
|
17 |
}
|
22 |
* @param string $TermClass
|
23 |
* @return mixed
|
24 |
*/
|
25 |
+
public static function get_terms( $args = null, $maybe_args = array(), $TermClass = 'Term' ) {
|
26 |
if ( is_string($maybe_args) && !strstr($maybe_args, '=') ) {
|
27 |
//the user is sending the $TermClass in the second argument
|
28 |
$TermClass = $maybe_args;
|
lib/Timber.php
CHANGED
@@ -35,7 +35,7 @@ use Timber\Loader;
|
|
35 |
*/
|
36 |
class Timber {
|
37 |
|
38 |
-
public static $version = '1.1.
|
39 |
public static $locations;
|
40 |
public static $dirname = 'views';
|
41 |
public static $twig_cache = false;
|
@@ -56,7 +56,7 @@ class Timber {
|
|
56 |
$this->test_compatibility();
|
57 |
$this->backwards_compatibility();
|
58 |
$this->init_constants();
|
59 |
-
$this
|
60 |
}
|
61 |
}
|
62 |
|
@@ -103,12 +103,12 @@ class Timber {
|
|
103 |
/**
|
104 |
* @codeCoverageIgnore
|
105 |
*/
|
106 |
-
protected function init() {
|
107 |
if ( class_exists('\WP') && !defined('TIMBER_LOADED') ) {
|
108 |
Twig::init();
|
109 |
ImageHelper::init();
|
110 |
Admin::init();
|
111 |
-
|
112 |
define('TIMBER_LOADED', true);
|
113 |
}
|
114 |
}
|
@@ -225,7 +225,7 @@ class Timber {
|
|
225 |
*/
|
226 |
public static function get_context() {
|
227 |
if ( empty(self::$context_cache) ) {
|
228 |
-
self::$context_cache['http_host'] =
|
229 |
self::$context_cache['wp_title'] = Helper::get_wp_title();
|
230 |
self::$context_cache['wp_head'] = Helper::function_wrapper('wp_head');
|
231 |
self::$context_cache['wp_footer'] = Helper::function_wrapper('wp_footer');
|
@@ -252,7 +252,7 @@ class Timber {
|
|
252 |
* @api
|
253 |
* @param array $filenames
|
254 |
* @param array $data
|
255 |
-
* @param
|
256 |
* @param string $cache_mode
|
257 |
* @param bool $via_render
|
258 |
* @return bool|string
|
@@ -324,9 +324,9 @@ class Timber {
|
|
324 |
* @api
|
325 |
* @param array $filenames
|
326 |
* @param array $data
|
327 |
-
* @param
|
328 |
* @param string $cache_mode
|
329 |
-
* @return
|
330 |
*/
|
331 |
public static function render( $filenames, $data = array(), $expires = false, $cache_mode = Loader::CACHE_USE_DEFAULT ) {
|
332 |
$output = self::fetch($filenames, $data, $expires, $cache_mode);
|
35 |
*/
|
36 |
class Timber {
|
37 |
|
38 |
+
public static $version = '1.1.3';
|
39 |
public static $locations;
|
40 |
public static $dirname = 'views';
|
41 |
public static $twig_cache = false;
|
56 |
$this->test_compatibility();
|
57 |
$this->backwards_compatibility();
|
58 |
$this->init_constants();
|
59 |
+
$this::init();
|
60 |
}
|
61 |
}
|
62 |
|
103 |
/**
|
104 |
* @codeCoverageIgnore
|
105 |
*/
|
106 |
+
protected static function init() {
|
107 |
if ( class_exists('\WP') && !defined('TIMBER_LOADED') ) {
|
108 |
Twig::init();
|
109 |
ImageHelper::init();
|
110 |
Admin::init();
|
111 |
+
Integrations::init();
|
112 |
define('TIMBER_LOADED', true);
|
113 |
}
|
114 |
}
|
225 |
*/
|
226 |
public static function get_context() {
|
227 |
if ( empty(self::$context_cache) ) {
|
228 |
+
self::$context_cache['http_host'] = 'http://'.URLHelper::get_host();
|
229 |
self::$context_cache['wp_title'] = Helper::get_wp_title();
|
230 |
self::$context_cache['wp_head'] = Helper::function_wrapper('wp_head');
|
231 |
self::$context_cache['wp_footer'] = Helper::function_wrapper('wp_footer');
|
252 |
* @api
|
253 |
* @param array $filenames
|
254 |
* @param array $data
|
255 |
+
* @param bool $expires
|
256 |
* @param string $cache_mode
|
257 |
* @param bool $via_render
|
258 |
* @return bool|string
|
324 |
* @api
|
325 |
* @param array $filenames
|
326 |
* @param array $data
|
327 |
+
* @param bool $expires
|
328 |
* @param string $cache_mode
|
329 |
+
* @return bool|string
|
330 |
*/
|
331 |
public static function render( $filenames, $data = array(), $expires = false, $cache_mode = Loader::CACHE_USE_DEFAULT ) {
|
332 |
$output = self::fetch($filenames, $data, $expires, $cache_mode);
|
lib/Twig.php
CHANGED
@@ -61,8 +61,6 @@ class Twig {
|
|
61 |
$twig->addFilter(new \Twig_SimpleFilter('wpautop', 'wpautop'));
|
62 |
$twig->addFilter(new \Twig_SimpleFilter('list', array($this, 'add_list_separators')));
|
63 |
|
64 |
-
$twig->addFilter(new \Twig_SimpleFilter('pluck', array('Timber\Helper', 'pluck')));
|
65 |
-
|
66 |
$twig->addFilter(new \Twig_SimpleFilter('relative', function( $link ) {
|
67 |
return URLHelper::get_rel_url($link, true);
|
68 |
} ));
|
61 |
$twig->addFilter(new \Twig_SimpleFilter('wpautop', 'wpautop'));
|
62 |
$twig->addFilter(new \Twig_SimpleFilter('list', array($this, 'add_list_separators')));
|
63 |
|
|
|
|
|
64 |
$twig->addFilter(new \Twig_SimpleFilter('relative', function( $link ) {
|
65 |
return URLHelper::get_rel_url($link, true);
|
66 |
} ));
|
lib/URLHelper.php
CHANGED
@@ -10,7 +10,10 @@ class URLHelper {
|
|
10 |
* @return string
|
11 |
*/
|
12 |
public static function get_current_url() {
|
13 |
-
$pageURL =
|
|
|
|
|
|
|
14 |
if ( isset($_SERVER["SERVER_PORT"]) && $_SERVER["SERVER_PORT"] && $_SERVER["SERVER_PORT"] != "80" ) {
|
15 |
$pageURL .= self::get_host().":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
|
16 |
} else {
|
@@ -19,17 +22,6 @@ class URLHelper {
|
|
19 |
return $pageURL;
|
20 |
}
|
21 |
|
22 |
-
/**
|
23 |
-
*
|
24 |
-
* Get url scheme
|
25 |
-
* @return string
|
26 |
-
*/
|
27 |
-
public static function get_scheme()
|
28 |
-
{
|
29 |
-
return isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http';
|
30 |
-
}
|
31 |
-
|
32 |
-
|
33 |
/**
|
34 |
*
|
35 |
*
|
10 |
* @return string
|
11 |
*/
|
12 |
public static function get_current_url() {
|
13 |
+
$pageURL = "http://";
|
14 |
+
if ( isset($_SERVER['HTTPS']) && $_SERVER["HTTPS"] == "on" ) {
|
15 |
+
$pageURL = "https://"; ;
|
16 |
+
}
|
17 |
if ( isset($_SERVER["SERVER_PORT"]) && $_SERVER["SERVER_PORT"] && $_SERVER["SERVER_PORT"] != "80" ) {
|
18 |
$pageURL .= self::get_host().":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
|
19 |
} else {
|
22 |
return $pageURL;
|
23 |
}
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
/**
|
26 |
*
|
27 |
*
|
lib/User.php
CHANGED
@@ -203,7 +203,7 @@ class User extends Core implements CoreInterface {
|
|
203 |
* @return string the human-friendly name of the user (ex: "Buster Bluth")
|
204 |
*/
|
205 |
public function name() {
|
206 |
-
return
|
207 |
}
|
208 |
|
209 |
/**
|
203 |
* @return string the human-friendly name of the user (ex: "Buster Bluth")
|
204 |
*/
|
205 |
public function name() {
|
206 |
+
return $this->display_name;
|
207 |
}
|
208 |
|
209 |
/**
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: jarednova, connorjburton, lggorman
|
3 |
Tags: template engine, templates, twig
|
4 |
Requires at least: 3.7
|
5 |
-
Stable tag: 1.1.
|
6 |
-
Tested up to: 4.
|
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,15 +41,7 @@ Timber is great for any WordPress developer who cares about writing good, mainta
|
|
41 |
|
42 |
== Changelog ==
|
43 |
|
44 |
-
= 1.1.4 =
|
45 |
-
* Native support for Co-Authors Plus! just use `{{ post.authors }}` 939331e282fd54bf3e210645964504304f2b071b
|
46 |
-
* New filter to enable PW propmpt for PW protected posts (`timber/post/content/show_password_form_for_protected`) 0f9b20ec90b34059634c25bc27671875c18f8fcb
|
47 |
-
* New filter for custom loaders (`timber/loader/custom`) (thanks @tnottu!) 9097984a7c3df23068056d7835465e0690338567
|
48 |
-
* Fixed some updating bugs with 4.6 (thanks @daronspence) 16b8bd71571be71b298e6306abe2cd4b95d8c9e8
|
49 |
-
* You can now count Query results (thanks Evan Mattson) 141624a0ac18d9dcce62a2a681134009a2b79814
|
50 |
-
|
51 |
= 1.1.3 =
|
52 |
-
* New escapers! (thanks @matgargano) c7e8ed34da6fcd13bdc9005c04045f3a6b33595b
|
53 |
* Fix to how categories work in Timber::get_posts 49f6007db3f829097f82ed41d389dd39053fb84a
|
54 |
* Fix to usage of class maps in Timber::get_posts (thanks @vilpersson) b1387e443850aa021a0a70203bc20d238d4b21cb
|
55 |
* Added Post::password_required method (thanks @marclarr) 2e685ce3d05c50e879817e51256202e032e77122
|
2 |
Contributors: jarednova, connorjburton, lggorman
|
3 |
Tags: template engine, templates, twig
|
4 |
Requires at least: 3.7
|
5 |
+
Stable tag: 1.1.3
|
6 |
+
Tested up to: 4.5.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 |
|
42 |
== Changelog ==
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
= 1.1.3 =
|
|
|
45 |
* Fix to how categories work in Timber::get_posts 49f6007db3f829097f82ed41d389dd39053fb84a
|
46 |
* Fix to usage of class maps in Timber::get_posts (thanks @vilpersson) b1387e443850aa021a0a70203bc20d238d4b21cb
|
47 |
* Added Post::password_required method (thanks @marclarr) 2e685ce3d05c50e879817e51256202e032e77122
|
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.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 Twig templates.
|
5 |
Plugin URI: http://timber.upstatement.com
|
6 |
Author: Jared Novack + Upstatement
|
7 |
+
Version: 1.1.3
|
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 ComposerAutoloaderInitb2a2afc28c48ff677ab21764a619bb60::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 ComposerAutoloaderInit6fd1e70a55055dbbade2a373bb243cbf
|
|
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 ComposerAutoloaderInitb2a2afc28c48ff677ab21764a619bb60
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInitb2a2afc28c48ff677ab21764a619bb60', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitb2a2afc28c48ff677ab21764a619bb60', 'loadClassLoader'));
|
25 |
|
26 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
27 |
foreach ($map as $namespace => $path) {
|