Rah_gps project is based on Adi Gilbert great work on adi_gps. The project orginates from a security patch (for adi_gps) that was sent to Adi in the late 2011. As of January 29, 2011 this patch hasn’t been released, and therefor I’m, giving my own taken into POST and GET extracting and trying to do it as securely as possible. In a form of new rah plugin. I personally hope that Adi can get some free time and release updated version of adi_gps.
Feature-wise rah_gps isn’t 1on1 identical with adi_gps. Apart from security fixes, it also has, in a sense, less features. For example, it has no global extracting, it can not overwrite variables anonymously and the included tag itself never returns anything.
Rah_gps at minimum requires:
- Textpattern v4.5.0 or newer.
<txp:rah_gps />, is a single, self-closing tag. It’s used to export POST and GET values as variables. The tag itself doesn’t return anything. Attributes for it follow.
Comma-separated list of HTTP POST/GET parameters to export. If not defined (left empty), all requested paramaters are exported as variables, expect for those that already exists as variables. Already existing variables are not overwritten when
name is not specified.
name="q, page, form_id, location"
If set to
1, extracted POST/GET values are escaped from Textpattern and HTML markup, and special characters are converted to HTML entities. By default this option is on (
1), and usually it should not be turned off. Never set
0 (off) if you plan to return the values on your page template.
Where to get the values, from POST or GET requests. Available values are
ps. If set to
ps values are retrieved from POST. If set to
gps values are retrieved from GET, and from POST if they are not first found in GET.
If defined, extracted variables are renamed to the given value. Only works when extracting sinle variable. If
new is used when extracting multiple values, only one variable will be created and populated with the last value.
Example: #1: Extracting all GET/POST values
If requested page’s URL is
?location=foobar&pid=barfoo, above would create and populate two variables,
<txp:variable name="location" /> and
<txp:variable name="pid" />.
Example #2: Extract only specific values
<txp:rah_gps name="foo, bar" />
Above would export GET/POST values values
bar, and create two new variables named