Timber - Version 0.20.3

Version Description

Download this release

Release Info

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

Code changes from version 0.20.2 to 0.20.3

functions/timber-menu-item.php CHANGED
@@ -30,7 +30,7 @@ class TimberMenuItem extends TimberCore implements TimberCoreInterface {
30
  $this->add_class( 'menu-item-' . $this->ID );
31
  $this->menu_object = $data;
32
  if ( isset( $this->url ) && $this->url ) {
33
- $this->url = untrailingslashit( $this->url );
34
  }
35
  }
36
 
@@ -94,10 +94,10 @@ class TimberMenuItem extends TimberCore implements TimberCoreInterface {
94
  if ( isset( $this->_menu_item_type ) && $this->_menu_item_type == 'custom' ) {
95
  $this->url = $this->_menu_item_url;
96
  } else if ( isset( $this->menu_object ) && method_exists( $this->menu_object, 'get_link' ) ) {
97
- $this->url = untrailingslashit( $this->menu_object->get_link() );
98
  }
99
  }
100
- return untrailingslashit( $this->url );
101
  }
102
 
103
  /**
@@ -106,7 +106,7 @@ class TimberMenuItem extends TimberCore implements TimberCoreInterface {
106
  * @return string
107
  */
108
  function get_path() {
109
- return untrailingslashit( TimberURLHelper::get_rel_url( $this->get_link() ) );
110
  }
111
 
112
  /**
@@ -204,7 +204,7 @@ class TimberMenuItem extends TimberCore implements TimberCoreInterface {
204
  * @return string
205
  */
206
  public function path() {
207
- return untrailingslashit( $this->get_path() );
208
  }
209
 
210
  /**
30
  $this->add_class( 'menu-item-' . $this->ID );
31
  $this->menu_object = $data;
32
  if ( isset( $this->url ) && $this->url ) {
33
+ $this->url = TimberURLHelper::remove_trailing_slash( $this->url );
34
  }
35
  }
36
 
94
  if ( isset( $this->_menu_item_type ) && $this->_menu_item_type == 'custom' ) {
95
  $this->url = $this->_menu_item_url;
96
  } else if ( isset( $this->menu_object ) && method_exists( $this->menu_object, 'get_link' ) ) {
97
+ $this->url = $this->menu_object->get_link();
98
  }
99
  }
100
+ return TimberURLHelper::remove_trailing_slash( $this->url );
101
  }
102
 
103
  /**
106
  * @return string
107
  */
108
  function get_path() {
109
+ return TimberURLHelper::remove_trailing_slash( TimberURLHelper::get_rel_url( $this->get_link() ) );
110
  }
111
 
112
  /**
204
  * @return string
205
  */
206
  public function path() {
207
+ return $this->get_path();
208
  }
209
 
210
  /**
functions/timber-url-helper.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
 
3
- class TimberURLHelper
4
- {
5
 
6
  /**
7
  * @return string
@@ -59,10 +58,16 @@ class TimberURLHelper
59
  if (isset($url_info['host']) && $url_info['host'] != $_SERVER['HTTP_HOST'] && !$force) {
60
  return $url;
61
  }
62
- $link = $url_info['path'];
 
 
 
63
  if (isset($url_info['query']) && strlen($url_info['query'])) {
64
  $link .= '?' . $url_info['query'];
65
  }
 
 
 
66
  $link = TimberURLHelper::remove_double_slashes($link);
67
  return $link;
68
  }
@@ -160,6 +165,18 @@ class TimberURLHelper
160
  return false;
161
  }
162
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  /**
164
  * @param string $url
165
  * @param int $timeout
1
  <?php
2
 
3
+ class TimberURLHelper {
 
4
 
5
  /**
6
  * @return string
58
  if (isset($url_info['host']) && $url_info['host'] != $_SERVER['HTTP_HOST'] && !$force) {
59
  return $url;
60
  }
61
+ $link = '';
62
+ if (isset($url_info['path'])){
63
+ $link = $url_info['path'];
64
+ }
65
  if (isset($url_info['query']) && strlen($url_info['query'])) {
66
  $link .= '?' . $url_info['query'];
67
  }
68
+ if (isset($url_info['fragment']) && strlen($url_info['fragment'])) {
69
+ $link .= '#' . $url_info['fragment'];
70
+ }
71
  $link = TimberURLHelper::remove_double_slashes($link);
72
  return $link;
73
  }
165
  return false;
166
  }
167
 
168
+ /**
169
+ * Pass links through untrailingslashit unless they are a single /
170
+ *
171
+ * @param string $link
172
+ * @return string
173
+ */
174
+ public static function remove_trailing_slash($link) {
175
+ if ( $link != "/")
176
+ $link = untrailingslashit( $link );
177
+ return $link;
178
+ }
179
+
180
  /**
181
  * @param string $url
182
  * @param int $timeout
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: jarednova
3
  Tags: template engine, templates, twig
4
  Requires at least: 3.7
5
- Stable tag: 0.20.2
6
  Tested up to: 3.9.1
7
  PHP version: 5.3.0 or greater
8
  License: GPLv2 or later
@@ -41,7 +41,7 @@ Timber is great for any WordPress developer who cares about writing good, mainta
41
 
42
  == Changelog ==
43
 
44
- = 0.20.2
45
  * Change default response code on load_view to be 200
46
  * Fixed error with relpath and subdomains (thanks @jnweaver)
47
  * Various bug fixes (thanks @andyford, @discern)
2
  Contributors: jarednova
3
  Tags: template engine, templates, twig
4
  Requires at least: 3.7
5
+ Stable tag: 0.20.3
6
  Tested up to: 3.9.1
7
  PHP version: 5.3.0 or greater
8
  License: GPLv2 or later
41
 
42
  == Changelog ==
43
 
44
+ = 0.20.2 =
45
  * Change default response code on load_view to be 200
46
  * Fixed error with relpath and subdomains (thanks @jnweaver)
47
  * Various bug fixes (thanks @andyford, @discern)
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.20.2
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.20.3
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 ComposerAutoloaderInit06b3e892971e1bc7ad59039b3f146658::getLoader();
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit1e4b722ec62306aebdca8ad5ad1beeb2::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit06b3e892971e1bc7ad59039b3f146658
6
  {
7
  private static $loader;
8
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit06b3e892971e1bc7ad59039b3f146658
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit06b3e892971e1bc7ad59039b3f146658', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit06b3e892971e1bc7ad59039b3f146658', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(__DIR__);
27
  $baseDir = dirname($vendorDir);
@@ -47,7 +47,7 @@ class ComposerAutoloaderInit06b3e892971e1bc7ad59039b3f146658
47
  }
48
  }
49
 
50
- function composerRequire06b3e892971e1bc7ad59039b3f146658($file)
51
  {
52
  require $file;
53
  }
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit1e4b722ec62306aebdca8ad5ad1beeb2
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit1e4b722ec62306aebdca8ad5ad1beeb2', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit1e4b722ec62306aebdca8ad5ad1beeb2', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(__DIR__);
27
  $baseDir = dirname($vendorDir);
47
  }
48
  }
49
 
50
+ function composerRequire1e4b722ec62306aebdca8ad5ad1beeb2($file)
51
  {
52
  require $file;
53
  }