Update dependencies and enhance emotize method

Bumps required plugin version dependencies for compatibility. Refactors the `emotize` method by adding a `$stripslashes` parameter to provide optional handling of string slashes, improving flexibility and functionality.
This commit is contained in:
Mykyta Synelnikov
2025-11-07 14:18:38 +02:00
parent e2cb125e97
commit 88607b854b
2 changed files with 10 additions and 9 deletions
+6 -5
View File
@@ -217,16 +217,18 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
return $args;
}
/**
* Emoji support
*
* @param $content
* @param string $content
* @param bool $stripslashes
*
* @return mixed|string
*/
function emotize( $content ) {
$content = stripslashes( $content );
public function emotize( $content, $stripslashes = true ) {
if ( $stripslashes ) {
$content = stripslashes( $content );
}
foreach ( $this->emoji as $code => $val ) {
$regex = str_replace( array( '(', ')' ), array( '\\' . '(', '\\' . ')' ), $code );
$content = preg_replace(
@@ -238,7 +240,6 @@ if ( ! class_exists( 'um\core\Shortcodes' ) ) {
return $content;
}
/**
* Remove wpautop filter for post content if it's UM core page
*/