soo_wordfest
Download, code preview, and plugin Help
Download
soo_wordfest version 0.3, 5.9 KB(If it won’t install try the compressed version)
Contents
Overview
Subvert the dominant paradigm and add festivity to your comments with this Textpattern version of Allen Chang’s delightfully clever Wordfest game for Symphony CMS commenters. MLP Pack compatible (but for non-English usage please see Notes).
The object of Wordfest is to meet a set of constraints on writing a comment message. There is a conditional tag that allows you to flag successful comments however you choose.
Usage
At a minimum, you must stick a soo_wordfest
tag somewhere above the article comments, then use one or more soo_wordfest output tags in your article and/or comment forms.
Tags
soo_wordfest
A single tag you use to set the rules of the game. You could probably put it anywhere, so long as it comes before any other soo_wordfest tags, but the intent is to use it directly in an article body. This allows you to enable and set rules for the game on a per-article basis; it wouldn’t be particularly festive to have the same rules across articles. The tag itself doesn’t output anything; it just sets global variables used by the other tags.
Note: while there is some mild error checking, it is really up to you to pick a sensible set of rules.
<txp:soo_wordfest />
Attributes
All attributes default to empty, so you must set at least one attribute to enable Wordfest. Each attribute you set creates an additional rule for the game.
All of the text attributes are case-insensitive. (For non-English websites please see Notes.)
must_contain
(text)
Text that must appear somewhere in the comment.must_begin
(text)
Text that must appear at the start of the comment.must_end
(text)
Text that must appear at the end of the comment.anagram
(text)
Text for which an anagram must appear somewhere in the comment.word_count
(integer)
Exact number of words allowed.max_word_count
(integer)
Maximum number of words allowed.min_word_length
(integer)
Minimum word length.max_word_length
(integer)
Maximum word length.not_word_length
(integer)
Word length that must be avoided.
soo_wordfest_rules
A single tag that displays the rules in effect. It isn’t context sensitive, so you can use it anywhere following the soo_wordfest
tag, but presumably you will want to use it in an article or comment form.
Uses the strings set in the plugin’s MLP Pack definitions, so you can translate or edit these as desired.
<txp:soo_wordfest_rules />
Attributes
Standard Txp attributes; none required.
html_id
class
wraptag
break
soo_if_wordfest
A standard Txp conditional tag that simply checks whether or not any Wordfest rules have been set.
<txp:soo_if_wordfest> ... output if Wordfest rules are in effect ... <txp:else /> ... otherwise this ... </txp:soo_if_wordfest>
Attributes
None.
soo_if_wordfestive
A standard Txp conditional tag that checks whether or not the current comment meets the current Wordfest rules. Use only in a comment display form.
<txp:soo_if_wordfestive> ... output if comment is properly Wordfestive ... <txp:else /> ... otherwise this ... </txp:soo_if_wordfestive>
Attributes
None.
Examples
See http://ipsedixit.net/txp/88/wordfest for working examples.
Notes
Internationalization
Despite having added the MLP Pack functions, I really have no experience in dealing with internationalization. I’m quite sure the anagram function currently only works within the ASCII set. I fear the other text-based functions are similary limited, using PHP functions such as substr()
that only work with single-byte text. Any hints or suggestions appreciated.
Support
Version History
0.3 (2017-02-15)
Textpattern 4.6 compatibility update
0.2 (August 2, 2009)
Added anagram
attribute to soo_wordfest
.
0.1 (August 1, 2009)
Hot off the grill.