Get the formatted XML list of files and folders to whitelist.

@param   string  $plugindir The root of the plugin, relative to the dataroot.
@return  array
320366
final public function get_whitelists(string $plugindir) : array {
        $filters = [];

        if (!empty($plugindir)) {
            $plugindir .= "/";
        }

        foreach ($this->whitelistfolders as $folder) {
            $filters[] = html_writer::tag('directory', "{$plugindir}{$folder}", ['suffix' => '.php']);
        }

        foreach ($this->whitelistfiles as $file) {
            $filters[] = html_writer::tag('file', "{$plugindir}{$file}");
        }

        return $filters;
    }
61592
protected function getAllBaseNames()
    {
        $pluggables = [];

        $path = $this->getPath();

        if (!is_dir($path)) {
            return $pluggables;
        }

        $folders = $this->files->directories($path);

        foreach ($folders as $plug) {
            $pluggables[] = basename($plug);
        }

        return $pluggables;
    }
64603
protected function getFiles()
    {
        if ($this->isSiteDeployment) {
            if ($this->deviceView != 'main' && !is_dir("{$this->viewDirectory}/{$this->context}/{$this->siteDomain}/{$this->deviceView}")) {
                $this->deviceView = 'main';
            }

            if ($this->design != 'default' && !is_dir("{$this->viewDirectory}/{$this->context}/{$this->siteDomain}/{$this->deviceView}/{$this->design}")) {
                $this->design = 'default';
            }
        }

        $list = array();
        if (!empty($this->viewDirectory))
            $list[] = $this->viewDirectory;

        // Build the list from all the plugin directorys, and the theme directory
        $list = array_merge($this->ApplicationContext->getEnabledPluginDirectories(),$list);

        if (count($list) > 0) {
            $files = array();
            foreach ($list as $tp) {
                if (is_dir($tp)) {
                    $paths = $this->getPathsToCheck($tp, $this->subject);
                    foreach ($paths as $basepath) {
                        if(!is_dir($basepath))
                            continue;

                        $cutoffDepth = null;
                        $objects     = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($basepath),
                                                                     RecursiveIteratorIterator::SELF_FIRST);

                        foreach ($objects as $name => $object) {
                            if($cutoffDepth !== null && $objects->getDepth() > $cutoffDepth)
                                continue;
                            else
                                $cutoffDepth = null;

                            if ($cutoffDepth === null && $object->isDir() && substr($object->getBasename(), 0, 1) == '.') {
                                $cutoffDepth = $objects->getDepth();
                                continue;
                            }

                            if (!$object->isFile() || substr($object->getBasename(), 0, 1) == '.')
                                continue;

                            $files[substr($name, strlen($basepath))] = $name;
                        }
                    }

                } else {
                    $this->Logger->warn('Directory does not exist: '.$tp);
                }
            }

            if(empty($files))
                return array(array(),null);

            $timestamps = array();
            foreach ($files as $relpath => $filename) {
                $timestamps[] = filemtime($filename);
            }

            $md5 = md5(serialize(array($files,$timestamps/*, $this->VersionService->getSystemVersion(), $this->VersionService->getDeploymentRevision()*/)));

            return array($files, $md5);
        }

        throw new Exception('No active themes or plugins.');
    }
1370696
public function getNameList()
	{
		$options['only'][] = '*.php';
		$fileList = FileHelper::findFiles($this->getFixtureDataDir(), $options);
		$fileList = array_map(function($file) {
			return pathinfo($file, PATHINFO_FILENAME);
		}, $fileList);
		return $fileList;
	}
1352577
public function listPluginDataBySubdirectory() {
    $plugin_types_data = $this->listPluginData('AnnotatedClassDiscovery');
    $plugin_types_data_by_subdirectory = [];
    foreach ($plugin_types_data as $plugin_id => $plugin_definition) {
      if (!empty($plugin_definition['subdir'])) {
        $subdir = substr($plugin_definition['subdir'], strlen('Plugin/'));

        $plugin_types_data_by_subdirectory[$subdir] = $plugin_definition;
      }
    }
    return $plugin_types_data_by_subdirectory;
  }
1140230
public function getRootLocalFolderFileList()
    {
        $spoolFolder = $this->_config->getHostSpoolerFolderPath();

        /** @var IteratorIterator $objects */
        $objects = new IteratorIterator(
            new DirectoryIterator($spoolFolder)
        );

        /** @var array $files */
        $files = [];

        /**
         * @var string $name
         * @var SplFileObject $object
         */
        foreach ($objects as $path => $object) {
            /** @noinspection TypeUnsafeComparisonInspection */
            /** @noinspection NotOptimalIfConditionsInspection */
            if ($object->getFilename() != '.' && $object->getFilename() != '..') {
                /** @noinspection PhpMethodOrClassCallIsNotCaseSensitiveInspection */
                $shortFilePath = str_replace($spoolFolder, '', $object->getPathName());

                /** @noinspection PhpMethodOrClassCallIsNotCaseSensitiveInspection */
                $files[] = [
                    'name' => $object->getFilename(),
                    'localPath' => $object->getPathName(),
                    'remotePath' => $shortFilePath,
                    'modified' => $object->getMTime()
                ];
            }
        }

        return $files;
    }
767208
public function getList()
    {
        $identifiers = array();

        $fileList = $this->filesystem->listFiles($this->getPath());
        foreach ($fileList as $file) {
            $identifiers[] = $file['filename'];
        }
        return $identifiers;

    }
