ePages 6.10 - DE_EPAGES/Content/API/ShortUrl.pm

Package DE_EPAGES::Content::API::ShortUrl

API functions for content objects

@EXPORT_OK
GetObjectByURI
TestShortUrl
GenerateShortUrl
GetShortUrlByClass
CreateAllShortUrls

Functions

CreateAllShortUrls
GenerateShortUrl
GetObjectByURI
GetShortUrlByClass
TestShortUrl

CreateAllShortUrls

Creates the short urls for all content objects in the shop.

Syntax
CreateAllShortUrls($Shop);
Input
$Shop (object)
shop object

GenerateShortUrl

Converts a string to a valid short url.

Syntax
$URI = GenerateShortUrl($Shop, $Name, $LanguageID);
$URI = GenerateShortUrl($Shop, $Name, $LanguageID, $ahTemporaryReserved);
Input
$Shop (object)
shop
$Name (string)
name of content object
$LanguageID (integer)
id of language : optional
$ahTemporaryReserved (array)
list of reserved ShortUrls used to save content object in more languages : optional
Return
$URI (string)
new short url

GetObjectByURI

Returns the content object of a shop for the given short url. Returns ($Shop->get('Categories'), $URI) if $URI is a valid locale id. Returns an empty array if the uri does not exist in the shop.

Syntax
($ContentObject, LocaleID) = GetObjectByURI($Shop, $URI);
Example
($ContentObject, LocaleID) = GetObjectByURI($Shop, 'futter/hundekuchen');
($ContentObject, LocaleID) = GetObjectByURI($Shop, 'de_DE');
Input
$Shop (object)
shop
$URI (string)
short url
Return
$ContentObject (object)
content object
$LocaleID (string)
locale id (e.g. 'en_GB')

GetShortUrlByClass

Returns a suggestion for a short url dependend from content object.

Syntax
$URI = GetShortUrlByClass($Parent, $Class, $Name, $LanguageID);
$URI = GetShortUrlByClass($Parent, $Class, $Name, $LanguageID, $ahTemporaryReserved);
Input
$Parent (object)
parent object of content object
$Class
class of content object
$Name (string)
name of content object
$LanguageID (integer)
id of language : optional
$ahTemporaryReserved (array)
list of reserved ShortUrls used to save content object in more languages : optional
Return
$URI (string)
new short url

TestShortUrl

Throws an error if short url is not valid: - max 255 characters - only a-zA-Z0-9-/ - unique

Syntax
TestShortUrl($Shop, $ContentObject, $URI, $LanguageID);
Input
$Shop (object)
shop
$ContentObject (object)
content object
$URI (string)
short url
$LanguageID (integer)
language id