Jump to content

interrobang

Members
  • Content Count

    229
  • Joined

  • Last visited

  • Days Won

    3

interrobang last won the day on May 4

interrobang had the most liked content!

Community Reputation

235 Excellent

About interrobang

  • Rank
    Distinguished Member

Profile Information

  • Gender
    Male
  • Location
    Munich, Germany

Recent Profile Visitors

8,089 profile views
  1. The more I think about it, I am sure we need a core solution. Even if we hook into every Inputfield::processInput method we know of, there will still be custom inputfields which we will miss. And if you populate your pages by api Inputfields are not even used and the hooks are never called. UTF8 normalization should be buried somewhere deep in the core: Probably every mysql query and all user input should be normalized automatically. Currently this is not possible with hooks alone as far as I know. Btw, I just found another lightweight library which provides a fallback function if normalizer_normalizer is not available: https://github.com/wikimedia/utfnormal
  2. Beware, a textformatter doesn't help with your search issue, as the texts in mysql are still the same and not normalized.
  3. To be honest, I just googled a bit, I probably don't understand more of this than you 😉 Btw, Wordpress is discussing this now for 6 years: https://core.trac.wordpress.org/ticket/30130 Also, I don't know if this normalizer function is usually available or not – there are polyfills, but then all gets complicated. I am not sure if just saving is enough or if the fields need some changes tracked. Better test before re-saving 1000s of pages.
  4. Without much testing this hook works for me (in site/ready.php). But I think utf normalizing should be part of the core text sanitizer, so other texts (like image descriptions) are normalized too. function normalize_UTF_NFC($string) { if (function_exists('normalizer_normalize')) { if ( !normalizer_is_normalized($string)) { $string = normalizer_normalize($string); } } return $string; } $wire->addHookBefore('InputfieldTextarea::processInput, InputfieldText::processInput', function (HookEvent $event) { /** @var Inputfield $inputfield */ /** @var WireInputData $input */ /** @var Language $language */ $inputfield = $event->object; $input = $event->arguments(0); if ($this->languages && $this->languages->count > 1) { foreach ($this->languages as $language) { $input_var_name = $language->isDefault() ? $inputfield->name : "{$inputfield->name}__{$language->id}"; $input->set($input_var_name, normalize_UTF_NFC($input->$input_var_name)); } } else { $input_var_name = $inputfield->name; $input->set($input_var_name, normalize_UTF_NFC($input->$input_var_name)); } $event->arguments(0, $input); });
  5. WTF?! Sorry, you are right, this is not useful.
  6. I think this would be a useful addition to the Sanitizer class. Something like this should do it: $dotfloat = rtrim(number_format($number,100,'.',''), '.0');
  7. Perfect! Thank you! I have merged your PR.
  8. Thank you! This looks good to me! If you make a PR I will merge and release a new version.
  9. So far I haven't found a fully working regex. My test case is this. You you or anybody else finds a solution a PR is more than welcome. $test = "<h2>Fully URLs</h2>"; $test .= "http://domain.com <br>"; $test .= "http://domain.com/ <br>"; $test .= "http://domain.com/dir <br>"; $test .= "(http://domain.com/dir) <br>"; $test .= "http://domain.com/dir/ <br>"; $test .= "http://domain.com/dir/?a=1 <br>"; $test .= "<h2>www. domains</h2>"; $test .= "www.domain.com <br>"; $test .= "www.domain.com/ <br>"; $test .= "www.domain.com/dir <br>"; $test .= "www.domain.com/dir/ <br>"; $test .= "www.domain.com/dir/?a=1 <br>"; $test .= "<h2>flourishlib Examples</h2>"; $test .= "Example 1: www.example.com.<br>"; $test .= "Example 2: https://example.com.<br>"; $test .= "Example 3: john@example.com.<br>"; $test .= "Example 4: ftp://john:password@example.com.<br>"; $test .= "Example 5: www.example.co.uk.<br>"; $test .= "Example 6: john@example.co.uk.<br>"; $test .= 'Example 7: <a href="http://example.com">http://example.com</a>.'; wireModules("TextformatterMakeLinks")->format($test); echo $test;
  10. Unfortunately, I'm not very good with regex, but I still tried to solve the problem. Can you please give it a try if the result is better if you remove the \b in lines 52 and 53? Has anyone here with more regex experience an idea what problems could arise from this change?
  11. It looks like Safari has a problem with the ui-helper-clearfix class. If you remove it the layout looks ok.
  12. You can add custom classes to the body of the ckeditor iframe. In the field settings (Input Tab) insert this in the "Custom Config Options" field: bodyClass: Inputfield_textarea1 If you need more flexibility you can also hook create a hook in your /sites/init.php to add multiple classes to all of your ckeditor fields: wire()->addHookBefore('Field(inputfieldClass=InputfieldCKEditor)::getInputfield', function(HookEvent $event) { // do not show modified data on Field edit page if ($this->wire('process') != 'ProcessPageEdit') return; $field = $event->object; $page = $this->pages->get($this->input->get->id); $customOptions = $field->customOptions; $customOptions .= "\nbodyClass: template-{$page->template} page-{$page->id} field-{$field->name}"; $field->customOptions = $customOptions; });
  13. Hi Nik, thanks, I am well Honestly I have not used my module myself for a long time, and I still have not looked into what has to be done to migrate this module to PW3 and its new image field. I plan to release a new version eventually, but can't say how long it will take. But seeing somebody still uses it at least motivates me to test it myself in PW3. Sorry, that I cant give you a more satisfying answer. I will post back here after testing.
  14. Thanks for sharing, looks Good. Some nice memories are coming back. Chrom Records was one of my favorite labels back in the 90ies. But I am feeling old now..
  15. Yes, should be possible now, see this blog post for more infos: https://processwire.com/blog/posts/language-access-control-and-more-special-permissions/
×
×
  • Create New...