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

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:  * @author           Andreas Lindner
15:  * @copyright        four for business AG <www.4fb.de>
16:  * @license          http://www.contenido.org/license/LIZENZ.txt
17:  * @link             http://www.4fb.de
18:  * @link             http://www.contenido.org
19:  */
20: 
21: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
22: 
23: /**
24:  *
25:  * @param string $currentBaseHref
26:  * @return string
27:  */
28: function cecCreateBaseHref($currentBaseHref) {
29: 
30:     // get props of current client
31:     $props = cRegistry::getClient()->getProperties();
32:     //$props = cRegistry::getClient()->getPropertiesByType('client');
33: 
34:     // return rootdir as defined in AMR if client has no props
35:     if (!is_array($props)) {
36:         return $currentBaseHref;
37:     }
38: 
39:     foreach ($props as $prop) {
40: 
41:         // skip props that are not of type 'client'
42:         if ($prop['type'] != 'client') {
43:             continue;
44:         }
45: 
46:         // skip props whose name does not contain 'frontend_path'
47:         if (false === strstr($prop['name'], 'frontend_path')) {
48:             continue;
49:         }
50: 
51:         // current host & path (HTTP_HOST & REQUEST_URI)
52:         $httpHost = $_SERVER['HTTP_HOST'];
53:         $httpPath = $_SERVER['REQUEST_URI'];
54: 
55:         // host & path of configured alternative URL
56:         $propHost = parse_url($prop['value'], PHP_URL_HOST);
57:         $propPath = parse_url($prop['value'], PHP_URL_PATH);
58: 
59:         // skip if http host does not equal configured host (allowing for optional www)
60:         if ($propHost != $httpHost && ('www.' . $propHost) != $httpHost && $propHost != 'www.' . $httpHost) {
61:             continue;
62:         }
63: 
64:         // skip if http path does not start with configured path
65:         if (0 !== strpos($httpPath, $propPath)) {
66:             continue;
67:         }
68: 
69:         // return URL as specified in client settings
70:         $currentBaseHref = $prop['value'];
71: 
72:     }
73: 
74:     // return default
75:     return $currentBaseHref;
76: 
77: }
78: 
79: ?>
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0