Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Extract HTTP POST/GET values as Textpattern's variables
PHP
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
LICENSE
README.textile
manifest.xml
rah_gps.php

README.textile

rah_gps

A plugin for Textpattern CMS. Extracts HTTP POST/GET variables as Textpattern’s variables tags.

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.

Requirements

Rah_gps at minimum requires:

  • Textpattern v4.5.0 or newer.

Attributes

The tag, <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.

name
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.
Default: undefined Example: name="q, page, form_id, location"

escape
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 escape to 0 (off) if you plan to return the values on your page template.
Default: escape="1" Example: "0"

type
Where to get the values, from POST or GET requests. Available values are gps and 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.
Default: type="gps" Example: "ps"

new
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.
Default: new="" Example: "private_id"

Examples

Example: #1: Extracting all GET/POST values

<txp:rah_gps />

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 foo and bar, and create two new variables named foo and bar.

Something went wrong with that request. Please try again.