This plugin enables compatibility mode redefining engine functions from ldu under seditio and vice versa. Cases where the names simply changed are easily overcome, and in case of incompatible features usage, the system dies gracefully, with a _diefatal() and not php internal error dump (in which case, like using the changed security features, for example, you need to alter your code anyway). The compatibility mode is based on LDU 802 and Seditio 110 public releases.
The plugin also provides:
1. engine information (engine codename - ldu/sed , version and title)
2. mechanism to request a function by it's code... (for instance, plx_func("import") will return "cv" under LDU and "sed_import" under Seditio (regardless the fact that both will be defined actually at that point).
3. Several general purpose functions (see below for list)
4. PluginLib Extensions support (Hook: pluginlib.extensions) - Added in v1.2
Installation
1. Unpack the tarball in appropriate plugins folder ( plugins/ for Seditio and plugins/extended/ for LDU)
2. Go to your site administration panel and install the plugin.
Configuration
Configuration entries of the plugin:
engine - possible values are: autodetect, ldu, sed (defaults to autodetect, which is recommended - only change if the plugin cannot determine engine by itself, which is doubtfully)
compatibility_mode - flag defining whether the plugin enables compatibility mode or not (see above) so You can turn it off in case you don't need this part. Will save a bit of memory and make the engine more strict..
loglevel - log level for the pluginlib logging function (plx_log).. if set to NONE, the function will not write anything to log, FATAL level message will imply _diefatal() call as well.
Functions reference
plx_log($message, $loglevel=PL_LOG_DEBUG) - Writes a message to the errorlog, with a specified loglevel (one of PL_LOG_NONE, PL_LOG_DUMP, PL_LOG_DEBUG, PL_LOG_NOTICE, PL_LOG_INFO, PL_LOG_WARNING, PL_LOG_ERROR, PL_LOG_CRITICAL, PL_LOG_FATAL). Only writes into log if loglevel configuration variable is lower or equal to the passed level (and not equal to NONE). If the message is FATAL, _diefatal() call is issued after logging the message.
plx_func($name) - Accepts "name" parameter and returns suggested name of the function to use for that purpose in case it is aware of one and NULL otherwise.
Example: plx_func("cv") = "sed_import" under seditio
Example: plx_func("timegap") = "plx_timegap"
plx_http_get($server, $uri, $cache=true) - performs an http get request, returns array containing status (array containing status code and name), headers (and associative array of response headers) and data, containing the body of the response.
plx_recode($txt, $input_encoding, $output_encoding) - Recodes a string from one encoding to another, if the encodings are the same does nothing, automatically detects available encoding method (recode or iconv - whichever is available), can use pluggable encoding functions - naming convention is "plx_recode_{input encoding}2{output encoding}". If no encoding mechanisms are available, and no plugin encoders match the request, no encoding is performed and WARNING level message is written to the log.
plx_timegap($t1,$t2,$precision=null) - A replacement to the internal _build_timegap function, which is a bit smarter.. (cause in some cases, the default one is really not enough). precision parameter specifies how precise the thing should be... (how many parts maximum the timegap should contain) to match the default timegap function, you can pass precision=1
Example: plx_timegap(0,1024) = 17 minutes, 4 seconds
Example: plx_timegap(0,32000) = 8 hours, 53 minutes
Example: plx_timegap(0,100000) = 1 days, 3 hours, 46 minutes
plx_rehash - reread $_PLUGINLIB["functions"] and redefine global $plx_FUNC variables