forked from GNUsocial/gnu-social
Unifying HTML stripping functions to common_strip_html
This commit is contained in:
@@ -174,10 +174,10 @@ class Blog_entry extends Managed_DataObject
|
||||
XMLStringer::estring('a', array('href' => $url,
|
||||
'class' => 'blog-entry'),
|
||||
_('More...'));
|
||||
$text = html_entity_decode(strip_tags($be->summary), ENT_QUOTES, 'UTF-8');
|
||||
$text = common_strip_html($be->summary);
|
||||
} else {
|
||||
$options['rendered'] = $be->content;
|
||||
$text = html_entity_decode(strip_tags($be->content), ENT_QUOTES, 'UTF-8');
|
||||
$text = common_strip_html($be->content);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -341,7 +341,7 @@ class DomainStatusNetworkInstaller extends Installer
|
||||
$breakout = preg_replace('/<a[^>+]\bhref="(.*)"[^>]*>(.*)<\/a>/',
|
||||
'\2 <\1>',
|
||||
$html);
|
||||
return html_entity_decode(strip_tags($breakout), ENT_QUOTES, 'UTF-8');
|
||||
return common_strip_html($breakout);
|
||||
}
|
||||
|
||||
function databaseize($nickname)
|
||||
|
@@ -607,7 +607,7 @@ class Ostatus_profile extends Managed_DataObject
|
||||
// Get (safe!) HTML and text versions of the content
|
||||
|
||||
$rendered = $this->purify($sourceContent);
|
||||
$content = html_entity_decode(strip_tags($rendered), ENT_QUOTES, 'UTF-8');
|
||||
$content = common_strip_html($rendered);
|
||||
|
||||
$shortened = common_shorten_links($content);
|
||||
|
||||
@@ -618,7 +618,7 @@ class Ostatus_profile extends Managed_DataObject
|
||||
|
||||
if (Notice::contentTooLong($shortened)) {
|
||||
$attachment = $this->saveHTMLFile($activity->title, $rendered);
|
||||
$summary = html_entity_decode(strip_tags($activity->summary), ENT_QUOTES, 'UTF-8');
|
||||
$summary = common_strip_html($activity->summary);
|
||||
if (empty($summary)) {
|
||||
$summary = $content;
|
||||
}
|
||||
@@ -774,7 +774,7 @@ class Ostatus_profile extends Managed_DataObject
|
||||
// Get (safe!) HTML and text versions of the content
|
||||
|
||||
$rendered = $this->purify($sourceContent);
|
||||
$content = html_entity_decode(strip_tags($rendered), ENT_QUOTES, 'UTF-8');
|
||||
$content = common_strip_html($rendered);
|
||||
|
||||
$shortened = common_shorten_links($content);
|
||||
|
||||
@@ -785,7 +785,7 @@ class Ostatus_profile extends Managed_DataObject
|
||||
|
||||
if (Notice::contentTooLong($shortened)) {
|
||||
$attachment = $this->saveHTMLFile($note->title, $rendered);
|
||||
$summary = html_entity_decode(strip_tags($note->summary), ENT_QUOTES, 'UTF-8');
|
||||
$summary = common_strip_html($note->summary);
|
||||
if (empty($summary)) {
|
||||
$summary = $content;
|
||||
}
|
||||
|
@@ -104,17 +104,6 @@ class TinyMCEPlugin extends Plugin
|
||||
return htmLawed($raw, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Strip HTML to plaintext string
|
||||
*
|
||||
* @param string $html HTML
|
||||
* @return string plaintext, single line
|
||||
*/
|
||||
private function stripHtml($html)
|
||||
{
|
||||
return str_replace("\n", " ", html_entity_decode(strip_tags($html), ENT_QUOTES, 'UTF-8'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook for new-notice form processing to take our HTML goodies;
|
||||
* won't affect API posting etc.
|
||||
@@ -130,7 +119,7 @@ class TinyMCEPlugin extends Plugin
|
||||
if ($action->arg('richedit') && $this->isAllowedRichEdit()) {
|
||||
$html = $this->sanitizeHtml($content);
|
||||
$options['rendered'] = $html;
|
||||
$content = $this->stripHtml($html);
|
||||
$content = common_strip_html($html);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user