ashishkranjan / dabr

Automatically exported from code.google.com/p/dabr
0 stars 0 forks source link

add 140-char auto trim #117

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What would you like dabr to do?
Add 140-char auto trim feature to dabr

here is my simple solution:
find in /common/twitter.php:

function twitter_update() {
  twitter_ensure_post_action();
  $status = twitter_url_shorten(stripslashes(trim($_POST['status'])));

add these lines after them:

  if (mb_strlen($status) > 140)
    $status = mb_substr($status, 0, 140, 'utf-8');

Original issue reported on code.google.com by felixonm...@gmail.com on 6 Feb 2010 at 3:27

GoogleCodeExporter commented 9 years ago
can also use tweetshrink if needed

$status = twitter_fetch("http://tweetshrink.com/shrink?format=string&text=" .
urlencode($status));

Original comment by ldoug...@gmail.com on 9 Feb 2010 at 4:52

GoogleCodeExporter commented 9 years ago
another idea is to split over multiple tweets using the wordwrap function I saw
mentioned elsewhere - also in post_status:

    if (strlen($status) > $limit){

    $status = explode("\r\n", wordwrap($status, $limit-10, "...\r\n"));
    $y = count($status);
        for ($x=0;$x<$y;$x++)
        $status[$x] .= sprintf(' (%d/%d)',$x+1,$y);
    } else {
    $status = array($status);

    }
    foreach ($status as $st){

        $request = 'http://twitter.com/statuses/update.json';

        $post_data = array('source' => 'dabr', 'status' => $st);

        $in_reply_to_id = (string) $_POST['in_reply_to_id'];

        if (is_numeric($in_reply_to_id)) {

            $post_data['in_reply_to_status_id'] = $in_reply_to_id;

        }

        if(!empty($_COOKIE['lat']) && !empty($_COOKIE['long'])){        

            $post_data['lat'] = $_COOKIE['lat'];

            $post_data['long'] = $_COOKIE['long'];

        }   

        $b = twitter_process($request, $post_data);
    }

Original comment by ldoug...@gmail.com on 9 Feb 2010 at 7:32

GoogleCodeExporter commented 9 years ago
Which browsers does this benefit? Just Opera Mini?

Everyone else should be notified about limits correctly

Original comment by david.carrington on 11 Feb 2010 at 10:59

GoogleCodeExporter commented 9 years ago
The idea was to allow flexibility when tweets run long. From what I've seen,
Ubertwitter uses Twitlonger and Brizzly does the multiple-tweet. and I've seen 
some
other web clients have a Tweetshrink option.

Original comment by ldoug...@gmail.com on 13 Feb 2010 at 6:49

GoogleCodeExporter commented 9 years ago
After I read issue 141, I know this will be not fixed. But, can someone help me 
how to merge API code from Kanvaso ( http://api.kanvaso.com/1/doc_update.php ) 
in Dabr?
I am not PHP developer, but I want to add that feature in my own application.
Thank You very much.

Original comment by adisp007 on 29 Nov 2010 at 3:27

GoogleCodeExporter commented 9 years ago
Kanvaso API documentation page has been update to make dabr work. Visit 
http://api.kanvaso.com/1/doc_update.php again. Thanks.

Original comment by Kanv...@gmail.com on 14 Apr 2011 at 8:55

GoogleCodeExporter commented 9 years ago
If a tweet is too long you should edit it down yourself. Auto cropping, 
splitting and 3rd party software as per issue 141 aren't preferred within dabr.

Original comment by ryancul...@gmail.com on 20 Mar 2013 at 12:36