]> git.mxchange.org Git - friendica.git/blobdiff - src/Console/Extract.php
bump version 2023.12
[friendica.git] / src / Console / Extract.php
index 06015f6970692506407c8b2c471e80abea95bafe..1f84d442b5031d69f929c9d00a428eadb157f9d6 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -21,6 +21,9 @@
 
 namespace Friendica\Console;
 
+use \RecursiveDirectoryIterator;
+use \RecursiveIteratorIterator;
+
 /**
  * Extracts translation strings from the Friendica project's files to be exported
  * to Transifex for translation.
@@ -72,9 +75,8 @@ HELP;
                $arr = [];
 
                $files = array_merge(
-                       ['index.php', 'boot.php'],
+                       ['index.php'],
                        glob('mod/*'),
-                       glob('include/*'),
                        glob('addon/*/*'),
                        $this->globRecursive('src')
                );
@@ -120,10 +122,10 @@ HELP;
 
                                                $arr[] = $matchtkns[0];
 
-                                               $s .= '$a->strings[' . $matchtkns[0] . "] = array(\n";
+                                               $s .= '$a->strings[' . $matchtkns[0] . "] = [\n";
                                                $s .= "\t0 => " . $matchtkns[0] . ",\n";
                                                $s .= "\t1 => " . $matchtkns[1] . ",\n";
-                                               $s .= ");\n";
+                                               $s .= "];\n";
                                        }
                                }
                        }
@@ -141,9 +143,17 @@ HELP;
                return 0;
        }
 
-       private function globRecursive($path) {
-               $dir_iterator = new \RecursiveDirectoryIterator($path);
-               $iterator = new \RecursiveIteratorIterator($dir_iterator, \RecursiveIteratorIterator::SELF_FIRST);
+       /**
+        * Returns an array with found files and directories including their paths.
+        *
+        * @param string $path Base path to scan
+        *
+        * @return array A flat array with found files and directories
+        */
+       private function globRecursive(string $path): array
+       {
+               $dir_iterator = new RecursiveDirectoryIterator($path);
+               $iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST);
 
                $return = [];
                foreach ($iterator as $file) {