Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/11/2019 in all areas

  1. A community member raised a question and I thought a new sanitizer method for the purpose would be useful, hence... Sanitizer Transliterate Adds a transliterate method to $sanitizer that performs character replacements as defined in the module config. The default character replacements are based on the defaults from InputfieldPageName, but with uppercase characters included too. Usage Install the Sanitizer Transliterate module. Customise the character replacements in the module config as needed. Use the sanitizer on strings like so: $transliterated_string = $sanitizer->transliterate($string); https://github.com/Toutouwai/SanitizerTransliterate https://modules.processwire.com/modules/sanitizer-transliterate/
    11 points
  2. Glad you like the updates! Hope I didn't give the wrong impression, as I didn't intend to communicate anything about a "feature freeze" (as was stated in one of the messages above). At least nothing like that was, is, or ever will be planned, except maybe for a few days prior to a master version release. This is a stable project, but not a static one. There is no freezing or thawing, just the flow—I'll try to clarify... ProcessWire was originally built out of the needs of web development projects here, and that has always been a significant driver of what and when features are focused on at any point in time. When I add or improve something, it's usually because I'm going to be using it now and always going forward in actual projects, and by extension, can also support it in this project for everyone else. Of course, I only add/improve stuff that I know has significant benefit for all PW users, regardless of whether it's recognized in the short term or not. The other major part is features that arise from needs or contributions in the community here and on GitHub. My client projects are pretty similar to those of most PW users, which is good for the project. I'm always looking for ways to optimize and improve PW and its API, especially things that will save time in my and your projects, and this has always been the case. I'm driven by it. The feature focus is always holistic and never sacrifices backwards compatibility. And the product focus is on long term quality and sustainability, being the best tool for the job, not on being popular. The focus may largely be on issue reports right now, but this should not be interpreted to mean anything beyond resolving issue reports. I'm making continuous improvements and additions where appropriate along the way, as always. Perhaps they aren't big enough things to warrant blog posts now, but stay tuned — there is lots of good stuff on the way and currently in development. Every year there are a couple of important periods of good momentum in the issues repo, especially this time around, and so I'd like to continue that as long as possible and hopefully cover everything there. The difference this time is that we've got Netcarver expertly leading the effort as well as intelligently identifying which reports are still relevant. Plus there are a whole lot more "includes suggested fix" reports this time, thanks to people like Toutouwai and many others that know their way around the core extremely well, and often figure out how to resolve issues well before I do. It's a great community collaboration.
    6 points
  3. Just committed some improvements to the log panel caching and also added caching for the ToDo panel which is a HUGE improvement - this has gone from 1.5 seconds to 60ms in my tests.
    5 points
  4. You can either try include $config->paths->templates . 'inc/item__project--filter.inc'; or: include __DIR__ . '/inc/item__project--filter.inc';
    5 points
  5. These settings probably wouldn't be ideal for the purpose because they only account for lowercase replacements (page names must be lowercase). But it seemed like a good candidate for a new sanitizer method so I made a module where you can define character replacements in the config:
    5 points
  6. @kongondo and everyone else ? I have just added caching for both the Tracy and PW logs panels so now they only read a log file if it has changed since it was last cached. This should make a dramatic difference to most page loads. Do note that if you have a large log file and a new entry is added, then the load time will still be slow for that first page load when the entry is logged, so you still may want to delete log files (or use the PW log prune function) if you notice a slow load. Hope that helps everyone.
    4 points
  7. Hi Robin, thx ? I think it would be nice to also list this sanitizer in the testAll() result, so I created a PR for it: https://github.com/Toutouwai/SanitizerTransliterate/pull/2 . Unfortunately this needs a fix in the core, so I also added a PR for this: https://github.com/processwire/processwire/pull/137 .
    4 points
  8. I think this one is pretty popular and powerful. Just to provide an alternative))
    4 points
  9. There is something similar posted over here if I'm not mistaken: Does this help?
    3 points
  10. Sure, absolute vs relative again, docs says: "...paths, with one important difference: the returned value is the full disk path on the server." + "There are also a few items in $config->paths that aren't in $config->urls. All entries in $config->paths always end with a trailing slash." Yeah, just as @bernhard reminded me ?
    2 points
  11. Hi @Elchin I got them in the past but the query was to slow so I finally used a custom query to achieve that, you might be interested as I don't know the number of pages your trying to fetch - I give you a small module which could be extended, shipped with a hook function which return all pages between two dates given a fieldname and a template id :
    2 points
  12. Thanks! Didn't know of GrapesJS, looks interesting ? That being said, my first impressions are somewhat mixed: the default theme is pretty bad in terms of accessibility, UI felt kind of confusing (possibly because there are a million options there), and overall it could use a major facelift. On the other hand it seems fast, apparently there are quite a few features available as plugins, and it does seem to be actively maintained as well. Overall I'm getting a strong "for power users" vibe from GrapesJS, and so far it doesn't seem like something that I'd be happy to introduce to non-technical clients who "just want to add some blocks". In other words: in my (possibly subjective) opinion Gutenberg still seems more viable than GrapesJS.
    2 points
  13. I think this should be ->templates . 'inc because all paths should already have a trailing slash whereas __DIR__ does not have one. But I guess your example should also work ?
    2 points
  14. Hey @Robin S - this looks great! I just noticed that the contents of your $default_replacements array is much more comprehensive than the list of character replacements in the InputfieldPageName settings in the core. Not sure whether Ryan would be willing to change those, but it seems to me that your list should be used there. Then perhaps you could pull that list in for your module and users of your module would benefit from any manual additions they have made to those settings, rather than using the character_replacements_str config setting in this module - it seems to me that users may need to add their custom replacements to both places at the moment.
    2 points
  15. Related discussion: https://processwire.com/talk/topic/18646-visual-builder-approach/?tab=comments#comment-162880
    2 points
  16. Hey Adrian, --- SOLVED --- I have this code that returns an unexpected result. I don't know if that's related to tracy, so I apologize if it is not... I'm developing a module. $rc->step is a shopping cart step object and it is possible to attach forms to it. $step->forms is a WireArray. I add the form "test" to this WireArray but when I dump it, it shows just the name of the Form, whereas when I dump the single item via $step->forms->first() I get what I expect (an InputfieldForm object). On the "Full Object" tab the output is also as I'd expect it to be: I guess that's totally normal but I'd like to understand what's going on and why the form shows up as string in the Debug Info Tab, thx! Edit: Ok sorry for this post, but it might also be interesting for somebody else. The debuginfo returns the id or classname of any WireData objects: https://github.com/processwire/processwire/blob/master/wire/core/WireArray.php#L2442-L2446
    2 points
  17. Just did some debugging and figured out it's a bug in VSCode in a recent update. Stay on v1.31.1 and you'll be fine. Github Issue: https://github.com/Microsoft/vscode/issues/70177 And if you've already updated and things are broken, you can get 1.31 here: https://code.visualstudio.com/updates/v1_31
    2 points
  18. Not if PageArray 2 contains some of the same pages as PageArray 1. If you want to maintain the sort order make sure the PageArray you are importing has only unique pages not in the other PageArray. For example: $pa2->removeItems($pa1); $pa1->import($pa2); Regarding the %= operator, note that if there are multiple words in the search string then the entire string must appear in that exact order in the field(s) being searched. See this solution for allowing the words in any order/location:
    2 points
  19. Just a quick update this week rather than a blog post. I’ve been continuing to work through the PW issues repo with Netcarver and it seems to be working well, so am planning to just keep working through it till we’ve covered everything there. Thanks to Netcarver and everyone else helping there. When we get the issues repo to the point where it’s pretty empty, I thought we’d then move on to the requests repo and PRs if possible. While there have been several commits to the core this week (mostly related to the issues repo), I don’t think there’s anything major enough to warrant a version bump, so will get another week’s worth of updates in place before bumping it to the next version number. This week I’ve been putting the finishing touches on the ProMailer module, getting that ready for release. A copy of ProMailer will be available to current subscribers of the ProDevTools package that want it. A few people have indicated that they’d also like to see it as a product independent of the ProDevTools, and actually I think that makes sense because ProMailer has become a much more comprehensive product than originally planned, and it really needs its own dedicated support board, as well as dedicated dev and agency versions. So I will make those available separately from ProDevTools. If you are a current ProDevTools subscriber and you’d like to get the first version of ProMailer when it is ready, please send me a PM here in the forums indicating that, and I will get a copy to you when it is released in beta. Even if you aren’t a ProDevTools subscriber, but would still like to be notified when ProMailer is available, please send me a PM as well. If all goes well, it should be available by this time next week or earlier. Next month we’ll hopefully be back to work on the website here as well, and develop the new modules directory.
    1 point
  20. The key thing is to make sure $matchesb does not contain any of the pages in $matchest - otherwise the order will not be what you expect when you join the PageArrays together. So you could use removeItems() as per my reply in the thread @szabesz linked to, or you could exclude the $matchest items in the selector for $matchesb: $matchest = $pages->find("title~=$q, template=BN-article|BN-infopage"); $matchesb = $pages->find("body~=$q, template=BN-article|BN-infopage, id!=$matchest"); $entries = $matchest->and($matchesb);
    1 point
  21. Sure, I will keep an eye on the core and merge your PR as soon as Ryan adds support for it. It's actually not that much more comprehensive. ? The only additions are the macronised vowels (āēīōū), which is something I wanted for my New Zealand context because they are used in Maori. The difference is that the list includes uppercase versions of the characters. I simply took the character list from InputfieldPageName, added the macronised vowels, and ran it through mb_strtoupper(). Adding uppercase characters to InputfieldPageName wouldn't make sense because page names are forced to lowercase. I had in mind that this sanitizer could be used for broader purposes besides converting characters to ASCII. Using the character replacements from InputfieldPageName seemed like a good starting point (particularly given the question that gave rise to the module) but a person could configure all kinds of replacements to suit their needs. There could well be cases where these substitutions would not be wanted in InputfieldPageName.
    1 point
  22. Thanks again, @szabesz for this! Made building it all in modules a lot more efficient and obvious now. Much appreciated.
    1 point
  23. Thanks, this is really great and helped me loads. Is there a reason you use $config->paths over $config->urls?
    1 point
  24. ok, tested a little and the selectors seem to work for me, primarily tested with this one: $results = $page->children("!date_end|date_end>=$start,date<$start,sort=-date,limit=12"); Did you try outputting your date and date_end fields unformatted to see if they contain proper values?
    1 point
  25. Not really. It depends on how you find something easier to implement. Usually I use include but I try to avoid relative paths. There is a "problem" with them: http://yagudaev.com/posts/resolving-php-relative-path-problem/ BTW dirname('__FILE__') is the same as __DIR__ I only use wireRenderFile() when I want to store the rendered output in a variable, and I use this technique to avoid the hassle of passing lots of variables: https://processwire.com/talk/topic/14332-storing-templates-in-separate-directories/?do=findComment&amp;comment=129024
    1 point
  26. Thanks all. I ended up using wireRenderFile() for all the includes. Is this a more preferred way?
    1 point
  27. Thank you Ryan for this information! What about all the open PR's? There are at the moment 50 of them open, some going back to 2016... Could @netcarver maybe also have an eye on them? Or do you prefer that we report feature requests also via the issues repository? thx ? PS: @kongondo recently shared how vscode integrates with pull requests. Don't know how PHPStorm handles this, but maybe VSCode can help checking all those open PRs:
    1 point
  28. It would be great having "ő", "Ő" (=> "o") and "ű", "Ű" (=> "u") on the list. I've requested it years ago but it haven't found its way to the core.
    1 point
  29. Sure, it's this rule of my frontend template:
    1 point
  30. You can pass a "numPageLinks" option to the $page->render method, like so: $options = array( 'numPageLinks' => 10, 'nextItemLabel' => '<i class="uk-icon-angle-double-right"></i>', // 'nextItemClass' => '', 'previousItemLabel' => '<span><i class="uk-icon-angle-double-left"></i></span>', // 'previousItemClass' => '', // 'lastItemClass' => '', 'currentItemClass' => 'bg-orange', 'separatorItemLabel' => '<span>…</span>', 'listMarkup' => "<ul>{out}</ul>", 'itemMarkup' => "<li>{out}</li>", 'linkMarkup' => "<a href='{url}' class=''>{out}</a>", 'currentLinkMarkup' => "<span class=''>{out}</span>" ); echo $pager->render($posts, $options);
    1 point
  31. Hey @bernhard - just an FYI regarding your PR which I think it a great idea by the way, but I don't think Ryan wants "all" to actually be all sanitizers: https://github.com/processwire/processwire-issues/issues/85
    1 point
  32. @psy, thanks....so sorry...... PushAlert said I had to download the .js files. Apologies for not following the README properly - thanks for being so patient!
    1 point
  33. I did not run into this again and it happened only on that one install which has not been upgraded since. So I'm afraid, I can't tell...
    1 point
  34. This also fixed it. Let me clarify Tracy Logs Panel disabled (logs not deleted): Loading speed fast Tracy Logs Panel enabled + Logs speed deleted: Loading speed fast Else: Loading speed slow
    1 point
  35. 1 point
  36. 1 point
  37. Looking at your Devilbox config NGINX seems to be the problem. Or at least was the problem. As far as I know it's not supported - but others are using it (with custom configs). PHP 7.2 is working perfectly - at least from what I can tell. Regarding MySQL I personally use the 5.6 version(s). Oh... and regarding ProcessWire... it gets better and better the longer you use and play around with it. ?
    1 point
  38. Hello, this module has been updated to conform to recent Facebook regulations that won't allow publishing content on a user profile. Instead, a post may be published on a Facebook page by the Facebook page only. To set it up, configure the module with a Facebook app ID, secret and a Page ID. Following is additional configuration on Facebook for developers: Minimum Required Facebook App configuration: on Settings -> Basics, provide the App Domains, provide the Site URL, on Settings -> Advanced, set the API version (has been tested up to v3.3), add Product: Facebook Login, on Facebook Login -> Settings, set Client OAuth Login: Yes, set Web OAuth Login: Yes, set Enforce HTTPS: Yes, add "https://www.example.com/processwire/page/" to field Valid OAuth Redirect URIs.  You may also view the revised first post of this topic. Thank you for your valuable input and I hope this update helps! Kind regards, Dimitrios
    1 point
  39. See the Page class (/wire/core/Page.php), especially the static array $baseProperties. For children, see this line. The magic itself happens in the method get(). For children(), this line, i.e.: // snip else if($type === 'm') { // local method return $this->{$key}();// magic :-)
    1 point
  40. To simply backup and clone an existing install I'm used to use the Duplicator module. Works like a regular install.
    1 point
  41. In addition to Ryan's work in the codebase, I'd like to mention @matjazp, @Robin S and @adrian for their activity in the issue repo! (I know there are others - but these three stand out to me.) Six weeks ago there were 230+ open issues, we just dipped under 100.
    1 point
  42. Hello Everyone! I'm new here, just signed up. I've discovered PW few days ago (what a shame...) and I'm angry for myself that I lost several years of my life... I'm a homegrown webdeveloper since 2005, started from pure HTML, then e107, Textpattern and from 2008 I work(ed) only with WordPress. I've made over a hundred of sites. Most of them are simple blogs but my main site is quite large (with over a 10k entries and over 100k of media). It's outdated a little bit so I was planning to modify and refresh it lately but then... Gutenberg happened. Gutenberg as an editor is unintuitive, buggy, produces massive problems and it's incompatibile with most of the things I'm using (it seems to be the same story for hundreds of websites built on WP). And though the whole WP community is frustrated and angry, it's been forced with WP 5.0 as the beginning of rebuilding WP as a platform into... hmm... next Wix? I was trying to discuss - my comments were deleted and my account has been blocked (as many others). After 8 years of developing WP... Well... I've frozen the site for updates and started looking elswhere. I have few advanced demands so tried Drupal, then played a little with Craft, Codeigniter and Laravel (I'm not a programmer per se). And after few recommendations I've finally found You. Guys... I'm so thrilled and emotional. I can't stop reading and following tutorials on localhost. PW is THE TOOL I was searching my whole life! I'm going to study everything very carefully and next year I'm going to rebuild slowly (there's no rush) my main site with PW. Back to Gutenberg: I understand where it aims to be and what it tries to accomplish BUT this is wrong on so many levels. As far as I can see, a barebone PW installation is far more flexible and useful then WP with 30 plugins. And obviously you know it perfectly. So I'm begging you: no Gutenberg here... ? Cheers to Ryan and Everyone! Greetings from Poland!
    1 point
  43. I really need something like that many times. Perhaps a partial solution is a module based on Textarea that the Inputfield Type is an HTML editor with design blocks. I tried to develop one but since I'm not a "real" programmer, I could not make much progress. Maybe someone who knows how to develop modules in Processwire can do it, it does not seem very complicated. It was based on GrapesJS http://grapesjs.com/ an open source Javascript library and it is very easy to include it in a project https://github.com/artf/grapesjs#usage. Here you can see a working example http://grapesjs.com/demo.html, the library exports the HTML code that can be stored in the Textarea. You just have to include the CSS that the frontend uses to make it work.
    1 point
  44. I've been working with FieldtypeOptions recently and in the absence of documentation thought I would share some example code: $field = $fields->get('test_options'); /* @var FieldtypeOptions $fieldtype */ $fieldtype = $field->type; // Get existing options // $options is a SelectableOptionsArray (WireArray) // If there are no options yet this will return an empty SelectableOptionsArray $options = $fieldtype->getOptions($field); // Create an option $yellow = new SelectableOption(); $yellow->title = 'Yellow'; $yellow->value = 'yel'; // if you want a different value from the title // Don't set an ID for new options - this is added automatically // Will deal with 'sort' property later // Create another option $orange = new SelectableOption(); $orange->title = 'Orange'; // Add option after the existing options $options->add($yellow); // Get an option by title $green = $options->get('title=Green'); // Insert option at a certain position $options->insertAfter($orange, $green); // Remove an option $options->remove($green); // Reset sort properties (so order of options is the same as the SelectableOptionsArray order) $sort = 0; foreach($options as $option) { $option->sort = $sort; $sort++; } // Set options back to field $fieldtype->setOptions($field, $options);
    1 point
  45. Here's a working example for you: <?php namespace ProcessWire; $showForm = true; if ($input->post->upload) { $tempDir = wire()->files->tempDir('userUploads')->get(); $uploaded = (new WireUpload('uploadedFile')) // same as form field name ->setValidExtensions(['txt', 'png', 'jpg', 'pdf']) ->setMaxFiles(1) // remove this to allow multiple files ->setMaxFileSize(10 * pow(2, 20))// 10MB ->setDestinationPath($tempDir) ->execute(); // $page = $pages->get(1234); foreach ($uploaded as $file) { $filePath = $tempDir . $file; // $page->files->add($filePath); echo $filePath . "<br>"; } // $page->save('files'); if (count($uploaded)) { echo sprintf("Uploaded %d files", count($uploaded)); $showForm = false; } } ?> <?php if ($showForm): ?> <?php // Adding enctype is crucial!! ?> <form method="POST" action="./" enctype="multipart/form-data"> <label for="uploadedFile"> Upload: <?php // suffix name with [] and add multiple attribute if you allow multiple files ?> <input type="file" name="uploadedFile[]" id="uploadedFile" multiple> </label> <div> <button name="upload" value="1">Upload</button> </div> </form> <?php endif; ?>
    1 point
  46. Ok so I gave it a shot with creating a module by altering Ryan's code you linked to and this seems to be working so far (I think). Here's the module using that code teppo linked to, slightly modified to match my requirements: <?php /** * Edit Yours Only * */ class EditYoursOnly extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Edit Yours Only', 'version' => 1, 'summary' => 'Custom module to allow users only to edit pages they created. Applies to role \'standard\'', 'author' => 'Christina Holly, TinaciousDesign.com', 'singular' => true, 'autoload' => true, ); } public function init() { if($this->user->hasRole("standard")) $this->addHookAfter("Page::editable", $this, 'editable'); } public function editable(HookEvent $event) { // abort if no access if(!$event->return) return; $page = $event->object; // criteria required in order to edit if($this->user->name !== $page->createdUser->name) $event->return = false; } } If anyone sees any problems that this could cause, please let me know. So far it appears to be working as I want it but I haven't tested it thoroughly. Thanks!
    1 point
×
×
  • Create New...