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