Skip to main content
Topic: A better Board News block for Simple Portal (Read 14706 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: A better Board News block for Simple Portal

Reply #45

Ah-ha ... it was your code :P

Re: A better Board News block for Simple Portal

Reply #46

 emanuele is innocent. :P
Bugs creator.
Features destroyer.
Template killer.

Re: A better Board News block for Simple Portal

Reply #47

I'm having some errors in my log if I use php 5.6

Type of  error: General
 preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
File: /.../sources/subs/PortalBlocks.subs.php
Row: 2103

Code: [Select]
	$data = preg_replace('~<\!\[CDATA\[(.+?)\]\]>~eu', '\'#cdata_escape_encode#\' . Util::htmlspecialchars(\'$1\')', $data);

Is there a way to solve this?
sorry for my bad english

Re: A better Board News block for Simple Portal

Reply #48

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? :P

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

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]
Bugs creator.
Features destroyer.
Template killer.

Re: A better Board News block for Simple Portal

Reply #50

matches[0] or matches[1] ?

Re: A better Board News block for Simple Portal

Reply #51

Thank you Emanuele and Frenzie!
With first code I was getting another error: preg_replace_callback() expects parameter 4 to be long, string given
The version provided by Emanuele works without errors. Thanks again ;)
sorry for my bad english


Re: A better Board News block for Simple Portal

Reply #53

Quote from: radu81 – The 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
Bugs creator.
Features destroyer.
Template killer.

Re: A better Board News block for Simple Portal

Reply #54

$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

Quote from: emanuele –
Quote from: radu81 – The version provided by Emanuele works without errors. Thanks again ;)
I feel you should trust Spuds...
Sounds like a recipe for disaster. ;)
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: A better Board News block for Simple Portal

Reply #56

Quote from: emanuele – I feel you should trust Spuds and change $matches[0] to $matches[1], I'm not good with converting to callbacks! xD
Ok, I did that, thanks again
sorry for my bad english