Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/02/2018 in all areas

  1. I am sure it is something useful not only in my case, but for Tracy usage in general. I'll be glad to at least test it if not switch to it for that dev/prod PW project if it will be implemented. I am pretty sure I never sent emails on init events.
    3 points
  2. This week flew by too fast. I did some work on the core, but mostly had to focus on some end-of-the-month client work deadlines, in ProcessWire-powered projects. As a result, I don't have enough core updates to warrant a version bump on the dev branch this week, so putting a quick update here rather than a blog post. ProcessWire 3.0.112 should be ready by this time next week. One of my clients recently requested a URL field that intermittently verifies itself—to make sure that the URL is still returning a 200 success, and not a 404 error, or some other error code. Their site has thousands of external URLs (more than they can check manually), and they want some way to avoid showing links for URLs that are no longer working. I thought a self-healing URL field sounded like a cool idea, so put a little work into that this week, and will likely finish it up next week. The module is called FieldtypeVerifiedURL and it extends the regular FieldtypeURL field, except that in its configuration you can specify how often you want it to verify that the URL is still valid. It also performs the verification whenever the value changes. It uses WireHttp to obtain and store the response code with the field, whether a 2xx (success), 3xx (redirect) or 4xx (error) code. So if you wanted to, you could filter the pages with this URL field by response code (like to find all those returning 404s for instance). It can optionally save the <title> tag found at the URL for you as well. In our case, we will be configuring it to check that URLs are valid once a week, and this is something that it will do in the background automatically. When a URL is found to be returning an error code (like a 404), the output of the field can be optionally configured to return an empty value rather than the URL (when output formatting is on). I'm not anywhere near finished with this one, but if this sounds useful to you, stay tuned for more on this soon. Have a great weekend!
    2 points
  3. Hi, I recommend a google search first: https://www.google.com/search?q=this+request+was+aborted+because+it+appears+to+be+forged+site%3Aprocesswire.com%2Ftalk you can find a bunch of threads, with crosslinks like: If you cannot find the solution, please proved more info base on what you've read in the other threads.
    2 points
  4. More enhancements to help support @Ivan Gretsky's needs. These settings (via config.php/config-dev.php or the module config settings): $config->tracy = array( 'enabled' => true, 'guestForceDevelopmentLocal' => true, 'frontendPanels' => array('mailInterceptor','processwireInfo','requestInfo','processwireLogs','tracyLogs','debugMode','console','panelSelector'), 'backendPanels' => array('mailInterceptor','processwireInfo','requestInfo','processwireLogs','tracyLogs','debugMode','console','panelSelector'), 'nonToggleablePanels' => array('mailInterceptor', 'tracyToggler'), 'panelSelectorTracyTogglerButton' => false ); results in the following: 1) Tracy is enabled 2) Tracy is in development mode (ie debug bar on) even when logged out on localhost / dev machine 3) Mail Interceptor is enabled and can't be toggled off (notice that the checkbox is greyed out) 4) Tracy Toggler panel is disabled and can't be toggled off (notice that the checkbox is greyed out) 5) Tracy Disable/Enable (toggler) button in the Panel Selector is removed
    2 points
  5. I would have multiple uses for this type of URL field for sure! At the moment I use @teppo's unreleased ProcessLinkChecker, which is awesome. I think the key thing would be that in addition to returning an empty value I think it also needs a way to log and also report (maybe via email or other options) broken links so that we don't need to monitor its findings.
    2 points
  6. After building the ProcessMentions module and another autocomplete module for images, I found that I am going to need even more of these, but things were going to get repetitive. So I refactored the whole thing into a basic autocompletion module and individual "actions". The result is Autocomplete for CKEditor (GitHub). To try out, Install the module and actions Enable actions in the settings of any CKEditor field Edit a page with this field, type "@" and some characters for the and enjoy There are still a few things I need to implement. ATM, it only supports single characters as triggers for the autocomplete. I'd like to change that to combinations so I don't run out of special characters at some point. I also have to add a few more configuration options (like search only at the beginning or also in the middle of the searched string). The documentation for custom styling also needs some work. I have tried to keep things generic. Implementing your own actions should be quite straight forward. The README at GitHub illustrates the main steps and the supplied action classes have inline documentation. I would love to get some feedback or even see some third party InlineCompleteAction implementations.
    1 point
  7. @Ivan Gretsky - I have implemented everything I think you will need. I have posted about it over here: https://processwire.com/talk/topic/12208-tracy-debugger/?do=findComment&amp;comment=172482 so let's continue the discussion there - thanks!
    1 point
  8. Thank you all for your answers! Also interesting with URL segments and GraphQL. It seems it produces slightly slower requests, so I will test it for another project. Using a router solution like the one you pointed seems a bit overkill at this stage specially for my knowledge level. So far Vue and Processwire work very well together. I built some kind of REST api and the performance is very good both for read or to create pages. In some pages I am using regular forms to create posts, users... and in some others I am using vue. Vue of course offers much more potential to build complex, modern interfaces. Great that I can combine both methods. I think Processwire is flexible and powerful enough to build webapps with a smaller learning curve than a full fledged framework such as Laravel. It would be just perfect if creation of APIs for consumption by the front-end would be just a bit easier out of the box. (Is not that the hot keyword of the year? Headless CMS?).
    1 point
  9. Hello @vincent, how about a pull request on the original GitHub repository? https://github.com/plauclair/pw-lang-fr/pulls You could ask @Pierre-Luc, if he would like to merge your pull request and update the language pack in the modules directory. ? Regards, Andreas
    1 point
  10. Hi everyone, I created a new version of this language pack for supporting ProcessWire 3.x : https://gitlab.com/vmaillard/pw_3.x_lang_fr Since the GitHub repository was last updated in December 2016, I don't know exactly what to do with my version. Should I create a new module in the Language Packs directory? There could be the "French Language Pack (fr-FR)" and the "French Language Pack (fr-FR) for ProcessWire 3.x". Have a nice day!
    1 point
  11. I opened a request on GitHub: https://github.com/processwire/processwire-requests/issues/226 @Macrura, I noticed this post of yours from a while ago: Were you only able to achieve the data attributes by disabling HTML Purifier on the CKEditor field?
    1 point
  12. Yes, but it can be set by anyone linking to your site, so I think it definitely needs to be verified. If you just display the event date from the GET variable without verifying it then any third party can create a link to your site that causes your event page to display any date of their choosing. I solved it like this: $req_date = $input->get->int('date'); $event = $recurme->find($req_date, $req_date, "id=$page->id")->first(); if(!$event) { // $req_date is invalid for this event // ... } rrule-gui.js needs updating in this package to account for the timeEndUnix property. Not quite. You are first passing the string through date()... // ... if(date('U',$date)){ $date = $date; } // ... ...which does not handle those example date strings correctly.
    1 point
  13. How would you nest more than one deep? For example, with my approach, I can insert a section, then a grid, then a cell, and then put an accordion into one cell, and then put another grid into that accordion. So I can do text in the left part of an accordion and an image in the right. Here is another screencast. Also shows I got rid of the content layer. I don't find it necessary. This is a one pager I did for our imaging clinic. It had an accordion example. https://www.hceimaging.com/
    1 point
  14. Going back to the original question, here are a couple of ways to get rid of too much pages. You could use URL segments instead of a page hierarchy to route requests to your REST class (hope I am using the right words)))) You could install some 3rd party router (maybe even laravel's own) via composer, include it the root api template and use it to route requests to your REST class. You could use GraphQL instead of REST.
    1 point
  15. I see your point for sure. I guess I thought it was more about ensuring the default panels on the local install vs a live one. If you're migrating a database between the two, Tracy settings could get mixed up easily, but by using the config.php file you can more easily keep track of these. You could even use PW's built-in config-dev.php file to ensure that locally the mailInterceptor is loaded, but not on the live server. I think if we need to prevent some panels from being adjusted via the debug bar's Panel Selector, then this needs to be a new config setting where you can select all the panels that you want excluded from the Panel Selector interface. This list of panels could of course be set in the config settings, or it could also be done via: $config->tracy = array( 'nonToggleablePanels' => array('mailInterceptor') ) What do you think about this option - this would make it very difficult to accidentally remove the Mail Interceptor panel. I think perhaps it would also be worth adding a few extra settings to config-dev.php so it looks like this: $config->tracy = array( 'enabled' => true, 'guestForceDevelopmentLocal' => true, 'frontendPanels' => array ("mailInterceptor","processwireInfo","requestInfo","processwireLogs","tracyLogs","methodsInfo","debugMode","console","panelSelector"), 'nonToggleablePanels' => array("mailInterceptor", "tracyToggler") ); This setup would ensure that Tracy is always enabled, the Mail Interceptor panel is on and can't be toggled off, and the Tracy Toggler panel/button can't be enabled. The only remaining way to disable Tracy would be via the Disable Tracy button on the Panel Selector, but I would add an option to remove this as well. @Ivan Gretsky - is this the sort of functionality you would need to feel comfortable with this approach? The other consideration in all this is the load order of modules by PW. The hook that intercepts emails from being sent is in Tracy's init() method, but I suppose if you have another module sends an email in init(), rather than ready(), then it's possible it could be sent before Tracy intercepts it, but that like a highly unlikely situation.
    1 point
  16. The most recent version includes @Robin S's suggestion for "Expand/Collapse All" functionality. Both Robin and @tpr have helped significantly with testing of this feature - thank you both. Also new in this version is the ability to override any module config settings using: $config->tracy = array() You can read more about this and why it was introduced here:
    1 point
  17. PW can in fact do that. It's entirely up to the developer what PW should output. JSON, XML, CSVs, HTML... re: Vue.js If you search here for Vue you'll find a few forum topics with tips and project insights, e.g. https://medium.com/icf-church-developers/processwire-vue-js-a-lovestory-d4d5bca365
    1 point
  18. Both would probably be doable, though a massive use of data URIs would probably also necessitate caching them, or processing time and memory use may lead to performance issues. Here's a small example Textformatter module that converts image links in HTML fields to data URIs. You can set a size limit in the module configuration so any images equal or bigger in file size aren't converted. The default is really conservative (16kB) since not requesting larger images through regular client caching will do more for recurring visitors than saving them a roundtrip but squeezing the images over the wire with every page reload. <?php namespace ProcessWire; /** * Proof-of-concept module for the ProcessWire CMS * * Implements a textformatter for HTML fields that turns regular src URLs to * inline data URIs to avoid separate http requests. * * The default maximum size for images to inline is 16kB. * Feel free to raise this in the module's configuration. * * This code comes without restrictions or warranties. */ class TextformatterImgDataUri extends Textformatter implements Module, ConfigurableModule { protected static $defaultDataUriLimit = 8192; public static function getModuleInfo() { return array( "title" => "Textformatter Image Data URI", "summary" => "Replace image URIs in HTML body with their encoded data URI to speed up page loads", "version" => "0.0.6", ); } public function __construct() { $this->dataUriLimit = self::$defaultDataUriLimit; } public function format(&$str) { $src = preg_replace_callback('/(<img[^>]+(?<!-)src=)(["\'])(.*?)(\\2)([^>]*>)/', function($match) { // Only use files in site/assets/files if(strpos($match[3], $this->config->urls->assets) === 0) { // Translate url to paths $filepath = str_replace($this->config->urls->files, $this->config->paths->files, $match[3]); // If pagefileSecure is active, the path prefix probably needs to be inserted if(!file_exists($filepath) && $this->config->pagefileSecure && strpos($filepath, $this->config->paths->files . $this->config->pagefileSecurePathPrefix) !== 0) { $filepath = str_replace($this->config->paths->files, $this->config->paths->files . $this->config->pagefileSecurePathPrefix, $filepath); //$this->log->save('imgdatauri', sprintf(_("Added pagefileSecurePathPrefix to file path %s"), $filepath)); } // If the file isn't found, we return the original url if(! file_exists($filepath)) { //$this->log->save('imgdatauri', sprintf(_("File %s not found"), $filepath)); return $match[0]; } // Only output images inline that are smaller than the value set in the module's configuration $fsize = filesize($filepath); if($fsize >= $this->dataUriLimit) { //$this->log->save('imgdatauri', sprintf(_("File %s too big, %d >= %d"), $filepath, $fsize, $this->dataUriLimit)); return $match[0]; } // On windows, make sure extension php_fileinfo.dll is loaded $mime = mime_content_type($filepath); $dataUri = "data:$mime;base64," . base64_encode(file_get_contents($filepath)); return $match[1] . $match[2] . $dataUri . $match[4] . ' data-orig-src="' . $match[3] . '"' . $match[5]; } //$this->log->save('imgdatauri', sprintf(_('Not an img with src: %s'), $match[0])); return $match[0]; }, $str); $str = $src; } public function formatValue(Page $page, Field $field, &$value) { $this->format($value); } public function getModuleConfigInputfields() { $wrap = new InputfieldWrapper(); $f = $this->modules->get("InputfieldInteger"); $f->label = _("Maximum size to convert"); $f->attr('name', 'dataUriLimit'); $f->attr('value', $this->dataUriLimit); $f->description = _("Images smaller than the value entered here in bytes will included directly in the HTML (base64 encoded data uri) instead of their links. Note that this text formatter only affects images under site/assets/files"); $wrap->append($f); return $wrap; } }
    1 point
  19. It looks like Tracy bd call. Either install Tracy or remove that bd() in line 471.
    1 point
  20. Hi folks, I published "Simple file downloads with ProcessWire tutorial" today which explains how to make a simple download function with ProcessWire (tested with version 3.0+). Basically this is based on my post here in the forums
    1 point
  21. One thing I'd like to add is considering to not use pages to store clicks (depending on the scale of the number of users). It's nice to get it up and running quickly, but in the long run a custom mysql table and raw mysql queries for the counting might be more performant.
    1 point
  22. You simply create a new template with a multilanguage text field for each expression you want to translate. the name of the fields and labels can be in english, but not necessarily the words that you will output, they would be just informative. Then you fill the fields with all the languages. To output them in other templates, you would do this: // top of the file $translations = $pages->get('/translations/'); // and when needed echo $translations->more_articles; // inside functions echo wire('pages')->get('/translations/')->more_articles;
    1 point
×
×
  • Create New...