Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/29/2024 in all areas

  1. It’s been a fairly quiet week here at the ProcessWire HQ as it’s a Thanksgiving week where the kids don’t have school, which means less time in the office. This is the time of year when we think about what we’re thankful for, and I’m especially thankful for all of you and the ProcessWire community. Even with the holiday week, work continues on our next main/master version of ProcessWire. This week Bernhard and Adrian identified that ProcessWire doesn’t work well with PHP 8.4 due to some new deprecations introduced by this version of PHP. It’s a technical detail, but PHP 8.4+ wants a question mark before function/method arguments of named types that have a default value of null. So if the function arguments were (PageArray $items = null) PHP 8.4 wants it to be (?PageArray $items = null). Why? Who knows, perhaps not even PHP does, as “?” points directly to it being a question, one with no obvious answer. Perhaps it wants to make sure we really meant what we wrote, so the “?” is an “are you sure?”. Without question, the “= null” part is a pretty clear statement about what the intention is, no? I question the question mark, doesn’t this turn arguments into questions? Questionable arguments? Being so close to a new master/main version, there’s no question that we want to make sure it works with the latest available PHP version, questionable or not. So that meant adding new questions to 72 different core files, which you’ll find on the dev branch this week. There may be more questions yet to answer, but those are the instances I was able to find so far. There’s a tradeoff in that the questions were introduced by PHP 7.1, so it’ll produce a parse error on any prior versions of PHP. Meaning, our minimum required PHP version is now 7.1. Prior to today, it was 7.0 (actually, PW still even worked even on PHP 5.6, not that it matters). Similar questions will have to be added to modules before they are PHP 8.4 compatible to not throw deprecation notices, so I’ll be making some questionable updates to Pro and public modules in the coming weeks as well. Thanks for putting up with all my questions and have a great weekend! Please reply with your questions below.
    8 points
  2. Hi, This is a basic module to add some classes and css to teh logs list page based on the amount of time since the log has been edited. less than a minute: Red -> purple -> grey less than a week https://github.com/benbyford/HighlightRecentLogs I hooked to the ProcessLogger module ___execute() function and basically overwrote it. Felt abit nasty to me, I wondered if there would have been a better way of doing it?
    1 point
  3. That works! Thank you so much! <?php if($user->language->name == "en-gb"): ?> <script src="<?php echo $config->urls->templates; ?>assets/scripts/cookieconsent-init-en.js" async></script> <?php else: ?> <script src="<?php echo $config->urls->templates; ?>assets/scripts/cookieconsent-init-no.js" async></script> <?php endif; ?>
    1 point
  4. Try maybe: if($user->language->name == "en"){ //Processwire magic }
    1 point
  5. Adding Endpoints to 3rd party modules https://www.baumrock.com/en/processwire/modules/rockfrontend/docs/ajax/#adding-endpoints-to-3rd-party-modules 😉 But of course that means a dependency. Some might prefer that, some might not. Just wanted to mention that the option is there if anybody finds this by coincidence.
    1 point
  6. Thank you very much for the fix. I can confirm that Tracy s now working without the modification. I think, for larger corporate sites redirects that route from root to a specific language/market URI are not that unusual. So it is great that you made things work for those use cases.
    1 point
  7. Hi @gebeer - please try the latest version. I have modified to use $_SERVER['REQUEST_URI'] which I hope should solve things when you guys have these unusual redirects in place and well as @Jonathan Lahijani's issue from here: https://github.com/adrianbj/TracyDebugger/issues/96 Please let me know if you can now work without that modification to your hook.
    1 point
  8. Deprecation warnings say, that it potentially may not be ready for 8.4.2 or 8.4.3 or any other further version. But in my understanding, it is ready for PHP 8.4.0 and 8.4.1. 🙂 If the deprecation warnings bother you, you can disable showing only those messages with a call of PHPs set_error_handler(): /** OWN ERROR HANDLER FOR DEPRECATION NOTES ************************************/ function myLocalDevDeprecationErrorHandler($errno, $errstr, $errfile, $errline) { return true; // true | false = suppress further processing } // preceed the callback function name with the PW namespace, // and define the error types that should passed to the function set_error_handler('ProcessWire\myLocalDevDeprecationErrorHandler', E_DEPRECATED); /** OWN ERROR HANDLER FOR DEPRECATION NOTES ************************************/ I often use this directly in site/config-dev.php, when I want to collect them, but only show them collected at the end of pages in dev local. /** OWN ERROR HANDLER FOR DEPRECATION NOTES ************************************/ function myLocalDevDeprecationErrorHandler($errno, $errstr, $errfile, $errline) { // CHECK / CREATE COLLECTION CONTAINER if (!isset($GLOBALS['DEPRECATION_WARNINGS_BAG'])) { $GLOBALS['DEPRECATION_WARNINGS_BAG'] = []; } if (!is_array($GLOBALS['DEPRECATION_WARNINGS_BAG'])) { $GLOBALS['DEPRECATION_WARNINGS_BAG'] = []; } // DO NOT SHOW THIS KNOWN THIRD PARTY ONES : $hideThisOnes = [ //'FileCompiler', 'Duplicator', 'ProcessCustomUploadNames', ]; foreach($hideThisOnes as $item) { if (preg_match("/{$item}/", $errfile)) return true; } // ADD IT TO THE COLLECTION $GLOBALS['DEPRECATION_WARNINGS_BAG'][] = [$errfile, $errline, $errstr]; return true; // true | false = suppress further processing } // preceed the callback function name with the PW namespace, // and define the error types that should passed to the function set_error_handler('ProcessWire\myLocalDevDeprecationErrorHandler', E_DEPRECATED); /** OWN ERROR HANDLER FOR DEPRECATION NOTES ************************************/
    1 point
  9. https://github.com/processwire/processwire-issues/issues/2000
    1 point
  10. The book is easy to read, kinda silly but fun. When I started reading I had zero experience with OOP, so it was funny to jump to understand "design patterns" without having an idea of the basics... BUT, it did help me to make the switch. I'm more confident now working with Custom Classes. I'm totally going to read it again from the start to interiorize the patterns (hopefully haha).
    1 point
  11. Hey ProcessWire RockStars! ? Ever felt like your ProcessWire backend could use a bit more... pizzazz? Or functionality? Well, it's time to roll up your sleeves and dive into the world of RockAdminTweaks! ??️ Creating tweaks is as easy as smashing a power chord on your guitar! If you've got cool features from AOS you'd love to see, why not port them over? We even have a GUI for creating new Tweaks! Let's make the backend rock even harder! Github: https://github.com/baumrock/RockAdminTweaks Modules Directory: https://processwire.com/modules/rock-admin-tweaks/ Docs: https://www.baumrock.com/processwire/module/rockadmintweaks/
    1 point
×
×
  • Create New...