Quote table names in admin_get_XXX() functions of t3lib_db
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_syntaxhl.php
index d6d340c..6d3b2b4 100644 (file)
@@ -1,22 +1,22 @@
 <?php
 /***************************************************************
 *  Copyright notice
-*  
-*  (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
+*
+*  (c) 1999-2006 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
-*  This script is part of the TYPO3 project. The TYPO3 project is 
+*  This script is part of the TYPO3 project. The TYPO3 project is
 *  free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
-* 
+*
 *  The GNU General Public License can be found at
 *  http://www.gnu.org/copyleft/gpl.html.
-*  A copy is found in the textfile GPL.txt and important notices to the license 
+*  A copy is found in the textfile GPL.txt and important notices to the license
 *  from the author is found in LICENSE.txt distributed with these scripts.
 *
-* 
+*
 *  This script is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/
-/** 
+/**
  * Contains a class for various syntax highlighting.
  *
  * $Id$
  *
- * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
  */
 /**
  * [CLASS/FUNCTION INDEX of SCRIPT]
  *
  *
  *
- *   84: class t3lib_syntaxhl 
+ *   84: class t3lib_syntaxhl
  *
  *              SECTION: Markup of Data Structure, <T3DataStructure>
- *  152:     function highLight_DS($str)       
- *  179:     function highLight_DS_markUpRecursively($struct,$parent='',$app='')       
+ *  156:     function highLight_DS($str)
+ *  183:     function highLight_DS_markUpRecursively($struct,$parent='',$app='')
  *
  *              SECTION: Markup of Data Structure, <T3FlexForms>
- *  264:     function highLight_FF($str)       
- *  291:     function highLight_FF_markUpRecursively($struct,$parent='',$app='')       
+ *  268:     function highLight_FF($str)
+ *  295:     function highLight_FF_markUpRecursively($struct,$parent='',$app='')
  *
  *              SECTION: Various
- *  362:     function getAllTags($str) 
- *  393:     function splitXMLbyTags($tagList,$str)    
+ *  376:     function getAllTags($str)
+ *  407:     function splitXMLbyTags($tagList,$str)
  *
  * TOTAL FUNCTIONS: 6
  * (This index is automatically created/updated by the extension "extdeveval")
@@ -77,7 +77,7 @@ require_once(PATH_t3lib.'class.t3lib_parsehtml.php');
 /**
  * Syntax Highlighting class.
  *
- * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage t3lib
  */
