示例#1
0
 public static function update_status($str)
 {
     $bitly = new Url_Shortner(array("login" => ORM::factory('setting', 'bitly_login')->value, "key" => ORM::factory('setting', 'bitly_api')->value));
     $str = $bitly->string_shorten($str);
     $twitter = Twitter::instance(ORM::factory('setting', 'twitter_username')->value, ORM::factory('setting', 'twitter_password')->value);
     $twitter->update_status($str);
 }
 public function __construct()
 {
     parent::__construct();
     $this->shortner = Url_Shortner::factory();
 }
示例#3
0
 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;
 }