Re: A better Board News block for Simple Portal Reply #45 – November 13, 2015, 05:18:20 pm Ah-ha ... it was your code
Re: A better Board News block for Simple Portal Reply #46 – November 13, 2015, 05:26:59 pm emanuele is innocent.
Re: A better Board News block for Simple Portal Reply #47 – April 05, 2016, 03:34:13 pm I'm having some errors in my log if I use php 5.6Type of error: General preg_replace(): The /e modifier is deprecated, use preg_replace_callback insteadFile: /.../sources/subs/PortalBlocks.subs.phpRow: 2103Code: [Select] $data = preg_replace('~<\!\[CDATA\[(.+?)\]\]>~eu', '\'#cdata_escape_encode#\' . Util::htmlspecialchars(\'$1\')', $data);Is there a way to solve this?
Re: A better Board News block for Simple Portal Reply #48 – April 05, 2016, 03:43:04 pm Apparently it won't do anything in PHP 7 anymore. But until then it'll just work.Anyway, to fix it just do what it says? Code: [Select] $data = preg_replace_callback('~<\!\[CDATA\[(.+?)\]\]>~eu', '\'#cdata_escape_encode#\' . Util::htmlspecialchars(\'$1\')', function($matches){return $matches[0];}, $data);(or something like that)
Re: A better Board News block for Simple Portal Reply #49 – April 05, 2016, 05:00:59 pm I think it's more like:Code: [Select] $data = preg_replace_callback('~<\!\[CDATA\[(.+?)\]\]>~u', function($matches){return '#cdata_escape_encode#' . Util::htmlspecialchars($matches[0]);}, $data);[/code]
Re: A better Board News block for Simple Portal Reply #50 – April 05, 2016, 05:07:24 pm matches[0] or matches[1] ?
Re: A better Board News block for Simple Portal Reply #51 – April 05, 2016, 05:08:13 pm Thank you Emanuele and Frenzie!With first code I was getting another error: preg_replace_callback() expects parameter 4 to be long, string givenThe version provided by Emanuele works without errors. Thanks again
Re: A better Board News block for Simple Portal Reply #52 – April 06, 2016, 02:14:59 am Quote from: emanuele – April 05, 2016, 05:00:59 pmI think it's more like:I failed to spot the first comma. xD
Re: A better Board News block for Simple Portal Reply #53 – April 06, 2016, 02:40:18 am Quote from: radu81 – April 05, 2016, 05:08:13 pmThe version provided by Emanuele works without errors. Thanks again I feel you should trust Spuds and change $matches[0] to $matches[1], I'm not good with converting to callbacks! xD
Re: A better Board News block for Simple Portal Reply #54 – April 06, 2016, 02:53:16 am $matches[0] is probably the full text and $matches[1] the first subpattern. I'm not in a position to test atm.
Re: A better Board News block for Simple Portal Reply #55 – April 06, 2016, 03:31:40 am Quote from: emanuele – April 06, 2016, 02:40:18 amQuote from: radu81 – April 05, 2016, 05:08:13 pmThe version provided by Emanuele works without errors. Thanks again I feel you should trust Spuds...Sounds like a recipe for disaster.
Re: A better Board News block for Simple Portal Reply #56 – April 06, 2016, 05:55:22 am Quote from: emanuele – April 06, 2016, 02:40:18 amI feel you should trust Spuds and change $matches[0] to $matches[1], I'm not good with converting to callbacks! xDOk, I did that, thanks again