PIUS - URL Shortener
The URL Shortener plugin provides an overview of all defined short URLs for articles and allows for editing or deleting them.
API
This plugin offers the classes cApiShortUrlCollection and cApiShortUrl which allow for creating and validating short URIs.
Create a short URI
The class cApiShortUrlCollection offers the method create() which expects at least a short URI which is given as first parameter $uri. The latter parameters ($idart, $idlang, $idclient) are optional and are taken from cRegistry (getArticleId(), getLanguageId() and getClientId() respectivly) if not set.
$coll = new cApiShortUrlCollection(); /** @var cApiShortUrl */ $item = $coll->create($uri, $idart, $idlang, $idclient);
Validate a short URI
In order to check if an URI is a valid short URI you can use the collections method isValidShortUrl() which expects an URI as single parameter. The check will be performed with the following criteria:
- given url is not a directory in the client folder
- given url respects minimum length
- given url contains only valid characters
- given url is not an article or category alias
$coll = new cApiShortUrlCollection(); $coll->isValidShortUrl($uri);
This method returns either true or an errorcode:
- cApiShortUrlCollection::ERR_IS_CLIENT_FOLDER
- cApiShortUrlCollection::ERR_TOO_SHORT
- cApiShortUrlCollection::ERR_INVALID_CHARS
- cApiShortUrlCollection::ERR_IS_ARTICLE_ALIAS
Chains
Name | Description |
---|---|
Contenido.Backend.ConMetaEditFormAdditionalRows | piUsEditFormAdditionalRows, allows to add additional rows to the end of article form |
Contenido.Action.con_meta_saveart.AfterCall | piUsConSaveArtAfter, this function is called after saving of article |
Contenido.Frontend.AfterLoadPlugins | piUsAfterLoadPlugins, this function is called after plugings have been loaded |
Tables
Name | Description |
---|---|
con_pi_shorturl | data table for the client article language shorturls |
Settings
Area/Type | Name | Description | Default | Scope |
---|---|---|---|---|
url_shortener | domain | Â | n/a | SCGU |