wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
LinkConverter Class Reference
+ Inheritance diagram for LinkConverter:

Public Member Functions

 convertStorageToApplication ($data, $type, $name)
 
 convertApplicationToStorage ($data, $type, $name)
 
 makeUrlRelative ($url)
 
 makeUrlAbsolute ($url)
 
 getBaseUrl ()
 
 isAbsoluteUrl ($url)
 
 isExternalUrl ($url)
 
- Public Member Functions inherited from DataConverter
 convertStorageToApplication ($data, $type, $name)
 
 convertApplicationToStorage ($data, $type, $name)
 

Detailed Description

LinkConverter converts internal absolute urls to relative ones when saving to the database and vice versa. Since StringUtil::getUrls() is used to detect urls, only urls in hmtl elements are detected when converting from storage to application (relative to absolute). If the url is not in an html element (e.g. if the whole data is an url) the conversion works only from application to storage (absolute to relative).

Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 39 of file class.LinkConverter.php.

Member Function Documentation

LinkConverter::convertStorageToApplication (   $data,
  $type,
  $name 
)
See Also
DataConverter::convertStorageToApplication()

Definition at line 44 of file class.LinkConverter.php.

References StringUtil\getUrls(), isExternalUrl(), and makeUrlAbsolute().

+ Here is the call graph for this function:

LinkConverter::convertApplicationToStorage (   $data,
  $type,
  $name 
)
See Also
DataConverter::convertApplicationToStorage()

Definition at line 64 of file class.LinkConverter.php.

References StringUtil\getUrls(), isExternalUrl(), and makeUrlRelative().

+ Here is the call graph for this function:

LinkConverter::makeUrlRelative (   $url)

Convert an absolute resource url on the server where the script runs to a relative one. The converted url is relative to the directory configured in the config key 'htmlBaseDir' section 'cms'

Parameters
urlThe url to convert
Returns
The converted url

Definition at line 92 of file class.LinkConverter.php.

References getBaseUrl().

Referenced by convertApplicationToStorage().

+ Here is the call graph for this function:

LinkConverter::makeUrlAbsolute (   $url)

Convert an relative url to a absolute one.

Parameters
urlThe url to convert
Returns
The converted url

Definition at line 110 of file class.LinkConverter.php.

References getBaseUrl().

Referenced by convertStorageToApplication().

+ Here is the call graph for this function:

LinkConverter::getBaseUrl ( )

Get the absolute http url of the base directory. The relative path to that directory as seen from the script is configured in the config key 'htmlBaseDir' section 'cms'.

Returns
The base url.

Definition at line 128 of file class.LinkConverter.php.

References $gLinkConverterBaseUrl, InifileParser\getInstance(), URIUtil\makeAbsolute(), and WCMFException\throwEx().

Referenced by makeUrlAbsolute(), and makeUrlRelative().

+ Here is the call graph for this function:

LinkConverter::isAbsoluteUrl (   $url)

Check if an url is absolute

Parameters
urlThe url to check
Returns
True/False wether the url is absolute

Definition at line 146 of file class.LinkConverter.php.

LinkConverter::isExternalUrl (   $url)

Check if an url is external

Parameters
urlThe url to check
Returns
True/False wether the url is external

Definition at line 155 of file class.LinkConverter.php.

Referenced by convertApplicationToStorage(), and convertStorageToApplication().


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