Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • 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:  * This file contains the uri builder front content class.
  4:  *
  5:  * @package    Core
  6:  * @subpackage Frontend_URI
  7:  * @version    SVN Revision $Rev:$
  8:  *
  9:  * @author     Rudi Bieller
 10:  * @copyright  four for business AG <www.4fb.de>
 11:  * @license    http://www.contenido.org/license/LIZENZ.txt
 12:  * @link       http://www.4fb.de
 13:  * @link       http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: /**
 19:  * Implementation to build front_content.php URL
 20:  *
 21:  * @package    Core
 22:  * @subpackage Frontend_URI
 23:  */
 24: class cUriBuilderFrontcontent extends cUriBuilder {
 25: 
 26:     /**
 27:      * Self instance
 28:      *
 29:      * @var cUriBuilderFrontcontent
 30:      */
 31:     private static $_instance;
 32: 
 33:     /**
 34:      * XHTML compliant parameter composition delimiter
 35:      *
 36:      * @var string
 37:      */
 38:     private $_sAmp = '&';
 39: 
 40:     /**
 41:      * Constructor
 42:      *
 43:      * @return void
 44:      */
 45:     private function __construct() {
 46:         $this->sHttpBasePath = '';
 47:     }
 48: 
 49:     /**
 50:      * Get instance of self
 51:      *
 52:      * @return cUriBuilderFrontcontent
 53:      */
 54:     public static function getInstance() {
 55:         if (self::$_instance == NULL) {
 56:             self::$_instance = new self();
 57:         }
 58:         return self::$_instance;
 59:     }
 60: 
 61:     /**
 62:      * Builds a URL in front_content.php style.
 63:      * Depending on which array keys of $aParams are set, the URL is built
 64:      * differently.
 65:      * Valid array keys are: idcat, idart and idcatart.
 66:      * Additional array keys will also be added to the generated url.
 67:      * Internally, the method first tries to create URLs in this order:
 68:      * front_content.php?idcat=1&idart=1
 69:      * front_content.php?idcat=1
 70:      * front_content.php?idart=1
 71:      * front_content.php?idcatart=1
 72:      *
 73:      * @param array $aParams
 74:      * @param bool $bUseAbsolutePath
 75:      * @param array $aConfig 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.1 API documentation generated by ApiGen 2.8.0