123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- if (!defined('STATUSNET') && !defined('LACONICA')) {
- exit(1);
- }
- class ShortenAction extends Action
- {
- private $text;
- function prepare($args)
- {
- parent::prepare($args);
- $this->groups=array();
- $this->users=array();
- $this->text = $this->arg('text');
- if(is_null($this->text)){
-
- throw new ClientException(_m('"text" argument must be specified.'));
- }
- return true;
- }
- function handle($args=null)
- {
- parent::handle($args);
- header('Content-Type: text/plain');
- $shortened_text = common_shorten_links($this->text);
- print $shortened_text;
- }
- }
|