Removed the tree filter toggle
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_extmgm.php
index 0783c41..e5f49e2 100644 (file)
@@ -255,41 +255,47 @@ class t3lib_extMgm {
                $insert=count($position);
 
                t3lib_div::loadTCA($table);
-               if (trim($str) && is_array($TCA[$table]) && is_array($TCA[$table]['types']))    {
+               $str = trim($str);
+               if ($str && is_array($TCA[$table]) && is_array($TCA[$table]['types']))  {
                        foreach($TCA[$table]['types'] as $k => $v)      {
-                               if (!$specificTypesList || t3lib_div::inList($specificTypesList,$k))    {
+                               if ($specificTypesList === '' || t3lib_div::inList($specificTypesList,$k))      {
                                        if ($insert)    {
-                                               $append=true;
-                                               $showItem = t3lib_div::trimExplode(',',$TCA[$table]['types'][$k]['showitem'],1);
-                                               foreach($showItem as $key => $fieldInfo)        {
-
-                                                       $parts = explode(';',$fieldInfo);
-                                                       $theField = trim($parts[0]);
-                                                       $palette = trim($parts[0]).';;'.trim($parts[2]);
-
-                                                               // insert before: find exact field name or palette with number
-                                                       if (in_array($theField, $positionArr) || in_array($palette, $positionArr) || in_array('before:'.$theField, $positionArr) || in_array('before:'.$palette, $positionArr)) {
-                                                               $showItem[$key]=trim($str).', '.$fieldInfo;
-                                                               $append=false;
-                                                               break;
+                                               if (count($positionArr)) {
+                                                       $append=true;
+                                                       $showItem = t3lib_div::trimExplode(',',$TCA[$table]['types'][$k]['showitem'],1);
+                                                       foreach($showItem as $key => $fieldInfo)        {
+       
+                                                               $parts = explode(';',$fieldInfo);
+                                                               $theField = trim($parts[0]);
+                                                               $palette = trim($parts[0]).';;'.trim($parts[2]);
+       
+                                                                       // insert before: find exact field name or palette with number
+                                                               if (in_array($theField, $positionArr) || in_array($palette, $positionArr) || in_array('before:'.$theField, $positionArr) || in_array('before:'.$palette, $positionArr)) {
+                                                                       $showItem[$key]=$str.', '.$fieldInfo;
+                                                                       $append=false;
+                                                                       break;
+                                                               }
+                                                                       // insert after
+                                                               if (in_array('after:'.$theField, $positionArr) || in_array('after:'.$palette, $positionArr))    {
+                                                                       $showItem[$key]=$fieldInfo.', '.$str;
+                                                                       $append=false;
+                                                                       break;
+                                                               }
                                                        }
-                                                               // insert after
-                                                       if (in_array('after:'.$theField, $positionArr) || in_array('after:'.$palette, $positionArr))    {
-                                                               $showItem[$key]=$fieldInfo.', '.trim($str);
-                                                               $append=false;
-                                                               break;
+       
+                                                               // Not found? Then append.
+                                                       if($append) {
+                                                               $showItem[]=$str;
                                                        }
+       
+                                                       $TCA[$table]['types'][$k]['showitem']=implode(', ', $showItem);
                                                }
-
-                                                       // Not found? Then append.
-                                               if($append) {
-                                                       $showItem[]=trim($str);
+                                               else {
+                                                       $TCA[$table]['types'][$k]['showitem'] .= ', ' . $str;
                                                }
 
-                                               $TCA[$table]['types'][$k]['showitem']=implode(', ', $showItem);
-
                                        } else {
-                                               $TCA[$table]['types'][$k]['showitem'].=', '.trim($str);
+                                               $TCA[$table]['types'][$k]['showitem'].=', ' . $str;
                                        }
                                }
                        }
@@ -517,9 +523,9 @@ class t3lib_extMgm {
                // even not available services will be included to make it possible to give the admin a feedback of non-available services.
                // but maybe it's better to move non-available services to a different array??
 
-               if ($serviceType AND
-                       !t3lib_div::isFirstPartOfStr($serviceType, 'tx_') AND
-                       (t3lib_div::isFirstPartOfStr($serviceKey, 'tx_') OR t3lib_div::isFirstPartOfStr($serviceKey, 'user_')) AND
+               if ($serviceType &&
+                       !t3lib_div::isFirstPartOfStr($serviceType, 'tx_') &&
+                       (t3lib_div::isFirstPartOfStr($serviceKey, 'tx_') || t3lib_div::isFirstPartOfStr($serviceKey, 'user_')) &&
                        is_array($info))        {
 
                        $info['priority'] = max(0,min(100,$info['priority']));
@@ -549,7 +555,7 @@ class t3lib_extMgm {
 
                                // OS check
                                // empty $os means 'not limited to one OS', therefore a check is not needed
-                       if ($T3_SERVICES[$serviceType][$serviceKey]['available'] AND $T3_SERVICES[$serviceType][$serviceKey]['os']!='') {
+                       if ($T3_SERVICES[$serviceType][$serviceKey]['available'] && $T3_SERVICES[$serviceType][$serviceKey]['os']!='') {
 
                                        // TYPO3_OS is not yet defined
                                $os_type = stristr(PHP_OS,'win')&&!stristr(PHP_OS,'darwin')?'WIN':'UNIX';
@@ -605,10 +611,10 @@ class t3lib_extMgm {
                                }
 
                                        // this matches empty subtype too
-                               if( $info['available'] AND ($info['subtype']==$serviceSubType OR $info['serviceSubTypes'][$serviceSubType]) AND $info['priority']>=$priority ) {
+                               if ($info['available'] && ($info['subtype']==$serviceSubType || $info['serviceSubTypes'][$serviceSubType]) && $info['priority']>=$priority )    {
 
                                                // has a lower quality than the already found, therefore we skip this service
-                                       if($info['priority']==$priority AND $info['quality']<$quality) {
+                                       if($info['priority']==$priority && $info['quality']<$quality) {
                                                continue;
                                        }
 
@@ -706,20 +712,21 @@ class t3lib_extMgm {
 
        /**
         * Adds an entry to the "ds" array of the tt_content field "pi_flexform".
-        * This is used by plugins to add a flexform XML reference / content for use when they are selected as plugin.
+        * This is used by plugins to add a flexform XML reference / content for use when they are selected as plugin or content element.
         * Usage: 0
         *
-        * @param       string          The same value as the key for the plugin
+        * @param       string          Plugin key as used in the list_type field. Use the asterisk * to match all list_type values.
         * @param       string          Either a reference to a flex-form XML file (eg. "FILE:EXT:newloginbox/flexform_ds.xml") or the XML directly.
+        * @param       string          Value of tt_content.CType (Content Type) to match. The default is "list" which corresponds to the "Insert Plugin" content element.  Use the asterisk * to match all CType values.
         * @return      void
         * @see addPlugin()
         */
-       function addPiFlexFormValue($piKeyToMatch,$value)       {
+       function addPiFlexFormValue($piKeyToMatch, $value, $CTypeToMatch='list')        {
                global $TCA;
                t3lib_div::loadTCA('tt_content');
 
                if (is_array($TCA['tt_content']['columns']) && is_array($TCA['tt_content']['columns']['pi_flexform']['config']['ds']))  {
-                       $TCA['tt_content']['columns']['pi_flexform']['config']['ds'][$piKeyToMatch] = $value;
+                       $TCA['tt_content']['columns']['pi_flexform']['config']['ds'][$piKeyToMatch.','.$CTypeToMatch] = $value;
                }
        }
 
@@ -1147,7 +1154,10 @@ $TYPO3_LOADED_EXT = unserialize(stripslashes(\''.addslashes(serialize($extension
                                }
                        }
                }
-
+               
+               $cFiles['ext_localconf'] = "<?php\n" . preg_replace('/<\?php|\?>/is', '', $cFiles['ext_localconf']) . "?>\n";
+               $cFiles['ext_tables'] = "<?php\n" . preg_replace('/<\?php|\?>/is', '', $cFiles['ext_tables']) . "?>\n";
+               
                t3lib_div::writeFile(PATH_typo3conf.$cacheFilePrefix.'_ext_localconf.php',$cFiles['ext_localconf']);
                t3lib_div::writeFile(PATH_typo3conf.$cacheFilePrefix.'_ext_tables.php',$cFiles['ext_tables']);