]> git.mxchange.org Git - shipsimu.git/blobdiff - inc/classes/middleware/compressor/class_CompressorChannel.php
eval() commands replace by improved object factory, user login class stub added
[shipsimu.git] / inc / classes / middleware / compressor / class_CompressorChannel.php
index 73305150e08c173a90a651dc81549f1ad6a20a4c..1a999852e3a8c839fdcef325a43d4d269bf035c8 100644 (file)
@@ -40,7 +40,7 @@ class CompressorChannel extends BaseMiddleware {
                $this->setObjectDescription("Komprimierungshandler");
 
                // Create an unique ID
-               $this->createUniqueID();
+               $this->generateUniqueId();
        }
 
        /**
@@ -65,7 +65,7 @@ class CompressorChannel extends BaseMiddleware {
                        $dirPointer = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($baseDir);
 
                        // Read all directories but no sub directories
-                       while ($dir = $dirPointer->readDirectoryExcept(array("..", ".", ".htaccess"))) {
+                       while ($dir = $dirPointer->readDirectoryExcept(array("..", ".", ".htaccess", ".svn"))) {
                                // Is this a class file?
                                if ((substr($dir, 0, 6) == "class_") && (substr($dir, -4, 4) == FrameworkConfiguration::getInstance()->readConfig('php_extension'))) {
                                        // Get the compressor's name. That's why you must name
@@ -73,35 +73,20 @@ class CompressorChannel extends BaseMiddleware {
                                        // must keep on class in one file.
                                        $class = substr($dir, 6, -4);
 
-                                       // Create eval command
-                                       $eval = sprintf("\$tempInstance = %s::create%s();",
-                                               $class,
-                                               $class
-                                       );
+                                       // Get an instance from our object factory
+                                       $tempInstance = ObjectFactory::createObjectByName($class);
 
-                                       // Debug message
-                                       if ((defined('DEBUG_EVAL')) || (defined('DEBUG_ALL'))) $cInstance->getDebugInstance()->output(sprintf("[%s:] Konstruierte PHP-Anweisung: <pre><em>%s</em></pre><br />\n",
-                                               $cInstance->__toString(),
-                                               htmlentities($eval)
-                                       ));
+                                       // Set the compressor
+                                       $cInstance->setCompressor($tempInstance);
 
-                                       // Run it. This will create an instance to the current class
-                                       eval($eval);
-
-                                       // Is the instance valid? We have the stream handler here
-                                       if ((!is_null($tempInstance)) && (method_exists($tempInstance, 'compressStream')) && (method_exists($tempInstance, 'decompressStream'))) {
-                                               // Okay, this handler is valid
-                                               $cInstance->setCompressor($tempInstance);
-
-                                               // No more searches required because we have found a valid compressor stream
-                                               break;
-                                       }
-                               }
-                       }
+                                       // No more searches required because we have found a valid compressor stream
+                                       break;
+                               } // END - if
+                       } // END - while
 
                        // Close the directory
                        $dirPointer->closeDirectory();
-               }
+               } // END - if
 
                // Check again if there is a compressor
                if (
@@ -112,7 +97,7 @@ class CompressorChannel extends BaseMiddleware {
                ) {
                        // Set the null compressor handler. This should not be configureable!
                        $cInstance->setCompressor(ObjectFactory::createObjectByName('NullCompressor'));
-               }
+               } // END - if
 
                // Return the compressor instance
                return $cInstance;