64 if (!is_string(
$html)) {
70 'parse_emails' =>
true,
113 $linkify = new \Misd\Linkify\Linkify();
115 return $linkify->processUrls(
$text, [
'attr' => [
'rel' =>
'nofollow']]);
128 $linkify = new \Misd\Linkify\Linkify();
130 return $linkify->processEmails(
$text, [
'attr' => [
'rel' =>
'nofollow']]);
142 $result = $this->autop->process($string);
147 $this->
getLogger()->warning(
'ElggAutoP failed to process the string: ' . $e->getMessage());
184 foreach (
$attrs as $attr => $val) {
185 if (0 !==
strpos($attr,
'data-') &&
false !==
strpos($attr,
'_')) {
190 $attr = strtolower($attr);
192 if (!isset($val) || $val ===
false) {
200 if (is_array($val) && empty($val)) {
205 if (is_scalar($val)) {
209 if (!is_array($val)) {
214 $filtered_val = array_filter($val,
function($e) {
215 return is_scalar($e);
224 $val = htmlspecialchars($val, ENT_QUOTES,
'UTF-8',
false);
262 if (is_array($tag_name)) {
269 if (isset(
$args[
'#tag_name'])) {
270 $tag_name =
$args[
'#tag_name'];
272 if (isset(
$args[
'#text'])) {
275 if (isset(
$args[
'#options'])) {
283 if (!is_string($tag_name) || $tag_name ===
'') {
291 $is_void = in_array(strtolower($tag_name), [
292 'area',
'base',
'br',
'col',
'embed',
'hr',
'img',
'input',
'keygen',
'link',
'menuitem',
293 'meta',
'param',
'source',
'track',
'wbr' 298 $double_encode = empty(
$options[
'double_encode']) ?
false :
true;
299 $text = htmlspecialchars(
$text, ENT_QUOTES | ENT_SUBSTITUTE,
'UTF-8', $double_encode);
311 return empty(
$options[
'is_xml']) ?
"<{$tag_name}{$attrs}>" :
"<{$tag_name}{$attrs} />";
314 return "<{$tag_name}{$attrs}>$text</$tag_name>";
327 public function stripTags($string, $allowable_tags = null) {
328 if (!isset($string)) {
333 'original_string' => $string,
334 'allowable_tags' => $allowable_tags,
337 $string = strip_tags($string, $allowable_tags);
338 $string = $this->hooks->trigger(
'format',
'strip_tags',
$params, $string);
371 if (!isset($string)) {
376 [
'>',
'<',
'&',
'"',
'''],
377 [
'&gt;',
'&lt;',
'&amp;',
'&quot;',
'&#039;'],
380 $string = html_entity_decode($string, ENT_NOQUOTES,
'UTF-8');
382 [
'&gt;',
'&lt;',
'&amp;',
'&quot;',
'&#039;'],
383 [
'>',
'<',
'&',
'"',
'''],
401 if (empty($html) || empty($css)) {
405 $inliner = CssInliner::fromHtml($html)->disableStyleBlocksParsing()->inlineCss($css);
407 return $body_only ? $inliner->renderBodyContent() : $inliner->render();
420 $pattern =
'/\s(?:href|src)=([\'"]\S+[\'"])/i';
424 preg_match_all($pattern, $text, $matches);
426 if (empty($matches) || !isset($matches[1])) {
432 $urls = array_unique($urls);
434 foreach ($urls as
$url) {
436 $real_url =
substr($url, 1, -1);
440 $replacement =
str_replace($real_url, $new_url, $url);
Exception thrown if an argument is not of the expected type.
$params
Saves global plugin settings.
Exception thrown if an error which can only be found on runtime occurs.
$args
Some servers don't allow PHP to check the rewrite, so try via AJAX.
trait Loggable
Enables adding a logger.
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
getLogger()
Returns logger.
foreach($plugin_guids as $guid) if(empty($deactivated_plugins)) $url
Create wrapper P and BR elements in HTML depending on newlines.
$attributes
Elgg AJAX loader.
if(empty($title)&&empty($body)) if(!empty($link)) $attrs