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

2014-10-30 Thread DaveG



On 10/30/2014 1:58 PM, Tiger!P wrote:

This does not result in the error message, but when I go to the new blog
page (/Site/BlogIt-Admin?action=bi_ne ) some blogit codes are displayed
on the page. I don't know if this was the case before PHP5.5, but don't
think so.

Blog Title: (:blogit list "$:entrytype":)bi_PageType/Type:
(:blogitend:)(:blogit list "$:blogid":)bi_BlogList/BlogID: (:blogitend:)
Tags: (:blogit list "$:entrystatus":)bi_StatusType/Status:
(:blogitend:)(:blogit list "$:entrycomments":)bi_CommentType/Comments:
(:blogitend:)


This problem still exists.
And now the /Blog/Main page does not have any blog posts anymore. Also
the list of recently written is empty.
But the Categories contains a list of tags and when I select a tag, I
see a link to the blogpost which has that tag.

So I think something is not quite right yet.

Hopefully DaveG can give some advice.
I suspect this error is not related to PHP5. I've applied your patches, 
and the test site seems to work (ref http://wiki.solidgone.org/BlogIt/Main).


For others testing this out, ensure you have updated to the latest 
version of PMWiki, load the new version of PmForms, ensure your skin is 
PHP5 compatible, and ensure other cookbooks you include are also compatible.


Quick questions:
1. Tiger!P: With your patch file, why are you making the change to 
$PageTextVarPatterns, from #blogit_(\w[_-\w]*)  to #blogit_(\w[_\w-]*)?


2. All: Is there a preference to using Markup_e over Markup? I went 
ahead and used anon functions with Markup, just to make things 
internally consistent.


3. All: Any suggestions for this:
   $bodyTags = (preg_match_all('/\[\[\!(.*?)\]\]/e', $body, $match) 
?$match[1] :array());


   To be honest I'm not entirely sure why the e modifier is used there, 
but assuming it's needed, do we have Pm helper functions for preg_match_all?



 ~ ~ David

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


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

2014-10-30 Thread DaveG
I'm looking into PHP5 compatibility right now. Not progressing far, as I 
need to research exactly what I'm remediating, but hopefully have some 
progress soonish.



 ~ ~ David

On 10/30/2014 1:58 PM, Tiger!P wrote:

On Thu, Oct 30, 2014 at 02:17:58PM +1300, John Rankin wrote:



On Mon, Oct 27, 2014 at 10:22:17AM +1300, John Rankin wrote:

Hello John,



[cut how to fix the Markup('blogit' line]


This does not result in the error message, but when I go to the new blog
page (/Site/BlogIt-Admin?action=bi_ne ) some blogit codes are displayed
on the page. I don't know if this was the case before PHP5.5, but don't
think so.

Blog Title: (:blogit list "$:entrytype":)bi_PageType/Type:
(:blogitend:)(:blogit list "$:blogid":)bi_BlogList/BlogID: (:blogitend:)
Tags: (:blogit list "$:entrystatus":)bi_StatusType/Status:
(:blogitend:)(:blogit list "$:entrycomments":)bi_CommentType/Comments:
(:blogitend:)


This problem still exists.
And now the /Blog/Main page does not have any blog posts anymore. Also
the list of recently written is empty.
But the Categories contains a list of tags and when I select a tag, I
see a link to the blogpost which has that tag.

So I think something is not quite right yet.

Hopefully DaveG can give some advice.


When I save the new blog entry, I get still some deprecated messages:
PHP Deprecated:  preg_replace(): The /e modifier is deprecated, use
preg_replace_callback instead in
/home/tigerp/www/pmwiki-2.2.62/pmwiki.php on line 471

So I think a little bit more needs to be done.


It looks like there are a number of instances of the /e modifier which
need to be changed.

In $bi_MakePageNamePatterns, it needs to remove the e, then use and
PCCF("return utf8toupper(\$m[1]);") and PCCF("return strtoupper(\$m[1]);")


This solved the issue of the deprecated warnings in the log :-)
Thank you for that.


Then all 3 calls to Markup need to be updated, in the same way as the
'blogit' rule.


I already did that before.

Attached is a patch for blogit.php with the changes I made sofar.

Tiger!P



___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users



___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


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

2014-10-30 Thread Tiger!P
On Thu, Oct 30, 2014 at 02:17:58PM +1300, John Rankin wrote:
> 
> > On Mon, Oct 27, 2014 at 10:22:17AM +1300, John Rankin wrote:
> >
> > Hello John,
> >

[cut how to fix the Markup('blogit' line]

> > This does not result in the error message, but when I go to the new blog
> > page (/Site/BlogIt-Admin?action=bi_ne ) some blogit codes are displayed
> > on the page. I don't know if this was the case before PHP5.5, but don't
> > think so.
> >
> > Blog Title: (:blogit list "$:entrytype":)bi_PageType/Type:
> > (:blogitend:)(:blogit list "$:blogid":)bi_BlogList/BlogID: (:blogitend:)
> > Tags: (:blogit list "$:entrystatus":)bi_StatusType/Status:
> > (:blogitend:)(:blogit list "$:entrycomments":)bi_CommentType/Comments:
> > (:blogitend:)

This problem still exists.
And now the /Blog/Main page does not have any blog posts anymore. Also
the list of recently written is empty.
But the Categories contains a list of tags and when I select a tag, I
see a link to the blogpost which has that tag.

So I think something is not quite right yet.

Hopefully DaveG can give some advice.

> > When I save the new blog entry, I get still some deprecated messages:
> > PHP Deprecated:  preg_replace(): The /e modifier is deprecated, use
> > preg_replace_callback instead in
> > /home/tigerp/www/pmwiki-2.2.62/pmwiki.php on line 471
> >
> > So I think a little bit more needs to be done.
> 
> It looks like there are a number of instances of the /e modifier which
> need to be changed.
> 
> In $bi_MakePageNamePatterns, it needs to remove the e, then use and
> PCCF("return utf8toupper(\$m[1]);") and PCCF("return strtoupper(\$m[1]);")

This solved the issue of the deprecated warnings in the log :-)
Thank you for that.

> Then all 3 calls to Markup need to be updated, in the same way as the
> 'blogit' rule.

I already did that before.

Attached is a patch for blogit.php with the changes I made sofar.

Tiger!P
-- 
A random quote:
Een theemuts is niet alleen goed voor de theepot.
--- blogit.php.orig.201410022014-10-02 17:04:04.951513050 +0200
+++ blogit.php  2014-10-30 18:56:39.137676955 +0100
@@ -79,8 +79,8 @@
"/[^". $PageNameChars. "]+/" => $bi_TitleSeparator,  #convert 
everything else to hyphen
"/(^\\" .$bi_TitleSeparator ."+)|(\\" .$bi_TitleSeparator ."+\$)/" => 
'',  #trim hyphens front and back
"/\\" .$bi_TitleSeparator ."{2,}/" => $bi_TitleSeparator,  #trim 
duplicate hyphens
-   ($Charset=='UTF-8' ?"/^([\\xc0-\\xdf].)/e" :'//') => ($Charset=='UTF-8' 
?"utf8toupper('$1')" :''),  #uppercase first letter
-   "/^([a-z])/e" => "strtoupper('$1')"
+   ($Charset=='UTF-8' ?"/^([\\xc0-\\xdf].)/" :'//') => ($Charset=='UTF-8' 
? PCCF("return utf8toupper(\$m[1]);") :''),  #uppercase first letter
+   "/^([a-z])/" => PCCF("return strtoupper(\$m[1]);")
 ));
 SDVA($bi_FixPageTitlePatterns, array(
'/[.\\/#]/' => ''   #remove dots, forward and backslashes in page 
titles as MakePageName returns '' when these characters are present
@@ -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,20 @@
 
 # 
 # - Markup
-Markup('blogit', 'fulltext', '/\(:blogit 
(list|cleantext)\s?(.*?):\)(.*?)\(:blogitend:\)/esi',
-   "blogitMU_$1(PSS('$2'), PSS('$3'))");
-Markup('blogit-skin', 'fulltext', '/\(:blogit-skin '.
+Markup('blogit', 'fulltext', '/\(:blogit
+ (list|cleantext)\s?(.*?):\)(.*?)\(:blogitend:\)/si',
+function ($m) {
+$func = 'blogitMU_'.$m[1];
+return $func($m[2], $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', '/\(:in