Permalink
Browse files

Ensure that constructor passing still works

Deprecate, rather than remove. This should work in a
backwards-compatible way.
  • Loading branch information...
1 parent 800aada commit bc3ae79c9e990510a77eb474916c1af1a8734da4 @rmccue rmccue committed Oct 30, 2012
Showing with 13 additions and 1 deletion.
  1. +13 −1 library/SimplePie.php
View
@@ -636,7 +636,19 @@ public function __construct()
if (func_num_args() > 0)
{
- trigger_error('Passing parameters to the constructor is no longer supported. Please use set_feed_url(), set_cache_location(), and set_cache_location() directly.');
+ $level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
+ trigger_error('Passing parameters to the constructor is no longer supported. Please use set_feed_url(), set_cache_location(), and set_cache_location() directly.', $level);
+
+ $args = func_get_args();
+ switch (count($args)) {
+ case 3:
+ $this->set_cache_duration($args[2]);
+ case 2:
+ $this->set_cache_location($args[1]);
+ case 1:
+ $this->set_feed_url($args[0]);
+ $this->init();
+ }
}
}

0 comments on commit bc3ae79

Please sign in to comment.