Jump to content

patrick

Members
  • Posts

    36
  • Joined

  • Last visited

Posts posted by patrick

  1. Hi Roope

    First of all, thanks so much for this great module!

    Just tested your latest release (v1.3.0 Stable) and got the following error (on PHP 8.1):
    Uncaught TypeError: Unsupported operand types: int + string in /site/modules/EmailObfuscation/EmailObfuscation.module:444

  2. Vimeo private video url's in combination with GDPR activated

    Vimeo introduced a hash parameter (h) that gets added to private video URL's in order to be embedded.

    The dnt=1 parameter does not get added anymore, if the GDPR checkbox is checked in the TextformatterVideoEmbed modul settings.

    In class TextformatterVideoEmbed I had to change the following code (line 284) from:

    $embedCode = str_replace(
    	"?app_id=",
    	"?dnt=1&app_id=", // add do-not-track parameter
    	$embedCode
    );

    to:

    $embedCode = str_replace(
    	"app_id=",
    	"dnt=1&app_id=", // add do-not-track parameter
    	$embedCode
    );
  3. After some tests, I found out that the above problem only occurs in fields of type "RepeaterMatrix".

    After the following steps, the problem now seams solved:

    • go to "Setup > Templates"
    • under "Filters": activate "show system templates"
    • edit the repeater template file and ...
    • under Tab "Access": activate view permission for the frontend user and deactivate view permission for guest
    • Like 3
  4. I'm running a website, where only logged-in members should have access to downloads (site/assets/files).

    This was working well in ProcessWire 3.0.165 with the following settings in config.php:

    $config->pagefileSecure = true;
    $config->pagefileSecurePathPrefix = '-';

    and in the template settings I also removed the "view" permission for "guest".

    Since updating ProcessWire to 3.0.184 (and 3.0.200) logged-in members have no more access to those downloads, they get a 404 page.

    I also tested the following settings, which didn't make any difference:

    access.thumb.png.acbe9593d76c05cc3602636f1044ee5b.png

    What exactly changed since 3.0.184 regarding pagefileSecure and what is the best approach to get back to the previous state (downloads for logged-in members only)?

  5. 6 hours ago, Robin S said:

    One more option...

    You could copy MarkupHTMLPurifier from /wire/modules/Markup/ to /site/modules/ and then select it as the copy you want to use.

    Then edit HTMLPurifier.standalone.php to replace this code with:

    return '<' . $token->name . ($attr ? ' ' : '') . $attr . '>';

    Seems to solve the slash issue without affecting HTML5 elements like <figure>

    Hi Robin

    Thanks a lot for your answer.

    I copied MarkupHTMLPurifier to /site/modules/ and made the changes. I like this approach and I will stick with your solution!

    Thanks again and have a nice day!

  6. 1 hour ago, Robin S said:

    @patrick, try this:

    $wire->addHookAfter('MarkupHTMLPurifier::initConfig', function(HookEvent $event) {
    	$settings = $event->arguments(0);
    	$settings->set('HTML.Doctype', 'HTML 4.01 Transitional');
    });

    For this to take effect you'll also need to clear the HTML Purifier cache which you can do by executing the following once (the Tracy Debugger console is useful for this sort of thing): 

    $purifier = new MarkupHTMLPurifier();
    $purifier->clearCache();

     

    Hi Robin

    Cool, this is working ?. Many thanks for taking the time!

    The only problem now: due to the html4 value other elements are getting converted, for example <figure> gets deleted (what shouldn't happen). Hopefully there will be a HTML.Doctype html5 in the future ?.

    Have a nice day and Greetings from Switzerland to New Zealand
    Patrick

    • Like 1
  7. 2 hours ago, BrendonKoz said:

    Using the HTMLPurifier demo page, if you change the defined Doctype to either of the standard HTML Doctypes, the BR tag will not use the XHTML formatted version. That said, there may be other unforeseen consequences in making this change. If this is simply an aesthetic preference, I would personally recommend leaving it alone. If there's another reason for it, I'm thinking that a call to str_replace on your data would be far simpler.

    If you do decide to customize HTMLPurifier, a good place to start for examples would be here and here.

    Here's an example set call that would change the Doctype to HTML Transitional, adjusted from the PW API Documentation example:

    $wireData = $markupHTMLPurifier->set('HTML.Doctype', 'HTML 4.01 Transitional');

     

    Hi Brendon

    Thanks for your answer.

    The reason is to make the source validate as html5 at w3c. I was thinking about str_replace too, but was wondering, if there is a nicer way to save it already in the database as html5.

    I tried the following in the admin.php:

    $wire->addHookAfter('MarkupHTMLPurifier::initConfig', function(HookEvent $event) {
        $def = $event->arguments(1);
        $this->settings->set('HTML.Doctype', 'HTML 4.01 Transitional');
    });

    but that doesn't seem to do the trick ?

  8. 1 hour ago, Robin S said:

    In the context of CKEditor the <br /> tag is probably caused by the CKEditor settings rather than HTML Purifier.

    Using this answer as a reference, you could put the following in /site/modules/InputfieldCKEditor/config.js:

    // When CKEditor instance ready
    CKEDITOR.on('instanceReady', function(event) {
    	// Output self-closing tags the HTML5 way, like <br>
    	event.editor.dataProcessor.writer.selfClosingEnd = '>';
    });

     

    Hi Robin

    Thanks for your answer. I tried it.

    With the above solution in the CKEditor config, looking at the source of CKEditor br tags are shown as <br>, but unfortunately are still saved in the database as <br />

  9. If I do a search, I get more results if I'm logged in than if I'm not logged in. The default language (DE) is not the problem, this only happens with the 2 additional languages (FR, IT).

    The pages have "view access" for guests and the checkboxes for additional languages are checked.

    Any idea, why this is?

    Every hint is much appreciated.
    Thank you.

  10. Perfect. Thanks a lot Robin, for your answer and explanation!

    I tried both and both are working. In the end I decided to go with the OR groups:

    $title = "title.data{$user->language}%=$q";
    $body  = "body.data{$user->language}%=$q";
    $titleRepeater = "content_element_matrix=[content_element_title.data{$user->language}%=$q]";
    $bodyRepeater  = "content_element_matrix=[body.data{$user->language}%=$q]";
            
    $result = $pages->find("($title), ($body), ($titleRepeater), ($bodyRepeater), limit=50");

    Thanks again.

    Have a good day.
    Patrick

  11. Hi Robin

    Thanks a lot for your answer.

    Your example is working perfect with a single field, but there are no matches (with the same query) if I search in multiple fields:

    $result = $pages->find("repeater_element=[title.data{$user->language}%=foo], repeater_element=[body.data{$user->language}%=foo]");

    I also tried this (which is not working too):

    $title = "title.data{$user->language}";
    $body  = "body.data{$user->language}";
    $titleRepeater = "content_element_matrix=[content_element_title.data{$user->language}]";
    $bodyRepeater  = "content_element_matrix=[body.data{$user->language}]";
            
    $result = $pages->find($title|$body|$titleRepeater|$bodyRepeater%=$q");

    Every hint is much appreciated.
    Thank you.

  12. In a photogallery I would like to upload more than 2-3 images at once. Let's say 20-30 images (around 200 KB per image) would be great.

    If I try to upload this amount of images, it sometimes works, but many times the upload gets stuck (progessbar stops & loading icons keep running).

    Is this a ProcessWire related problem or has this to do with any server connection interruption at my webhost?

    My current php ini settings are:

    memory_limit = 512M
    post_max_size = 256M
    upload_max_filesize = 16M
    max_execution_time = 300
    max_file_uploads = 100
    max_input_time = 0

    Thanks
    Patrick

  13. Hi Robin S

    Thanks a lot for your reply.

    I tried the example in your linked post and it works:

    $field = $user->language->isDefault() ? "body" : "body.data" . $user->language;

    But in case of Repeaters it seems not to work. The following code throws an Error Exception: Multi-dot 'a.b.c' type selectors may not be used with OR '|' fields.

    $field = $user->language->isDefault() ? "repeater_element.body" : "repeater_element.body.data" . $user->language;

    I tried with sub-selectors, but couldn't get it to work fo far:

     

    • Like 1
  14. Currently working on a search function for a multi language website (DE, FR, IT).

    If I'm on the FR (or IT) version of the website and start a search with a DE term, I also get FR (or IT) pages in the search result (because the default language field has this DE term).

    How can I achieve that the find() function searches only in the field of the current user language?

    The current selector looks like this:

    $selector = "title|body~=$q, limit=50";

     

×
×
  • Create New...