I still find this a very useful/essential plugin, so I thought I’d share the fix I created to run on PHP7+ and on EE6 - a couple of simple amends in pi.ce_str.php:
Within the expand_escaped function, replace:
return preg_replace_callback( '/\\\([nrtvf]|[0-7]{1,3}|[0-9A-Fa-f]{1,2})?/', create_function( '$matches', 'return ($matches[0] == "\\\\") ? "" : eval( sprintf(\'return "%s";\', $matches[0]) );' ), $string );
with:
return preg_replace_callback( '/\\\([nrtvf]|[0-7]{1,3}|[0-9A-Fa-f]{1,2})?/', function($matches) { return ($matches[0] == "\\") ? "" : eval( sprintf('return "%s";', $matches[0]) ); } , $string );
Within the url_title function, replace:
ee()->load->helper('url_helper'); return url_title( $string, $separator, $lowercase );
with:
$url_format = ee('Format')->make('Text', $string); if (method_exists($url_format, 'urlSlug')) //EE4+ { $slug = $url_format->urlSlug()->compile(array('separator' => $separator, 'lowercase' => $lowercase)); } else { ee()->load->helper('url_helper'); $slug = url_title( $url_format->compile(), $separator, $lowercase ); } return $slug;
That’s it.
|