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: /**
  4:  * CONTENIDO Chain.
  5:  * Parse template to do some CONTENIDO specific replacements.
  6:  *
  7:  * Replaces following placeholders in templates:
  8:  * - {_SID_}:  CONTENIDO session id
  9:  * - {_PATH_CONTENIDO_FULLHTML_}:  Full URL to contenido backend (protocol + host + path)
 10:  * - {_META_HEAD_CONTENIDO_}:  Default meta tags
 11:  * - {_CSS_HEAD_CONTENIDO_}:  Default links tags to load core CSS files
 12:  * - {_CSS_HEAD_CONTENIDO_FULLHTML_}:  Default links tags with full URL to contenido backend
 13:  * - {_JS_HEAD_CONTENIDO_}:  Default script tags to load core JS files
 14:  * - {_JS_HEAD_CONTENIDO_FULLHTML_}:  Default script tags with full URL to contenido backend
 15:  *
 16:  * @package          Core
 17:  * @subpackage       Chain
 18:  * @version          SVN Revision $Rev$
 19:  *
 20:  * @author           Murat Purc <murat@purc.de>
 21:  * @copyright        four for business AG <www.4fb.de>
 22:  * @license          http://www.contenido.org/license/LIZENZ.txt
 23:  * @link             http://www.4fb.de
 24:  * @link             http://www.contenido.org
 25:  */
 26: 
 27: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 28: 
 29: /**
 30:  * Does some replacements in the given template.
 31:  * Replaces some CONTENIDO specific placeholders against their values.
 32:  *
 33:  * @param  string  $template  Template string to preprocess
 34:  * @param cTemplate $templateObj  The current template instance
 35:  * @return string
 36:  */
 37: function cecParseTemplate($template, cTemplate $templateObj) {
 38: 
 39:     global $frame;
 40: 
 41:     // Autofill special placeholders like
 42:     // - Session id
 43:     // - Initial CONTENIDO scripts
 44: 
 45:     $prefix = "\n    ";
 46: 
 47:     $cfg = cRegistry::getConfig();
 48:     $sessid = (string) cRegistry::getBackendSessionId();
 49:     $backendPath = cRegistry::getBackendUrl();
 50:     $backendLang = cRegistry::getBackendLanguage();
 51: # Fixme: Creates an error on backend login form, since we have no language there, see main.loginform.php
 52: #        $oLanguage = cRegistry::getLanguage();
 53: #        $encoding = $oLanguage->get("encoding");
 54:     $languageid = cRegistry::getLanguageId();
 55:     if ($languageid) {
 56:         $oLanguage = cRegistry::getLanguage();
 57:         $encoding = $oLanguage->get('encoding');
 58:     } else {
 59:         $encoding = 'utf-8';
 60:     }
 61:     $frameNr = (!empty($frame) && is_numeric($frame)) ? $frame : 0;
 62: 
 63:     // Default meta tags
 64:     // @TODO  Make this also configurable
 65:     $metaCon = '
 66:     <meta http-equiv="Content-type" content="text/html;charset=' . $encoding . '">
 67:     <meta http-equiv="expires" content="0">
 68:     <meta http-equiv="cache-control" content="no-cache">
 69:     <meta http-equiv="pragma" content="no-cache">';
 70: 
 71:     // JavaScript configuration
 72:     $jsConfigurationAdded = false;
 73:     $jsConfiguration = '
 74:     <script type="text/javascript">
 75:     (function(Con, $) {
 76:         Con.sid = "' . $sessid . '";
 77:         $.extend(Con.cfg, {
 78:             urlBackend: "' .  $backendPath . '",
 79:             urlHelp: "' . $cfg['help_url'] . '",
 80:             belang: "' . $backendLang . '",
 81:             frame: ' . $frameNr . '
 82:         });
 83:     })(Con, Con.$);
 84:     </script>';
 85: 
 86:     // Default CSS styles
 87:     $cssHeadCon = '';
 88:     $files = $cfg['backend_template']['css_files'];
 89:     foreach ($files as $file) {
 90:         $cssHeadCon .= $prefix . '<link rel="stylesheet" type="text/css" href="' . $file . '">';
 91:     }
 92:     $cssHeadCon = $prefix . "<!-- CSS -->" . $cssHeadCon . $prefix . "<!-- /CSS -->";
 93: 
 94:     // Default JavaScript files & JS code
 95:     $jsHeadCon = '';
 96:     $files = $cfg['backend_template']['js_files'];
 97:     foreach ($files as $file) {
 98:         if ('_CONFIG_' === $file) {
 99:             $jsHeadCon .= $jsConfiguration;
100:             $jsConfigurationAdded = true;
101:         } else {
102:             $jsHeadCon .= $prefix . '<script type="text/javascript" src="' . $file . '"></script>';
103:         }
104:     }
105: 
106:     if (false === $jsConfigurationAdded) {
107:         $jsHeadCon .= $jsConfiguration;
108:     }
109: 
110:     $jsHeadCon = $prefix . "<!-- JS -->" . $jsHeadCon . $prefix . "<!-- /JS -->";
111: 
112:     // Placeholders to replace
113:     $replacements = array(
114:         '_SID_' => $sessid,
115:         '_PATH_CONTENIDO_FULLHTML_' => $backendPath,
116:         '_META_HEAD_CONTENIDO_' => $metaCon,
117:         '_CSS_HEAD_CONTENIDO_' => str_replace('{basePath}', '', $cssHeadCon),
118:         '_CSS_HEAD_CONTENIDO_FULLHTML_' => str_replace('{basePath}', $backendPath, $cssHeadCon),
119:         '_JS_HEAD_CONTENIDO_' => str_replace('{basePath}', '', $jsHeadCon),
120:         '_JS_HEAD_CONTENIDO_FULLHTML_' => str_replace('{basePath}', $backendPath, $jsHeadCon),
121:     );
122: 
123:     // Loop through all replacements and replace keys which are not in needles but found
124:     // in the template
125:     foreach ($replacements as $key => $value) {
126:         $placeholder = '{' . $key . '}';
127:         if (!in_array($key, $templateObj->needles) && false !== strpos($template, $placeholder)) {
128:             $template = str_replace($placeholder, $value, $template);
129:         }
130:     }
131: 
132:     return $template;
133: 
134: }
135: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen