Wedge
Public area => The Pub => Plugins => Topic started by: live627 on November 24th, 2012, 11:53 AM
-
This is a very simple plugin that bakes cheesecake and apple pie. Actually, it extends the new Moderation filters to be able to limit the number of images embedded within a post. This could be probably done with a complex regex and without the need of a plugin, but that requires more skill than I currently have. Plus it's more user friendly this way. Plus now we have a plugin made that expands this lonely area.. Plus it's after three. Plus I should be in bed. Plus... hey, don't throw that plate at me!
I got this idea when I saw a support topic at SM asking about such, and was bewildered when the truth was revealed.
Implementing this was dead easy. Three lang strings, a template (yes, one sub-block), one hook. Took more time to research (!) this than to actually write it up!
-
Sweet, the moderation filters can be extended through the hooks! (Not tested, you see)
I still haven't figured out how to cope with making a nicer error message to users, though. I might just give them a space to add an explanation for the users rather than trying to write something that makes a sensible explanation out of the rules given how complex rules can actually be.
-
Also looks like you missed a language string...
-
Also looks like you missed a language string...
See bug report
-
Just a random thought, instead of doing a preg_replace first, couldn't you just:
return substr_count(strtolower($body), '[img');
(Yes, I looked at your max images plugin as the base for Word Count Limits. Made me realise how messed up the API is.)
-
It doesn't account for whitespace before the bracket.
-
What do you mean? It's looking for any img tag openers, not complete img tags...