Added feature #15621: Feature: TYPO3 misses page-option to force SSL oder Non-SSL...
[Packages/TYPO3.CMS.git] / typo3 / sysext / cms / tslib / class.tslib_content.php
index 45490f4..3116174 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
  * Copyright notice
  *
- * (c) 1999-2010 Kasper Skårhøj (kasperYYYY@typo3.com)
+ * (c) 1999-2010 Kasper Sk�rh�j (kasperYYYY@typo3.com)
  * All rights reserved
  *
  * This script is part of the TYPO3 project. The TYPO3 project is
  * The class "tslib_cObj" is normally instantiated and referred to as "cObj".
  * When you call your own PHP-code typically through a USER or USER_INT cObject then it is this class that instantiates the object and calls the main method. Before it does so it will set (if you are using classes) a reference to itself in the internal variable "cObj" of the object. Thus you can access all functions and data from this class by $this->cObj->... from within you classes written to be USER or USER_INT content objects.
  *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
+ * @author     Kasper Sk�rh�j <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage tslib
  * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&cHash=4ad9d7acb4
@@ -691,6 +691,9 @@ class tslib_cObj {
                                                case 'QTOBJECT' :
                                                        $content .= $this->QTOBJECT($conf);
                                                break;
+                                               case 'SVG' :
+                                                       $content .= $this->SVG($conf);
+                                               break;
                                                default :
                                                                // call hook functions for extra processing
                                                        if ($name && is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'])) {
@@ -3281,8 +3284,52 @@ class tslib_cObj {
                return $content;
        }
 
+       /**
+        * Rendering the cObject, SVG
+        *
+        * @param       array           array of TypoScript properties
+        * @return      string          Output
+        */
+       public function SVG($conf) {
+
+               $width = $conf['width'] ? $this->stdWrap($conf['width'], $conf['width.']) : 600;
+               $height = $conf['height'] ? $this->stdWrap($conf['height'], $conf['height.']) : 400;
+
+               $src = $conf['src'] ? $this->stdWrap($conf['src'], $conf['src.']) : NULL;
+               $value = $this->stdWrap($conf['value'], $conf['value.']);
 
+               if ($src) {
+                       $content = '
+
+                                       <!--[if IE]>
+                                       <object src="' . $src . '" classid="image/svg+xml" width="' . $width . '" height="' . $height . '">
+                                       <![endif]-->
+                                       <!--[if !IE]>-->
+                                       <object data="' . $src . '" type="image/svg+xml" width="' . $width . '" height="' . $height . '">
+                                       <!--<![endif]-->
+                                       ' . $this->stdWrap($conf['noscript'], $conf['noscript.']) . '
+                                       </object>
+
+                       ';
+               } else {
+                       $content = '
+                               <script type="image/svg+xml">
+                                       <svg xmlns="http://www.w3.org/2000/svg"
+                                       xmlns:xlink="http://www.w3.org/1999/xlink"
+                                       width="' . $width . '"
+                                       height="' . $height . '">
+                       ' . $value . '
+                               </svg>
+                               </script>
+                               <noscript>
+                       ' . $this->stdWrap($conf['noscript'], $conf['noscript.']) . '
+                               </noscript>
+                       ';
+               }
+               $GLOBALS['TSFE']->getPageRenderer()->loadSvg();
 
+               return $content;
+       }
        /************************************
         *
         * Various helper functions for content objects:
@@ -3545,7 +3592,7 @@ class tslib_cObj {
                                                htmlspecialchars('openPic(\'' . $GLOBALS['TSFE']->baseUrlWrap($url) . '\',\'' .
                                                ($conf['JSwindow.']['newWindow'] ? md5($url) : 'thePicture') . '\',\'width=' .
                                                ($dims[0] + $offset[0]) . ',height=' . ($dims[1] + $offset[1]) .
-                                               ',status=0,menubar=0\'); return FALSE;') . '"' .
+                                               ',status=0,menubar=0\'); return false;') . '"' .
                                                $target . $GLOBALS['TSFE']->ATagParams . '>';
                                        $a2 = '</a>';
                                        $GLOBALS['TSFE']->setJS('openPic');
@@ -4822,7 +4869,7 @@ class tslib_cObj {
         * @param       array           TypoScript configuration.
         * @return      string          Return string
         * @author      Thomas Bley (all from moregroupware cvs code / readmessage.inc.php, published under gpl by Thomas)
-        * @author      Kasper Skårhøj
+        * @author      Kasper Sk�rh�j
         */
        function removeBadHTML($text, $conf) {
 
@@ -6329,6 +6376,7 @@ class tslib_cObj {
                $delimiter = $conf['delimiter'] ? $conf['delimiter'] : ' ,';
 
                $GLOBALS['TSFE']->includeTCA();
+               t3lib_div::loadTCA($table);
 
                if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$field]) && is_array($TCA[$table]['columns'][$field]['config']['items'])) {
                        $values = t3lib_div::trimExplode(',', $inputValue);
@@ -6688,14 +6736,18 @@ class tslib_cObj {
 
                                                $absoluteUrlScheme = 'http';
                                                        // URL shall be absolute:
-                                               if (isset($conf['forceAbsoluteUrl']) && $conf['forceAbsoluteUrl']) {
-                                                               // If no domain records are defined, use current domain:
-                                                       if ($targetDomain === '') {
-                                                               $targetDomain = $currentDomain;
-                                                       }
+                                               if (isset($conf['forceAbsoluteUrl']) && $conf['forceAbsoluteUrl'] || $page['url_scheme'] > 0) {
                                                                // Override scheme:
                                                        if (isset($conf['forceAbsoluteUrl.']['scheme']) && $conf['forceAbsoluteUrl.']['scheme']) {
                                                                $absoluteUrlScheme = $conf['forceAbsoluteUrl.']['scheme'];
+                                                       } elseif ($page['url_scheme'] > 0) {
+                                                               $absoluteUrlScheme = ((int) $page['url_scheme'] === t3lib_utility_http::SCHEME_HTTP) ? 'http' : 'https';
+                                                       }
+
+                                                               // If no domain records are defined, use current domain:
+                                                       if ($targetDomain === '' && $conf['forceAbsoluteUrl'] ||
+                                                                       $absoluteUrlScheme !== parse_url(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'), PHP_URL_SCHEME)) {
+                                                               $targetDomain = $currentDomain;
                                                        }
                                                }
 
@@ -8731,7 +8783,7 @@ class tslib_cObj {
 /**
  * Rendering of framesets
  *
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
+ * @author     Kasper Sk�rh�j <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage tslib
  */
@@ -8844,7 +8896,7 @@ class tslib_frameset {
  * Rendering of tables for offset
  *
  * @see        tslib_cObj::OTABLE(), tslib_cObj::stdWrap()
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
+ * @author     Kasper Sk�rh�j <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage tslib
  */
@@ -8938,7 +8990,7 @@ class tslib_tableOffset {
  * Rendering of tables for content positioning
  *
  * @see tslib_cObj::CTABLE()
- * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
+ * @author     Kasper Sk�rh�j <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage tslib
  */