Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Andi

  1. Awesome news, can't wait to try this. Thank you guys for the effort!!
  2. All good, that seems to have done it πŸ™‚ Glad I could help & thanks for the support!
  3. Somehow i feel like getPath is doing it's thing correctly..., It's supposed to return false if the path is not valid, or am I getting confused here? πŸ™‚ But in AssetsArray.php -> addAll(), there seems to be a check missing for $path. If I change that to public function addAll($path, $suffix = '', $levels = 2, $ext = ['js']) { /** @var RockFrontend $rf */ $rf = $this->wire('modules')->get('RockFrontend'); bd($path, 'before'); $path = $rf->getPath($path); bd($path, 'after'); if (!$path) return; // ******* <-- add this line ********* $files = $this->wire->files->find($path, [ 'recursive' => $levels, 'extensions' => $ext, ]); foreach ($files as $f) $this->add($f, $suffix); return $this; } The errors are gone... Although I'm not quite sure about what to return there πŸ™‚
  4. So, back on this. If I create an empty folder "site/templates/layouts", there's only two errors coming up.. So I guess for the 3 directories that do not exist, instead of not doing anything, the script somehow falls back to trying to look up files in the server root '/site/templates/layouts' <-- does not exist, error 1 '/site/templates/sections' <-- exists '/site/templates/partials' <-- exists '/site/assets/RockMatrix' <-- does not exist, error 2 '/site/assets/RockPageBuilder' <-- does not exist, error 3 Let me know if you need anything else and thanks again! RF is really fantastic already, and loving the new features.
  5. Error is still there on 2.1.10 unfortunately.. Here's the bd.. I need to run now but I'll happily provide more information later today. '/home/sites/XXXXXXXXX/public/site/templates/site/templates/layouts' '/home/sites/XXXXXXXXX/public/site/assets/site/templates/layouts' '/home/sites/XXXXXXXXX/public/site/templates/layouts' '/home/sites/XXXXXXXXX/public/site/templates/site/templates/sections' '/home/sites/XXXXXXXXX/public/site/assets/site/templates/sections' '/home/sites/XXXXXXXXX/public/site/templates/sections' '/home/sites/XXXXXXXXX/public/site/templates/site/templates/partials' '/home/sites/XXXXXXXXX/public/site/assets/site/templates/partials' '/home/sites/XXXXXXXXX/public/site/templates/partials' '/home/sites/XXXXXXXXX/public/site/templates/site/assets/RockMatrix' '/home/sites/XXXXXXXXX/public/site/assets/site/assets/RockMatrix' '/home/sites/XXXXXXXXX/public/site/assets/RockMatrix' '/home/sites/XXXXXXXXX/public/site/templates/site/assets/RockPageBuilder' '/home/sites/XXXXXXXXX/public/site/assets/site/assets/RockPageBuilder' '/home/sites/XXXXXXXXX/public/site/assets/RockPageBuilder' Thanks a bunch!
  6. before '/site/templates/layouts' after false before '/site/templates/sections' after '/home/sites/XXXXXXX/public/site/templates/sections/' before '/site/templates/partials' after '/home/sites/XXXXXXX/public/site/templates/partials/' before '/site/assets/RockMatrix' after false before '/site/assets/RockPageBuilder' after false
  7. Ok so a little more info.. It seems RF is trying to add styles from StylesArray->addAll("/site/templates/layouts") Although I'm currently not using layouts on the site. Then also from StylesArray->addAll("/site/assets/RockMatrix") and StylesArray->addAll("/site/assets/RockPageBuilder") which I don't have installed on this setup, maybe that helps...
  8. Hey and thanks. So that gives me 5 dumps, 3 of which look similar to this one array 0 => array 'file' => '/site/modules/RockFrontend/AssetsArray.php:69' 'call' => 'WireFileTools $files->find("/", [ 2, array(2) ])' <--- this seems to be causing trouble 1 => array 'file' => '/site/modules/RockFrontend/StylesArray.php:28' 'call' => 'StylesArray->addAll(false, "", 2, [ 'css', 'less' ])' 2 => array 'file' => '/site/modules/RockFrontend/RockFrontend.module.php:513' 'call' => 'StylesArray->addAll("/site/templates/layouts")' 3 => array 'file' => '/site/modules/RockFrontend/RockFrontend.module.php:266' 'call' => '$rockfrontend->autoload(Page $obj)' 4 => array 'file' => '/wire/modules/Process/ProcessPageView.module:184' 'call' => 'Page $settings->render()' 5 => array 'file' => '/wire/modules/Process/ProcessPageView.module:114' 'call' => 'ProcessPageView $process->renderPage(Page $obj, PagesRequest $obj)' 6 => array 'file' => '/index.php:55' 'call' => 'ProcessPageView $process->execute([ true ])' The other ones look like this 0 => array 'file' => '/site/modules/RockFrontend/AssetsArray.php:69' 'call' => 'WireFileTools $files->find("/home/sites/XXXXX/web/XXXXXX/public/site/templates/sections/", [ 2, array(2) ])' ... So somehow AssetsArray.php seems to be looking for something in the server root, although I have no idea what exactly, and why πŸ˜„ I'll investigate further.. Many thanks for the pointers @bernhard
  9. Hey @bernhard, after deploying from ddev to a live server Tracy is giving me 3 errors per page load (frontend only) like this: PHP Warning: is_dir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/home/sites/XXXXXXXXXXXX/:/tmp/:/dev/:/usr/share/php/:/etc/ssl/certs/:/usr/lib64/php8.0/bin/) in .../XXXXXXXXXXXXXX/public/wire/core/WireFileTools.php:765 I wasn't even sure if Rockfrontend was the culprit here, but I checked two versions. On 2.0.7 Tracy gave me the error twice, while on 2.1.5 it's three times per page.. We're on a shared hosting plan with this project, not sure how to go about this.. Any idea what could be going on there?
  10. Hey @kaz, in /site/modules/FieldtypeLeafletMapMarker/InputfieldLeafletMapMarker.module try changing line 193 f. if( ((string) round($lat, $precision)) != ((string) round($this->defaultLat, $precision)) || ((string) round($lng, $precision)) != ((string) round($this->defaultLng, $precision))) { to if( ((string) round(floatval($lat), $precision)) != ((string) round(floatval($this->defaultLat), $precision)) || ((string) round(floatval($lng), $precision)) != ((string) round(floatval($this->defaultLng), $precision))) { that's hotfixing the issue over here. Don't know about the rest of the module, but I haven't gotten other errors so far.
  11. @bernhard you're on fire ? Looks great but I'm currently on a self-hosted Gitea instance, and it looks like they're not planning on supporting Github Actions anytime soon.. https://github.com/go-gitea/gitea/issues/12673#issuecomment-684968986 Thanks for the heads up though, I'll keep an eye on RM!
  12. @bernhard Trying this on a test project currently, I'm wondering if there's an easy way to add pages to RockFrontend the same way you're doing with $home. Let's say, I normally have a /contact/ page, stored in $contact, holding all possible information, phone numbers, social media links etc., and I'd like to make that page available in all rendered files. Right now, unless I'm missing something, I could use custom variables to pass to $rockfrontend->render(), but that doesn't seem to work with ->renderLayout().. The other minor issue I'm having, if you use Alfred on an empty text block, you don't get the edit links, the whole block just disappears. Other than that, very nice work, feels really good to be using Latte again ?
  13. If you're following the steps above, don't forget (like I did earlier) to make the bash script executable.. In Step 6, after editing your post-recieve file $ cd /var/www/myproject-git/hooks $ chmod u+x post-receive Very cool guide @gebeer, I was toying around with a webhook from Gitea calling on a local php script earlier today, which runs okay, but this seems way more elegant.. And definitely easier to set up ? Thanks!
  14. Just a quick note, if you're on Linux & Code-OSS and have trouble opening your ALFRED / Tracy links to directly edit template code (around 34:00 in the video), you need to create a separate URL handler for vscode:// type links in ~/.local/share/applications create a file code-oss-vscode-url-handler.desktop #!/usr/bin/env xdg-open [Desktop Entry] Name=Code - OSS - VSCode URL Handler Comment=Handles opening of vscode:// URLs in Code-OSS GenericName=Text Editor Exec=/usr/bin/code-oss --open-url %U Icon=code-oss Type=Application NoDisplay=true StartupNotify=true StartupWMClass=Code - OSS Categories=Utility;TextEditor;Development;IDE; MimeType=x-scheme-handler/vscode Keywords=vscode; Terminal=false Borrowed from here: https://github.com/Microsoft/vscode/issues/48528#issuecomment-414056547 And Alfred is your new best pal ?
  15. Thanks @bernhard! Tried that but somehow Firefox keeps acting up.. See the first two screenshots attached, one of these two pops up on every page reload (no addons activated). Vs. no problems on Chromium (last screenshot). Maybe something to keep an eye on.. I'll investigate some more and maybe try this on a live server later. ### Firefox 1: ### Firefox 2: ### Chromium:
  16. Hey @bernhard, working through some chapters of the video. Lots of good stuff in there, just DDEV and livereload alone will be major game changers for me. And that's only the first 5 minutes ? As for the module itself, everything's working nicely so far, but Firefox console is complaining that Die Verbindung zu https://pw-rockfrontend-test.ddev.site/livereload.php?secret=###secretkey123456### wurde unterbrochen, wΓ€hrend die Seite geladen wurde. livereload.js:7:20 English: The connection to http://site/livereload.php broke up while the page was being loaded. Happens on almost every page load, Frontend and Backend. Chromium seems fine. Also, despite the error message in FF, I'm not noticing anything breaking at all. Any ideas what could be happening here? Thanks in advance and servus from Regensburg!
  17. As much as I appreciate @bernhard's faith in my motivation (?), and as much as I'd like to contribute, that would at this point go way above my head.. I keep pushing the day where I'll finally take a dive and learn to use git/hub/lab. And I'm still struggling to find my way around these "new" development tools and procedures.. Lots of ground to cover there currently. But yeah this seems like something that would be really useful. Maybe even as some kind of default way of dealing with user input, as I currently could only think of fringe cases where someone would not want to have this enabled..
  18. After some more testing I feel like this should be safe to implement on the production site.. The only remaining issue at this point being.. The image description input fields seem to be a different kind of beast altogether.. Is there any way to extend the hook to cover these as well?
  19. Ok ... ->count() ? in site/ready.php /** * run all Text and Textarea input fields through UTF-8 normalization * requires justb3a's TextformatterNormalizeUtf8 module * https://modules.processwire.com/modules/textformatter-normalize-utf8/ * * @var Inputfield $inputfield * @var WireInputData $input * @var Language $language * */ $wire->addHookBefore('InputfieldTextarea::processInput, InputfieldText::processInput', function (HookEvent $event) { $inputfield = $event->object; $input = $event->arguments(0); if (wire()->modules->isInstalled("TextformatterNormalizeUtf8")) { if ($this->languages && $this->languages->count() > 1) { foreach ($this->languages as $language) { $input_var_name = $language->isDefault() ? $inputfield->name : "{$inputfield->name}__{$language->id}"; $normalize_input = $input->$input_var_name; wire()->modules->get('TextformatterNormalizeUtf8')->format($normalize_input); $input->set($input_var_name, $normalize_input); } } else { $input_var_name = $inputfield->name; $normalize_input = $input->$input_var_name; wire()->modules->get('TextformatterNormalizeUtf8')->format($normalize_input); $input->set($input_var_name, $normalize_input); } } $event->arguments(0, $input); }); This is by no means thoroughly tested.. Use at your own risk ? Does anyone see how there could be any downsides to this approach on a live PW site?
  20. So on the input side of things.. I'm thinking, since we don't know about ..but we have @justb3a's module we could combine @interrobang's idea of hooking into InputfieldTextarea::processInput with calling the textformatter module to sort out normalization right off the bat.. This almost works ? $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 (wire()->modules->isInstalled("TextformatterNormalizeUtf8")) { bd($this->languages); // ### this doesn't seem to be an array ### if ($this->languages && $this->languages->count > 1) { // ### this part never gets called ### foreach ($this->languages as $language) { bd("language loop"); $input_var_name = $language->isDefault() ? $inputfield->name : "{$inputfield->name}__{$language->id}"; $normalize_input = $input->$input_var_name; wire()->modules->get('TextformatterNormalizeUtf8')->format($normalize_input); bd("$input_var_name :: $normalize_input"); $input->set($input_var_name, $normalize_input); } } else { // ### this part works ### $input_var_name = $inputfield->name; $normalize_input = $input->$input_var_name; wire()->modules->get('TextformatterNormalizeUtf8')->format($normalize_input); $input->set($input_var_name, $normalize_input); bd("$input_var_name :: $normalize_input"); } } $event->arguments(0, $input); }); With this, utf-8 normalizing works for the default language input fields, but currently all others remain untouched. I tried looking around for a working example of how to get to the language fields, but no luck so far.. Also feeling just a tad bit twitchy about hooking in at such a deep level, but so far no problems during testing.. Does anyone have an idea where I'm going wrong here? Thanks and all the best..! Almost there I think ?
  21. Haha @bernhard easy on me.. Still coding like it's 2005 over here.. Guess the 10 year break made me miss out on a whole lot of stuff ? Good lord I'm glad these arrays are no longer needed ? if ($modules->isInstalled("TextformatterNormalizeUtf8")) { $pgs = $pages->find("template=artist"); foreach($pgs as $p) { $p->of(false); $summary=$p->summary; bd("OLD: $summary"); $this->modules->get('TextformatterNormalizeUtf8')->format($summary); bd("NORMALIZED: $summary"); $p->summary = $summary; $p->save('summary'); } }
  22. Just getting started here but I can already confirm that @justb3a's module completely fixes this issue on the frontend side of things.. Now I'd basically just need to find a simple way to run every text & textarea field in both language versions through the normalizer.. Actually also pagetitle fields.. Or ideally, literally every bit of text that's being saved to the database.. Or would there be any downsides to that at all? --- Module works fine on PW v3.0.148 by the way
  23. I'm aware of that, but thanks for pointing it out @interrobang Thought I just put that here for future reference, I'm imagining many people (like me until 3 hrs ago ?) haven't even heard of the term utf normalization. That thread at the wordpress tracker is a great read btw. There's a lot there already, so I think we should be able to get this whole thing sorted out by tomorrow night. Cheers & danke vielmals ?
  24. Always helps to know what you're looking for ? https://modules.processwire.com/modules/textformatter-normalize-utf8/ Thanks for the pointers @interrobang, this is going to help a lot..
  25. Haha ok looks like you're right on the money ? Awesome stuff, that really makes this all seem a little less nonsensical.. I'll absolutely make sure of that.. Will set this up tomorrow first thing in the morning and report back. Thank you all for your help and advice! SchΓΆnen Feierabend! ?
  • Create New...