projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #24022 from colemanw/afformFrontend
[civicrm-core.git]
/
CRM
/
Utils
/
String.php
diff --git
a/CRM/Utils/String.php
b/CRM/Utils/String.php
index 939ad2270adc7612929c7a31920177ec032770aa..4b230e1879ce9e9eb82089e04efd7d4bce856689 100644
(file)
--- a/
CRM/Utils/String.php
+++ b/
CRM/Utils/String.php
@@
-437,10
+437,9
@@
class CRM_Utils_String {
* the converted string
*/
public static function htmlToText($html) {
* the converted string
*/
public static function htmlToText($html) {
- require_once 'html2text/rcube_html2text.php';
$token_html = preg_replace('!\{([a-z_.]+)\}!i', 'token:{$1}', $html);
$token_html = preg_replace('!\{([a-z_.]+)\}!i', 'token:{$1}', $html);
- $converter = new
rcube_html2text($token_html
);
- $token_text = $converter->get
_t
ext();
+ $converter = new
\Html2Text\Html2Text($token_html, ['do_links' => 'table', 'width' => 75]
);
+ $token_text = $converter->get
T
ext();
$text = preg_replace('!token\:\{([a-z_.]+)\}!i', '{$1}', $token_text);
return $text;
}
$text = preg_replace('!token\:\{([a-z_.]+)\}!i', '{$1}', $token_text);
return $text;
}
@@
-530,7
+529,7
@@
class CRM_Utils_String {
*/
public static function stripAlternatives($full) {
$matches = [];
*/
public static function stripAlternatives($full) {
$matches = [];
- preg_match('/-ALTERNATIVE ITEM 0-(.*?)-ALTERNATIVE ITEM 1-.*-ALTERNATIVE END-/s',
$full
, $matches);
+ preg_match('/-ALTERNATIVE ITEM 0-(.*?)-ALTERNATIVE ITEM 1-.*-ALTERNATIVE END-/s',
($full ?? '')
, $matches);
if (isset($matches[1]) &&
trim(strip_tags($matches[1])) != ''
if (isset($matches[1]) &&
trim(strip_tags($matches[1])) != ''
@@
-640,7
+639,7
@@
class CRM_Utils_String {
$_filter = new HTMLPurifier($config);
}
$_filter = new HTMLPurifier($config);
}
- return $_filter->purify($string);
+ return $_filter->purify($string
?? ''
);
}
/**
}
/**
@@
-879,7
+878,7
@@
class CRM_Utils_String {
return TRUE;
}
$len = strlen($fragment ?? '');
return TRUE;
}
$len = strlen($fragment ?? '');
- return substr(
$string
, 0, $len) === $fragment;
+ return substr(
($string ?? '')
, 0, $len) === $fragment;
}
/**
}
/**
@@
-896,7
+895,7
@@
class CRM_Utils_String {
return TRUE;
}
$len = strlen($fragment ?? '');
return TRUE;
}
$len = strlen($fragment ?? '');
- return substr(
$string
, -1 * $len) === $fragment;
+ return substr(
($string ?? '')
, -1 * $len) === $fragment;
}
/**
}
/**