UNA
BxDolPermalinks Class Reference
Inheritance diagram for BxDolPermalinks:
BxDolDb iBxDolSingleton BxDolFactory iBxDolSingleton

Public Member Functions

 __clone ()
 
 getPageNameFromLink ($sLink, $iLength=false)
 
 permalink ($sLink, $aParams=array())
 
 unpermalink ($sLink, $isStripBaseUrl=true)
 
 redirectIfNecessary ($aSkip=array())
 
- Public Member Functions inherited from BxDolDb
 __clone ()
 
 connect ()
 
 disconnect ()
 
 ping ()
 
 pdoExec ($sQuery)
 
 pdoQuery ($sQuery)
 
 pdoExceptionHandler ($oException)
 
 getOption ($sName)
 
 getOne ($oStatement, $aBindings=array(), $iIndex=0)
 
 getRow ($oStatement, $aBindings=array(), $iFetchType=PDO::FETCH_ASSOC)
 
 getColumn ($oStatement, $aBindings=array(), $iFetchColumnNumber=0)
 
 getFirstRow ($oStatement, $aBindings=array(), $iFetchType=PDO::FETCH_ASSOC)
 
 getNextRow ($iFetchType=PDO::FETCH_ASSOC)
 
 getAll ($oStatement, $aBindings=array(), $iFetchType=PDO::FETCH_ASSOC)
 
 fillArray ($oStatement, $aBindings=array(), $iFetchType=PDO::FETCH_ASSOC)
 
 getAllWithKey ($oStatement, $sFieldKey, $aBindings=array(), $iFetchType=PDO::FETCH_ASSOC)
 
 getPairs ($oStatement, $sFieldKey, $sFieldValue, $aBindings=array(), $iFetchType=PDO::FETCH_ASSOC)
 
 getNumRows ($oStatement=null)
 
 getAffectedRows ($oStatement=null)
 
 query ($oStatement, $aBindings=array(), $bVerbose=null)
 
 res ($oStatement, $aBindings=array(), $bVerbose=null)
 
 getServerInfo ()
 
 getVersion ()
 
 listTables ()
 
 getDbCacheObject ()
 
 escape ($s)
 
 implode_escape ($mixed)
 
 unescape ($mixed)
 
 prepare ($sQuery)
 
 prepareAsString ($sQuery)
 
 arrayToSQL ($a, $sDiv=',', $sOperator='=', $bWildcardSpaceChars=false)
 

Static Public Member Functions

static getInstance ()
 
- Static Public Member Functions inherited from BxDolDb
static getInstance ()
 

Additional Inherited Members

- Protected Member Functions inherited from BxDolDb
 __construct ($aDbConf=false)
 

Detailed Description

Permalinks for any content.

An object of the class allows to check whether permalink is enabled and get it for specified standard URI.

All permalinks must match the whole URL, to be automatially determined. There are only 2 permlinks which are replaced by prefix:

  • modules/?r= - for module URLs
  • page.php?i= - for pages URLs

Example of usage

  1. Register permalink in database by adding necessary info in the sys_permalinks table.
  2. Create an object and process the URI
    $oPermalinks = new BxDolPermalinks();
    $oPermalinks->permalink('modules/?r=news/home');

Memberships/ACL:

Doesn't depend on user's membership.

Alerts(hooks)

The following alert can be used when permalink call is performed:

  • $sUnit - system
  • $sAction - permalink | unpermalink
  • $iObjectId - 0 (not used)
  • $iSenderId - 0 (not used)
  • $aExtra['link'] - the link to check permalink for
  • $aExtra['return_data'] - it is possible to override default behavior, by setting 'return_data' to non NULL value.

Member Function Documentation

◆ __clone()

BxDolPermalinks::__clone ( )

Prevent cloning the instance

◆ getInstance()

static BxDolPermalinks::getInstance ( )
static

Get singleton instance of the class

Implements iBxDolSingleton.

◆ getPageNameFromLink()

BxDolPermalinks::getPageNameFromLink (   $sLink,
  $iLength = false 
)

Get page name (changeable page of URL) from the URL.

Parameters
$sLink- relative UNpermalinked, it is better to use unpermalink method to make sure that correct url is passed here
$iLength- position of the page name, or false to detect automatically
Returns
page name (changeable part of URL) or empty string if page name is not detectable.

◆ permalink()

BxDolPermalinks::permalink (   $sLink,
  $aParams = array() 
)

Make permalink from link.

Parameters
$sLink- relative URL.
$aParams- params to add to the url.
Returns
- relative permalinked URL if it was detected and permalinks are ON or unchanged URL otherwise.

◆ redirectIfNecessary()

BxDolPermalinks::redirectIfNecessary (   $aSkip = array())

redirect to the correct url after switching skin or language only correct modules urls are supported

◆ unpermalink()

BxDolPermalinks::unpermalink (   $sLink,
  $isStripBaseUrl = true 
)

Remove permalink from link.

Parameters
$sLink- relative or absoulte URL.
$isStripBaseUrl- strip site prefix (absolute URL) automatically (enabled by default)
Returns
- relative UNpermalinked URL if it was detected or relative URL if URL withing the site or unchanged URL otherwise.

The documentation for this class was generated from the following file: