Recently Updated Topics
Showing topics posted in for the last 7 days.
- Today
-
Fixed it, it will be released in Duplicator v1.5.0. I tested AWS, no problem found. I will release also the updated Duplicator-SDKs. It's committed.
-
Whatever I do, it does not work (it shows only the link). I have only this textformatter and the video is public: <p>https://www.youtube.com/watch?v=ciyEItodGOw</p> I have no idea what else could be wrong…
-
Hey @adrian this is the whole block: // Session if (in_array('session', $panelSections)) { $session_oc = 0; $session = $this->sectionHeader(array('Key', 'Value')); foreach ($this->wire('session') as $key => $value) { if ( $key == 'tracyDumpItemsAjax' || $key == 'tracyDumpsRecorderItems' || $key == 'tracyEventItems' || $key == 'tracyMailItems' || $key == 'tracyIncludedFiles' || $key == 'tracyPostData' || $key == 'tracyGetData' || $key == 'tracyWhitelistData' || $key == 'tracyLoginUrl' ) continue; $session_oc++; try { if (is_object($value)) $value = (string)$value; } catch (\Throwable $th) { try { $value = json_encode($value); } catch (\Throwable $th) { $value = $th->getMessage(); } } if (is_array($value)) $value = print_r($value, true); $session .= "<tr><td>" . $this->wire('sanitizer')->entities($key) . "</td><td><pre>" . $this->wire('sanitizer')->entities($value) . "</pre></td></tr>"; } $session .= $sectionEnd; } Not sure about this and when that code is used. But I think we can ignore this request. I've changed my code to save values as plain array in the session. The session is not meant to store any type of object, so it's ok if it breaks I guess?!
-
Templates & access restictions on multilanguage site
Zeka replied to DV-JF's topic in API & Templates
Hi @DV-JF Probably you can use 1 option and then make a hook to 'ProcessPageView::pageNotFound' and within the hook, definition make a redirect to the login page like $this->wire()->pages('/login/')->url([ 'language' => $this->wire()->user->language, ])- 1 reply
-
- 1
-
-
I did some testing with HTML like <p>E-Mail: <a href="mailto:test@email.com">test@email.com</a></p> and it didn't catch the links. I think this is related to https://github.com/patman15/EmailObfuscation/blob/cfb7d7e50cf7ac47a6b40b054e4174275df7b68e/EmailObfuscation.module#L375 !empty($arr = ...) The $arr definition should be outside !empty(), I guess. Also you original mailto_pattern didn't catch the address until I removed self::fastpattern. Also mailto hrefs like this do not work: <a class="icon social ma" href="mailto:?subject==?UTF-8?B?RGllIFdlYnNpdGUgZGVyIFNQSUVMQkVSR0VSIE3DvGhsZSB3dXJkZSBkaXIgZW1wZm9obGVu?=&body=https%3A%2F%2Fspielberger.ddev.site%2Fde%2Fimpressum%2F" title="Diese Seite per Email teilen"><span class="sr-only">Diese Seite per Email teilen</span></a> And yes, I think modifying the DOM while iterating can cause some issues. You might want to collect all relevant node instances in an array first and then iterate over that and do the replacement.
-
The other thing that I think should be implemented is a better cache expiry option - given how infrequently sitemap.xml files are called by search engines, I don't really think any sort of time based expiry is much use in reality. I think it should support wireCache's selector option (set to expire when any page is saved - although on regularly updated sites, even this might not result in the cache being used very often).
- Yesterday
-
Hey @ryan sounds like a great module 🙂 Wouldn't it be nice if the module's config screen showed that information? So it would be in a safe space without additional steps to do 🙂
- 1 reply
-
- 2
-
-
Thanks. Is paying you to develop this feature an option?
-
Update: SOLVED! Never mind, I had moved a bunch of hooks to admin.php, including the DynamicOptions hook, which is why it stopped working on the frontend. I have put the hook back in ready.php and works as expected. Of course that makes perfect sense in retrospect. [--- Snipped description of the problem, it was a wild goose chase! --]
-
Now that there is llamaindex https://gpt-index.readthedocs.io/en/latest/index.html with connector for github repo https://llamahub.ai/l/github_repo available, I thought it would be awesome to have a LLM that is specifically trained on PW. I thought I'd give it a try and asked GPT-4 for some guidance on how to create an index and then setup training and so on. Here's what I asked for And that was the answer Disappointing. This answer proves that even GPT-4 has only data until Sept. 21 available. At that time llamaindex was not public yet. I'm not into python at all. So I would have a hard time when trying to setup indexing of the PW github repo and then training a LLM on that index. I'd love to see how this would work out. But GPT-3 and 4 are already quite good at understanding PW, it seems. I installed https://marketplace.visualstudio.com/items?itemName=Rubberduck.rubberduck-vscode in vscodium. So I don't have to switch to the browser when asking GPT. Pretty neat tool.
-
Just wanted to install Copilot on https://vscodium.com/. Unfortunately not possible atm. And don't think it will be possible anytime in the future. Seems like MS is locking open source projects out. Anyways, I opted for https://codeium.com/ and will give this a go. Had https://www.tabnine.com/ installed for almost 1 month. But it was no great help IMHO. Especially when it comes to PW specific stuff.
-
@Zeka I wholeheartedly agree to most of what you wrote. The first version is more beautiful and presumably more performant. But as in most cases this is a small clients projects. Meaning nobody is ever going to look at that code and judge it by those standards. As soon as the page is online no one (including myself) will look at the code for a long period of time. Then my client will ask for some changes and I - or even worse - a new person will open that site and try to figure out how things are happening. And at this point the first version has its flaws. From the viewpoint of structure the second version (although not as beautiful) is better to handle. I have everything regarding one workflow at one point. So anyone not familiar with the code can look for "what happens with field1?" without gathering together bits and pieces shattered over half the document. Of course i can use comments but it's still like "what you are looking for is in shelf 1" vs. "What you are looking for is in shelf 1, 2, 5, 12 and some minor places I surely forgot to mention". So if performance issues are neglectable I'd rather prefer the second version for any page that is not maintained on a regular basis.
- Last week
-
Thanks. Yes, I think you're right on the number: 62^16. So when you put it like that it seems more than fine. The firewall should pick up on repeating attempts anyway. When it comes to stuff like this, I always self-doubt so like to get a second opinion. 🙂 As part of the process the phone number is the only field we will always have. I didn't mean it so much for intercepted SMSs as they would have the token by then, no matter how secure. It was more as a way to only allow the brute forcing of one users at a time. By the way, I'm sure you cited GUIDs because of their length but you should never used them for secure tokens. They're generated for uniqueness, not unpredictability.
-
Hi @ryan, after some testing around with our translation management, I saw that we need XLIFF format for most of our translation tools (https://www.across.net/, https://tolgee.io/) I guess you could take the id attribute in XLIFF and use some [pageid]-[fieldname]. Example for file from tolgee export/import file XLIFF: <file xmlns="" datatype="plaintext" source-language="de" target-language="de"> And "skeleton" is not mandatory. So there is not need for in in Processwire exports. Example XLIFF export format for processwire could look like this: <?xml version="1.0" encoding="UTF-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2"> <file xmlns="" datatype="plaintext" source-language="en" target-language="de"> <body> <trans-unit id="1234-title" datatype="html"> <source>Hello World</source> <target>Hallo Welt</target> </trans-unit> <trans-unit id="1234-body" datatype="html"> <source> <p> <strong>A text about flowers.</strong> </p> </source> <target> <p> <strong>Ein text über Blumen.</strong> </p> </target> </trans-unit> </body> </file> </xliff> This approach is for XLIFF 1.2 which is used by toolge but its depricated. Maybe it would be good to make an export/import option for XLIFF 1.x and XLIFF 2.x.
-
Problems after hosting company upgraded to Debian 10
caffeineben replied to caffeineben's topic in General Support
Just a quick note to say it happened again and it was once again related to Processwire updating the OS of their services - in the process resetting ModSec rules. They went through and had to manually reset all the rules for all my sites and all working again. Thank you @Hani and @gRegor. Last time this happened was the end of 2020 and I had forgotten that was what was causing the spinning wheel when trying to upload even small images in the admin. A quick search brought this thread up and I was able to quickly get things resolved with help from Dreamhost because I knew the issue. Your help is much appreciated! -
Ok great, I thought I might be missing something, which can easily happen if you don't use the "regular" approach any more 🙂 For me the runtime approach in general is a huge benefit. Once you start defining things in code all the little details that you would usually avoid because the GUI does not support it suddenly become a no-brainer and very easy to add. All the little customisations that you'd usually need a hook or a module for. They are simply there in your pageclass and you start to develop the backend (page editor) similar to how you'd develop your frontend. <?php public function editForm($form) { if ($f = $form->get('title')) { $f->appendMarkup(" <div>Custom field markup without any hooks...</div> <style>#wrap_Inputfield_title {border: 5px solid red;z-index:1;}</style> <script>console.log('js-demo');</script> "); } } PS: Note that this code will only be added on the page editor of pages having the pageclass where you defined your editForm() method! So if you added that in HomePage.php you'll only get the red border on the "home" page 🙂
-
How to setup Composer and use external libraries in ProcessWire
szabesz replied to MoritzLost's topic in Tutorials
https://processwire.com/talk/profile/2312-richard-jedlička/ -
Display page data on other page depending on a field
DV-JF replied to brandy's topic in General Support
As far as I understand the code it should be $pages->find("parent=/unterkuenfte/, region=$vorschlag->tour_start"); -
Comments module with Cloudflare Turnstile
millipedia replied to millipedia's topic in Modules/Plugins
OK - this kind of works: In my template I've included the Cloudflare script (and added their end point to the content security policy). Then I'm injecting a placeholder into the form: $comments_form= $page->comments->renderForm(array( 'requireHoneypotField' => 'email2' )); // add a div with class="cf-turnstil" to the form - this gets replaced with a token (after a successful challenge) $cft_tag='<div class="cf-turnstile" data-sitekey="yourturnstilesitekey"></div>'; $comments_form=str_replace("CommentForm' method='post'>","CommentForm' method='post'>$cft_tag", $comments_form); echo $comments_form; Cloudflare replaces that with a token if they think you're not a bot. Then in init.php (not _init.php) I'm hooking into ProcessPageVIew $this->addHookBefore('ProcessPageView::execute', function(HookEvent $event) { if(wire('input')->post('CommentForm_submit')){ // get the Cloudflare token. $cf_token=wire('input')->post('cf-turnstile-response'); // and send it to siteverify $postdata = http_build_query( array( 'secret' => 'yoursupersecretcloudflaresecretkey', 'response' => $cf_token ) ); $opts = array('http' => array( 'method' => 'POST', 'header' => 'Content-Type: application/x-www-form-urlencoded', 'content' => $postdata ) ); $context = stream_context_create($opts); $api_json_response = file_get_contents('https://challenges.cloudflare.com/turnstile/v0/siteverify', false, $context); if($api_json_response ){ // check result and redirect if failed. $result=json_decode($api_json_response,TRUE); if(!($result['success'])){ // die or redirect or whaterver you fancy. // print_r($result); // die("Failed verification."); wire('session')->redirect('/some-help-page-or-something/'); } }else{ // die or redirect or whaterver you fancy. die("No response from verification server."); } } }); If we have a comment that's been submitted then I check the token with Cloudflare. If it fails we can redirect or die or something - it'd be nice to fail a bit more gracefully. No idea how well this will deal with spam and I think I'll need to do some user testing but I think it might be useful. -
@DV-JF I also had the same behavior that no core updates were displayed. This phenomenon was only with Processwire installations that were already somewhat older. I then noticed that the ready.php in the site folder were different for these old installations. Replacing them with a new ready.php resulted in the coreupdates being displayed again. But be careful, if you already have a modified ready.php, you have to make these changes in the new file too.
-
Hi @bernhard, sorry for the delayed response but I'm flitting between 2 projects and have just come back to this. From looking at that Tracy source code and reading the Tracy docs it looks like the method used relies on the alt-template being in the main /site/templates/ folder and having a recognisable suffix. My goal is: 1) to keep dev templates outside of the main templates folder (eg. have /site/templates/ and /site/dev-templates/) 2) for /site/dev-templates/ not to require a full set of templates, just one or two that are being worked on, and to 'fallback' to the main templates folder if there is no tpl for the current request in dev-templates. My problem is that include files and assets are no longer in the same relative location if the alt-template is used when the dev-tpl is not in the same folder as the main tpl. TBH, it's not super-high priority but I think it would be useful both when collaborating or when modifying a live site so I will come back to it at some point.
-
@horst after a PHP upgrade to 8.2 we get these deprecation warnings: PHP Deprecated: Creation of dynamic property ImageManipulator02::$originalImage is deprecated in ImageManipulator02.class.php:215 PHP Deprecated: Creation of dynamic property ImageManipulator02::$configOptions1 is deprecated in ImageManipulator02.class.php:265 PHP Deprecated: Creation of dynamic property ImageManipulator02::$configOptions2 is deprecated in ImageManipulator02.class.php:267 PHP Deprecated: Creation of dynamic property ImageManipulator02::$dibIsLoaded is deprecated in ImageManipulator02.class.php:839 PHP Deprecated: Creation of dynamic property ImageManipulator02::$iptcRaw is deprecated in ImageManipulator02.class.php:362