[pmwiki-users] Fix blogit for use with PHP 5.5

Tiger!P pmwiki-tigerp at tigerp.net
Fri Oct 24 11:46:04 CDT 2014


On Thu, Oct 23, 2014 at 06:51:59PM -0400, DaveG wrote:

Hello David,

> On 10/23/2014 3:24 PM, Tiger!P wrote:
> >The original code line is (line 239):
> >
> >Markup('blogit', 'fulltext', '/\(:blogit (list|cleantext)\s?(.*?):\)(.*?)\(:blogitend:\)/esi',
> >  "blogitMU_$1(PSS('$2'), PSS('$3'))");
> >
> >I replaced it with the following:
> >
> >Markup_e('blogit', 'fulltext', '/\(:blogit (list|cleantext)\s?(.*?):\)(.*?)\(:blogitend:\)/si',
> >           "blogitMU_\$m[1](PSS(\$m[2]), PSS(\$m[3]))");
> >
> >But this results in the following message in apache's error.log:
> >PHP Parse error:  syntax error, unexpected '$m' (T_VARIABLE) in
> >/home/tigerp/www/pmwiki-2.2.62/pmwiki.php(458) : runtime-created
> >function on line 1
> I have not yet looked into updating blogit to work with php5.5, but purely
> based on reading ref [1], and purely based on syntax, you may need to simply
> quote the $m parameters in the $replace part of the markup:
> 
> Markup_e('blogit', 'fulltext', '/\(:blogit
> (list|cleantext)\s?(.*?):\)(.*?)\(:blogitend:\)/si',
>           "blogitMU_\$m[1](PSS('\$m[2]'), PSS('\$m[3]'))");
> 
> Let me know how that works. If you could send me the changes you made, I'll
> update BlogIt.

I tried this, but it gave the same error message in the log.
Attached you will find a patch for blogit.php based on version 1.7.0
(2011-07-04) and it is using the suggested fix above (which does not
work).

Tiger!P
-- 
A random quote:
Je hoeft niet veel te hebben om gelukkig te zijn.
-------------- next part --------------
--- blogit.php.orig.20141002	2014-10-02 17:04:04.951513050 +0200
+++ blogit.php	2014-10-24 18:25:28.965148636 +0200
@@ -140,7 +140,7 @@
 $bi_OriginalFn['AuthFunction']=$AuthFunction;  #must occur before calling bi_Auth()
 $AuthFunction = 'bi_BlogItAuth';  #TODO: Use $AuthUserFunctions instead?
 # Need to save entrybody in an alternate format to prevent (:...:) markup confusing the end of the variable definition.
-$PageTextVarPatterns['[[#anchor]]'] = '/(\[\[#blogit_(\w[_-\w]*)\]\](?: *\n)?)(.*?)(\[\[#blogit_\2end\]\])/s';  #[1]
+$PageTextVarPatterns['[[#anchor]]'] = '/(\[\[#blogit_(\w[_\w-]*)\]\](?: *\n)?)(.*?)(\[\[#blogit_\2end\]\])/s';  #[1]
 $bi_Pagename = ResolvePageName($pagename);  #undo clean urls (replace / with .) to make pagename checks easier
 
 if ($bi_Pagename == $bi_Pages['blog_list'])	$FmtPV['$bi_BlogId']='"' .bi_Clean('word', $_GET['blogid']) .'"';
@@ -236,14 +236,14 @@
 
 # ----------------------------------------
 # - Markup
-Markup('blogit', 'fulltext', '/\(:blogit (list|cleantext)\s?(.*?):\)(.*?)\(:blogitend:\)/esi',
-	"blogitMU_$1(PSS('$2'), PSS('$3'))");
-Markup('blogit-skin', 'fulltext', '/\(:blogit-skin '.
+Markup_e('blogit', 'fulltext', '/\(:blogit (list|cleantext)\s?(.*?):\)(.*?)\(:blogitend:\)/si',
+	"blogitMU_"."\$m[1](PSS('\$m[2]'), PSS('\$m[3]'))");
+Markup_e('blogit-skin', 'fulltext', '/\(:blogit-skin '.
 	'(date|intro|author|tags|edit|newentry|delete|commentcount|date|commentauthor|commentapprove|commentdelete|commentedit|commentreply|commentblock|commenttext|commentid)'.
-	'\s?(.*?):\)(.*?)\(:blogit-skinend:\)/esi',
-	"blogitSkinMU('$1', PSS('$2'), PSS('$3'))");
-Markup('includesection', '>if', '/\(:includesection\s+(\S.*?):\)/ei',
-	"PRR(bi_includeSection(\$GLOBALS['bi_Pagename'], PSS('$1 '.\$GLOBALS['bi_TemplateList'])))");
+	'\s?(.*?):\)(.*?)\(:blogit-skinend:\)/si',
+	"blogitSkinMU(\$m[1], PSS(\$m[2]), PSS(\$m[3]))");
+Markup_e('includesection', '>if', '/\(:includesection\s+(\S.*?):\)/i',
+	"PRR(bi_includeSection(\$GLOBALS['bi_Pagename'], PSS(\$m[1].' '.\$GLOBALS['bi_TemplateList'])))");
 $SaveAttrPatterns['/\\(:includesection\\s.*?:\\)/i'] = ' ';  #prevents include sections becoming part of page targets list
 if (IsEnabled($EnableGUIButtons) && $FmtPV['$bi_Mode']!='ajax'){
 	if ($action=='bi_be' || $action=='bi_ne' || ($action=='pmform' && $_REQUEST['target']=='blogit-entry'))


More information about the pmwiki-users mailing list