Refactor bbcode() into BBCode::convert()
This commit is contained in:
parent
29f5270313
commit
0c52866693
21 changed files with 89 additions and 73 deletions
|
@ -2,6 +2,8 @@
|
|||
/**
|
||||
* @file mod/babel.php
|
||||
*/
|
||||
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\Markdown;
|
||||
use Friendica\Core\L10n;
|
||||
|
||||
|
@ -37,7 +39,7 @@ function babel_content()
|
|||
$o .= '<h2>' . L10n::t('Source input: ') . '</h2>' . EOL . EOL;
|
||||
$o .= visible_lf($text) . EOL . EOL;
|
||||
|
||||
$html = bbcode($text);
|
||||
$html = BBCode::convert($text);
|
||||
$o .= '<h2>' . L10n::t("bbcode \x28raw HTML\x28: ") . '</h2>' . EOL . EOL;
|
||||
$o .= htmlspecialchars($html) . EOL . EOL;
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\L10n;
|
||||
|
@ -646,11 +647,11 @@ function contacts_content(App $a)
|
|||
'$profileurllabel' => L10n::t('Profile URL'),
|
||||
'$profileurl' => $contact['url'],
|
||||
'$account_type' => Contact::getAccountType($contact),
|
||||
'$location' => bbcode($contact["location"]),
|
||||
'$location' => BBCode::convert($contact["location"]),
|
||||
'$location_label' => L10n::t("Location:"),
|
||||
'$xmpp' => bbcode($contact["xmpp"]),
|
||||
'$xmpp' => BBCode::convert($contact["xmpp"]),
|
||||
'$xmpp_label' => L10n::t("XMPP:"),
|
||||
'$about' => bbcode($contact["about"], false, false),
|
||||
'$about' => BBCode::convert($contact["about"], false),
|
||||
'$about_label' => L10n::t("About:"),
|
||||
'$keywords' => $contact["keywords"],
|
||||
'$keywords_label' => L10n::t("Tags:"),
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Protocol;
|
||||
|
@ -368,8 +369,8 @@ function display_content(App $a, $update = false, $update_uid = 0) {
|
|||
// Preparing the meta header
|
||||
require_once 'include/bbcode.php';
|
||||
require_once 'include/html2plain.php';
|
||||
$description = trim(html2plain(bbcode($s[0]["body"], false, false), 0, true));
|
||||
$title = trim(html2plain(bbcode($s[0]["title"], false, false), 0, true));
|
||||
$description = trim(html2plain(BBCode::convert($s[0]["body"], false), 0, true));
|
||||
$title = trim(html2plain(BBCode::convert($s[0]["title"], false), 0, true));
|
||||
$author_name = $s[0]["author-name"];
|
||||
|
||||
$image = $a->remove_baseurl($s[0]["author-thumb"]);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Smilies;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
|
@ -376,7 +377,7 @@ function message_content(App $a)
|
|||
|
||||
$from_name_e = $message['from-name'];
|
||||
$subject_e = $message['title'];
|
||||
$body_e = Smilies::replace(bbcode($message['body']));
|
||||
$body_e = Smilies::replace(BBCode::convert($message['body']));
|
||||
$to_name_e = $message['name'];
|
||||
|
||||
$contact = Contact::getDetailsByURL($message['from-url']);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\NotificationsManager;
|
||||
use Friendica\Core\System;
|
||||
|
@ -69,7 +70,7 @@ function notify_content(App $a)
|
|||
$notif_content .= replace_macros($not_tpl, [
|
||||
'$item_link' => System::baseUrl(true).'/notify/view/'. $it['id'],
|
||||
'$item_image' => $it['photo'],
|
||||
'$item_text' => strip_tags(bbcode($it['msg'])),
|
||||
'$item_text' => strip_tags(BBCode::convert($it['msg'])),
|
||||
'$item_when' => Temporal::getRelativeDate($it['date'])
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
|
@ -17,7 +18,6 @@ use Friendica\Model\Group;
|
|||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\Term;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Protocol\DFRN;
|
||||
|
@ -1411,7 +1411,7 @@ function photos_content(App $a)
|
|||
if (strlen($tag_str)) {
|
||||
$tag_str .= ', ';
|
||||
}
|
||||
$tag_str .= bbcode($t);
|
||||
$tag_str .= BBCode::convert($t);
|
||||
}
|
||||
$tags = [L10n::t('Tags: '), $tag_str];
|
||||
if ($cmd === 'edit') {
|
||||
|
@ -1574,7 +1574,7 @@ function photos_content(App $a)
|
|||
|
||||
$name_e = $profile_name;
|
||||
$title_e = $item['title'];
|
||||
$body_e = bbcode($item['body']);
|
||||
$body_e = BBCode::convert($item['body']);
|
||||
|
||||
$comments .= replace_macros($template,[
|
||||
'$id' => $item['item_id'],
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\ForumManager;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\L10n;
|
||||
|
@ -481,8 +482,8 @@ function ping_get_notifications($uid)
|
|||
$notification["name"] = $notification["name_cache"];
|
||||
$notification["message"] = $notification["msg_cache"];
|
||||
} else {
|
||||
$notification["name"] = strip_tags(bbcode($notification["name"]));
|
||||
$notification["message"] = format_notification_message($notification["name"], strip_tags(bbcode($notification["msg"])));
|
||||
$notification["name"] = strip_tags(BBCode::convert($notification["name"]));
|
||||
$notification["message"] = format_notification_message($notification["name"], strip_tags(BBCode::convert($notification["msg"])));
|
||||
|
||||
q(
|
||||
"UPDATE `notify` SET `name_cache` = '%s', `msg_cache` = '%s' WHERE `id` = %d",
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\System;
|
||||
|
@ -246,7 +247,7 @@ function poco_init(App $a) {
|
|||
$about = Cache::get("about:" . $contact['updated'] . ":" . $contact['nurl']);
|
||||
if (is_null($about)) {
|
||||
require_once 'include/bbcode.php';
|
||||
$about = bbcode($contact['about'], false, false);
|
||||
$about = BBCode::convert($contact['about'], false);
|
||||
Cache::set("about:" . $contact['updated'] . ":" . $contact['nurl'], $about);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<?php
|
||||
/**
|
||||
* @file mod/register.php
|
||||
* @file_tag_list_to_file mod/register.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
|
@ -262,7 +263,7 @@ function register_content(App $a)
|
|||
'$invite_id' => $invite_id,
|
||||
'$realpeople' => $realpeople,
|
||||
'$regtitle' => L10n::t('Registration'),
|
||||
'$registertext' => x($a->config, 'register_text') ? bbcode($a->config['register_text']) : "",
|
||||
'$registertext' => x($a->config, 'register_text') ? BBCode::convert($a->config['register_text']) : "",
|
||||
'$fillwith' => $fillwith,
|
||||
'$fillext' => $fillext,
|
||||
'$oidlabel' => $oidlabel,
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
/**
|
||||
* @file mod/tagrm.php
|
||||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
|
@ -91,7 +93,7 @@ function tagrm_content(App $a) {
|
|||
$o .= '<ul>';
|
||||
|
||||
foreach ($arr as $x) {
|
||||
$o .= '<li><input type="checkbox" name="tag" value="' . bin2hex($x) . '" >' . bbcode($x) . '</input></li>';
|
||||
$o .= '<li><input type="checkbox" name="tag" value="' . bin2hex($x) . '" >' . BBCode::convert($x) . '</input></li>';
|
||||
}
|
||||
|
||||
$o .= '</ul>';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue