SN/T dont send linked @-names when we dont send linked #-tags

This commit is contained in:
Tobias Diekershoff 2012-05-15 11:23:39 +02:00
parent c79102cdb5
commit 80f5c5bbe0
4 changed files with 8 additions and 2 deletions

Binary file not shown.

View file

@ -342,7 +342,7 @@ function statusnet_settings(&$a,&$s) {
$s .= '<label id="statusnet-default-label" for="statusnet-default">'. t('Send public postings to StatusNet by default') .'</label>';
$s .= '<input id="statusnet-default" type="checkbox" name="statusnet-default" value="1" ' . $defchecked . '/>';
$s .= '<div class="clear"></div>';
$s .= '<label id="statusnet-sendtaglinks-label" for="statusnet-sendtaglinks">'.t('Send #tag links to StatusNet').'</label>';
$s .= '<label id="statusnet-sendtaglinks-label" for="statusnet-sendtaglinks">'.t('Send linked #-tags and @-names to StatusNet').'</label>';
$s .= '<input id="statusnet-sendtaglinks" type="checkbox" name="statusnet-sendtaglinks" value="1" '. $linkschecked . '/>';
$s .= '</div><div class="clear"></div>';
@ -453,7 +453,10 @@ function statusnet_post_hook(&$a,&$b) {
// that is, don't send if the option is not set in the
// connector settings
if ($linksenabled=='0') {
// #-tags
$tmp = preg_replace( '/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '#$2', $tmp);
// @-mentions
$tmp = preg_replace( '/@\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '@$2', $tmp);
}
// preserve links to webpages
$tmp = preg_replace( '/\[url\=(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)\](\w+.*?)\[\/url\]/i', '$2 $1', $tmp);

Binary file not shown.

View file

@ -198,7 +198,7 @@ function twitter_settings(&$a,&$s) {
$s .= '<label id="twitter-default-label" for="twitter-default">'. t('Send public postings to Twitter by default') .'</label>';
$s .= '<input id="twitter-default" type="checkbox" name="twitter-default" value="1" ' . $defchecked . '/>';
$s .= '<div class="clear"></div>';
$s .= '<label id="twitter-sendtaglinks-label" for="twitter-sendtaglinks">'.t('Send #tag links to Twitter').'</label>';
$s .= '<label id="twitter-sendtaglinks-label" for="twitter-sendtaglinks">'.t('Send linked #-tags and @-names to Twitter').'</label>';
$s .= '<input id="twitter-sendtaglinks" type="checkbox" name="twitter-sendtaglinks" value="1" '. $linkschecked . '/>';
$s .= '</div><div class="clear"></div>';
@ -319,7 +319,10 @@ function twitter_post_hook(&$a,&$b) {
// that is, don't send if the option is not set in the
// connector settings
if ($linksenabled=='0') {
// #-tags
$tmp = preg_replace( '/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '#$2', $tmp);
// @-mentions
$tmp = preg_replace( '/@\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '@$2', $tmp);
}
$tmp = preg_replace( '/\[url\=(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)\](\w+.*?)\[\/url\]/i', '$2 $1', $tmp);
$tmp = preg_replace( '/\[bookmark\=(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)\](\w+.*?)\[\/bookmark\]/i', '$2 $1', $tmp);