1106243
public function get_install_xml_files(): array {
        global $CFG;
        require_once($CFG->libdir.'/adminlib.php');

        $files = [];
        $dbdirs = get_db_directories();
        foreach ($dbdirs as $dbdir) {
            $filename = "{$dbdir}/install.xml";
            if (file_exists($filename)) {
                $files[] = $filename;
            }
        }

        return $files;
    }
401764
protected static function fetch_plugins($plugintype, $fulldir) {
        global $CFG;

        $fulldirs = (array)$fulldir;
        if ($plugintype === 'theme') {
            if (realpath($fulldir) !== realpath($CFG->dirroot.'/theme')) {
                // Include themes in standard location too.
                array_unshift($fulldirs, $CFG->dirroot.'/theme');
            }
        }

        $result = array();

        foreach ($fulldirs as $fulldir) {
            if (!is_dir($fulldir)) {
                continue;
            }
            $items = new \DirectoryIterator($fulldir);
            foreach ($items as $item) {
                if ($item->isDot() or !$item->isDir()) {
                    continue;
                }
                $pluginname = $item->getFilename();
                if ($plugintype === 'auth' and $pluginname === 'db') {
                    // Special exception for this wrong plugin name.
                } else if (isset(self::$ignoreddirs[$pluginname])) {
                    continue;
                }
                if (!self::is_valid_plugin_name($plugintype, $pluginname)) {
                    // Always ignore plugins with problematic names here.
                    continue;
                }
                $result[$pluginname] = $fulldir.'/'.$pluginname;
                unset($item);
            }
            unset($items);
        }

        ksort($result);
        return $result;
    }
1150456
public function getRelativeFiles(Finder $finder)
    {
        $files = [];
        foreach ($this->getFiles($finder) as $file) {
            $files[] = str_replace($this->directory.'/', '', $file);
        }

        return $files;
    }
1078071
protected function get_full_component_list() {
        global $CFG;

        $list = \core_component::get_component_list();
        $list['core']['core'] = "{$CFG->dirroot}/lib";
        $formattedlist = [];
        foreach ($list as $plugintype => $plugin) {
            $formattedlist[] = ['plugin_type' => $plugintype, 'plugins' => array_keys($plugin)];
        }

        return $formattedlist;
    }
687764
public function getPluginsWithPressbooksInDescription() {
		$plugins = get_plugins();
		$matches = [];
		foreach ( $plugins as $file => $plugin ) {
			if ( $plugin['Name'] === 'Pressbooks' ) {
				continue; // Fix Pluginception...
			}
			if ( stristr( $plugin['Name'], 'pressbooks' ) || stristr( $plugin['Description'], 'pressbooks' ) || stristr( $file, 'pressbooks' ) ) {
				$matches[ $file ] = $plugin;
			}
		}
		return $matches;
	}
285133
public static function getPlugins(array $list = [])
    {
        $plugins = [];

        if (!empty($list)) {
            foreach ($list as $plug) {
                if (class_exists($plug['class'])) {
                    $plugins[] = json_decode($plug['class']::getInfo());
                }
            }
        }

        return $plugins;
    }
445662
public function getTreeSelectList(array $list, $root = 0)
    {
        $list = ArrayHelper::listToTree($list, $this->pkField, $this->parentField, '_child', $root);
        $list = $this->_toFormatTree($list, 0);
        
        return $this->buildTreeOptionsToArray($list);
    }
1353515
public function getFolders($rootFolder = null)
    {
        if (!$rootFolder || $rootFolder == 'INBOX') {
            return $this->_rootFolder;
        }

        // rootdir is same as INBOX in maildir
        if (strpos($rootFolder, 'INBOX' . $this->_delim) === 0) {
            $rootFolder = substr($rootFolder, 6);
        }
        $currentFolder = $this->_rootFolder;
        $subname = trim($rootFolder, $this->_delim);
        while ($currentFolder) {
            @list($entry, $subname) = @explode($this->_delim, $subname, 2);
            $currentFolder = $currentFolder->$entry;
            if (!$subname) {
                break;
            }
        }

        if ($currentFolder->getGlobalName() != rtrim($rootFolder, $this->_delim)) {
            /**
             * @see Zend_Mail_Storage_Exception
             */
            // require_once 'Zend/Mail/Storage/Exception.php';
            throw new Zend_Mail_Storage_Exception("folder $rootFolder not found");
        }
        return $currentFolder;
    }
609912
public function getPluginNodesWithViewDefinitions(ContentContext $context)
    {
        $pluginNodes = [];
        foreach ($this->getPluginNodes($context) as $pluginNode) {
            /** @var NodeInterface $pluginNode */
            if ($this->getPluginViewDefinitionsByPluginNodeType($pluginNode->getNodeType()) !== []) {
                $pluginNodes[] = $pluginNode;
            }
        }
        return $pluginNodes;
    }
739249
public function getPluginNamespaces()
    {
        $classNames = [];

        foreach ($this->getVendorAndPluginNames() as $vendorName => $vendorList) {
            foreach ($vendorList as $pluginName => $pluginPath) {
                $namespace = '\\'.$vendorName.'\\'.$pluginName;
                $namespace = Str::normalizeClassName($namespace);
                $classNames[$namespace] = $pluginPath;
            }
        }

        return $classNames;
    }