Jump to content

gebeer

Members
  • Posts

    1,417
  • Joined

  • Last visited

  • Days Won

    39

Everything posted by gebeer

  1. Let me throw https://laradock.io/ into the mix. I've been using it for the last 3 years or so. Absolutely great.
  2. @Mike Rockett has this been addressed yet? I have a customer complaining about this. Would be really nice if those 404 entries got removed. Any plans on implementing this? And thousand thanks for this great module!
  3. I tried both but it didn't help. Also I uninstalled and removed the module, deleted all cookies, local storage and session storage and then reinstalled. Problem persists. Can't see what the invalid escape sequence could possibly be. On my local dev install of the website, I don't have that problem. I'll try to find the cause for this behaviour and will let you know here. Thanks again.
  4. Thanks for that hint. I already had deleted cookies and local storage. Didn't help. Problem persists across browsers, also in private mode. So it doesn't seem to be related to local storage.
  5. Hello, on one of my installs the editor window in the Console in the backend doesn't show up and I get this error in the JS debug console: Uncaught SyntaxError: invalid escape sequence evalScripts .../admin/module/edit?name=TracyDebugger&collapse_info=1&_tracy_bar=js&v=2.5.9&XDEBUG_SESSION_STOP=1:514 forEach .../admin/module/edit?name=TracyDebugger&collapse_info=1&_tracy_bar=js&v=2.5.9&XDEBUG_SESSION_STOP=1:665 evalScripts .../admin/module/edit?name=TracyDebugger&collapse_info=1&_tracy_bar=js&v=2.5.9&XDEBUG_SESSION_STOP=1:508 init .../admin/module/edit?name=TracyDebugger&collapse_info=1&_tracy_bar=js&v=2.5.9&XDEBUG_SESSION_STOP=1:35 displayTimeout .../admin/module/edit?name=TracyDebugger&collapse_info=1&_tracy_bar=js&v=2.5.9&XDEBUG_SESSION_STOP=1:302 setTimeout handler*initTabs/</< .../admin/module/edit?name=TracyDebugger&collapse_info=1&_tracy_bar=js&v=2.5.9&XDEBUG_SESSION_STOP=1:297 initTabs .../admin/module/edit?name=TracyDebugger&collapse_info=1&_tracy_bar=js&v=2.5.9&XDEBUG_SESSION_STOP=1:291 forEach .../admin/module/edit?name=TracyDebugger&collapse_info=1&_tracy_bar=js&v=2.5.9&XDEBUG_SESSION_STOP=1:665 initTabs .../admin/module/edit?name=TracyDebugger&collapse_info=1&_tracy_bar=js&v=2.5.9&XDEBUG_SESSION_STOP=1:264 init .../admin/module/edit?name=TracyDebugger&collapse_info=1&_tracy_bar=js&v=2.5.9&XDEBUG_SESSION_STOP=1:254 init .../admin/module/edit?name=TracyDebugger&collapse_info=1&_tracy_bar=js&v=2.5.9&XDEBUG_SESSION_STOP=1:388 <anonymous> .../admin/module/edit?name=TracyDebugger&collapse_info=1:284 edit:1:155320 This has been going on for some time. Also persists after upgrade to v4.21.20. Refreshed modules, cleared all cookies and local storage related to TD to no avail. Console looks like this and div#tracyConsoleEditor is empty: Any help on how I can back the console editor would be much appreciated.
  6. HAving similar PHP warnings here PHP Warning: exif_read_data(1-transf-kosk4-min.gif): File not supported in /home/m1698/Sites/processwire/site/modules/FileValidatorImage/FileValidatorImage.module:398 On this install I'm running images attached to a frontend form upload through the FileValidatorImage module which I installed first. This module uses PHP's exif_read_data function. And that doesn't seem to support gif. Couldn't find a list of supported file types in the PHP docs, though. I don't really worry too much about the warning itself. Only the mails I get from Tracydebugger get annoying after a while ;-) Just posting for reference.
  7. The wire folder is already in my workspace. Or do you mean I have to add it in VSCode in the workspace settings? After adding namespace ProcessWire to my template files, I got rid of these errors.
  8. VSCode with intelephense, in the Problems tab I always get this error for __() language string function Anyone knows how to get rid of this? Just found out that it was a namespace problem. When namespace ProcessWire is not declared, intelephense will throw this error.
  9. If I understand this correctly, then your default language should be German. What was the reasoning behind switching languages in your case? If you want to write a PHP script, maybe my old script can give you some pointers. I wrote that years ago when I wasn't very experienced in working with the PW API. So there sure is much room for improvement.
  10. @Florian Thanks for sharing! I also wonder why we do not have this in the core.
  11. After looking through it, it should be compatible with 3.x. Most paths haven't changed since 2.x But in 3.x there are lots of new .htaccess rules. I wonder if anyone has already "translated" them to Nginx?
  12. Guess you need to initialise the map in your callback function to make it render. I'm using Openstreetmaps with this code { name: 'openstreetmaps', default: false, title: 'Open Street Maps', purposes: ['localityinfo'], cookies: [], callback: function (consent, app) { if(consent && window.initMap !== undefined) { setTimeout(function() { window.initMap(); }, 1000); } } } You see that window initMap() gets called here. You need to make sure that you can call your init function code for your Google map from the global namespace. I have a function initMap() that sets aup the map function initMap() { // console.log(window.L); if (window.L === undefined) return false; const mapcontainer = document.getElementById('map'); const latlng = JSON.parse(mapcontainer.getAttribute('data-latlng')); const address = JSON.parse(mapcontainer.getAttribute('data-address')); mapcontainer.removeChild(mapcontainer.getElementsByTagName('img').item(0)); var mymap = window.L.map('map').setView(latlng, 10); window.L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', { attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', maxZoom: 18, id: 'mapbox.streets', accessToken: 'xxx' // get from https://account.mapbox.com/access-tokens/ }).addTo(mymap); var marker = window.L.marker(latlng).addTo(mymap); marker.bindPopup(address)/* .openPopup() */; } and attach it in my JS to the global namespace addEventListener('DOMContentLoaded', () => { if (document.getElementById('map')) { window.initMap = initMap; } });
  13. Hello and thanks for your work! is this still being maintained? Last changes on github dev repo are 16 months ago.
  14. Hi, I'm facing a strange issue with priority values being output with colon (0,5) instead of period (0.5) which I guess is wrong. On some servers PW issues a warning to translate the locale setting: I have a site with a single language (German) and language support enabled to have the backend translated to German. So I translated the locale setting to de_DE.UTF-8 But now sitemap items that are generated through a hook will output 0,5 (which is correct for German locale). Other pages in the sitemap output correctly like 0.5. I have automatic sitemap generation disabled because I update it manually whenever some data changes that comes from an external XML and is converted to virtual pages on runtime that do not get saved to the DB. My code for adding those virtual page entries to the sitemap public function updateXmlSitemap() { $config = $this->wire('modules')->getConfig('SeoMaestro'); $items = $this->stellenangeboteXMLToPageArray(); // results in array of virtual pages $entries = array(); foreach ($items as $item) { $entry = (new SitemapItem()) ->set('loc', $config['baseUrl'] . $item->url) ->set('lastmod', date('c'), time()) ->set('priority', (float) 0.7) // casting explicitly to float doesn't help ->set('changefreq', 'daily'); $entries[] = $entry; } $this->addHookAfter('SeoMaestro::sitemapItems', function (HookEvent $event) use ($entries) { $event->return = array_merge($event->return, $entries); // add my entries to the sitemap }); $manager = new SitemapManager($config); try { $sitemap = $manager->generate($this->wire('config')->paths->root . $config['sitemapPath']); if (!$sitemap) { $this->wire('log')->save(strtolower($this->className), 'Could not generate sitemap'); } else { $this->wire('log')->save(strtolower($this->className), 'sitemap generated'); } } catch (\Throwable $th) { $this->wire('log')->save($this->className, 'Error generating sitemap' . $th->getMessage()); } } I don't know why the items added to the sitemap through my hook produce different output (0,5) from the items that are generated by the module (0.5). Could you make sure in the module code that the priority value is always being rendered as a float value, no matter what locale setting? That would be awesome.
  15. It is working ok. I was just curious how you create the non-css version.
  16. How do you actually build a version without css? I cloned the repo and added this to the scripts section of package.json and then run npm run makenocss "makenocss": "cross-env APP_ENV=production cross-env APP_VERSION=$(git tag --points-at HEAD) cross-env APP_COMMIT=$(git rev-parse HEAD) cross-env SEPARATE_CSS=true webpack --config webpack.config.js" This will build a klaro-no-css.js inside dist. Is there a simpler way passing the SEPARATE_CSS flag to the make script?
  17. You can have a site/config-dev.php with all config for your local dev environment. If this file exists, all config values will be pulled from it instead of site/config.php. This is the common PW-way of having separate configs for live and development environments. This info can be found on this page in the docs at the very bottom.
  18. With klaro consent manager you can gain control over the scripts loaded by GTM. See this issue. (I'm not affiliated with that project in any way, just using it on a couple of sites) It is implemented via custom callback functions for each app that is managed by the consent manager. @joshua Maybe you could go a similar route to make configuration more flexible and tweakable? And thanks for putting this together! And a suggestion for improvement: The type="optin" attribute is not a valid script attribute. So W3C Validator will not like it. You could use text/plain instead. That is not very semantic but could help to pass validator tests...
  19. Hello all, wasn't sure where to put this, so it goes in General section. Ryan shows a hook that we can use to mirror files on demand from live server to development environment to be up to date with the files on the server without having to download complete site/assets/files folder. I just implemented this but had problems getting files to load from a site in development that is secured with user/password via htaccess. First I tried to use WireHttp setHeader method for basic authentication like this function mirrorFilesfromLiveServer(HookEvent $event) { $config = $event->wire('config'); $file = $event->return; if ($event->method == 'url') { // convert url to disk path $file = $config->paths->root . substr($file, strlen($config->urls->root)); } if (!file_exists($file)) { // download file from source if it doesn't exist here $src = 'http://mydomain.com/site/assets/files/'; $url = str_replace($config->paths->files, $src, $file); $http = new WireHttp(); // basic authentication $u = 'myuser'; $pw = 'mypassword'; $http->setHeader('Authorization: Basic', base64_encode("$u:$pw")); $http->download($url, $file); } } But, unfortunately this didn't work. So now I am using curl to do the download. My hook function now looks like this function mirrorFilesfromLiveServer(HookEvent $event) { $config = $event->wire('config'); $file = $event->return; if ($event->method == 'url') { // convert url to disk path $file = $config->paths->root . substr($file, strlen($config->urls->root)); } if (!file_exists($file)) { // download file from source if it doesn't exist here $src = 'http://mydomain.com/site/assets/files/'; $fp = fopen($file, 'w+'); // init file pointer $url = str_replace($config->paths->files, $src, $file); $u = 'myuser'; $pw = 'mypassword'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 50); // crazy high timeout just in case there are very large files curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, "$u:$pw"); // authentication curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); // authentication curl_setopt($ch, CURLOPT_FILE, $fp); // give curl the file pointer so that it can write to it curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $data = curl_exec($ch); curl_close($ch); } } Now I can load files and images from the htaccess protected development server ? If anyone knows how to get this to work with WireHttp, please let me know. Thank you.
  20. I am having a different issue. With v1.2.0. I get this warning: Warning array_key_exists() expects parameter 2 to be array, null given File: .../EmailObfuscation/EmailObfuscation.module:352 352 if(!is_array($options) && !array_key_exists('pageStack', $options)) { return false; } If $options passes the first test, it is not an array. The second test checks for array_key_exists in a non-array. Hence the warning. The error is being triggered when $options is null. As a temp workaround I amended the if statement to read if(is_array($options) && !array_key_exists('pageStack', $options)) { return false; } Not sure though if this is correct. Maybe you wanted to return false when $options is not an array, too?
  21. Instead of having extra fields and saving extra data, you could make use of the $page->references() method, I mentioned above. You could utilize this method inside a ProcessPageEdit::buildFormContent hook and add a Markup field that holds the titles (and even links) of the referenced pages. Just an idea.
  22. I thought I'd just use your new inputfield type ? Won't have time for implementing this before April. If I see room for improvement on your module, I am happy to make a PR. Thanks again!
  23. Since modern browsers support flex and grid and most CSS3 specs, I also moved from using frameworks like BS to setting up things manually with my own, reusable scss partials and the JS libs that I need for a project. Also trying to move more and more to vanilla JS and kick jQuery. This way I get more streamlined assets. If I need to support old browsers (mainly IE11), I write some specific extra CSS to cater for them if need be.
  24. Did you have a look at $page->references() method? This gives you all pages that reference this page. In the page edit screen you can see those in the "Settings" tab under "What pages link to this page". With this method available in your template php maybe you don't even need your hook. And there is @Robin S's module ConnectPageFields that handles those cases. You might also want to take a look at @Martijn Geerts' FieldPageSync Module that also does something similar.
  25. Thank you so much for all your efforts in putting this together! I'll be using this soon to replace date range logic in 2 live projects that deal with events.
×
×
  • Create New...