mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-19 21:43:42 +00:00
Merge pull request #982 from annando/bbcode-constants
Replacing numberic values with constants for the BBCode conversion
This commit is contained in:
commit
5688629a4b
5 changed files with 12 additions and 12 deletions
|
@ -526,7 +526,7 @@ function pumpio_send(App $a, array &$b)
|
||||||
if ($oauth_token && $oauth_token_secret) {
|
if ($oauth_token && $oauth_token_secret) {
|
||||||
$title = trim($b['title']);
|
$title = trim($b['title']);
|
||||||
|
|
||||||
$content = BBCode::convert($b['body'], false, 4);
|
$content = BBCode::convert($b['body'], false, BBCode::CONNECTORS);
|
||||||
|
|
||||||
$params = [];
|
$params = [];
|
||||||
|
|
||||||
|
|
|
@ -424,7 +424,7 @@ function tumblr_send(App $a, array &$b) {
|
||||||
switch ($siteinfo["type"]) {
|
switch ($siteinfo["type"]) {
|
||||||
case "photo":
|
case "photo":
|
||||||
$params['type'] = "photo";
|
$params['type'] = "photo";
|
||||||
$params['caption'] = BBCode::convert($body, false, 4);
|
$params['caption'] = BBCode::convert($body, false, BBCode::CONNECTORS);
|
||||||
|
|
||||||
if (isset($siteinfo["url"])) {
|
if (isset($siteinfo["url"])) {
|
||||||
$params['link'] = $siteinfo["url"];
|
$params['link'] = $siteinfo["url"];
|
||||||
|
@ -437,25 +437,25 @@ function tumblr_send(App $a, array &$b) {
|
||||||
$params['type'] = "link";
|
$params['type'] = "link";
|
||||||
$params['title'] = $title;
|
$params['title'] = $title;
|
||||||
$params['url'] = $siteinfo["url"];
|
$params['url'] = $siteinfo["url"];
|
||||||
$params['description'] = BBCode::convert($body, false, 4);
|
$params['description'] = BBCode::convert($body, false, BBCode::CONNECTORS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "audio":
|
case "audio":
|
||||||
$params['type'] = "audio";
|
$params['type'] = "audio";
|
||||||
$params['external_url'] = $siteinfo["url"];
|
$params['external_url'] = $siteinfo["url"];
|
||||||
$params['caption'] = BBCode::convert($body, false, 4);
|
$params['caption'] = BBCode::convert($body, false, BBCode::CONNECTORS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "video":
|
case "video":
|
||||||
$params['type'] = "video";
|
$params['type'] = "video";
|
||||||
$params['embed'] = $siteinfo["url"];
|
$params['embed'] = $siteinfo["url"];
|
||||||
$params['caption'] = BBCode::convert($body, false, 4);
|
$params['caption'] = BBCode::convert($body, false, BBCode::CONNECTORS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$params['type'] = "text";
|
$params['type'] = "text";
|
||||||
$params['title'] = $title;
|
$params['title'] = $title;
|
||||||
$params['body'] = BBCode::convert($b['body'], false, 4);
|
$params['body'] = BBCode::convert($b['body'], false, BBCode::CONNECTORS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ function tumblr_send(App $a, array &$b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($params['caption']) && !empty($siteinfo["description"])) {
|
if (empty($params['caption']) && !empty($siteinfo["description"])) {
|
||||||
$params['caption'] = BBCode::convert("[quote]" . $siteinfo["description"] . "[/quote]", false, 4);
|
$params['caption'] = BBCode::convert("[quote]" . $siteinfo["description"] . "[/quote]", false, BBCode::CONNECTORS);
|
||||||
}
|
}
|
||||||
|
|
||||||
$consumer_key = DI::config()->get('tumblr','consumer_key');
|
$consumer_key = DI::config()->get('tumblr','consumer_key');
|
||||||
|
|
|
@ -624,7 +624,7 @@ function twitter_post_hook(App $a, array &$b)
|
||||||
|
|
||||||
$b['body'] = twitter_update_mentions($b['body']);
|
$b['body'] = twitter_update_mentions($b['body']);
|
||||||
|
|
||||||
$msgarr = ItemContent::getPlaintextPost($b, $max_char, true, 8);
|
$msgarr = ItemContent::getPlaintextPost($b, $max_char, true, BBCode::TWITTER);
|
||||||
Logger::info('Got plaintext', ['id' => $b['id'], 'message' => $msgarr]);
|
Logger::info('Got plaintext', ['id' => $b['id'], 'message' => $msgarr]);
|
||||||
$msg = $msgarr["text"];
|
$msg = $msgarr["text"];
|
||||||
|
|
||||||
|
@ -854,7 +854,7 @@ function twitter_prepare_body(App $a, array &$b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$msgarr = ItemContent::getPlaintextPost($item, $max_char, true, 8);
|
$msgarr = ItemContent::getPlaintextPost($item, $max_char, true, BBCode::TWITTER);
|
||||||
$msg = $msgarr["text"];
|
$msg = $msgarr["text"];
|
||||||
|
|
||||||
if (isset($msgarr["url"]) && ($msgarr["type"] != "photo")) {
|
if (isset($msgarr["url"]) && ($msgarr["type"] != "photo")) {
|
||||||
|
|
|
@ -214,7 +214,7 @@ function windowsphonepush_cron()
|
||||||
if (substr($body, 0, 4) == "[url") {
|
if (substr($body, 0, 4) == "[url") {
|
||||||
$body = "URL/Image ...";
|
$body = "URL/Image ...";
|
||||||
} else {
|
} else {
|
||||||
$body = BBCode::convert($body, false, 2, true);
|
$body = BBCode::convert($body, false, BBCode::API, true);
|
||||||
$body = HTML::toPlaintext($body, 0);
|
$body = HTML::toPlaintext($body, 0);
|
||||||
$body = ((strlen($body) > 137) ? substr($body, 0, 137) . "..." : $body);
|
$body = ((strlen($body) > 137) ? substr($body, 0, 137) . "..." : $body);
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ function wppost_settings_post(&$a,&$b) {
|
||||||
DI::pConfig()->set(local_user(),'wppost','backlink',trim($_POST['wp_backlink'] ?? ''));
|
DI::pConfig()->set(local_user(),'wppost','backlink',trim($_POST['wp_backlink'] ?? ''));
|
||||||
DI::pConfig()->set(local_user(),'wppost','shortcheck',trim($_POST['wp_shortcheck']));
|
DI::pConfig()->set(local_user(),'wppost','shortcheck',trim($_POST['wp_shortcheck']));
|
||||||
$wp_backlink_text = Strings::escapeTags(trim($_POST['wp_backlink_text']));
|
$wp_backlink_text = Strings::escapeTags(trim($_POST['wp_backlink_text']));
|
||||||
$wp_backlink_text = BBCode::convert($wp_backlink_text, false, 8);
|
$wp_backlink_text = BBCode::convert($wp_backlink_text, false, BBCode::BACKLINK);
|
||||||
$wp_backlink_text = HTML::toPlaintext($wp_backlink_text, 0, true);
|
$wp_backlink_text = HTML::toPlaintext($wp_backlink_text, 0, true);
|
||||||
DI::pConfig()->set(local_user(),'wppost','wp_backlink_text', $wp_backlink_text);
|
DI::pConfig()->set(local_user(),'wppost','wp_backlink_text', $wp_backlink_text);
|
||||||
}
|
}
|
||||||
|
@ -302,7 +302,7 @@ function wppost_send(&$a, &$b)
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = '<title>' . (($wptitle) ? $wptitle : DI::l10n()->t('Post from Friendica')) . '</title>';
|
$title = '<title>' . (($wptitle) ? $wptitle : DI::l10n()->t('Post from Friendica')) . '</title>';
|
||||||
$post = BBCode::convert($b['body'], false, 4);
|
$post = BBCode::convert($b['body'], false, BBCode::CONNECTORS);
|
||||||
|
|
||||||
// If a link goes to youtube then remove the stuff around it. Wordpress detects youtube links and embeds it
|
// If a link goes to youtube then remove the stuff around it. Wordpress detects youtube links and embeds it
|
||||||
$post = preg_replace('/<a.*?href="(https?:\/\/www.youtube.com\/.*?)".*?>(.*?)<\/a>/ism',"\n$1\n",$post);
|
$post = preg_replace('/<a.*?href="(https?:\/\/www.youtube.com\/.*?)".*?>(.*?)<\/a>/ism',"\n$1\n",$post);
|
||||||
|
|
Loading…
Reference in a new issue