public function string_expand($str) { if ($urls = Url_Shortner::find_urls($str)) { foreach ($urls as $url) { $this->clean(); $this->add_options(array('shortUrl' => $url)); $this->set_method('expand'); $data = $this->execute(); $hash = str_replace($this->config['domain'], '', $url); $str = str_replace($url, $data->results->{$hash}->longUrl, $str); } } return $str; }