Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cUri
  • cUriBuilder
  • cUriBuilderConfig
  • cUriBuilderCustom
  • cUriBuilderCustomPath
  • cUriBuilderFactory
  • cUriBuilderFrontcontent

Exceptions

  • NotInitializedException
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the uri builder front content class.
  5:  *
  6:  * @package    Core
  7:  * @subpackage Frontend_URI
  8:  * @version    SVN Revision $Rev:$
  9:  *
 10:  * @author     Rudi Bieller
 11:  * @copyright  four for business AG <www.4fb.de>
 12:  * @license    http://www.contenido.org/license/LIZENZ.txt
 13:  * @link       http://www.4fb.de
 14:  * @link       http://www.contenido.org
 15:  */
 16: 
 17: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 18: 
 19: /**
 20:  * Implementation to build front_content.php URL
 21:  *
 22:  * @package    Core
 23:  * @subpackage Frontend_URI
 24:  */
 25: class cUriBuilderFrontcontent extends cUriBuilder {
 26: 
 27:     /**
 28:      * Self instance
 29:      *
 30:      * @var cUriBuilderFrontcontent
 31:      */
 32:     private static $_instance;
 33: 
 34:     /**
 35:      * XHTML compliant parameter composition delimiter
 36:      *
 37:      * @var string
 38:      */
 39:     private $_sAmp = '&';
 40: 
 41:     /**
 42:      * Constructor
 43:      */
 44:     private function __construct() {
 45:         $this->sHttpBasePath = '';
 46:     }
 47: 
 48:     /**
 49:      * Get instance of self
 50:      *
 51:      * @return cUriBuilderFrontcontent
 52:      */
 53:     public static function getInstance() {
 54:         if (self::$_instance == NULL) {
 55:             self::$_instance = new self();
 56:         }
 57:         return self::$_instance;
 58:     }
 59: 
 60:     /**
 61:      * Builds a URL in front_content.php style.
 62:      * Depending on which array keys of $aParams are set, the URL is built
 63:      * differently.
 64:      * Valid array keys are: idcat, idart and idcatart.
 65:      * Additional array keys will also be added to the generated url.
 66:      * Internally, the method first tries to create URLs in this order:
 67:      * front_content.php?idcat=1&idart=1
 68:      * front_content.php?idcat=1
 69:      * front_content.php?idart=1
 70:      * front_content.php?idcatart=1
 71:      *
 72:      * @param array $aParams
 73:      * @param bool $bUseAbsolutePath [optional]
 74:      * @param array $aConfig [optional]
 75:      *         Is not used at the moment
 76:      * @throws cInvalidArgumentException
 77:      * @throws cException
 78:      */
 79:     public function buildUrl(array $aParams, $bUseAbsolutePath = false, array $aConfig = array()) {
 80:         $bIdcatSet = isset($aParams['idcat']);
 81:         $bIdartSet = isset($aParams['idart']);
 82:         $bIdcatArtSet = isset($aParams['idcatart']);
 83:         if ($bIdcatSet === false && $bIdartSet === false && $bIdcatArtSet === false) {
 84:             throw new cInvalidArgumentException('$aParams must have at least one of the following values set: $aParams[idcat], $aParams[idart] or $aParams[idcatart]!');
 85:         }
 86:         $sHttpBasePath = $bUseAbsolutePath === true ? $this->sHttpBasePath : '';
 87:         if ($bIdcatSet === true) {
 88:             if ($bIdartSet === true) {
 89:                 $this->sUrl = $sHttpBasePath . 'front_content.php?idcat=' . strval($aParams['idcat']) . $this->_sAmp . 'idart=' . strval($aParams['idart']);
 90:             } else {
 91:                 $this->sUrl = $sHttpBasePath . 'front_content.php?idcat=' . strval($aParams['idcat']);
 92:             }
 93:         } else {
 94:             if ($bIdartSet === true) {
 95:                 $this->sUrl = $sHttpBasePath . 'front_content.php?idart=' . strval($aParams['idart']);
 96:             } else {
 97:                 if ($bIdcatArtSet === true) {
 98:                     $this->sUrl = $sHttpBasePath . 'front_content.php?idcatart=' . strval($aParams['idcatart']);
 99:                 } else {
100:                     throw new cException('Cannot build URL because of missing parameters!');
101:                 }
102:             }
103:         }
104: 
105:         // now add additional params
106:         foreach ($aParams as $param => $value) {
107:             if ($param == 'idcat' || $param == 'idart' || $param == 'idcatart') {
108:                 continue;
109:             }
110:             $this->sUrl .= $this->_sAmp . $param . '=' . urlencode(urldecode((string) $value));
111:         }
112:     }
113: 
114: }
115: 
CMS CONTENIDO 4.9.8 API documentation generated by ApiGen 2.8.0