Permalink
Browse files

Merge branch 'release/1.19'

* release/1.19:
  Update changelog
  Bump version to v1.19
  Add getter for cache_path
  Added more twig extension functions.
  Add Katsuma Ito to contributers
  Make asset urls scheme-relative, to avoid http/https issues.
  Prevent glob() from including folders
  Remove commented-out line
  Remove duplicate from contributers
  • Loading branch information...
2 parents 91fd9a3 + 9704838 commit 1c169c8495d53ec7b85e6dff0ac2f0a5bd038dbc @canton7 committed Sep 12, 2012
View
2 bootstrap.php
@@ -4,7 +4,7 @@
* Casset: Convenient asset library for FuelPHP.
*
* @package Casset
- * @version v1.18
+ * @version v1.19
* @author Antony Male
* @license MIT License
* @copyright 2012 Antony Male
View
6 changelog.md
@@ -3,6 +3,12 @@ Changelog
This file lists the important changes between versions. For a list of minor changes, check the log.
+v1.19
+-----
+ - Prevent globs from matching folders
+ - $asset_url is, by default, scheme-relative. You'll have to update your config/casset.php to benefit though (see the new default)
+ - More twig extension functions (add_css, add_js)
+
v1.18
-----
- Add a new CSS URI rewriting algorithm ('relative'), which should fix the problems with using the (original) absolute rewriting with a symlinked docroot.
View
18 classes/casset.php
@@ -4,7 +4,7 @@
* Casset: Convenient asset library for FuelPHP.
*
* @package Casset
- * @version v1.18
+ * @version v1.19
* @author Antony Male
* @license MIT License
* @copyright 2012 Antony Male
@@ -139,7 +139,10 @@ public static function _init()
\Config::load('casset', true);
- static::$asset_url = \Config::get('casset.url', \Config::get('base_url'));
+ static::$asset_url = \Config::get('casset.url');
+ if (!static::$asset_url)
+ static::$asset_url = preg_replace('#^https?://#','//', \Uri::base(false));
+ static::$asset_url = rtrim(static::$asset_url, '/') . '/';
static::$default_folders = array(
'css' => \Config::get('casset.css_dir', static::$default_folders['css']),
@@ -192,6 +195,15 @@ public static function _init()
static::$initialized = true;
}
+ /**
+ * Getter for cache_path
+ *
+ * @return string
+ */
+ public static function get_cache_path() {
+ return static::$cache_path;
+ }
+
/**
* Sets up options for new groups setup via casset/config.php.
@@ -956,7 +968,7 @@ protected static function find_files($file, $asset_type)
}
else
{
- $glob_files = glob($path.$folder.$file);
+ $glob_files = array_filter(glob($path.$folder.$file), 'is_file');
if (!$glob_files || !count($glob_files))
throw new Casset_Exception("Found no files matching $path$folder$file");
return $glob_files;
View
6 classes/casset/addons/twig.php
@@ -4,7 +4,7 @@
* Casset: Convenient asset library for FuelPHP.
*
* @package Casset
- * @version v1.18
+ * @version v1.19
* @author Antony Male
* @author Derek Myers
* @license MIT License
@@ -38,7 +38,9 @@ public function getFunctions()
'render_css' => new \Twig_Function_Function('Casset::render_css'),
'render_js' => new \Twig_Function_Function('Casset::render_js'),
'img' => new \Twig_Function_Function('Casset::img'),
- 'img_url' => new \Twig_Function_Function('Casset::get_filepath_img')
+ 'img_url' => new \Twig_Function_Function('Casset::get_filepath_img'),
+ 'add_css' => new \Twig_Function_Function('Casset::css'),
+ 'add_js' => new \Twig_Function_Function('Casset::js'),
);
}
}
View
2 classes/casset/csscompressor.php
@@ -17,7 +17,7 @@
* This library is used as part of Casset.
*
* @package Casset
- * @version v1.18
+ * @version v1.19
* @author Antony Male
* @license MIT License
* @link http://github.com/canton7/fuelphp-casset
View
2 classes/casset/cssurirewriter.php
@@ -10,7 +10,7 @@
* This library is used as part of Casset.
*
* @package Casset
- * @version v1.18
+ * @version v1.19
* @author Antony Male
* @license MIT License
* @link http://github.com/canton7/fuelphp-casset
View
4 classes/casset/cssurirewriterrelative.php
@@ -4,7 +4,7 @@
* This library is used as part of Casset.
*
* @package Casset
- * @version v1.18
+ * @version v1.19
* @author Antony Male
* @license MIT License
* @link http://github.com/canton7/fuelphp-casset
@@ -39,8 +39,6 @@ public static function rewrite_css($css, $before_dir, $after_dir) {
// then back into the dir the file was in before
$rel = str_repeat('../', substr_count($after_dir, '/')) . $before_dir;
- // return $css;
-
$css = preg_replace_callback(static::PATTERN, function($m) use ($rel) {
list($match, $type, $quote, $url) = $m;
if (strpos($url, 'data:') === 0 || strpos($url, '://') !== false)
View
2 classes/casset/jsmin.php
@@ -52,7 +52,7 @@
/**
* This library is used as part of Casset.
* @package Casset
- * @version v1.18
+ * @version v1.19
* @author Antony Male
* @license MIT License
* @link http://github.com/canton7/fuelphp-casset
View
10 config/casset.php
@@ -3,7 +3,7 @@
* Casset: Convenient asset library for FuelPHP.
*
* @package Casset
- * @version v1.18
+ * @version v1.19
* @author Antony Male
* @license MIT License
* @copyright 2012 Antony Male
@@ -42,12 +42,10 @@
),
/**
- * URL to your Fuel root. Typically this will be your base URL,
- * WITH a trailing slash:
- *
- * Config::get('base_url')
+ * URL to your Fuel root. If null/falsy, this will default to Uri::base(false),
+ * but will be scheme-relative (starts with '//').
*/
- 'url' => Config::get('base_url'),
+ 'url' => null,
/**
* Asset Sub-folders
View
2 readme.md
@@ -947,7 +947,6 @@ Thanks
The following people have helped Casset become what it is, so thank you!
- - [Peter Wigger](http://fuelphp.com/user/383)
- [ShonM](https://github.com/shonm)
- [Lee Overy](https://github.com/leekudos)
- [Chris Meller](https://github.com/chrismeller)
@@ -957,6 +956,7 @@ The following people have helped Casset become what it is, so thank you!
- [Derek Myers](https://github.com/dmyers)
- [Ian Turgeon](https://github.com/iturgeon)
- [Peter Wiggers](https://github.com/pwwebdev)
+ - [Katsuma Ito](katsumai@gmail.com)
Contributing
------------

0 comments on commit 1c169c8

Please sign in to comment.