Fixed bug #10497: Mark t3lib_div::makeInstanceClassName() as deprecated
authorIngo Renner <ingo.renner@typo3.org>
Tue, 3 Mar 2009 19:10:40 +0000 (19:10 +0000)
committerIngo Renner <ingo.renner@typo3.org>
Tue, 3 Mar 2009 19:10:40 +0000 (19:10 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5116 709f56b5-9817-0410-a4d7-c38de5d9e867

13 files changed:
ChangeLog
t3lib/class.t3lib_div.php
t3lib/class.t3lib_fullsearch.php
typo3/ajax.php
typo3/backend.php
typo3/init.php
typo3/sysext/beuser/mod/index.php
typo3/sysext/cms/tslib/class.tslib_eidtools.php
typo3/sysext/cms/tslib/class.tslib_fe.php
typo3/sysext/cms/tslib/index_ts.php
typo3/sysext/cms/tslib/publish.php
typo3/sysext/lowlevel/class.tx_lowlevel_cleaner.php
typo3/sysext/tsconfig_help/mod1/index.php

index 8067b43..afc6046 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2009-03-03  Ingo Renner  <ingo@typo3.org>
 
        * Fixed bug #9779: t3lib_div::trimExplode limit parameter leads to wrong result with non-empty requirement
+       * Fixed bug #10497: Mark t3lib_div::makeInstanceClassName() as deprecated
 
 2009-03-03  Michael Stucki  <michael@typo3.org>
 
index 565a1db..19ea9a0 100755 (executable)
@@ -4720,8 +4720,11 @@ final class t3lib_div {
         *
         * @param       string          Base Class name to evaluate
         * @return      string          Final class name to instantiate with "new [classname]"
+        * @deprecated since TYPO3 4.3 - Use t3lib_div::makeInstance('myClass', $arg1, $arg2,  ..., $argN)
         */
        public static function makeInstanceClassName($className)        {
+               self::logDeprecatedFunction();
+
                return class_exists('ux_'.$className) ? t3lib_div::makeInstanceClassName('ux_'.$className) : $className;
        }
 
index 7bb51fb..928a6e2 100755 (executable)
@@ -475,8 +475,7 @@ class t3lib_fullsearch {
                                $cPR['content']=$out;
                        break;
                        case 'xml':
-                               $className=t3lib_div::makeInstanceClassName('t3lib_xml');
-                               $xmlObj = new $className('typo3_export');
+                               $xmlObj = t3lib_div::makeInstance('t3lib_xml', 'typo3_export');
                                $xmlObj->includeNonEmptyValues=1;
                                $xmlObj->renderHeader();
                                $first=1;
index a8d4b29..0540460 100644 (file)
@@ -59,9 +59,8 @@ $ajaxScript = $TYPO3_CONF_VARS['BE']['AJAX'][$ajaxID];
 
 
        // instantiating the AJAX object
-$ajaxClassName = t3lib_div::makeInstanceClassName('TYPO3AJAX');
-$ajaxObj       = new $ajaxClassName($ajaxID);
-$ajaxParams    = array();
+$ajaxObj    = t3lib_div::makeInstance('TYPO3AJAX', $ajaxID);
+$ajaxParams = array();
 
 
        // evaluating the arguments and calling the AJAX method/function
index b8253a0..07029b8 100644 (file)
@@ -140,9 +140,7 @@ class TYPO3backend {
                );
 
                foreach($coreToolbarItems as $toolbarItemName => $toolbarItemClassName) {
-                               // Get name of XCLASS (if any):
-                       $toolbarItemClassName = t3lib_div::makeInstanceClassName($toolbarItemClassName);
-                       $toolbarItem = new $toolbarItemClassName($this);
+                       $toolbarItem = t3lib_div::makeInstance($toolbarItemClassName, $this);
 
                        if(!($toolbarItem instanceof backend_toolbarItem)) {
                                throw new UnexpectedValueException('$toolbarItem "'.$toolbarItemName.'" must implement interface backend_toolbarItem', 1195126772);
@@ -273,7 +271,7 @@ class TYPO3backend {
                foreach($this->toolbarItems as $toolbarItem) {
                        $menu = $toolbarItem->render();
                        if ($menu) {
-                               $additionalAttributes = $toolbarItem->getAdditionalAttributes();   
+                               $additionalAttributes = $toolbarItem->getAdditionalAttributes();
                                $toolbar .= '<li' . $additionalAttributes . '>' .$menu. '</li>';
                        }
                }
@@ -970,8 +968,7 @@ class TYPO3backend {
         * @return      void
         */
        public function addToolbarItem($toolbarItemName, $toolbarItemClassName) {
-               $toolbarItemResolvedClassName = t3lib_div::makeInstanceClassName($toolbarItemClassName);
-               $toolbarItem                  = new $toolbarItemResolvedClassName($this);
+               $toolbarItem = t3lib_div::makeInstance($toolbarItemClassName, $this);
 
                if(!($toolbarItem instanceof backend_toolbarItem)) {
                        throw new UnexpectedValueException('$toolbarItem "'.$toolbarItemName.'" must implement interface backend_toolbarItem', 1195125501);
index b4d87f7..25a9fbb 100755 (executable)
@@ -198,8 +198,7 @@ require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_invalidda
 require_once(PATH_t3lib . 'cache/exception/class.t3lib_cache_exception_nosuchcache.php');
 
 $typo3CacheManager = t3lib_div::makeInstance('t3lib_cache_Manager');
-$cacheFactoryClass = t3lib_div::makeInstanceClassName('t3lib_cache_Factory');
-$typo3CacheFactory = new $cacheFactoryClass($typo3CacheManager);
+$typo3CacheFactory = t3lib_div::makeInstance('t3lib_cache_Factory', $typo3CacheManager);
 
 t3lib_cache::initPageCache();
 t3lib_cache::initPageSectionCache();
index 8c94fc8..d31d156 100755 (executable)
@@ -584,8 +584,7 @@ class local_beUserAuth extends t3lib_beUserAuth {
                        // Prepare for filemount and db-mount
                if ($printTrees)        {       // ... this is if we see the detailed view for a user:
                                // Page tree object:
-                       $className=t3lib_div::makeInstanceClassName(!$this->isAdmin() ? 'printAllPageTree_perms' : 'printAllPageTree');
-                       $pagetree = new $className($this,$this->returnWebmounts());     // Here, only readable webmounts are returned (1=1)
+                       $pagetree = t3lib_div::makeInstance(!$this->isAdmin() ? 'printAllPageTree_perms' : 'printAllPageTree', $this, $this->returnWebmounts());        // Here, only readable webmounts are returned (1=1)
                        $pagetree->addField('perms_user',1);
                        $pagetree->addField('perms_group',1);
                        $pagetree->addField('perms_everybody',1);
@@ -594,16 +593,13 @@ class local_beUserAuth extends t3lib_beUserAuth {
                        $pagetree->addField('editlock',1);
 
                                // Folder tree object:
-                       $className=t3lib_div::makeInstanceClassName('printAllFolderTree');
-                       $foldertree = new $className($this,$this->returnFilemounts());
+                       $foldertree = t3lib_div::makeInstance('printAllFolderTree', $this, $this->returnFilemounts());
                } else {
                                // Page tree object:
-                       $className=t3lib_div::makeInstanceClassName('localPageTree');
-                       $pagetree = new $className($this,$this->returnWebmounts('1=1'));        // Here, ALL webmounts are returned (1=1)
+                       $pagetree = t3lib_div::makeInstance('localPageTree', $this, $this->returnWebmounts('1=1'));     // Here, ALL webmounts are returned (1=1)
 
                                // Folder tree object:
-                       $className=t3lib_div::makeInstanceClassName('localFolderTree');
-                       $foldertree = new $className($this,$this->returnFilemounts());
+                       $foldertree = t3lib_div::makeInstance('localFolderTree', $this, $this->returnFilemounts());
                }
 
                        // Names for modules:
@@ -873,8 +869,7 @@ class local_beUserAuth extends t3lib_beUserAuth {
                                'HTML'=>t3lib_iconWorks::getIconImage('pages',$row,$GLOBALS['BACK_PATH'],'align="top" title="['.$row['uid'].']"')       // .htmlspecialchars($row['title'])
                        );
                }
-               $className=t3lib_div::makeInstanceClassName('printAllPageTree_perms');
-               $pp = new $className($this);
+               $pp = t3lib_div::makeInstance('printAllPageTree_perms', $this);
                return $pp->printTree($dat,1);
        }
 
index 3bb9441..a6bd4b0 100644 (file)
@@ -172,8 +172,7 @@ final class tslib_eidtools {
                        require_once(PATH_tslib . 'class.tslib_fe.php');
                        require_once(PATH_t3lib . 'class.t3lib_cs.php');
 
-                       $tsfeClassName = t3lib_div::makeInstanceClassName('tslib_fe');
-                       $tsfe = new $tsfeClassName($GLOBALS['TYPO3_CONF_VARS'], 0, 0);
+                       $tsfe = t3lib_div::makeInstance('tslib_fe', $GLOBALS['TYPO3_CONF_VARS'], 0, 0);
                }
 
                return $tsfe;
index be9d26b..a1e2045 100755 (executable)
@@ -629,8 +629,7 @@ require_once (PATH_t3lib.'class.t3lib_lock.php');
                $GLOBALS['TT']->push('Initializing the Caching System','');
 
                $GLOBALS['typo3CacheManager'] = t3lib_div::makeInstance('t3lib_cache_Manager');
-               $cacheFactoryClass = t3lib_div::makeInstanceClassName('t3lib_cache_Factory');
-               $GLOBALS['typo3CacheFactory'] = new $cacheFactoryClass($GLOBALS['typo3CacheManager']);
+               $GLOBALS['typo3CacheFactory'] = t3lib_div::makeInstance('t3lib_cache_Factory', $GLOBALS['typo3CacheManager']);
 
                try {
                        $this->pageCache = $GLOBALS['typo3CacheManager']->getCache(
@@ -2858,8 +2857,7 @@ require_once (PATH_t3lib.'class.t3lib_lock.php');
 
                try {
                        if (!is_object($lockObj)) {
-                               $className = t3lib_div::makeInstanceClassName('t3lib_lock');
-                               $lockObj = new $className($key, $this->TYPO3_CONF_VARS['SYS']['lockingMode']);
+                               $lockObj = t3lib_div::makeInstance('t3lib_lock', $key, $this->TYPO3_CONF_VARS['SYS']['lockingMode']);
                        }
 
                        $success = false;
index 35bfd0b..8c29b9d 100755 (executable)
@@ -154,9 +154,7 @@ $TT->pull();
 // Create $TSFE object (TSFE = TypoScript Front End)
 // Connecting to database
 // ***********************************
-$temp_TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
-/* @var $TSFE tslib_fe */
-$TSFE = new $temp_TSFEclassName(
+$TSFE = t3lib_div::makeInstance('tslib_fe',
        $TYPO3_CONF_VARS,
        t3lib_div::_GP('id'),
        t3lib_div::_GP('type'),
@@ -166,6 +164,7 @@ $TSFE = new $temp_TSFEclassName(
        t3lib_div::_GP('MP'),
        t3lib_div::_GP('RDCT')
 );
+/* @var $TSFE tslib_fe */
 
 if($TYPO3_CONF_VARS['FE']['pageUnavailable_force'] &&
        !t3lib_div::cmpIP(t3lib_div::getIndpEnv('REMOTE_ADDR'), $TYPO3_CONF_VARS['SYS']['devIPmask'])) {
index 59e61ff..fff94fe 100755 (executable)
@@ -65,8 +65,7 @@ $temp_publish_array = array();        // Collects the rendered pages.
 while(list(,$temp_publish_id)=each($temp_publish_pages))       {
        $TT->push('Page '.$temp_publish_id,'');
 //debug($temp_publish_id,1);
-               $temp_TSFEclassName=t3lib_div::makeInstanceClassName('tslib_fe');
-               $TSFE = new $temp_TSFEclassName($TYPO3_CONF_VARS,$temp_publish_id,0);
+               $TSFE = t3lib_div::makeInstance('tslib_fe', $TYPO3_CONF_VARS, $temp_publish_id, 0);
 
                $TSFE->initFEuser();
                $TSFE->clear_preview();
index c62a35c..e80cd9a 100644 (file)
@@ -177,8 +177,7 @@ class tx_lowlevel_cleaner extends t3lib_extobjbase {
 /*
 // TEST of how we can get the used Content Elements on a TemplaVoila page:
 require_once(t3lib_extMgm::extPath('templavoila').'class.tx_templavoila_api.php');
-$apiClassName = t3lib_div::makeInstanceClassName('tx_templavoila_api');
-$apiObj = new $apiClassName('pages');
+$apiObj = t3lib_div::makeInstance('tx_templavoila_api', 'pages');
 $contentTreeData = $apiObj->getContentTree('pages', t3lib_BEfunc::getRecordWSOL('pages',33),FALSE);
 debug($contentTreeData);
 */
index 47d63b6..9a05888 100644 (file)
@@ -307,8 +307,7 @@ class tx_tsconfighelp_module1 extends t3lib_SCbase {
         */
        function unzip($file, $path)    {
                        // we use the unzip class of the Extension Manager here
-               $className = t3lib_div::makeInstanceClassName('em_unzip');
-               $unzip = new $className($file);
+               $unzip = t3lib_div::makeInstance('em_unzip', $file);
                $ret = $unzip->extract(array('add_path'=>$path));
                return (is_array($ret));
        }