Some fixes.
[core.git] / inc / classes / main / file_directories / directory / class_FrameworkDirectoryPointer.php
index 7fe69cb80feabeb3a2ae6c606107f9c278976bc2..a267c63f075eb6d0f6174aa88bb5808754e32ee2 100644 (file)
@@ -116,26 +116,26 @@ class FrameworkDirectoryPointer extends BaseFrameworkSystem {
        /**
         * Read raw lines of data from a directory pointer and return the data
         *
-        * @return      $current        Current entry from encapsulated iterator
+        * @return      $currentEntry   Current entry from encapsulated iterator
         */
        public function readRawDirectory () {
                // Can the next entry be read?
                assert($this->getDirectoryInstance()->valid());
 
                // Default is FALSE
-               $current = FALSE;
+               $currentEntry = FALSE;
 
                // Is it a dot directory?
                if (!$this->getDirectoryInstance()->isDot()) {
                        // Read data from the directory pointer and return it
-                       $current = $this->getDirectoryInstance()->current();
+                       $currentEntry = $this->getDirectoryInstance()->current();
                } // END - if
 
                // Advance to next entry
                $this->getDirectoryInstance()->next();
 
                // Return found entry
-               return $current;
+               return $currentEntry;
        }
 
        /**
@@ -152,24 +152,30 @@ class FrameworkDirectoryPointer extends BaseFrameworkSystem {
                        return $this->readRawDirectory();
                } // END - if
 
+               // Init raw line
+               $rawLine = NULL;
+
                // Read a raw line...
-               $rawLine = $this->readRawDirectory();
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: rawLine[' . gettype($rawLine) . ']=' . $rawLine);
+               $currentEntry = $this->readRawDirectory();
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: currentEntry[]=' . gettype($currentEntry));
 
                // Shall we exclude directories?
-               if ((!is_null($rawLine)) && ($rawLine !== FALSE) && (!in_array($rawLine, $except))) {
-                       // Return read data
+               if (is_object($currentEntry)) {
+                       // Get file name
+                       $rawLine = $currentEntry->getFilename();
                        //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: rawLine[' . gettype($rawLine) . ']=' . $rawLine);
-                       return $rawLine;
-               } elseif ((!is_null($rawLine)) && ($rawLine !== FALSE)) {
-                       // Exclude this part
-                       //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: rawline[' . gettype($rawLine) . ']=' . $rawLine . ' - Recursive call!');
-                       return $this->readDirectoryExcept($except);
-               }
 
-               // End pointer reached
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: Returning NULL!');
-               return NULL;
+                       // Is it not excluded?
+                       if (in_array($rawLine, $except)) {
+                               // Exclude this part
+                               $rawLine = $this->readDirectoryExcept($except);
+                               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: rawline[' . gettype($rawLine) . ']=' . $rawLine . ' - Recursive call!');
+                       } // END - if
+               } // END - if
+
+               // Return read line
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('DIRECTORY[' . __METHOD__ . ':' . __LINE__ . ']: rawLine[' . gettype($rawLine) . ']=' . $rawLine);
+               return $rawLine;
        }
 
        /**