@@ -85,7 +85,7 @@ class t3lib_syntaxhl {
 
                // Internal, dynamic:
        var $htmlParse;                 // Parse object.
-       
+
                // External, static:
        var $DS_wrapTags = array(
                'T3DataStructure' => array('<span style="font-weight: bold;">','</span>'),
@@ -112,8 +112,12 @@ class t3lib_syntaxhl {
                'T3FlexForms' => array('<span style="font-weight: bold;">','</span>'),
                'meta' => array('<span style="font-weight: bold; color: #800080;">','</span>'),
                'data' => array('<span style="font-weight: bold; color: #800080;">','</span>'),
+               'el' => array('<span style="font-weight: bold; color: #80a000;">','</span>'),
+               'itemType' => array('<span style="font-weight: bold; color: #804000;">','</span>'),
+               'section' => array('<span style="font-weight: bold; color: #604080;">','</span>'),
+               'numIndex' => array('<span style="color: #333333;">','</span>'),
                '_unknown' => array('<span style="font-style: italic; color: #666666;">','</span>'),
-               
+
 
                'sDEF'  => array('<span style="font-weight: bold; color: #008000;">','</span>'),
                'level:sheet' => array('<span style="font-weight: bold; color: #008000;">','</span>'),
@@ -123,8 +127,8 @@ class t3lib_syntaxhl {
 
                'level:fieldname' => array('<span style="font-weight: bold; color: #666666;">','</span>'),
 
-               'vDEF'  => array('<span style="font-weight: bold; color: #800000;">','</span>'),
-               'level:value' => array('<span style="font-weight: bold; color: #800000;">','</span>'),
+               'vDEF'  => array('<span style="font-weight: bold; color: #008080;">','</span>'),
+               'level:value' => array('<span style="font-weight: bold; color: #008080;">','</span>'),
 
                'currentSheetId' => array('<span style="color: #000080;">','</span>'),
                'currentLangId' => array('<span style="color: #000080;">','</span>'),
@@ -141,7 +145,7 @@ class t3lib_syntaxhl {
         *
         * Markup of Data Structure, <T3DataStructure>
         *
-        *************************************/ 
+        *************************************/
 
        /**
         * Makes syntax highlighting of a Data Structure, <T3DataStructure>
@@ -150,23 +154,23 @@ class t3lib_syntaxhl {
         * @return      string          HTML code with highlighted content. Must be wrapped in <PRE> tags
         */
        function highLight_DS($str)     {
-               
+
                        // Parse DS to verify that it is valid:
                $DS = t3lib_div::xml2array($str);
                if (is_array($DS))      {
                        $completeTagList = array_unique($this->getAllTags($str));       // Complete list of tags in DS
-                       
+
                                // Highlighting source:
                        $this->htmlParse = t3lib_div::makeInstance('t3lib_parsehtml');  // Init parser object
                        $struct = $this->splitXMLbyTags(implode(',',$completeTagList),$str);    // Split the XML by the found tags, recursively into LARGE array.
-                       $markUp = $this->highLight_DS_markUpRecursively($struct);       // Perform color-markup on the parsed content. Markup preserves the LINE formatting of the XML. 
+                       $markUp = $this->highLight_DS_markUpRecursively($struct);       // Perform color-markup on the parsed content. Markup preserves the LINE formatting of the XML.
 
                                // Return content:
                        return $markUp;
                } else $error = 'ERROR: The input content failed XML parsing: '.$DS;
                return $error;
        }
-       
+
        /**
         * Making syntax highlighting of the parsed Data Structure XML.
         * Called recursively.
@@ -182,7 +186,7 @@ class t3lib_syntaxhl {
                        if ($k%2)       {
                                $nextApp = $app;
                                $wrap = array('','');
-                               
+
                                switch($app)    {
                                        case 'TCEforms':
                                        case 'tx_templavoila':
@@ -199,12 +203,12 @@ class t3lib_syntaxhl {
                                                        $wrap = $this->DS_wrapTags[$v['tagName']];
                                                        $nextApp = '';
                                                }
-                               
+
                                                        // If no wrap defined, us "unknown" definition
                                                if (!is_array($wrap))   {
                                                        $wrap = $this->DS_wrapTags['_unknown'];
                                                }
-                                               
+
                                                        // Check for application sections in the XML:
                                                if ($app=='el' || $parent=='ROOT')      {
                                                        switch($v['tagName'])   {
@@ -225,7 +229,7 @@ class t3lib_syntaxhl {
                                $output.=htmlspecialchars($v);
                        }
                }
-               
+
                return $output;
        }
 
@@ -253,7 +257,7 @@ class t3lib_syntaxhl {
         *
         * Markup of Data Structure, <T3FlexForms>
         *
-        *************************************/ 
+        *************************************/
 
        /**
         * Makes syntax highlighting of a FlexForm Data, <T3FlexForms>
@@ -262,23 +266,23 @@ class t3lib_syntaxhl {
         * @return      string          HTML code with highlighted content. Must be wrapped in <PRE> tags
         */
        function highLight_FF($str)     {
-               
+
                        // Parse DS to verify that it is valid:
                $DS = t3lib_div::xml2array($str);
                if (is_array($DS))      {
                        $completeTagList = array_unique($this->getAllTags($str));       // Complete list of tags in DS
-                       
+
                                // Highlighting source:
                        $this->htmlParse = t3lib_div::makeInstance('t3lib_parsehtml');  // Init parser object
                        $struct = $this->splitXMLbyTags(implode(',',$completeTagList),$str);    // Split the XML by the found tags, recursively into LARGE array.
-                       $markUp = $this->highLight_FF_markUpRecursively($struct);       // Perform color-markup on the parsed content. Markup preserves the LINE formatting of the XML. 
+                       $markUp = $this->highLight_FF_markUpRecursively($struct);       // Perform color-markup on the parsed content. Markup preserves the LINE formatting of the XML.
 
                                // Return content:
                        return $markUp;
                } else $error = 'ERROR: The input content failed XML parsing: '.$DS;
                return $error;
        }
-       
+
        /**
         * Making syntax highlighting of the parsed FlexForm XML.
         * Called recursively.
@@ -300,16 +304,22 @@ class t3lib_syntaxhl {
                        $app='fieldname';
                } elseif($app=='fieldname')     {
                        $app='value';
+               } elseif($app=='el' || $app=='numIndex')        {
+                       $app='fieldname';
                }
-               
-                       // Traverse structure:          
+
+                       // Traverse structure:
                foreach($struct as $k => $v)    {
                        if ($k%2)       {
                                $wrap = array('','');
 
-                                       // Default wrap:                                
+                               if ($v['tagName'] == 'numIndex')        {
+                                       $app = 'numIndex';
+                               }
+
+                                       // Default wrap:
                                $wrap = $this->FF_wrapTags[$v['tagName']];
-                               
+
                                        // If no wrap defined, us "unknown" definition
                                if (!is_array($wrap))   {
                                        switch($app)    {
@@ -325,6 +335,10 @@ class t3lib_syntaxhl {
                                        }
                                }
 
+                               if ($v['tagName']=='el')        {
+                                       $app='el';
+                               }
+
                                $output.=$wrap[0].htmlspecialchars($v['tag']).$wrap[1];
                                $output.=$this->highLight_FF_markUpRecursively($v['sub'],$v['tagName'],$app);
                                $output.=$wrap[0].htmlspecialchars('</'.$v['tagName'].'>').$wrap[1];
@@ -332,7 +346,7 @@ class t3lib_syntaxhl {
                                $output.=htmlspecialchars($v);
                        }
                }
-               
+
                return $output;
        }
 
@@ -340,19 +354,19 @@ class t3lib_syntaxhl {
 
 
 
-       
-       
-       
-       
-       
-       
+
+
+
+
+
+
 
        /*************************************
         *
         * Various
         *
-        *************************************/ 
-       
+        *************************************/
+
        /**
         * Returning all tag names found in XML/HTML input string
         *
@@ -360,24 +374,24 @@ class t3lib_syntaxhl {
         * @return      array           Array with all found tags (starttags only)
         */
        function getAllTags($str)       {
-       
+
                        // Init:
                $tags = array();
                $token = md5(microtime());
-               
+
                        // Markup all tag names with token.
                $markUpStr = ereg_replace('<([[:alnum:]_]+)[^>]*>',$token.'\1'.$token,$str);
-               
+
                        // Splitting by token:
                $parts = explode($token,$markUpStr);
-               
+
                        // Traversing parts:
                foreach($parts as $k => $v)     {
                        if ($k%2)       {
                                $tags[]=$v;
                        }
                }
-               
+
                        // Returning tags:
                return $tags;
        }
@@ -392,7 +406,7 @@ class t3lib_syntaxhl {
         */
        function splitXMLbyTags($tagList,$str)  {
                $struct = $this->htmlParse->splitIntoBlock($tagList,$str);
-               
+
                        // Traverse level:
                foreach($struct as $k => $v)    {
                        if ($k%2)       {
@@ -405,7 +419,7 @@ class t3lib_syntaxhl {
                                );
                        }
                }
-               
+
                return $struct;
        }
 }
@@ -414,4 +428,4 @@ class t3lib_syntaxhl {
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_syntaxhl.php']) {
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_syntaxhl.php']);
 }
-?>
\ No newline at end of file
+?>