Extension talk:HTMLets

Jump to navigation Jump to search

About this board

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead

4
Reverse Corruption (talkcontribs)

Not sure if this is proper, but here is how I fixed it:

diff HTMLets.php HTMLets.php.org
133,137c133,135
< $text = preg_replace_callback(
< '//sm',
< function ($m) {
< return base64_decode("$m[1]");
< },
---
> $text = preg_replace(
> '//esm',
> 'base64_decode("$1")',


If anyone has a better solution, please post it.

Thank you!

Reverse Corruption

Kghbln (talkcontribs)

I think you should file a bug for this at bugzilla: and provide this patch for others to have a look at the issue.

Jongfeli (talkcontribs)

Noticed this problem to when moving to PHP 5.5.13

Filed a bug with the above code.

119.160.195.124 (talkcontribs)

how to set $v = preg_replace("/'/", "&#39;", $v); to preg_replace_callback

Reply to "Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead"
Peachey88 (Flood) (talkcontribs)

hi guys,

thanks for the great functionality this extension brings to Wiki.. really helpful ! got one question - i keep trying to have it parse PHP files as well - as far as i can see, when htmlet requests the file, the web server will return the results as HTML, so i don't see why it won't work...however it does not work...for me at least :) any help / hint is highly appreciated

This post was posted by Peachey88 (Flood), but signed as 86.121.11.216.

Peachey88 (Flood) (talkcontribs)

ahh...figured it out myself... all you need to do is specify "http://" and the complete path to the php file, and the resulting HTML output will be rendered, rather than the PHP source ;)

This post was posted by Peachey88 (Flood), but signed as 86.121.9.48.

Martinwguy2 (talkcontribs)

Exactly what I needed. Many thanks!

Reply to "PHP code support ?"

Broken in 1.27 with the depreciation of wfMsgForContent

2
108.11.216.62 (talkcontribs)

Change lines 93-100 from

if ( !preg_match('!^\w+://!', $dir ) && !file_exists( $f ) ) {

$output = Html::rawElement( 'div', array( 'class' => 'error' ), wfMsgForContent( 'htmlets-filenotfound', htmlspecialchars( $name ) ) );

} else {

$output = file_get_contents( $f );

if ( $output === false ) {

$output = Html::rawElement( 'div', array( 'class' => 'error' ), wfMsgForContent( 'htmlets-loadfailed', htmlspecialchars( $name ) ) );

}

}

TO

if ( !preg_match('!^\w+://!', $dir ) && !file_exists( $f ) ) {

$output = Html::rawElement( 'div', array( 'class' => 'error' ), wfMessage( 'htmlets-filenotfound', htmlspecialchars( $name ) )->inContentLanguage()->text() );

} else {

$output = file_get_contents( $f );

if ( $output === false ) {

$output = Html::rawElement( 'div', array( 'class' => 'error' ), wfMessage( 'htmlets-loadfailed', htmlspecialchars( $name ) )->inContentLanguage()->text() );

}

}

Kghbln (talkcontribs)
Reply to "Broken in 1.27 with the depreciation of wfMsgForContent"

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in HTMLets.php

2
Patricia Barden (talkcontribs)

Hello:

I'm getting the following error message on my wiki:

Deprecated:  preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in HTMLets.php on line 139.

I'm running:

MediaWiki 1.25.3

PHP 5.6.19 (apache2handler)

MySQL 5.1.56-log

Thank you!

Kghbln (talkcontribs)

This was reported with T68706 and fixed with this commit in June 2015. Use the REL1_26 tag or the MW 1.26 tarball and the issue should go away. Cheers

Reply to "Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in HTMLets.php"
Peachey88 (Flood) (talkcontribs)

It would be nice to add wiki code inside HTML pages, for example, autofill username in a form field.

Peachey88 (Flood) (talkcontribs)

HTMLets are for static HTML only. Extension:RawMsg might allow something like this, not sure.


In any case: pre-filling form fields with user-specific information has to be done with JavaScript anyway. Remember that the generated HTML for pages gets cached. This means that there can be no user-specific content there.

This post was posted by Peachey88 (Flood), but signed as Duesentrieb.

Reply to "Mix with mediawiki code."
Peachey88 (Flood) (talkcontribs)

Is there any way to split HTMLet files into subfolders within the main htmlets directory?

I've got a lot of these and it would be nice to separate them, rather than having them all in one megafolder.

I tried

<htmlet>subfolder/filename</htmlet>

but that didn't work.

No biggie if this is impossible.

This post was posted by Peachey88 (Flood), but signed as DoubleSuitedChris.

Reply to "Subfolders?"
Peachey88 (Flood) (talkcontribs)

When trying to use this extension with PHP 5.3.0, the following error occurs:

Warning: Parameter 3 to wfRenderHTMLet() expected to be a reference, value given in /.../w/includes/parser/Parser.php on line 3243

Any help would be appreciated. Thx

This post was posted by Peachey88 (Flood), but signed as Tommy us Kölle.

Peachey88 (Flood) (talkcontribs)

I can confirm that, I have exactly the same problem (line 3243) under PHP 5.3.1 now! So I have put away the Probably from the title. ;-)

This post was posted by Peachey88 (Flood), but signed as Master on EN.

Peachey88 (Flood) (talkcontribs)

I can confirm too. Can someone please take a look at this?

This post was posted by Peachey88 (Flood), but signed as ToreN.

Peachey88 (Flood) (talkcontribs)
Peachey88 (Flood) (talkcontribs)

