Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by thausmann

  1. I created a Pull Request with two fixes. Fixed a bug that formatted Hexcodes starting with 0E to 000000 (Issue #12) Added CSS to distinguish fields with no value (red strike through)
  2. The module isn't working for me aswell. I did some debugging and the issue seems to be having a <header> element in the HTML anywhere before an email address. This issue was mentioned earlier and allegedly fixed, but the problem I'm facing is gone when changing my <header> to a <div>. This obfuscate method should probably skip replacing addresses in the <head>, but cannot distinguish it from <header>. Adding a negative lookahead to the <head regex seems to fixes this issue. Here is a Git diff that's working for me. [Pull Request] Edit: just a conceptional thought, to support obfuscation everywhere, I could imagine a regex matching any email address in the entire HTML, and collect obfuscated attributes in a custom attribute, something like data-emo="title,value,innerHTML".
  3. Hey @jploch, oh yes, getFile() only creates temporary files, they are deleted automatically when ProcessWire is done with the request. That may sounds weird, but my use case was to send ICS via E-Mail. To permanently store the file somewhere, I could imagine something like this: // write ICS to a custom file // https://processwire.com/api/ref/wire-file-tools/file-put-contents/ $str = $icsgen->getString(); $files->filePutContents('/my/server/path/event.ics', $str); or // add the temporary file to a file field (field named "ics_files") // https://processwire.com/talk/topic/15928-adding-a-file-to-pagefiles-and-saving-to-database/ $path = $icsgen->getFile(); $page->of(false); $page->ics_files->add($path); $page->save('ics_files'); Both untested, let me know if this works.
  4. I looked at my HTML output today and all this chaotic whitespace triggered my OCD. This module simply hooks into Page::render and removes whitespaces from frontend HTML with a simple regex replace. I mostly put this together for cosmetics. I like my View source neat and tidy. This is not well tested yet, please open an issue if you run into problems. GitHub: https://github.com/timohausmann/MinifyPageRender
  5. I'm looking for a module that would allow me to change page urls and make sure that the old URLs would redirect to the new adresses. Mostly for SEO/Bots. Something like https://processwire.com/modules/process-redirects/ with a bit of magic. Wasn't there a module for this in the past or did I dream that?
  6. Just want to drop a line that I used CroppableImage 4 on a new project and ran into no problems so far. Okay, the issue Didjee mentioned persists, I just didn't run into it during dev phase. I applied your fix.
  7. The module can generate basic ICS calendar strings and files. Usage Example: $icsgen = wire()->modules->IcsGenerator; // set properties $icsgen->setArray(array( 'date' => new \DateTime('2033-12-24 12:00'), 'dateEnd' => new \DateTime('2033-12-24 13:00'), 'summary' => 'Event title', 'description' => 'Event description', )); // get path to a temporary .ics file // (using wire()->files->tempDir) $icspath = $icsgen->getFile(); // send email with ics file $mail = wireMail(); $mail->attachment($icspath, 'calendar.ics'); $mail->to($user->email); $mail->subject('ICS Demo'); $mail->body('This is a ICS demo.'); $numSent = $mail->send(); For more infos see GitHub Readme or Modules Page. If you experience reproducable issues please open a GitHub issue.
  8. Hello, I'm wondering if there is way to use $cache so it lasts exactly for one request, something like WireCache::expiresRequest? Edit: I didn't think right, I can simply delete the cache when I'm done. And cache is probably overkill, in memory should be fine. I wrote a cron php script that bootstraps ProcessWire and sends out some e-mails with an ICS file attached. I thought about caching the different files (the filepath to be precise) instead of generating the same over and over again.
  9. Hey @adrian, thanks a lot, I've tested your modified version. For me, subfields as top level options are totally fine, already adds a lot of possibilites for user references! I found that my columns have type pageAutocomplete and not pageSelect, I think that's why they were exported as IDs only. I added pageAutocomplete to the fieldType checks and this works! – unless I export both "User" and "User.email", then somehow the $subfields indexes are off (Undefined offset ...). So I made one more change where the main page "User" is not added as an option anymore. To cover all cases I also added id as a subfield option. I marked my edits with //@TH SUBFIELDS There is also pageAutocompleteMultiple, that seems to procude other problems I didn't dig into. TableCsvImportExportSubfieldsTH.zip
  10. Hey @adrian, thanks for this great module. Is there a way to choose a page field instead of the id when exporting a table with a page reference? I have a table with users and it would be awesome to export the name or email instead of the id. As an idea, maybe just a checkbox to export "labelField" instead of value.
  11. @horst thanks, we still need the session / active login somehow but maybe this is a starting point. @LostKobrakai thanks for the link, the Storage Access API looks very promising (requesting user permissions) and matches our use case (user is already signed in in the main window). Apparently this has no Chrome Support (yet). For the OAuth Solution I need more time to understand it ? Will post updates here if I find a solution!
  12. Hi all, is there an easy way to implement login and session handling that doesn't require cookies? I'm thinking about passing the session ID as a URL parameter instead of a cookie (like good old PHPSESSID) but I cannot get it working. I can easily append the URL parameter, but I cannot "restore" the session on the server. Do you think it's possible or is the cookie behaviour hardcoded in Session.php? Background: Browsers are working towards more privacy protection and banning "3rd party cookies". While this primarily targets tracking services, it applies to all sites embedded as an iframe. We are using Processwire like an iframe "Applet" for other websites and we start seeing problems (user logins reset) due to the new privacy policies. Safari has already implemented this, Chrome has scheduled this as a standard for 2022 but already has a privacy setting for this feature.
  13. Hey, I just refactored my site to use markup regions and noticed slower responses / rendering times by two-four times. I'm having a landingpage with a Pagetable that has 15 blocks, most of them have a little CSS with mediaqueries that I can now put in the header with pw-append, which is nice, but seems especially costly to do it 15 times. I put together a minimal example showing the speed impact: https://gist.github.com/timohausmann/e7643d75e26135450dab63e33c94de8f This effect scales up so my real page went from 600ms to 3.2s. The page gets cached in the end so it's not a total deal breaker, but I'm wondering if I'm doing something wrong, or if this is normal and markup regions and pw-append aren't designed to be used repeatedly? Thanks for reading!
  14. Okay, issue created: https://github.com/processwire/processwire-issues/issues/1209 As a quick fix I will re-upload my affected non-transparent PNGs with JPGs. Another possible workaround on template level: if($image->width == $width) { $imgUrl = $image->webp->url; } else { $imgUrl = $image->width($width)->webp->url; }
  15. Thanks for your reply! I just tried that and apparently it gives me the same png url filename.1280x0.png. As soon as I go 1 pixel up or down I get a webp URL.
  16. Hey, I'm trying to completely switch over to WebP and noticed some strange behaviour. Let's say I upload a PNG in Processwire of size 1280x800. $page->image->url ➝ correct URL (filename.webp) $page->image->width(800)->url ➝ correct URL (filename.800x0.webp) $page->image->width(1280)->url ➝ wrong URL (filename.1280x0.png), webp file is not generated $page->image->width(1280)->url(false) ➝ correct URL (filename.1280x0.webp) but webp file is not generated So: When I request a size that equals the original file, no WebP conversion is happening (no webp file is created, although a new PNG is generated (...1280x0.png)). When I use url(false), I get the expected URL but still the file is not generated. Also interesting: this issue is only occuring with PNG, not JPG. My Configuration: $config->imageSizerOptions('webpAdd', true); $config->imageSizerOptions('defaultGamma', -1); GD Pageimage::url Hook from here Also tried to output width(1280)->webp->url, it makes no difference I checked that the PNG version is not smaller in filesize (PNG=450KB, WebP (from other tool)=60KB) Tested with Processwire 3.0.148 and 3.0.160 dev I think this post is about the same issue and where I got the url(false) from. Setting 'useSrcUrlOnFail' => false inside $config->webpOptions results in correct output URL (filename.1280x0.webp), but still the file is not generated. So maybe the webp conversion fails? Apparently I see zero webp logs in logs/image-resizer.txt "Don't use resize" seems like a solution here but this is a generic approach in my code, sometimes uploaded images are simply already in the correct size. Any ideas how to fix this and always get dem sweet sweet WebP images? Or did I find a bug? Maybe @horst has an idea what the cause of this phenomenon could be? ?
  17. For anyone like me who's slowly descending into madness wondering why their fields are ignoring the required validation: Make sure to set required=1 before setting the HTML5 required attribute. Otherwise the required flag will reset to 0. Correct order: $field->required = 1; $field->attr('required', true); Using requiredAttr is more fool-safe, here the order does not matter (and it looks nicer): $field->required(true); $field->requiredAttr(true);
  18. A bit late but hey: If you only pass one argument to attr it will retrieve the value. So to set / tick a checkbox try $field->attr("checked", 1). Note that even attr("checked", 0) will set the checked attribute, so simply do nothing to leave it un-checked. If discard is already an InputfieldCheckbox from your template, you can simply do $field = $page->getInputfield('discard'); and it will automatically come with the correct label, value and checked attr from the backend. To also make this work in a "create new" form (when there is no $page yet) you can also get fields via $fields and a NullPage: $f = $fields->get('discard'); $p = $do_we_already_have_a_page ? $page : new NullPage(); $field = $f->getInputfield($p);
  • Create New...