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

Functions

  • cecCreateBaseHref
  • cecCreateMetatags
  • cecFrontendCategoryAccess
  • cecFrontendCategoryAccess_Backend
  • cecIndexArticle
  • cecParseTemplate
  • CheckIfMetaTagExists
  • Overview
  • Package
  • Function
  • Tree
  • Deprecated
  • Todo
 1: <?php
 2: 
 3: /**
 4:  * CONTENIDO Chain.
 5:  * Generate base href for multiple client domains
 6:  *
 7:  * Client setting must look like this:
 8:  * Type:    client
 9:  * Name:    frontend_pathX (X any number/character)
10:  * Value:   base href URL (e.g. http://www.example.org/example/)
11:  *
12:  * @package          Core
13:  * @subpackage       Chain
14:  * @version          SVN Revision $Rev:$
15:  *
16:  * @author           Andreas Lindner
17:  * @copyright        four for business AG <www.4fb.de>
18:  * @license          http://www.contenido.org/license/LIZENZ.txt
19:  * @link             http://www.4fb.de
20:  * @link             http://www.contenido.org
21:  */
22: 
23: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
24: 
25: function cecCreateBaseHref($currentBaseHref) {
26: 
27:     // get props of current client
28:     $props = cRegistry::getClient()->getProperties();
29:     //$props = cRegistry::getClient()->getPropertiesByType('client');
30: 
31:     // return rootdir as defined in AMR if client has no props
32:     if (!is_array($props)) {
33:         return $currentBaseHref;
34:     }
35: 
36:     foreach ($props as $prop) {
37: 
38:         // skip props that are not of type 'client'
39:         if ($prop['type'] != 'client') {
40:             continue;
41:         }
42: 
43:         // skip props whose name does not contain 'frontend_path'
44:         if (false === strstr($prop['name'], 'frontend_path')) {
45:             continue;
46:         }
47: 
48:         // current host & path (HTTP_HOST & REQUEST_URI)
49:         $httpHost = $_SERVER['HTTP_HOST'];
50:         $httpPath = $_SERVER['REQUEST_URI'];
51: 
52:         // host & path of configured alternative URL
53:         $propHost = parse_url($prop['value'], PHP_URL_HOST);
54:         $propPath = parse_url($prop['value'], PHP_URL_PATH);
55: 
56:         // skip if http host does not equal configured host (allowing for optional www)
57:         if ($propHost != $httpHost && ('www.' . $propHost) != $httpHost && $propHost != 'www.' . $httpHost) {
58:             continue;
59:         }
60: 
61:         // skip if http path does not start with configured path
62:         if (0 !== strpos($httpPath, $propPath)) {
63:             continue;
64:         }
65: 
66:         // return URL as specified in client settings
67:         $currentBaseHref = $prop['value'];
68: 
69:     }
70: 
71:     // return default
72:     return $currentBaseHref;
73: 
74: }
75: 
76: ?>
CMS CONTENIDO 4.9.5 API documentation generated by ApiGen 2.8.0