Addpixel / KirbyComments

[Kirby 2] File-based comments stored as subpages for the Kirby CMS.
MIT License
68 stars 4 forks source link

Allow unlimited length in options #10

Closed samnabi closed 7 years ago

samnabi commented 7 years ago

It would be helpful to allow unlimited length for the plugin options. max-character-count in particular would benefit from a false option to allow unlimited length of comments.

florianpircher commented 7 years ago

I don’t know why anyone would want someone been able to paste “Alice in Wonderland” into a comment, but as long as it is not the default option (which it will never be) I am OK with it. Maybe the plugin gets used in ways I could never imagine, so I think this is a acceptable addition to the plugin’s feature set.

samnabi commented 7 years ago

It's difficult to decide what a maximum length should be, so I just put 999999999 or something in my config. It's not the end of the world, but I realized the arbitrarily large number is kind of silly.

florianpircher commented 7 years ago

As a good default I would suggest something between 512 and 2048. You typically don’t want people (nor bots) to be able to paste books or the first 10^6 digits of π into the comments field. As mentioned above, maybe some developers want to use the plugin for non-comment purposes, where it is fine to not set a limit, so I will add this option in version 1.1.7.

florianpircher commented 7 years ago

After thinking more about this I changed my mind. max-character-count is an integer option and allowing booleans would introduce to much complexity, especially because booleans are handled like integers in PHP. So false would evaluate to 0 characters and infinitely many characters. I would suggest using PHP_INT_MAX as value for max-character-count if you can’t decide on a maximum character count.

samnabi commented 7 years ago

Thanks for the PHP_INT_MAX tip, that feels right to me.