Child pages
  • PIUS - URL Shortener
Skip to end of metadata
Go to start of metadata
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

NameDescription
Contenido.Backend.ConMetaEditFormAdditionalRowspiUsEditFormAdditionalRows, allows to add additional rows to the end of article form
Contenido.Action.con_meta_saveart.AfterCallpiUsConSaveArtAfter, this function is called after saving of article
Contenido.Frontend.AfterLoadPluginspiUsAfterLoadPlugins, this function is called after plugings have been loaded

Tables

NameDescription
con_pi_shorturldata table for the client article language shorturls

Settings

Area/TypeNameDescriptionDefault

Scope

url_shortenerdomain n/aSCGU