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
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
  1: <?php
  2: /**
  3:  * This file contains the uri builder custom path 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: cInclude('includes', 'functions.pathresolver.php');
 19: 
 20: /**
 21:  * Custom path uri builder class.
 22:  * Implementation to build URL in style index-a-1.html
 23:  * with category path (/category/subcategory/index-a-1.html).
 24:  *
 25:  * @package    Core
 26:  * @subpackage Frontend_URI
 27:  */
 28: class cUriBuilderCustomPath extends cUriBuilder {
 29: 
 30:     /**
 31:      * Self instance
 32:      * @var  cUriBuilderCustomPath
 33:      */
 34:     static private $_instance;
 35: 
 36:     /**
 37:      * Configuration
 38:      * @var array
 39:      */
 40:     private $aConfig;
 41: 
 42:     /**
 43:      * Constructor
 44:      */
 45:     private function __construct() {
 46:         $this->sHttpBasePath = '';
 47:     }
 48: 
 49:     /**
 50:      * Get instance of self
 51:      * @return obj 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 index-a-1.html style.
 62:      * Index keys of $aParams will be used as "a", corresponding values as "1" in this sample.
 63:      * For creating the location string $aParams needs to have keys idcat, level, lang and at least one custom key.
 64:      * If level is not set, level 0 will be used as default.
 65:      *
 66:      * @param  array  $aParams  Required keys are: idcat, level, lang and at least one custom key.
 67:      * @param  bool  $bUseAbsolutePath
 68:      * @param  array  $aConfig  If not set, will use UriBuilderConfig::getConfig()
 69:      * @throws cInvalidArgumentException
 70:      * @todo Somehow get around using prCreateURLNameLocationString()
 71:      */
 72:     public function buildUrl(array $aParams, $bUseAbsolutePath = false, array $aConfig = array()) {
 73:         if (!isset($aParams['idcat'])) {
 74:             throw new cInvalidArgumentException('$aParams[idcat] must be set!');
 75:         }
 76:         if (!isset($aParams['level'])) {
 77:             //throw new cInvalidArgumentException('$aParams[level] must be set! Setting it to 0 will create complete path.');
 78:             $aParams['level'] = '1';
 79:         }
 80:         if (!isset($aParams['lang'])) {
 81:             throw new cInvalidArgumentException('$aParams[lang] must be set!');
 82:         }
 83:         if (sizeof($aParams) <= 3) {
 84:             throw new cInvalidArgumentException('$aParams must have at least one custom entry!');
 85:         }
 86:         // if no config passed or not all parameters available, use default config
 87:         if (sizeof($aConfig) == 0 || !isset($aConfig['prefix']) || !isset($aConfig['suffix']) || !isset($aConfig['separator'])) {
 88:             include_once('class.uribuilder.config.php');
 89:             $aConfig = cUriBuilderConfig::getConfig();
 90:         }
 91:         $this->aConfig = $aConfig;
 92: 
 93:         $sCategoryString = '';
 94:         prCreateURLNameLocationString(intval($aParams['idcat']), "/", $sCategoryString, false, "", $aParams['level'], $aParams['lang'], true, false);
 95:         if (strlen($sCategoryString) > 0 && substr($sCategoryString, -1) != '/') {
 96:             $sCategoryString .= '/';
 97:         }
 98:         $this->sUrl = $bUseAbsolutePath === true ? $this->sHttpBasePath : '';
 99:         $this->sUrl .= $sCategoryString;
100:         $this->sUrl .= $this->aConfig['prefix'];
101:         foreach ($aParams as $sKey => $mVal) {
102:             if ($sKey != 'idcat' && $sKey != 'lang' && $sKey != 'level') {
103:                 $sVal = $mVal; // assuming mVal is a string and thus a single value
104:                 if (is_array($mVal)) { // mVal has more than one value, e.g. index-b-1-2.html
105:                     $sVal = implode($this->aConfig['separator'], $mVal);
106:                 }
107:                 $this->sUrl .= $this->aConfig['separator'] . strval($sKey) . $this->aConfig['separator'] . strval($sVal);
108:             }
109:         }
110:         $this->sUrl .= $this->aConfig['suffix'];
111:     }
112: 
113: }
114: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen