function twitter_dialog($link, $text) { if (mb_strlen($text, 'utf-8') > 140) { $key = create_snippet($link, $text); $shorturl = new ShortUrl(); $snippet_url = $shorturl->create(get_self_url_prefix() . '/snippet.php?key=' . $key, 'isgd'); $tweet = truncate_string($text, 90) . " {$snippet_url}"; } else { $tweet = $text; } $counter = 140 - mb_strlen($tweet, 'utf-8'); ?> <div id="infoBoxTitle"><?php echo __("Send Tweet"); ?> </div> <div class="infoBoxContents"> <div id="mini-notice" style='display : none'> </div> <form id="new_tweet_form" onsubmit="return false;"> <input type="hidden" name="op" value="send-tweet"/> <div class="dlgSec"><?php echo __("Your tweet:"); ?> </div> <textarea onkeyup="tweet_update_counter(this)" name="text" class="tweet-text"><?php echo $tweet; ?> </textarea><p> <?php if ($snippet_url) { ?> <div class="dlgSec"><?php echo __("Full IRC snippet:"); ?> </div> <textarea disabled="1" class="tweet-snippet"><?php echo $text; ?> </textarea><p> <?php } ?> <div class="dlgButtons"> <div style='float : left'> <input id="tweet-dlg-counter" disabled="1" name="counter" value="<?php echo $counter; ?> "> </div> <button type="submit" onclick="tweet_selection_do()"><?php echo __('Tweet this!'); ?> </button> <button type="submit" onclick="close_infobox()"><?php echo __('Cancel'); ?> </button></div> </div> </form> </div> <?php }