It would be better not to assume that the 2nd parameter to simplepie_get is relative to file_directory_path(). The main reason is that you can't use:

   simplepie_get($url,simplepie_get_cache_location(),$cache_time);
 

which means you have to call variable_get('simplepie_cache_location') from your own code.

Comments

Freso’s picture

Version: 6.x-1.0-beta1 » 6.x-1.x-dev

Hm. I think I agree with you... but. I don't immediately see how to check whether the given path is relative or absolute. I see a few options here:

  1. Simply make the default argument NULL; that would trigger the else, which sets the cache location to simplepie_get_cache_location().
  2. Replace the current arguments, with an array argument. It would be trivial to add a "location relative to files dir" option then.

For this particular use case, you could use simplepie_get($url, NULL, $cache_time), I'm also mostly leaning towards replacing the default with that.

daph2001’s picture

It's a good solution - I now use NULL.