/** * Returns all children elements that have one of the specified extensions * * This function may skip subfolders and recursively add their children * {@link repository_local::can_skip()} * * @param file_info $fileinfo * @param string|array $extensions, for example '*' or array('.gif','.jpg') * @return array array of file_info elements */ private function get_non_empty_children(file_info $fileinfo, $extensions) { $nonemptychildren = $fileinfo->get_non_empty_children($extensions); $list = array(); foreach ($nonemptychildren as $child) { if ($this->can_skip($child, $extensions, $fileinfo)) { $list = array_merge($list, $this->get_non_empty_children($child, $extensions)); } else { $list[] = $this->get_node($child); } } return $list; }