Jump to content

LostKobrakai

PW-Moderators
  • Posts

    4,956
  • Joined

  • Last visited

  • Days Won

    100

Everything posted by LostKobrakai

  1. I doubt that Facebook plays a huge role in blogging. Medium on the other hand does, which is surely killing of a lot of smaller independent blogs.
  2. It does look like it. See here for all the requirements of pw: http://processwire.com/about/requirements/
  3. The ImageExtra module might be a more flexible solution to a description / tag.
  4. The has_parent issues are not 100% fixed for 2.7.3 either. I've a fixer module in my installation, which does fix all the missing pages_parents rows every few hours.
  5. Block the ip in your firewall and see where the error does come up. Also editing the .htaccess won't help anything because it's used for incoming request not outgoing ones. You could try to log WireHttp usage, which I think is used by core modules with outgoing requests.
  6. You don't even need to set the return value to it's previous value. Just don't modify it if you don't need to: function pageRenderHookMethod (HookEvent $event) { if ('my condition' != true) return; $event->return = 'my custom return value'; } But most often it's the better solution to use a before hook and prevent the original render function from running uselessly if it's return value might be replaced anyways: function pageBeforeRenderHookMethod (HookEvent $event) { if ('my condition' != true) return; // Let the original $page->render() do it's job $event->replace = true; // Skip the original $page->render() $event->return = 'custom value'; }
  7. Set $event->cancelHooks and $event->replace to true in your first hook. Edit: First one should be enough.
  8. Only after hooks have access to the old return value, so to modify it you need to use an after hook. But you should be able to hook before a hookable function and return something completely custom. At least when making sure you do use $event->replace = true, because otherwise the hookable function would run as well and replace your custom return value.
  9. It's not a bug, but just how processwire does handle this kind of selector. If you need empty tags as well use the following: $pages->find("parent=/things, (tags.name!=xx), (tags=''),limit=10")
  10. That's a problem on your end. It means your server cannot resolve the domain to it's ip address.
  11. <?php $buildings = $pages->find("template=building-entry"); $towns = sort(array_unique($buildings->explode('addressBuildingTown'))); Not really without plain arrays, but still shorter and more elegant.
  12. Accessing anything inside the admin backend does require the page-edit permission, which you surely wouldn't want to give to your guest user role. I'm also not sure why you created a Process module to render an ajax response. Process modules are to render admin backend pages, e.g. to be used in the backend. For your usecase I'd rather rather use a plain pw module with some public method to generate your ajax response. Then you can create the ajax endpoint as a simple template/page in your page tree. The template file can then just call your module's method and return it. This way you can control your ajax endpoint like any other page, while still having the logic to generate your markup in the module.
  13. CKEditor styles will be inline styles anyway, which would override any css you supply otherwise.
  14. $page->sort always worked this way, which is why most people simply avoided changing it most of the time. It might need some clarification now that there is a function which does prevent duplicate sort values. Rebuilding all sort values is a waist of db computation. Imagine you've 10000 siblings and you reorder just the 9999 to be the last one. If there are gaps in the first siblings sort values it'll rebuild all 10000 instead of just a few pages. I think you expect to set the new index of the page not the sort value, which in ProcessWire are currently different things. I see that it might be confusing, but mostly because people rarely dealt with that issue by now as sorting was mostly done via the GUI / modules. It would be great if you could formulate those issue you had in a github issue, so that ryan can improve on them.
  15. I don't think sanitizers will be the kicker here, but rather which characters are supported by processwire's selector engine and/or mysql's handling of those characters. I'm not sure, but $sanitizer->selectorValue might give at least some insights.
  16. You might want to look into this package: http://fractal.thephpleague.com/
  17. Just so you don't miss them; there are sorting functions in the dev version of 3.0: https://github.com/processwire/processwire/blob/4ca684df83db90aa6cfe5a76ef7a830b399af721/wire/core/Pages.php#L841-L916
  18. _func.php and this file probably do have different namespaces (might be because of the compiler). \renderNav() !== \ProcessWire\renderNav().
  19. You only sanitize the user input. So anything coming in via GET/POST/… data. Anything else comes from your system and your system should never have data in it, which aren't "save", so no need to sanitize anything there. It's not only about plainly changing the number to another one. People try to inject all manner of things into websites, like sql statements or else. So it's for security as well as for preventing errors in your system because of values you didn't expect.
  20. array_keys() will just revert your array back to the form of just the sq ft "[500, 1000, …]" so no need to change that one. Just make sure you have all the possible keys of your form inputs accessable when sanitizing. It doesn't matter where those keys come from or how the arrays are created. It's just a shortcut. Both versions below do the same. $minArea = $input->get->options("minArea", $allowed); $minArea = $sanitizer->options($input->get->minArea, $allowed); Edit: Also there's no magic whitelist anywhere. This is all plain php and using arrays.
  21. Even with the setting enabled there are various places in processwire where output formatting is not enabled and therefore one does still get a list of images (might not be the case here, but still). Also I did check the website and the urls for the images are "/site/assets/files/xxxx/", which is the result of using ->url on the images list instead of a single image. Also a field named "images" should probably never return a single image or it should at least be renamed to image.
  22. $page->images is a list of images. You need to select a image out of the lists to be shown, e.g. $page->images->first()
  23. $allowed is a simple array, where you put the values, which the form does present, e.g. <?php $values = [500 => "500 sq ft.", 1000 => "1000 sq ft."]; ?> <select> <?php foreach($values as $value => $label) : ?> <option value="<?=$value?>"><?=$label?></option> </select> <?php // With the same $values array $allowed = array_keys($values); // [500, 1000] $minArea = $input->get->options("minArea", $allowed);
  24. You form looks like $sanitizer->option() and ->options() should be enough. There's no input where a user is supposed to supply other values than the ones you supply.
×
×
  • Create New...