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:  * @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: /**
26:  *
27:  * @param string $currentBaseHref
28:  * @return string
29:  */
30: function cecCreateBaseHref($currentBaseHref) {
31: 
32:     // get props of current client
33:     $props = cRegistry::getClient()->getProperties();
34:     //$props = cRegistry::getClient()->getPropertiesByType('client');
35: 
36:     // return rootdir as defined in AMR if client has no props
37:     if (!is_array($props)) {
38:         return $currentBaseHref;
39:     }
40: 
41:     foreach ($props as $prop) {
42: 
43:         // skip props that are not of type 'client'
44:         if ($prop['type'] != 'client') {
45:             continue;
46:         }
47: 
48:         // skip props whose name does not contain 'frontend_path'
49:         if (false === strstr($prop['name'], 'frontend_path')) {
50:             continue;
51:         }
52: 
53:         // current host & path (HTTP_HOST & REQUEST_URI)
54:         $httpHost = $_SERVER['HTTP_HOST'];
55:         $httpPath = $_SERVER['REQUEST_URI'];
56: 
57:         // host & path of configured alternative URL
58:         $propHost = parse_url($prop['value'], PHP_URL_HOST);
59:         $propPath = parse_url($prop['value'], PHP_URL_PATH);
60: 
61:         // skip if http host does not equal configured host (allowing for optional www)
62:         if ($propHost != $httpHost && ('www.' . $propHost) != $httpHost && $propHost != 'www.' . $httpHost) {
63:             continue;
64:         }
65: 
66:         // skip if http path does not start with configured path
67:         if (0 !== strpos($httpPath, $propPath)) {
68:             continue;
69:         }
70: 
71:         // return URL as specified in client settings
72:         $currentBaseHref = $prop['value'];
73: 
74:     }
75: 
76:     // return default
77:     return $currentBaseHref;
78: 
79: }
80: 
81: ?>
CMS CONTENIDO 4.9.8 API documentation generated by ApiGen 2.8.0