Hello Daniel, with 1.17 you mean the next release of MediaWiki, correct?

After updating to XAMPP 1.7.7 with PHP 5.3.8 and MediaWiki 1.17.0 I again got the same problem, just on another line:

Warning: Parameter 3 to wfRenderHTMLet() expected to be a reference, value given in ...\includes\parser\Parser.php on line 3470

Then I downloaded the last version of the extension and replaced the previous version and added the necessary line ($wgHTMLetsDirectory = "$IP/htmlets";) to the LocalSettings.php and now it works fine again, at least for me!

This post was posted by Peachey88 (Flood), but signed as WikipediaMaster.

Kghbln (talkcontribs)

Affirmative. After upgrade to PHP 5.3.8 this extension stopped working (same error message). (MW 1.17.0) I guess I will file a bug. Cheers

Edit: Done with bug 32714

Kghbln (talkcontribs)

Shame on me. I moved the freshly downloaded extension to the wrong wiki. :( This is actually working with PHP 5.3.8. Case closed since r67215 did the job. Thank you for the fix and Cheers

Reply to "Not working with PHP 5.3.x"

Trouble relocating the htmlets directory

5
Peachey88 (Flood) (talkcontribs)

I've had the extension working with the htmlets directory located in the default location under the "wiki" directory. Wanted to move the htmlets directory to the root of my server so I can open up ftp directories without giving access to the htmlets directory. Entered the following in localsettings.php:

$wgHTMLetsDirectory = "http://localhost/htmlets/";

Used ?action=purge on the test page but still I get error message. Is there something very simple I'm overlooking (I'm new with all this stuff)?

This post was posted by Peachey88 (Flood), but signed as Kassoe.

Peachey88 (Flood) (talkcontribs)

Well, what do you mean by root - the file system root, or the document root? the URL above refers to the document root.


Anyway, unless you want to access htmlets on a different server, it's better to use an (absolute) file path instead of a URL, for example "/htmlets/" or some such. This would refer to the htmlets directory directly in the file system root.

This post was posted by Peachey88 (Flood), but signed as Duesentrieb.

Peachey88 (Flood) (talkcontribs)

Hi Duesentrieb, thanks for fast response - was not familiar with the localhost concept and did not find enough explanation when looking around. I guess I mean "the file system root" but "http://localhost/htmlets/" was what I got from your help text. Just tested again and still haven't solved it.

When localsettings.php has $wgHTMLetsDirectory = "$IP/htmlets"; I get the htmlets served ok from /public_html/wiki/htmlets

When localsettings.php has $wgHTMLetsDirectory = "/htmlets/"; I do not get htmlets served, neither when locating the htmlets-directory in the server root shown in my ftp-progam as /htmlets nor when locating it as /public_html/htmlets. I wonder if "root" is really "root" - I run the site hosted with Siteground (I see the locations the same way when checking through their web-based ftp interface).

Again, I'm not really familiar with server concepts, I might be doing something wrong. The file permissions are shown as the exact same for all three locations of the htmlets-directory (-rw-r--r--).

Any hints?

This post was posted by Peachey88 (Flood), but signed as Kassoe.

Peachey88 (Flood) (talkcontribs)

The "root" you get from your FTP program is probably not "the" filesystem root, but simply your home directory or somethign similar. Ask your host what the actual file path is.


Alternatively, you can do this: $wgHTMLetsDirectory = "$IP/../../htmlets"; that's "two up from where the wiki is, and then into the htmlets dir".


What I don't quite get is... you want to open ftp directories? but hopefully not in a why that would allow others to manipulate your wiki files. that would be kind of bad...

This post was posted by Peachey88 (Flood), but signed as Duesentrieb.

Peachey88 (Flood) (talkcontribs)

Great, thanks Duesentrieb. The "two up"-approach worked. No, I will open up ftp only for one or more external developers ... I need a little help, as you can gather ;-) and will soon be looking around for someone who'd be interested for pay.

Reply to "Trouble relocating the htmlets directory"
Peachey88 (Flood) (talkcontribs)

Does this work with 1.12? Could you provide some more documentation on installation? I have installed many extensions, but I can't seem to get this one to work. Thanks

This post was posted by Peachey88 (Flood), but signed as 118.92.110.162.

Peachey88 (Flood) (talkcontribs)

I have not tried on 1.12, but i don't see why it wouldn't work. But then, there's the new preprocessor code, maybe that itnerferes. WIll try to look into it in a couple of weeks. Installation should be streight forward, there's nothing special to do.

This post was posted by Peachey88 (Flood), but signed as Duesentrieb.

Peachey88 (Flood) (talkcontribs)
Reply to "Does this work with 1.12?"

Does this extension need "$wgRawHtml=true"?

3
Peachey88 (Flood) (talkcontribs)

I am comparing Extension:SecureHTML with HTMLets. Not being a programmer I like the simplicity of this extension and I think that is all I need to include a javascript. Will this extension work even with "$wgRawHtml=false" or does that need a "true"?

This post was posted by Peachey88 (Flood), but signed as Kassoe.

Peachey88 (Flood) (talkcontribs)

It will work with $wgRawHtml=false; If you have that set to true, you can insert HTML anyway, so using this extension would be pretty pointless.

This post was posted by Peachey88 (Flood), but signed as Duesentrieb.

Peachey88 (Flood) (talkcontribs)

Thanks for clarifying this for a newbie, it wasn't quite clear on Manual:$wgRawHtml where I first found a link to this extension so I will make a small change there also ...

Reply to "Does this extension need "$wgRawHtml=true"?"