Summary: Implement miscellaneous PHP functions by means of Markup Expressions
Version: 2008-05-13
Prerequisites:
Status: Alpha
Questions answered by this recipe
This section is optional; use it to indicate the types of questions (if any) this recipe is intended to answer.
- How can I "crypt" text?
- How can I "hash" something (using sha1, md5, etc.)?
- How can I "hash_hmac" something (using sha1, md5, etc.)?
- How can I "crc32" text?
- How can I encode/decode something into/from base64?
Description
Implement miscellaneous PHP function by means of Markup Expressions.
Notes
Implemented MXes:
| crypt | Run crypt() on all arguments (imploded with space if there are multiple arguments). |
| hash | First argument must be a valid algorithm for hash() (md5, sha1, etc.). hash() will be executed on all subsequent arguments (imploded with space if there are multiple arguments). Valid arguments are -f or --file which says that arguments are a page or a file rather than just text. --raw which says to do a raw hash |
| hash_hmac | Identical to hash (above) except for a required --key:"secret" option to set the key. |
| crc32 | Run crc32() on all arguments (imploded with space if there are multiple arguments). It is appropriately processed with sprint("%u"...). |
| base64_encode | Run base64_encode on arguments. Note that base64 encoded text often (always?) ends with a double-equals-sign. The PmWiki Markup Expression engine will interpret this as setting an option if you place this value as an argument to another MX. Thus you must be careful to protect the value with quotes, particularly if you are using base64_encode within backquotes or within a nested MX. |
| base64_decode | Run base64_decode on arguments. |
MiscMX can be used independently of WikiSh, but if it is included after WikiSh then it will allow additional functionality in a "WikiSh-Compatible" mode. The additional functionality follows:
- Receiving input from a pipe in wikish (either as a file or as an argument via --xargs)
- Redirecting output
- Setting options via -x or --longx or --longx:val
- Other general WikiSh options
Release Notes
If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".
- 2008-05-13 - Initial Release
See Also
Contributors
Comments